diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2016-09-08 19:56:23 +0200 |
---|---|---|
committer | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2016-09-08 19:56:23 +0200 |
commit | 6c93c7e08d754d70073ed91b3670e28e1dde6c94 (patch) | |
tree | d2f9fb846ef06b0187908856f1b4d85ce4a4b408 | |
parent | 1132f3e0859e6de320fd28280178461b2612815f (diff) |
[PVR] Recordings home scren widget: Fix widget not updating when new recording appears / a recording gets deleted.
-rw-r--r-- | Kodi.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | xbmc/listproviders/DirectoryProvider.cpp | 11 | ||||
-rw-r--r-- | xbmc/listproviders/DirectoryProvider.h | 4 | ||||
-rw-r--r-- | xbmc/pvr/CMakeLists.txt | 2 | ||||
-rw-r--r-- | xbmc/pvr/PVREvent.h (renamed from xbmc/pvr/PVRManagerState.h) | 18 | ||||
-rw-r--r-- | xbmc/pvr/PVRManager.cpp | 36 | ||||
-rw-r--r-- | xbmc/pvr/PVRManager.h | 22 | ||||
-rw-r--r-- | xbmc/pvr/channels/PVRChannelGroupInternal.cpp | 4 | ||||
-rw-r--r-- | xbmc/pvr/channels/PVRChannelGroupInternal.h | 4 | ||||
-rw-r--r-- | xbmc/pvr/recordings/PVRRecordings.cpp | 2 |
10 files changed, 80 insertions, 27 deletions
diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index d64a531a0b..ae7bd4db5c 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -2609,7 +2609,7 @@ 2AC7EB591C21F6BA00BDAA95 /* GUIWindowPVRTimersBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowPVRTimersBase.h; sourceTree = "<group>"; }; 2AC7EB5E1C34892100BDAA95 /* PVRRecordingsPath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PVRRecordingsPath.h; sourceTree = "<group>"; }; 2AC7EB5F1C34893700BDAA95 /* PVRRecordingsPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PVRRecordingsPath.cpp; sourceTree = "<group>"; }; - 2AE16B7A1D58B11B005C20EB /* PVRManagerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRManagerState.h; sourceTree = "<group>"; }; + 2AFB819A1D81D1A2002B82A2 /* PVREvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVREvent.h; sourceTree = "<group>"; }; 2AFBB94A1CC6088000BAB340 /* GUIEPGGridContainerModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIEPGGridContainerModel.h; sourceTree = "<group>"; }; 2AFBB94B1CC608A200BAB340 /* GUIEPGGridContainerModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIEPGGridContainerModel.cpp; sourceTree = "<group>"; }; 2F4564D31970129A00396109 /* GUIFontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIFontCache.cpp; sourceTree = "<group>"; }; @@ -7004,11 +7004,11 @@ 42DAC16D1A6E789E0066B4C8 /* PVRActionListener.h */, C848289B156CFCD8005A996F /* PVRDatabase.cpp */, C848289C156CFCD8005A996F /* PVRDatabase.h */, + 2AFB819A1D81D1A2002B82A2 /* PVREvent.h */, C848289D156CFCD8005A996F /* PVRGUIInfo.cpp */, C848289E156CFCD8005A996F /* PVRGUIInfo.h */, C848289F156CFCD8005A996F /* PVRManager.cpp */, C84828A0156CFCD8005A996F /* PVRManager.h */, - 2AE16B7A1D58B11B005C20EB /* PVRManagerState.h */, 2A7B2BDB1BD6F16600044BCD /* PVRSettings.cpp */, 2A7B2BDE1BD6F18B00044BCD /* PVRSettings.h */, ); diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp index 185503df71..b0660f9aed 100644 --- a/xbmc/listproviders/DirectoryProvider.cpp +++ b/xbmc/listproviders/DirectoryProvider.cpp @@ -292,15 +292,16 @@ void CDirectoryProvider::OnAddonEvent(const ADDON::AddonEvent& event) } } -void CDirectoryProvider::OnPVRManagerEvent(const PVR::ManagerState& event) +void CDirectoryProvider::OnPVRManagerEvent(const PVR::PVREvent& event) { CSingleLock lock(m_section); if (URIUtils::IsProtocol(m_currentUrl, "pvr")) { - if (event == ManagerStateStarted || - event == ManagerStateStopped || - event == ManagerStateError || - event == ManagerStateInterrupted) + if (event == ManagerStarted || + event == ManagerStopped || + event == ManagerError || + event == ManagerInterrupted || + event == RecordingsInvalidated) m_updateState = INVALIDATED; } } diff --git a/xbmc/listproviders/DirectoryProvider.h b/xbmc/listproviders/DirectoryProvider.h index bda3d8f877..dfe77c8e0f 100644 --- a/xbmc/listproviders/DirectoryProvider.h +++ b/xbmc/listproviders/DirectoryProvider.h @@ -25,7 +25,7 @@ #include "addons/AddonEvents.h" #include "IListProvider.h" #include "guilib/GUIStaticItem.h" -#include "pvr/PVRManagerState.h" +#include "pvr/PVREvent.h" #include "utils/Job.h" #include "threads/CriticalSection.h" #include "interfaces/IAnnouncer.h" @@ -89,5 +89,5 @@ private: bool UpdateLimit(); bool UpdateSort(); void OnAddonEvent(const ADDON::AddonEvent& event); - void OnPVRManagerEvent(const PVR::ManagerState& event); + void OnPVRManagerEvent(const PVR::PVREvent& event); }; diff --git a/xbmc/pvr/CMakeLists.txt b/xbmc/pvr/CMakeLists.txt index 068eba0a48..aab1a62694 100644 --- a/xbmc/pvr/CMakeLists.txt +++ b/xbmc/pvr/CMakeLists.txt @@ -6,9 +6,9 @@ set(SOURCES PVRActionListener.cpp set(HEADERS PVRActionListener.h PVRDatabase.h + PVREvent.h PVRGUIInfo.h PVRManager.h - PVRManagerState.h PVRSettings.h) core_add_library(pvr) diff --git a/xbmc/pvr/PVRManagerState.h b/xbmc/pvr/PVREvent.h index d45ca12029..660562d2de 100644 --- a/xbmc/pvr/PVRManagerState.h +++ b/xbmc/pvr/PVREvent.h @@ -21,13 +21,17 @@ namespace PVR { - enum ManagerState + enum PVREvent { - ManagerStateError = 0, - ManagerStateStopped, - ManagerStateStarting, - ManagerStateStopping, - ManagerStateInterrupted, - ManagerStateStarted + // PVR Manager states + ManagerError = 0, + ManagerStopped, + ManagerStarting, + ManagerStopping, + ManagerInterrupted, + ManagerStarted, + + // Recording events + RecordingsInvalidated }; } // namespace PVR diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index 8b8ecbf300..25afcd4ce1 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -353,20 +353,50 @@ void CPVRManager::Stop(void) Cleanup(); } -ManagerState CPVRManager::GetState(void) const +CPVRManager::ManagerState CPVRManager::GetState(void) const { CSingleLock lock(m_managerStateMutex); return m_managerState; } -void CPVRManager::SetState(ManagerState state) +void CPVRManager::SetState(CPVRManager::ManagerState state) { CSingleLock lock(m_managerStateMutex); if (m_managerState == state) return; m_managerState = state; - m_events.Publish(m_managerState); + + PVREvent event; + switch (state) + { + case ManagerStateError: + event = ManagerError; + break; + case ManagerStateStopped: + event = ManagerStopped; + break; + case ManagerStateStarting: + event = ManagerStarting; + break; + case ManagerStateStopping: + event = ManagerStopped; + break; + case ManagerStateInterrupted: + event = ManagerInterrupted; + break; + case ManagerStateStarted: + event = ManagerStarted; + break; + default: + return; + } + m_events.Publish(event); +} + +void CPVRManager::PublishEvent(PVREvent event) +{ + m_events.Publish(event); } void CPVRManager::Process(void) diff --git a/xbmc/pvr/PVRManager.h b/xbmc/pvr/PVRManager.h index 41ce26aee1..8389382490 100644 --- a/xbmc/pvr/PVRManager.h +++ b/xbmc/pvr/PVRManager.h @@ -29,7 +29,7 @@ #include "utils/JobManager.h" #include "utils/Observer.h" -#include "pvr/PVRManagerState.h" +#include "pvr/PVREvent.h" #include "pvr/recordings/PVRRecording.h" #include <map> @@ -564,7 +564,13 @@ private: /*! * @brief Query the events available for CEventStream */ - CEventStream<ManagerState>& Events() { return m_events; } + CEventStream<PVREvent>& Events() { return m_events; } + + /*! + * @brief Publish an event + * @param state the event + */ + void PublishEvent(PVREvent state); /*! * @brief Show or update the progress dialog. @@ -629,6 +635,16 @@ private: */ void QueueJob(CJob *job); + enum ManagerState + { + ManagerStateError = 0, + ManagerStateStopped, + ManagerStateStarting, + ManagerStateStopping, + ManagerStateInterrupted, + ManagerStateStarted + }; + ManagerState GetState(void) const; void SetState(ManagerState state); @@ -664,7 +680,7 @@ private: static const int m_pvrWindowIds[12]; std::atomic_bool m_isChannelPreview; - CEventSource<ManagerState> m_events; + CEventSource<PVREvent> m_events; }; class CPVRStartupJob : public CJob diff --git a/xbmc/pvr/channels/PVRChannelGroupInternal.cpp b/xbmc/pvr/channels/PVRChannelGroupInternal.cpp index 38b07cc134..eb00a59bb7 100644 --- a/xbmc/pvr/channels/PVRChannelGroupInternal.cpp +++ b/xbmc/pvr/channels/PVRChannelGroupInternal.cpp @@ -347,8 +347,8 @@ bool CPVRChannelGroupInternal::CreateChannelEpgs(bool bForce /* = false */) return true; } -void CPVRChannelGroupInternal::OnPVRManagerEvent(const PVR::ManagerState& event) +void CPVRChannelGroupInternal::OnPVRManagerEvent(const PVR::PVREvent& event) { - if (event == ManagerStateStarted) + if (event == ManagerStarted) g_PVRManager.TriggerEpgsCreate(); } diff --git a/xbmc/pvr/channels/PVRChannelGroupInternal.h b/xbmc/pvr/channels/PVRChannelGroupInternal.h index 2622d7275c..9e71c35c77 100644 --- a/xbmc/pvr/channels/PVRChannelGroupInternal.h +++ b/xbmc/pvr/channels/PVRChannelGroupInternal.h @@ -19,7 +19,7 @@ * */ -#include "pvr/PVRManagerState.h" +#include "pvr/PVREvent.h" #include "PVRChannelGroup.h" @@ -154,6 +154,6 @@ namespace PVR size_t m_iHiddenChannels; /*!< the amount of hidden channels in this container */ private: - void OnPVRManagerEvent(const PVR::ManagerState& event); + void OnPVRManagerEvent(const PVR::PVREvent& event); }; } diff --git a/xbmc/pvr/recordings/PVRRecordings.cpp b/xbmc/pvr/recordings/PVRRecordings.cpp index 012639da02..17f6b06f0b 100644 --- a/xbmc/pvr/recordings/PVRRecordings.cpp +++ b/xbmc/pvr/recordings/PVRRecordings.cpp @@ -28,6 +28,7 @@ #include "pvr/addons/PVRClients.h" #include "pvr/recordings/PVRRecordingsPath.h" #include "pvr/PVRManager.h" +#include "pvr/PVREvent.h" #include "settings/Settings.h" #include "threads/SingleLock.h" #include "URL.h" @@ -167,6 +168,7 @@ void CPVRRecordings::Update(void) lock.Leave(); g_PVRManager.NotifyObservers(ObservableMessageRecordings); + g_PVRManager.PublishEvent(RecordingsInvalidated); } int CPVRRecordings::GetNumTVRecordings() const |