diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-09-24 23:13:28 +0200 |
---|---|---|
committer | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-09-27 13:18:27 +0200 |
commit | 43635322082e97c8ba75206455ce6e665507a861 (patch) | |
tree | 3314f88fae246005f124acef91d208660e1e2c78 | |
parent | cff3d297f68983fc46c52d7221621ec9fde763a1 (diff) |
[PVR] Add CPVRGUIActionsUtils to PVR components.
-rw-r--r-- | xbmc/listproviders/DirectoryProvider.cpp | 4 | ||||
-rw-r--r-- | xbmc/pvr/PVRComponentRegistration.cpp | 3 | ||||
-rw-r--r-- | xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp | 8 | ||||
-rw-r--r-- | xbmc/pvr/guilib/PVRGUIActions.h | 4 | ||||
-rw-r--r-- | xbmc/pvr/guilib/PVRGUIActionsChannels.cpp | 5 | ||||
-rw-r--r-- | xbmc/pvr/guilib/PVRGUIActionsUtils.h | 9 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRBase.cpp | 8 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRGuide.cpp | 11 |
8 files changed, 32 insertions, 20 deletions
diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp index 6ee7f3ce51..6a9a9d5137 100644 --- a/xbmc/listproviders/DirectoryProvider.cpp +++ b/xbmc/listproviders/DirectoryProvider.cpp @@ -22,7 +22,7 @@ #include "pictures/PictureThumbLoader.h" #include "pvr/PVRManager.h" #include "pvr/PVRThumbLoader.h" -#include "pvr/guilib/PVRGUIActions.h" +#include "pvr/guilib/PVRGUIActionsUtils.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "utils/JobManager.h" @@ -440,7 +440,7 @@ bool CDirectoryProvider::OnInfo(const CGUIListItemPtr& item) } else if (fileItem->IsPVR()) { - return CServiceBroker::GetPVRManager().GUIActions()->OnInfo(fileItem); + return CServiceBroker::GetPVRManager().Get<PVR::GUI::Utils>().OnInfo(fileItem); } else if (fileItem->HasVideoInfoTag()) { diff --git a/xbmc/pvr/PVRComponentRegistration.cpp b/xbmc/pvr/PVRComponentRegistration.cpp index 9d220cfc62..7532283710 100644 --- a/xbmc/pvr/PVRComponentRegistration.cpp +++ b/xbmc/pvr/PVRComponentRegistration.cpp @@ -17,6 +17,7 @@ #include "pvr/guilib/PVRGUIActionsPowerManagement.h" #include "pvr/guilib/PVRGUIActionsRecordings.h" #include "pvr/guilib/PVRGUIActionsTimers.h" +#include "pvr/guilib/PVRGUIActionsUtils.h" #include <memory> @@ -33,10 +34,12 @@ CPVRComponentRegistration::CPVRComponentRegistration() RegisterComponent(std::make_shared<CPVRGUIActionsPowerManagement>()); RegisterComponent(std::make_shared<CPVRGUIActionsRecordings>()); RegisterComponent(std::make_shared<CPVRGUIActionsTimers>()); + RegisterComponent(std::make_shared<CPVRGUIActionsUtils>()); } CPVRComponentRegistration::~CPVRComponentRegistration() { + DeregisterComponent(typeid(CPVRGUIActionsUtils)); DeregisterComponent(typeid(CPVRGUIActionsTimers)); DeregisterComponent(typeid(CPVRGUIActionsRecordings)); DeregisterComponent(typeid(CPVRGUIActionsPowerManagement)); diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp index a4d5854f88..83a4628521 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp @@ -23,9 +23,9 @@ #include "pvr/channels/PVRChannelGroups.h" #include "pvr/channels/PVRChannelGroupsContainer.h" #include "pvr/epg/EpgContainer.h" -#include "pvr/guilib/PVRGUIActions.h" #include "pvr/guilib/PVRGUIActionsChannels.h" #include "pvr/guilib/PVRGUIActionsPlayback.h" +#include "pvr/guilib/PVRGUIActionsUtils.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" @@ -90,7 +90,8 @@ void CGUIDialogPVRChannelsOSD::OnDeinitWindow(int nextWindowID) { if (m_group) { - CServiceBroker::GetPVRManager().GUIActions()->SetSelectedItemPath(m_group->IsRadio(), m_viewControl.GetSelectedItemPath()); + CServiceBroker::GetPVRManager().Get<PVR::GUI::Utils>().SetSelectedItemPath( + m_group->IsRadio(), m_viewControl.GetSelectedItemPath()); // next OnInitWindow will set the group which is then selected m_group.reset(); @@ -191,7 +192,8 @@ void CGUIDialogPVRChannelsOSD::Update() if (!m_group) { m_group = group; - m_viewControl.SetSelectedItem(pvrMgr.GUIActions()->GetSelectedItemPath(channel->IsRadio())); + m_viewControl.SetSelectedItem( + pvrMgr.Get<PVR::GUI::Utils>().GetSelectedItemPath(channel->IsRadio())); SaveSelectedItemPath(group->GroupID()); } } diff --git a/xbmc/pvr/guilib/PVRGUIActions.h b/xbmc/pvr/guilib/PVRGUIActions.h index dd328570d9..25afb818ca 100644 --- a/xbmc/pvr/guilib/PVRGUIActions.h +++ b/xbmc/pvr/guilib/PVRGUIActions.h @@ -8,11 +8,9 @@ #pragma once -#include "pvr/guilib/PVRGUIActionsUtils.h" - namespace PVR { -class CPVRGUIActions : public CPVRGUIActionsUtils +class CPVRGUIActions { public: CPVRGUIActions() = default; diff --git a/xbmc/pvr/guilib/PVRGUIActionsChannels.cpp b/xbmc/pvr/guilib/PVRGUIActionsChannels.cpp index 2f59fc9d9d..a3ffce2fea 100644 --- a/xbmc/pvr/guilib/PVRGUIActionsChannels.cpp +++ b/xbmc/pvr/guilib/PVRGUIActionsChannels.cpp @@ -29,7 +29,7 @@ #include "pvr/channels/PVRChannelGroupMember.h" #include "pvr/channels/PVRChannelGroups.h" #include "pvr/channels/PVRChannelGroupsContainer.h" -#include "pvr/guilib/PVRGUIActions.h" //! @todo decouple +#include "pvr/guilib/PVRGUIActionsUtils.h" #include "pvr/windows/GUIWindowPVRBase.h" #include "utils/Variant.h" #include "utils/log.h" @@ -330,8 +330,7 @@ void CPVRGUIActionsChannels::OnPlaybackStarted(const CFileItemPtr& item) if (groupMember) { m_channelNavigator.SetPlayingChannel(groupMember); - //! @todo decouple - CServiceBroker::GetPVRManager().GUIActions()->SetSelectedItemPath( + CServiceBroker::GetPVRManager().Get<PVR::GUI::Utils>().SetSelectedItemPath( groupMember->Channel()->IsRadio(), groupMember->Path()); } } diff --git a/xbmc/pvr/guilib/PVRGUIActionsUtils.h b/xbmc/pvr/guilib/PVRGUIActionsUtils.h index a486c9905e..658a4cb8c1 100644 --- a/xbmc/pvr/guilib/PVRGUIActionsUtils.h +++ b/xbmc/pvr/guilib/PVRGUIActionsUtils.h @@ -8,6 +8,7 @@ #pragma once +#include "pvr/IPVRComponent.h" #include "pvr/settings/PVRSettings.h" #include "threads/CriticalSection.h" @@ -18,7 +19,7 @@ class CFileItem; namespace PVR { -class CPVRGUIActionsUtils +class CPVRGUIActionsUtils : public IPVRComponent { public: CPVRGUIActionsUtils(); @@ -56,4 +57,10 @@ private: std::string m_selectedItemPathRadio; }; +namespace GUI +{ +// pretty scope and name +using Utils = CPVRGUIActionsUtils; +} // namespace GUI + } // namespace PVR diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp index 7988cbdd3f..bc477c2675 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRBase.cpp @@ -28,7 +28,7 @@ #include "pvr/channels/PVRChannelGroups.h" #include "pvr/channels/PVRChannelGroupsContainer.h" #include "pvr/filesystem/PVRGUIDirectory.h" -#include "pvr/guilib/PVRGUIActions.h" +#include "pvr/guilib/PVRGUIActionsUtils.h" #include "utils/Variant.h" #include "utils/log.h" @@ -144,7 +144,8 @@ CGUIWindowPVRBase::~CGUIWindowPVRBase() void CGUIWindowPVRBase::UpdateSelectedItemPath() { - CServiceBroker::GetPVRManager().GUIActions()->SetSelectedItemPath(m_bRadio, m_viewControl.GetSelectedItemPath()); + CServiceBroker::GetPVRManager().Get<PVR::GUI::Utils>().SetSelectedItemPath( + m_bRadio, m_viewControl.GetSelectedItemPath()); } void CGUIWindowPVRBase::RegisterObservers() @@ -288,7 +289,8 @@ void CGUIWindowPVRBase::OnInitWindow() CGUIMediaWindow::OnInitWindow(); // mark item as selected by channel path - m_viewControl.SetSelectedItem(CServiceBroker::GetPVRManager().GUIActions()->GetSelectedItemPath(m_bRadio)); + m_viewControl.SetSelectedItem( + CServiceBroker::GetPVRManager().Get<PVR::GUI::Utils>().GetSelectedItemPath(m_bRadio)); // This has to be done after base class OnInitWindow to restore correct selection m_channelGroupsSelector->SelectChannelGroup(GetChannelGroup()); diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp index dbe885f46c..c5c43fe532 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp @@ -34,11 +34,11 @@ #include "pvr/epg/EpgContainer.h" #include "pvr/epg/EpgInfoTag.h" #include "pvr/guilib/GUIEPGGridContainer.h" -#include "pvr/guilib/PVRGUIActions.h" #include "pvr/guilib/PVRGUIActionsChannels.h" #include "pvr/guilib/PVRGUIActionsEPG.h" #include "pvr/guilib/PVRGUIActionsPlayback.h" #include "pvr/guilib/PVRGUIActionsTimers.h" +#include "pvr/guilib/PVRGUIActionsUtils.h" #include "pvr/recordings/PVRRecordings.h" #include "pvr/timers/PVRTimers.h" #include "settings/Settings.h" @@ -80,7 +80,7 @@ void CGUIWindowPVRGuideBase::InitEpgGridControl() CPVRManager& mgr = CServiceBroker::GetPVRManager(); const std::shared_ptr<CPVRChannel> channel = - mgr.ChannelGroups()->GetByPath(mgr.GUIActions()->GetSelectedItemPath(m_bRadio)); + mgr.ChannelGroups()->GetByPath(mgr.Get<PVR::GUI::Utils>().GetSelectedItemPath(m_bRadio)); if (channel) { @@ -198,8 +198,8 @@ void CGUIWindowPVRGuideBase::UpdateSelectedItemPath() const std::shared_ptr<CPVRChannelGroupMember> groupMember = epgGridContainer->GetSelectedChannelGroupMember(); if (groupMember) - CServiceBroker::GetPVRManager().GUIActions()->SetSelectedItemPath(m_bRadio, - groupMember->Path()); + CServiceBroker::GetPVRManager().Get<PVR::GUI::Utils>().SetSelectedItemPath( + m_bRadio, groupMember->Path()); } } @@ -228,7 +228,8 @@ bool CGUIWindowPVRGuideBase::Update(const std::string& strDirectory, bool update { CGUIEPGGridContainer* epgGridContainer = GetGridControl(); if (epgGridContainer) - m_bChannelSelectionRestored = epgGridContainer->SetChannel(CServiceBroker::GetPVRManager().GUIActions()->GetSelectedItemPath(m_bRadio)); + m_bChannelSelectionRestored = epgGridContainer->SetChannel( + CServiceBroker::GetPVRManager().Get<PVR::GUI::Utils>().GetSelectedItemPath(m_bRadio)); } return bReturn; |