aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2022-10-17 19:59:35 +0200
committerKai Sommerfeld <kai.sommerfeld@gmx.com>2022-10-26 19:30:32 +0200
commit4a7510d430df5450353ff2158e46266e455fe5d1 (patch)
tree687d52527f3a530eeef9a98fdd356d04dc0a03d4
parent77553c48d5fe1782fd2692e600375e7b4608ff08 (diff)
[music] Add context menu item 'Browse into'.
-rw-r--r--addons/resource.language.en_gb/resources/strings.po1
-rw-r--r--xbmc/ContextMenuManager.cpp1
-rw-r--r--xbmc/music/ContextMenus.cpp22
-rw-r--r--xbmc/music/ContextMenus.h7
4 files changed, 31 insertions, 0 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 100e96ba0e..5d181d833e 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -21850,6 +21850,7 @@ msgctxt "#37014"
msgid "Last used profile"
msgstr ""
+#: xbmc/music/ContextMenus.h
#: xbmc/windows/GUIMediaWindow.cpp
msgctxt "#37015"
msgid "Browse into"
diff --git a/xbmc/ContextMenuManager.cpp b/xbmc/ContextMenuManager.cpp
index 568382820e..fedc700085 100644
--- a/xbmc/ContextMenuManager.cpp
+++ b/xbmc/ContextMenuManager.cpp
@@ -88,6 +88,7 @@ void CContextMenuManager::Init()
std::make_shared<CONTEXTMENU::CRenameFavourite>(),
std::make_shared<CONTEXTMENU::CRemoveFavourite>(),
std::make_shared<CONTEXTMENU::CAddRemoveFavourite>(),
+ std::make_shared<CONTEXTMENU::CMusicBrowse>(),
std::make_shared<CONTEXTMENU::CMusicPlay>(),
std::make_shared<CONTEXTMENU::CMusicPlayNext>(),
std::make_shared<CONTEXTMENU::CMusicQueue>(),
diff --git a/xbmc/music/ContextMenus.cpp b/xbmc/music/ContextMenus.cpp
index b5fc6c39e7..4d98d0121a 100644
--- a/xbmc/music/ContextMenus.cpp
+++ b/xbmc/music/ContextMenus.cpp
@@ -9,6 +9,7 @@
#include "ContextMenus.h"
#include "FileItem.h"
+#include "GUIUserMessages.h"
#include "ServiceBroker.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
@@ -38,6 +39,27 @@ bool CMusicInfo::Execute(const std::shared_ptr<CFileItem>& item) const
return true;
}
+bool CMusicBrowse::IsVisible(const CFileItem& item) const
+{
+ return item.m_bIsFolder && MUSIC_UTILS::IsItemPlayable(item);
+}
+
+bool CMusicBrowse::Execute(const std::shared_ptr<CFileItem>& item) const
+{
+ auto& windowMgr = CServiceBroker::GetGUI()->GetWindowManager();
+ if (windowMgr.GetActiveWindow() == WINDOW_MUSIC_NAV)
+ {
+ CGUIMessage msg(GUI_MSG_NOTIFY_ALL, WINDOW_MUSIC_NAV, 0, GUI_MSG_UPDATE);
+ msg.SetStringParam(item->GetPath());
+ windowMgr.SendMessage(msg);
+ }
+ else
+ {
+ windowMgr.ActivateWindow(WINDOW_MUSIC_NAV, {item->GetPath(), "return"});
+ }
+ return true;
+}
+
bool CMusicPlay::IsVisible(const CFileItem& item) const
{
return MUSIC_UTILS::IsItemPlayable(item);
diff --git a/xbmc/music/ContextMenus.h b/xbmc/music/ContextMenus.h
index de1afb1ad0..73275923fc 100644
--- a/xbmc/music/ContextMenus.h
+++ b/xbmc/music/ContextMenus.h
@@ -43,6 +43,13 @@ struct CSongInfo : CMusicInfo
CSongInfo() : CMusicInfo(MediaTypeSong) {}
};
+struct CMusicBrowse : CStaticContextMenuAction
+{
+ CMusicBrowse() : CStaticContextMenuAction(37015) {} // Browse into
+ bool IsVisible(const CFileItem& item) const override;
+ bool Execute(const std::shared_ptr<CFileItem>& item) const override;
+};
+
struct CMusicPlay : CStaticContextMenuAction
{
CMusicPlay() : CStaticContextMenuAction(208) {} // Play