diff options
author | Sascha Woo <sascha.woo@gmail.com> | 2015-08-04 18:48:27 +0200 |
---|---|---|
committer | Sascha Woo <sascha.woo@gmail.com> | 2015-08-04 18:48:27 +0200 |
commit | 9363bb8f2a3515fa620b79efd34142ac31a445ac (patch) | |
tree | 088f5145633149b953ecf4515acc8f9f3d58b43e | |
parent | 976e0777863cb4b21cf8695afe020a1807ea06ee (diff) | |
parent | b10e8fb61b99e5e638c466507383a03d813b2e7f (diff) |
Merge pull request #7693 from xhaggi/isengard-pvr-fix-observable-msg-handling
[backport][pvr] fix missing epg observable message handling in pvr windows
-rw-r--r-- | xbmc/messaging/Makefile | 7 | ||||
-rw-r--r-- | xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp | 43 | ||||
-rw-r--r-- | xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h | 2 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRBase.cpp | 14 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRBase.h | 1 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRChannels.cpp | 2 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRRecordings.cpp | 3 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRTimers.cpp | 4 |
8 files changed, 66 insertions, 10 deletions
diff --git a/xbmc/messaging/Makefile b/xbmc/messaging/Makefile new file mode 100644 index 0000000000..976e0b887e --- /dev/null +++ b/xbmc/messaging/Makefile @@ -0,0 +1,7 @@ +SRCS = ApplicationMessenger.cpp + +LIB = messaging.a + +include /Users/haggi/Home/devs/workspace/xbmc/Makefile.include +-include $(patsubst %.cpp,%.P,$(patsubst %c,%.P,$(patsubst %.S,,$(SRCS)))) + diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp index 1194d4c34d..0aaeebc2af 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp @@ -35,10 +35,13 @@ #include "pvr/PVRManager.h" #include "pvr/channels/PVRChannelGroupsContainer.h" #include "pvr/windows/GUIWindowPVRBase.h" +#include "epg/EpgContainer.h" using namespace PVR; using namespace EPG; +#define MAX_INVALIDATION_FREQUENCY 2000 // limit to one invalidation per X milliseconds + #define CONTROL_LIST 11 CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() : @@ -54,6 +57,8 @@ CGUIDialogPVRChannelsOSD::~CGUIDialogPVRChannelsOSD() if (IsObserving(g_infoManager)) g_infoManager.UnregisterObserver(this); + if (IsObserving(g_EpgContainer)) + g_EpgContainer.UnregisterObserver(this); } bool CGUIDialogPVRChannelsOSD::OnMessage(CGUIMessage& message) @@ -84,6 +89,22 @@ bool CGUIDialogPVRChannelsOSD::OnMessage(CGUIMessage& message) } } break; + case GUI_MSG_REFRESH_LIST: + { + switch(message.GetParam1()) + { + case ObservableMessageCurrentItem: + m_viewControl.SetItems(*m_vecItems); + return true; + case ObservableMessageEpg: + case ObservableMessageEpgContainer: + case ObservableMessageEpgActiveItem: + if (IsActive()) + SetInvalid(); + return true; + } + } + break; } return CGUIDialog::OnMessage(message); @@ -166,6 +187,8 @@ void CGUIDialogPVRChannelsOSD::Update() if (!IsObserving(g_infoManager)) g_infoManager.RegisterObserver(this); + if (!IsObserving(g_EpgContainer)) + g_EpgContainer.RegisterObserver(this); m_viewControl.SetCurrentView(DEFAULT_VIEW_LIST); @@ -193,6 +216,18 @@ void CGUIDialogPVRChannelsOSD::Update() g_graphicsContext.Unlock(); } +void CGUIDialogPVRChannelsOSD::SetInvalid() +{ + if (m_refreshTimeout.IsTimePast()) + { + VECFILEITEMS items = m_vecItems->GetList(); + for (VECFILEITEMS::iterator it = items.begin(); it != items.end(); ++it) + (*it)->SetInvalid(); + CGUIDialog::SetInvalid(); + m_refreshTimeout.Set(MAX_INVALIDATION_FREQUENCY); + } +} + void CGUIDialogPVRChannelsOSD::SaveControlStates() { CGUIDialog::SaveControlStates(); @@ -324,12 +359,8 @@ CGUIControl *CGUIDialogPVRChannelsOSD::GetFirstFocusableControl(int id) void CGUIDialogPVRChannelsOSD::Notify(const Observable &obs, const ObservableMessage msg) { - if (msg == ObservableMessageCurrentItem) - { - g_graphicsContext.Lock(); - m_viewControl.SetItems(*m_vecItems); - g_graphicsContext.Unlock(); - } + CGUIMessage m(GUI_MSG_REFRESH_LIST, GetID(), 0, msg); + CApplicationMessenger::Get().SendGUIMessage(m); } void CGUIDialogPVRChannelsOSD::SaveSelectedItemPath(int iGroupID) diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h index f19c1341f8..376c37bff8 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h @@ -45,6 +45,7 @@ namespace PVR virtual void OnDeinitWindow(int nextWindowID); virtual void RestoreControlStates(); virtual void SaveControlStates(); + virtual void SetInvalid(); void CloseOrSelect(unsigned int iItem); void GotoChannel(int iItem); @@ -62,6 +63,7 @@ namespace PVR std::map<int, std::string> m_groupSelectedItemPaths; void SaveSelectedItemPath(int iGroupID); std::string GetLastSelectedItemPath(int iGroupID) const; + XbmcThreads::EndTime m_refreshTimeout; }; } diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp index 18a58596fb..9deb14d217 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRBase.cpp @@ -45,6 +45,8 @@ #include "utils/StringUtils.h" #include "utils/Observer.h" +#define MAX_INVALIDATION_FREQUENCY 2000 // limit to one invalidation per X milliseconds + using namespace PVR; using namespace EPG; @@ -212,10 +214,14 @@ bool CGUIWindowPVRBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button) void CGUIWindowPVRBase::SetInvalid() { - VECFILEITEMS items = m_vecItems->GetList(); - for (VECFILEITEMS::iterator it = items.begin(); it != items.end(); ++it) - (*it)->SetInvalid(); - CGUIMediaWindow::SetInvalid(); + if (m_refreshTimeout.IsTimePast()) + { + VECFILEITEMS items = m_vecItems->GetList(); + for (VECFILEITEMS::iterator it = items.begin(); it != items.end(); ++it) + (*it)->SetInvalid(); + CGUIMediaWindow::SetInvalid(); + m_refreshTimeout.Set(MAX_INVALIDATION_FREQUENCY); + } } bool CGUIWindowPVRBase::OpenGroupSelectionDialog(void) diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.h b/xbmc/pvr/windows/GUIWindowPVRBase.h index b6f5eb9e10..c0f20aef93 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.h +++ b/xbmc/pvr/windows/GUIWindowPVRBase.h @@ -104,5 +104,6 @@ namespace PVR private: CPVRChannelGroupPtr m_group; + XbmcThreads::EndTime m_refreshTimeout; }; } diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp index 9940ca3557..90ebe401f3 100644 --- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp @@ -220,6 +220,8 @@ bool CGUIWindowPVRChannels::OnMessage(CGUIMessage& message) { case ObservableMessageChannelGroup: case ObservableMessageTimers: + case ObservableMessageEpg: + case ObservableMessageEpgContainer: case ObservableMessageEpgActiveItem: case ObservableMessageCurrentItem: { diff --git a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp index a028ca0420..24bb39beba 100644 --- a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp @@ -293,6 +293,9 @@ bool CGUIWindowPVRRecordings::OnMessage(CGUIMessage &message) switch(message.GetParam1()) { case ObservableMessageTimers: + case ObservableMessageEpg: + case ObservableMessageEpgContainer: + case ObservableMessageEpgActiveItem: case ObservableMessageCurrentItem: { if (IsActive()) diff --git a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp index 70794b78f5..f18f811315 100644 --- a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp @@ -143,6 +143,10 @@ bool CGUIWindowPVRTimers::OnMessage(CGUIMessage &message) switch(message.GetParam1()) { case ObservableMessageTimers: + case ObservableMessageEpg: + case ObservableMessageEpgContainer: + case ObservableMessageEpgActiveItem: + case ObservableMessageCurrentItem: { if (IsActive()) SetInvalid(); |