aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Woo <sascha.woo@gmail.com>2014-05-07 10:03:37 +0200
committerSascha Woo <sascha.woo@gmail.com>2014-05-07 10:03:37 +0200
commit619880f5ce65c10b7c40ea872c4fd07b090a7b5d (patch)
treee971db15ca6affe937b8055bc8048e27b98826a0
parent1a2cf73ab10e0546283c2dd2127024a19347eed8 (diff)
parentd26a659caba0afdd538f512dbf788539ab88cee6 (diff)
Merge pull request #4646 from xhaggi/channel-selection
[pvr] numeric input to select a channel within pvr views
-rwxr-xr-xlanguage/English/strings.po6
-rw-r--r--xbmc/epg/GUIEPGGridContainer.cpp27
-rw-r--r--xbmc/epg/GUIEPGGridContainer.h1
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRChannels.cpp20
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRChannels.h1
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRCommon.cpp32
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRCommon.h1
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRGuide.cpp21
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRGuide.h1
9 files changed, 104 insertions, 6 deletions
diff --git a/language/English/strings.po b/language/English/strings.po
index 58e811bc9e..e4fd35ce86 100755
--- a/language/English/strings.po
+++ b/language/English/strings.po
@@ -7726,7 +7726,11 @@ msgctxt "#19102"
msgid "Please switch to another channel."
msgstr ""
-#empty string with id 19103
+#. Title of numeric dialog for choosing a channel by entering a number
+#: xbmc/pvr/windows/GUIWindowPVRCommon.cpp
+msgctxt "#19103"
+msgid "Go to channel"
+msgstr ""
msgctxt "#19104"
msgid "Enter the name of the folder for the recording"
diff --git a/xbmc/epg/GUIEPGGridContainer.cpp b/xbmc/epg/GUIEPGGridContainer.cpp
index bc5c68bd87..c7fbffd176 100644
--- a/xbmc/epg/GUIEPGGridContainer.cpp
+++ b/xbmc/epg/GUIEPGGridContainer.cpp
@@ -1069,8 +1069,7 @@ void CGUIEPGGridContainer::SetChannel(const CStdString &channel)
}
}
- if (iChannelIndex >= 0)
- ScrollToChannelOffset(iChannelIndex);
+ SetSelectedChannel(iChannelIndex);
}
void CGUIEPGGridContainer::SetChannel(const CPVRChannel &channel)
@@ -1086,8 +1085,7 @@ void CGUIEPGGridContainer::SetChannel(const CPVRChannel &channel)
}
}
- if (iChannelIndex >= 0)
- ScrollToChannelOffset(iChannelIndex);
+ SetSelectedChannel(iChannelIndex);
}
void CGUIEPGGridContainer::SetChannel(int channel)
@@ -1266,6 +1264,27 @@ bool CGUIEPGGridContainer::OnMouseWheel(char wheel, const CPoint &point)
return true;
}
+void CGUIEPGGridContainer::SetSelectedChannel(int channelIndex)
+{
+ if (channelIndex < 0)
+ return;
+
+ if (channelIndex - m_channelOffset < m_channelsPerPage && channelIndex - m_channelOffset >= 0)
+ {
+ SetChannel(channelIndex - m_channelOffset);
+ }
+ else if(channelIndex < m_channels - m_channelsPerPage)
+ {
+ ScrollToChannelOffset(channelIndex - m_channelsPerPage + 1);
+ SetChannel(m_channelsPerPage - 1);
+ }
+ else
+ {
+ ScrollToChannelOffset(m_channels - m_channelsPerPage);
+ SetChannel(channelIndex - (m_channels - m_channelsPerPage));
+ }
+}
+
int CGUIEPGGridContainer::GetSelectedItem() const
{
if (m_gridIndex.empty() ||
diff --git a/xbmc/epg/GUIEPGGridContainer.h b/xbmc/epg/GUIEPGGridContainer.h
index 8ae80e3def..1d3eacc48c 100644
--- a/xbmc/epg/GUIEPGGridContainer.h
+++ b/xbmc/epg/GUIEPGGridContainer.h
@@ -65,6 +65,7 @@ namespace EPG
const int GetNumChannels() { return m_channels; };
virtual int GetSelectedItem() const;
const int GetSelectedChannel() { return m_channelCursor + m_channelOffset; }
+ void SetSelectedChannel(int channelIndex);
virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
index 41d5e7ecff..74ba3c6186 100644
--- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
@@ -264,6 +264,26 @@ void CGUIWindowPVRChannels::UpdateData(bool bUpdateSelectedFile /* = true */)
m_parent->SetLabel(CONTROL_LABELGROUP, currentGroup->GroupName());
}
+bool CGUIWindowPVRChannels::OnAction(const CAction &action)
+{
+ switch (action.GetID())
+ {
+ case REMOTE_0:
+ case REMOTE_1:
+ case REMOTE_2:
+ case REMOTE_3:
+ case REMOTE_4:
+ case REMOTE_5:
+ case REMOTE_6:
+ case REMOTE_7:
+ case REMOTE_8:
+ case REMOTE_9:
+ return ActionInputChannelNumber(action.GetID() - REMOTE_0);
+ }
+
+ return false;
+}
+
bool CGUIWindowPVRChannels::OnClickButton(CGUIMessage &message)
{
bool bReturn = false;
diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.h b/xbmc/pvr/windows/GUIWindowPVRChannels.h
index 3f9a982f48..fe61c20808 100644
--- a/xbmc/pvr/windows/GUIWindowPVRChannels.h
+++ b/xbmc/pvr/windows/GUIWindowPVRChannels.h
@@ -45,6 +45,7 @@ namespace PVR
void Notify(const Observable &obs, const ObservableMessage msg);
void ResetObservers(void);
void UnregisterObservers(void);
+ bool OnAction(const CAction &action);
private:
bool OnClickButton(CGUIMessage &message);
diff --git a/xbmc/pvr/windows/GUIWindowPVRCommon.cpp b/xbmc/pvr/windows/GUIWindowPVRCommon.cpp
index 6b356537e8..483b4da31b 100644
--- a/xbmc/pvr/windows/GUIWindowPVRCommon.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRCommon.cpp
@@ -22,6 +22,7 @@
#include "Application.h"
#include "ApplicationMessenger.h"
+#include "dialogs/GUIDialogNumeric.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogYesNo.h"
@@ -566,6 +567,36 @@ bool CGUIWindowPVRCommon::ActionDeleteChannel(CFileItem *item)
return true;
}
+bool CGUIWindowPVRCommon::ActionInputChannelNumber(int input, bool bGuideGrid)
+{
+ CStdString strInput = StringUtils::Format("%i", input);
+ if (CGUIDialogNumeric::ShowAndGetNumber(strInput, g_localizeStrings.Get(19103)))
+ {
+ int iChannelNumber = atoi(strInput.c_str());
+ if (iChannelNumber > 0)
+ {
+ int itemIndex = 0;
+ VECFILEITEMS items = m_parent->m_vecItems->GetList();
+ for(VECFILEITEMS::iterator it = items.begin(); it != items.end(); ++it)
+ {
+ if(((*it)->HasPVRChannelInfoTag() && (*it)->GetPVRChannelInfoTag()->ChannelNumber() == iChannelNumber) ||
+ ((*it)->HasEPGInfoTag() && (*it)->GetEPGInfoTag()->HasPVRChannel() && (*it)->GetEPGInfoTag()->PVRChannelNumber() == iChannelNumber))
+ {
+ // different handling for guide grid
+ if (bGuideGrid && m_parent->m_guideGrid)
+ m_parent->m_guideGrid->SetChannel((*(*it)->GetEPGInfoTag()->ChannelTag()));
+ else
+ m_parent->m_viewControl.SetSelectedItem(itemIndex);
+ return true;
+ }
+ itemIndex++;
+ }
+ }
+ }
+
+ return false;
+}
+
bool CGUIWindowPVRCommon::UpdateEpgForChannel(CFileItem *item)
{
CPVRChannel *channel = item->GetPVRChannelInfoTag();
@@ -602,7 +633,6 @@ bool CGUIWindowPVRCommon::ShowTimerSettings(CFileItem *item)
return pDlgInfo->GetOK();
}
-
bool CGUIWindowPVRCommon::PlayRecording(CFileItem *item, bool bPlayMinimized /* = false */)
{
if (!item->HasPVRRecordingInfoTag())
diff --git a/xbmc/pvr/windows/GUIWindowPVRCommon.h b/xbmc/pvr/windows/GUIWindowPVRCommon.h
index 7320c56f94..05d4228192 100644
--- a/xbmc/pvr/windows/GUIWindowPVRCommon.h
+++ b/xbmc/pvr/windows/GUIWindowPVRCommon.h
@@ -117,6 +117,7 @@ namespace PVR
virtual bool ActionPlayChannel(CFileItem *item);
virtual bool ActionPlayEpg(CFileItem *item);
virtual bool ActionDeleteChannel(CFileItem *item);
+ virtual bool ActionInputChannelNumber(int input, bool bGuideGrid = false);
virtual bool PlayRecording(CFileItem *item, bool bPlayMinimized = false);
virtual bool PlayFile(CFileItem *item, bool bPlayMinimized = false);
diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
index b8c2063ba0..16677d441e 100644
--- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
@@ -120,6 +120,27 @@ void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &butt
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
}
+bool CGUIWindowPVRGuide::OnAction(const CAction &action)
+{
+ switch (action.GetID())
+ {
+ case REMOTE_0:
+ case REMOTE_1:
+ case REMOTE_2:
+ case REMOTE_3:
+ case REMOTE_4:
+ case REMOTE_5:
+ case REMOTE_6:
+ case REMOTE_7:
+ case REMOTE_8:
+ case REMOTE_9:
+ if (m_iGuideView != GUIDE_VIEW_CHANNEL)
+ return ActionInputChannelNumber(action.GetID() - REMOTE_0, (m_iGuideView == GUIDE_VIEW_TIMELINE));
+ break;
+ }
+
+ return false;
+}
bool CGUIWindowPVRGuide::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.h b/xbmc/pvr/windows/GUIWindowPVRGuide.h
index 988ef06b73..afc0951acf 100644
--- a/xbmc/pvr/windows/GUIWindowPVRGuide.h
+++ b/xbmc/pvr/windows/GUIWindowPVRGuide.h
@@ -48,6 +48,7 @@ namespace PVR
CGUIWindowPVRGuide(CGUIWindowPVR *parent);
virtual ~CGUIWindowPVRGuide(void);
+ bool OnAction(const CAction &action);
void GetContextButtons(int itemNumber, CContextButtons &buttons) const;
bool OnContextButton(int itemNumber, CONTEXT_BUTTON button);
void UpdateData(bool bUpdateSelectedFile = true);