aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/keymaps/keyboard.xml1
-rw-r--r--system/keymaps/remote.xml3
-rw-r--r--xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp91
-rw-r--r--xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h1
4 files changed, 63 insertions, 33 deletions
diff --git a/system/keymaps/keyboard.xml b/system/keymaps/keyboard.xml
index b7488f4cba..d6dac8bbf7 100644
--- a/system/keymaps/keyboard.xml
+++ b/system/keymaps/keyboard.xml
@@ -729,7 +729,6 @@
<backspace>Close</backspace>
<escape>Close</escape>
<browser_back>Close</browser_back>
- <c>Close</c>
</keyboard>
</PVROSDChannels>
<PVRChannelGuide>
diff --git a/system/keymaps/remote.xml b/system/keymaps/remote.xml
index b139af0a9d..c122b99188 100644
--- a/system/keymaps/remote.xml
+++ b/system/keymaps/remote.xml
@@ -612,9 +612,6 @@
<PVROSDChannels>
<remote>
<back>Close</back>
- <menu>Close</menu>
- <contentsmenu>Close</contentsmenu>
- <rootmenu>Close</rootmenu>
<start>Close</start>
<playlist>Close</playlist>
<zero>Number0</zero>
diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
index 87a810e0bc..2ef6ca0b34 100644
--- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
+++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
@@ -8,8 +8,10 @@
#include "GUIDialogPVRChannelsOSD.h"
+#include "ContextMenuManager.h"
#include "FileItem.h"
#include "ServiceBroker.h"
+#include "dialogs/GUIDialogContextMenu.h"
#include "GUIInfoManager.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
@@ -47,34 +49,6 @@ bool CGUIDialogPVRChannelsOSD::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
- case GUI_MSG_CLICKED:
- {
- int iControl = message.GetSenderId();
-
- if (m_viewControl.HasControl(iControl)) // list/thumb control
- {
- int iItem = m_viewControl.GetSelectedItem();
- int iAction = message.GetParam1();
-
- if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
- {
- // If direct channel number input is active, select the entered channel.
- if (CServiceBroker::GetPVRManager().GUIActions()->GetChannelNumberInputHandler().CheckInputAndExecuteAction())
- return true;
-
- /* Switch to channel */
- GotoChannel(iItem);
- return true;
- }
- else if (iAction == ACTION_SHOW_INFO || iAction == ACTION_MOUSE_RIGHT_CLICK)
- {
- /* Show information Dialog */
- ShowInfo(iItem);
- return true;
- }
- }
- }
- break;
case GUI_MSG_REFRESH_LIST:
{
switch(message.GetParam1())
@@ -129,6 +103,25 @@ bool CGUIDialogPVRChannelsOSD::OnAction(const CAction &action)
{
switch (action.GetID())
{
+ case ACTION_SELECT_ITEM:
+ case ACTION_MOUSE_LEFT_CLICK:
+ {
+ // If direct channel number input is active, select the entered channel.
+ if (CServiceBroker::GetPVRManager().GUIActions()->GetChannelNumberInputHandler().CheckInputAndExecuteAction())
+ return true;
+
+ /* Switch to channel */
+ GotoChannel(m_viewControl.GetSelectedItem());
+ return true;
+ }
+ case ACTION_SHOW_INFO:
+ ShowInfo(m_viewControl.GetSelectedItem());
+ return true;
+
+ case ACTION_CONTEXT_MENU:
+ case ACTION_MOUSE_RIGHT_CLICK:
+ return OnContextMenu(m_viewControl.GetSelectedItem());
+
case ACTION_PREVIOUS_CHANNELGROUP:
case ACTION_NEXT_CHANNELGROUP:
{
@@ -156,7 +149,7 @@ bool CGUIDialogPVRChannelsOSD::OnAction(const CAction &action)
case REMOTE_8:
case REMOTE_9:
{
- AppendChannelNumberCharacter((action.GetID() - REMOTE_0) +'0');
+ AppendChannelNumberCharacter((action.GetID() - REMOTE_0) + '0');
return true;
}
case ACTION_CHANNEL_NUMBER_SEP:
@@ -257,6 +250,46 @@ void CGUIDialogPVRChannelsOSD::ShowInfo(int item)
CServiceBroker::GetPVRManager().GUIActions()->ShowEPGInfo(m_vecItems->Get(item));
}
+bool CGUIDialogPVRChannelsOSD::OnContextMenu(int itemIdx)
+{
+ auto InRange = [](size_t i, std::pair<size_t, size_t> range){ return i >= range.first && i < range.second; };
+
+ if (itemIdx < 0 || itemIdx >= m_vecItems->Size())
+ return false;
+
+ const CFileItemPtr item = m_vecItems->Get(itemIdx);
+ if (!item)
+ return false;
+
+ CContextButtons buttons;
+
+ // Add the global menu
+ const ContextMenuView globalMenu = CServiceBroker::GetContextMenuManager().GetItems(*item, CContextMenuManager::MAIN);
+ auto globalMenuRange = std::make_pair(buttons.size(), buttons.size() + globalMenu.size());
+ for (const auto& menu : globalMenu)
+ buttons.emplace_back(~buttons.size(), menu->GetLabel(*item));
+
+ // Add addon menus
+ const ContextMenuView addonMenu = CServiceBroker::GetContextMenuManager().GetAddonItems(*item, CContextMenuManager::MAIN);
+ auto addonMenuRange = std::make_pair(buttons.size(), buttons.size() + addonMenu.size());
+ for (const auto& menu : addonMenu)
+ buttons.emplace_back(~buttons.size(), menu->GetLabel(*item));
+
+ if (buttons.empty())
+ return true;
+
+ int idx = CGUIDialogContextMenu::Show(buttons);
+ if (idx < 0 || idx >= static_cast<int>(buttons.size()))
+ return false;
+
+ Close();
+
+ if (InRange(idx, globalMenuRange))
+ return CONTEXTMENU::LoopFrom(*globalMenu[idx - globalMenuRange.first], item);
+
+ return CONTEXTMENU::LoopFrom(*addonMenu[idx - addonMenuRange.first], item);
+}
+
void CGUIDialogPVRChannelsOSD::OnWindowLoaded()
{
CGUIDialog::OnWindowLoaded();
diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h
index 959d5ced0e..1afb5fdd4e 100644
--- a/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h
+++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h
@@ -47,6 +47,7 @@ namespace PVR
private:
void GotoChannel(int iItem);
void ShowInfo(int item);
+ bool OnContextMenu(int iItem);
void Clear();
void Update();
void SaveSelectedItemPath(int iGroupID);