diff options
author | pieh <misiek.piechowiak@gmail.com> | 2012-09-21 17:48:08 +0200 |
---|---|---|
committer | pieh <misiek.piechowiak@gmail.com> | 2012-09-21 17:48:43 +0200 |
commit | db3d6d0895f8f8f45dd85681b74ce8d7997c01e0 (patch) | |
tree | 1ff1434ca4ef841bd80c21aa9ad6f9a119da18b4 | |
parent | b35e1ac6bced295f15f062052beaaba19785758f (diff) |
fix GUIDialogSelect showing wrong button label after first window load
store wanted label and set it on window init or immediately if window is active
-rw-r--r-- | xbmc/dialogs/GUIDialogSelect.cpp | 33 | ||||
-rw-r--r-- | xbmc/dialogs/GUIDialogSelect.h | 2 |
2 files changed, 22 insertions, 13 deletions
diff --git a/xbmc/dialogs/GUIDialogSelect.cpp b/xbmc/dialogs/GUIDialogSelect.cpp index 10876e89a6..cdc10564db 100644 --- a/xbmc/dialogs/GUIDialogSelect.cpp +++ b/xbmc/dialogs/GUIDialogSelect.cpp @@ -33,6 +33,7 @@ CGUIDialogSelect::CGUIDialogSelect(void) : CGUIDialogBoxBase(WINDOW_DIALOG_SELECT, "DialogSelect.xml") { m_bButtonEnabled = false; + m_buttonString = -1; m_useDetails = false; m_vecListInternal = new CFileItemList; m_selectedItems = new CFileItemList; @@ -77,6 +78,9 @@ bool CGUIDialogSelect::OnMessage(CGUIMessage& message) m_vecListInternal->Clear(); m_vecList = m_vecListInternal; + + m_buttonString = -1; + SET_CONTROL_LABEL(CONTROL_BUTTON, ""); return true; } break; @@ -208,9 +212,10 @@ const CFileItemList& CGUIDialogSelect::GetSelectedItems() const void CGUIDialogSelect::EnableButton(bool enable, int string) { m_bButtonEnabled = enable; - CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), CONTROL_BUTTON); - msg.SetLabel(string); - OnMessage(msg); + m_buttonString = string; + + if (IsActive()) + SetupButton(); } bool CGUIDialogSelect::IsButtonPressed() @@ -322,16 +327,7 @@ void CGUIDialogSelect::OnInitWindow() if (m_multiSelection) EnableButton(true, 186); - if (m_bButtonEnabled) - { - CGUIMessage msg2(GUI_MSG_VISIBLE, GetID(), CONTROL_BUTTON); - g_windowManager.SendMessage(msg2); - } - else - { - CGUIMessage msg2(GUI_MSG_HIDDEN, GetID(), CONTROL_BUTTON); - g_windowManager.SendMessage(msg2); - } + SetupButton(); CGUIDialogBoxBase::OnInitWindow(); if (m_iSelected >= 0) @@ -343,3 +339,14 @@ void CGUIDialogSelect::OnWindowUnload() CGUIDialog::OnWindowUnload(); m_viewControl.Reset(); } + +void CGUIDialogSelect::SetupButton() +{ + if (m_bButtonEnabled) + { + SET_CONTROL_LABEL(CONTROL_BUTTON, g_localizeStrings.Get(m_buttonString)); + SET_CONTROL_VISIBLE(CONTROL_BUTTON); + } + else + SET_CONTROL_HIDDEN(CONTROL_BUTTON); +} diff --git a/xbmc/dialogs/GUIDialogSelect.h b/xbmc/dialogs/GUIDialogSelect.h index 5e47928b09..bad2c0bc2d 100644 --- a/xbmc/dialogs/GUIDialogSelect.h +++ b/xbmc/dialogs/GUIDialogSelect.h @@ -59,8 +59,10 @@ protected: virtual void OnWindowLoaded(); virtual void OnInitWindow(); virtual void OnWindowUnload(); + void SetupButton(); bool m_bButtonEnabled; + int m_buttonString; bool m_bButtonPressed; int m_iSelected; bool m_useDetails; |