From 63f0f8d77bbf344be97952d7841950e37240d646 Mon Sep 17 00:00:00 2001 From: ksooo <3226626+ksooo@users.noreply.github.com> Date: Fri, 9 Aug 2024 04:21:46 +0200 Subject: [PATCH] [video] Change select action choose implementation to open the full context menu of the item, not a special short context menu. Brings back old behavior for PVR recordings, adds more flexibility to other video items. --- .../resources/strings.po | 1 - system/settings/settings.xml | 18 ++++----- xbmc/favourites/GUIWindowFavourites.cpp | 2 +- .../listproviders/DirectoryProvider.cpp | 2 +- xbmc/pvr/windows/GUIWindowPVRRecordings.cpp | 2 +- xbmc/video/ContextMenus.cpp | 2 +- xbmc/video/guilib/VideoAction.h | 2 +- .../guilib/VideoSelectActionProcessor.cpp | 38 +------------------ .../video/guilib/VideoSelectActionProcessor.h | 3 +- xbmc/video/windows/GUIWindowVideoBase.cpp | 2 +- 10 files changed, 17 insertions(+), 55 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index d0064af1b9a88..cc8070cf57ac8 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -15675,7 +15675,6 @@ msgstr "" #. Label to denote that there is something 'more' #. xbmc/favourites/ContextMenus.h #: xbmc/guilib/listproviders/DirectoryProvider.cpp -#: xbmc/video/guilib/VideoSelectActionProcessor.cpp #: system/settings/settings.xml msgctxt "#22082" msgid "More..." diff --git a/system/settings/settings.xml b/system/settings/settings.xml index 987e366fd8012..e5bee132ab8b0 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -1081,14 +1081,14 @@ 0 - 1 + 1 - - - - - + + + + + @@ -1100,11 +1100,11 @@ 0 - 1 + 1 - - + + diff --git a/xbmc/favourites/GUIWindowFavourites.cpp b/xbmc/favourites/GUIWindowFavourites.cpp index de3d25de371b1..daae1c3d3493a 100644 --- a/xbmc/favourites/GUIWindowFavourites.cpp +++ b/xbmc/favourites/GUIWindowFavourites.cpp @@ -90,7 +90,7 @@ class CVideoSelectActionProcessor : public VIDEO::GUILIB::CVideoSelectActionProc return UTILS::GUILIB::CGUIContentUtils::ShowInfoForItem(*m_item); } - bool OnMoreSelected() override + bool OnChooseSelected() override { CONTEXTMENU::ShowFor(m_item, CContextMenuManager::MAIN); return true; diff --git a/xbmc/guilib/listproviders/DirectoryProvider.cpp b/xbmc/guilib/listproviders/DirectoryProvider.cpp index c71855255ae49..e0cd42d039813 100644 --- a/xbmc/guilib/listproviders/DirectoryProvider.cpp +++ b/xbmc/guilib/listproviders/DirectoryProvider.cpp @@ -516,7 +516,7 @@ class CVideoSelectActionProcessor : public VIDEO::GUILIB::CVideoSelectActionProc return true; } - bool OnMoreSelected() override + bool OnChooseSelected() override { m_provider.OnContextMenu(m_item); return true; diff --git a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp index 0e5886a52b170..50d4b3ef523ea 100644 --- a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp @@ -268,7 +268,7 @@ class CVideoSelectActionProcessor : public VIDEO::GUILIB::CVideoSelectActionProc return true; } - bool OnMoreSelected() override + bool OnChooseSelected() override { m_window.OnPopupMenu(m_itemIndex); return true; diff --git a/xbmc/video/ContextMenus.cpp b/xbmc/video/ContextMenus.cpp index 0d463b81050d7..3b502e1479133 100644 --- a/xbmc/video/ContextMenus.cpp +++ b/xbmc/video/ContextMenus.cpp @@ -228,7 +228,7 @@ class CVideoSelectActionProcessor : public VIDEO::GUILIB::CVideoSelectActionProc return true; } - bool OnMoreSelected() override + bool OnChooseSelected() override { CONTEXTMENU::ShowFor(m_item, CContextMenuManager::MAIN); return true; diff --git a/xbmc/video/guilib/VideoAction.h b/xbmc/video/guilib/VideoAction.h index d8d0ccb782fc0..d2b060434b3fb 100644 --- a/xbmc/video/guilib/VideoAction.h +++ b/xbmc/video/guilib/VideoAction.h @@ -18,7 +18,7 @@ enum Action ACTION_PLAY_OR_RESUME = 1, // if resume is possible, ask user. play from beginning otherwise ACTION_RESUME = 2, // resume if possibly, play from beginning otherwise ACTION_INFO = 3, - ACTION_MORE = 4, + // 4 unused ACTION_PLAY_FROM_BEGINNING = 5, // play from beginning, also if resume would be possible ACTION_PLAYPART = 6, ACTION_QUEUE = 7, diff --git a/xbmc/video/guilib/VideoSelectActionProcessor.cpp b/xbmc/video/guilib/VideoSelectActionProcessor.cpp index 4935d62f04eb6..5f9e9dab33866 100644 --- a/xbmc/video/guilib/VideoSelectActionProcessor.cpp +++ b/xbmc/video/guilib/VideoSelectActionProcessor.cpp @@ -11,7 +11,6 @@ #include "FileItem.h" #include "FileItemList.h" #include "ServiceBroker.h" -#include "dialogs/GUIDialogContextMenu.h" #include "dialogs/GUIDialogSelect.h" #include "filesystem/Directory.h" #include "guilib/GUIComponent.h" @@ -22,7 +21,6 @@ #include "utils/StringUtils.h" #include "utils/Variant.h" #include "video/VideoFileItemClassify.h" -#include "video/VideoInfoTag.h" #include "video/guilib/VideoGUIUtils.h" namespace KODI::VIDEO::GUILIB @@ -47,16 +45,7 @@ bool CVideoSelectActionProcessorBase::Process(Action action) switch (action) { case ACTION_CHOOSE: - { - const Action selectedAction = ChooseVideoItemSelectAction(); - if (selectedAction < 0) - { - m_userCancelled = true; - return true; // User cancelled the select menu. We're done. - } - - return Process(selectedAction); - } + return OnChooseSelected(); case ACTION_PLAYPART: { @@ -83,9 +72,6 @@ bool CVideoSelectActionProcessorBase::Process(Action action) return OnInfoSelected(); } - case ACTION_MORE: - return OnMoreSelected(); - default: break; } @@ -115,26 +101,4 @@ unsigned int CVideoSelectActionProcessorBase::ChooseStackItemPartNumber() const return dialog->GetSelectedItem() + 1; // part numbers are 1-based } -Action CVideoSelectActionProcessorBase::ChooseVideoItemSelectAction() const -{ - CContextButtons choices; - - const std::string resumeString = UTILS::GetResumeString(*m_item); - if (!resumeString.empty()) - { - choices.Add(ACTION_RESUME, resumeString); - choices.Add(ACTION_PLAY_FROM_BEGINNING, 12021); // Play from beginning - } - else - { - choices.Add(ACTION_PLAY_FROM_BEGINNING, 208); // Play - } - - choices.Add(ACTION_INFO, 22081); // Show information - choices.Add(ACTION_QUEUE, 13347); // Queue item - choices.Add(ACTION_MORE, 22082); // More - - return static_cast(CGUIDialogContextMenu::ShowAndGetChoice(choices)); -} - } // namespace KODI::VIDEO::GUILIB diff --git a/xbmc/video/guilib/VideoSelectActionProcessor.h b/xbmc/video/guilib/VideoSelectActionProcessor.h index 30e2dc10495c9..565546a19cb62 100644 --- a/xbmc/video/guilib/VideoSelectActionProcessor.h +++ b/xbmc/video/guilib/VideoSelectActionProcessor.h @@ -35,11 +35,10 @@ class CVideoSelectActionProcessorBase : public CVideoPlayActionProcessorBase virtual bool OnPlayPartSelected(unsigned int part) = 0; virtual bool OnQueueSelected() = 0; virtual bool OnInfoSelected() = 0; - virtual bool OnMoreSelected() = 0; + virtual bool OnChooseSelected() = 0; private: CVideoSelectActionProcessorBase() = delete; - Action ChooseVideoItemSelectAction() const; unsigned int ChooseStackItemPartNumber() const; }; } // namespace KODI::VIDEO::GUILIB diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index e93b2b02aa1ff..a875ae4bfaca6 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -605,7 +605,7 @@ class CVideoSelectActionProcessor : public VIDEO::GUILIB::CVideoSelectActionProc bool OnInfoSelected() override { return m_window.OnItemInfo(*m_item); } - bool OnMoreSelected() override + bool OnChooseSelected() override { // window only shows the default version, so no window specific context menu items available if (m_item->HasVideoVersions() && !m_item->GetVideoInfoTag()->IsDefaultVideoVersion())