Skip to content

Commit

Permalink
[guilib] Allow to send int64_t in CGUIMessage
Browse files Browse the repository at this point in the history
* This is needed for implementing a new message GUI_MSG_PLAYBACK_SEEKED
  containing two 64-bit integers.
  • Loading branch information
dobo90 committed Oct 27, 2023
1 parent b29d4d2 commit ae960b2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
27 changes: 21 additions & 6 deletions xbmc/guilib/GUIMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

std::string CGUIMessage::empty_string;

CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int param2)
CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int64_t param1, int64_t param2)
{
m_message = msg;
m_senderID = senderID;
Expand All @@ -22,7 +22,8 @@ CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int p
m_pointer = NULL;
}

CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, CFileItemList *item)
CGUIMessage::CGUIMessage(
int msg, int senderID, int controlID, int64_t param1, int64_t param2, CFileItemList* item)
{
m_message = msg;
m_senderID = senderID;
Expand All @@ -32,8 +33,12 @@ CGUIMessage::CGUIMessage(int msg, int senderID, int controlID, int param1, int p
m_pointer = item;
}

CGUIMessage::CGUIMessage(
int msg, int senderID, int controlID, int param1, int param2, const CGUIListItemPtr& item)
CGUIMessage::CGUIMessage(int msg,
int senderID,
int controlID,
int64_t param1,
int64_t param2,
const CGUIListItemPtr& item)
: m_item(item)
{
m_message = msg;
Expand Down Expand Up @@ -70,11 +75,21 @@ CGUIListItemPtr CGUIMessage::GetItem() const
}

int CGUIMessage::GetParam1() const
{
return static_cast<int>(m_param1);
}

int64_t CGUIMessage::GetParam1AsI64() const
{
return m_param1;
}

int CGUIMessage::GetParam2() const
{
return static_cast<int>(m_param2);
}

int64_t CGUIMessage::GetParam2AsI64() const
{
return m_param2;
}
Expand All @@ -86,12 +101,12 @@ int CGUIMessage::GetSenderId() const

CGUIMessage& CGUIMessage::operator = (const CGUIMessage& msg) = default;

void CGUIMessage::SetParam1(int param1)
void CGUIMessage::SetParam1(int64_t param1)
{
m_param1 = param1;
}

void CGUIMessage::SetParam2(int param2)
void CGUIMessage::SetParam2(int64_t param2)
{
m_param2 = param2;
}
Expand Down
22 changes: 15 additions & 7 deletions xbmc/guilib/GUIMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,15 @@ class CFileItemList;
class CGUIMessage final
{
public:
CGUIMessage(int dwMsg, int senderID, int controlID, int param1 = 0, int param2 = 0);
CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, CFileItemList* item);
CGUIMessage(int msg, int senderID, int controlID, int param1, int param2, const CGUIListItemPtr &item);
CGUIMessage(int dwMsg, int senderID, int controlID, int64_t param1 = 0, int64_t param2 = 0);
CGUIMessage(
int msg, int senderID, int controlID, int64_t param1, int64_t param2, CFileItemList* item);
CGUIMessage(int msg,
int senderID,
int controlID,
int64_t param1,
int64_t param2,
const CGUIListItemPtr& item);
CGUIMessage(const CGUIMessage& msg);
~CGUIMessage(void);
CGUIMessage& operator = (const CGUIMessage& msg);
Expand All @@ -377,10 +383,12 @@ class CGUIMessage final
void* GetPointer() const;
CGUIListItemPtr GetItem() const;
int GetParam1() const;
int64_t GetParam1AsI64() const;
int GetParam2() const;
int64_t GetParam2AsI64() const;
int GetSenderId() const;
void SetParam1(int param1);
void SetParam2(int param2);
void SetParam1(int64_t param1);
void SetParam2(int64_t param2);
void SetPointer(void* pointer);
void SetLabel(const std::string& strLabel);
void SetLabel(int iString); // for convenience - looks up in strings.po
Expand All @@ -398,8 +406,8 @@ class CGUIMessage final
int m_controlID;
int m_message;
void* m_pointer;
int m_param1;
int m_param2;
int64_t m_param1;
int64_t m_param2;
CGUIListItemPtr m_item;

static std::string empty_string;
Expand Down

0 comments on commit ae960b2

Please sign in to comment.