aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxhaggi <sascha.woo@gmail.com>2015-01-19 14:05:16 +0100
committerxhaggi <sascha.woo@gmail.com>2015-01-20 12:51:22 +0100
commit25d42079f3687f81e2cedee7d0044309a76820a4 (patch)
tree3ca8303270880d3842528b5ba7b1f71894f6b6fe
parentd91fccf9f2c1ee168986634cd78d7aae314cb6d7 (diff)
[pvr] refactor CPVRManager:OnAction out to PVRActionListener
-rw-r--r--xbmc/Application.cpp4
-rw-r--r--xbmc/pvr/PVRActionListener.cpp25
-rw-r--r--xbmc/pvr/PVRManager.cpp36
-rw-r--r--xbmc/pvr/PVRManager.h7
4 files changed, 28 insertions, 44 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 86bcd8474d..95b24a62b0 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -2700,10 +2700,6 @@ bool CApplication::OnAction(const CAction &action)
return true;
}
- // forward action to g_PVRManager and break if it was able to handle it
- if (g_PVRManager.OnAction(action))
- return true;
-
// forward action to graphic context and see if it can handle it
if (CStereoscopicsManager::Get().OnAction(action))
return true;
diff --git a/xbmc/pvr/PVRActionListener.cpp b/xbmc/pvr/PVRActionListener.cpp
index 8d051fb785..df6af56ddd 100644
--- a/xbmc/pvr/PVRActionListener.cpp
+++ b/xbmc/pvr/PVRActionListener.cpp
@@ -27,6 +27,7 @@
#include "guilib/LocalizeStrings.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogNumeric.h"
+#include "dialogs/GUIDialogKaiToast.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
#include "utils/log.h"
@@ -51,6 +52,30 @@ bool CPVRActionListener::OnAction(const CAction &action)
{
switch (action.GetID())
{
+ case ACTION_PVR_PLAY:
+ case ACTION_PVR_PLAY_TV:
+ case ACTION_PVR_PLAY_RADIO:
+ {
+ // see if we're already playing a PVR stream and if not or the stream type
+ // doesn't match the demanded type, start playback of according type
+ bool isPlayingPvr(g_PVRManager.IsPlaying() && g_application.CurrentFileItem().HasPVRChannelInfoTag());
+ switch (action.GetID())
+ {
+ case ACTION_PVR_PLAY:
+ if (!isPlayingPvr)
+ g_PVRManager.StartPlayback(PlaybackTypeAny);
+ break;
+ case ACTION_PVR_PLAY_TV:
+ if (!isPlayingPvr || g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
+ g_PVRManager.StartPlayback(PlaybackTypeTv);
+ break;
+ case ACTION_PVR_PLAY_RADIO:
+ if (!isPlayingPvr || !g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
+ g_PVRManager.StartPlayback(PlaybackTypeRadio);
+ break;
+ }
+ return true;
+ }
case REMOTE_0:
case REMOTE_1:
case REMOTE_2:
diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp
index 3ecb3d4ce9..0f22fba993 100644
--- a/xbmc/pvr/PVRManager.cpp
+++ b/xbmc/pvr/PVRManager.cpp
@@ -1558,42 +1558,6 @@ void CPVRManager::ExecutePendingJobs(void)
m_triggerEvent.Reset();
}
-bool CPVRManager::OnAction(const CAction &action)
-{
- // process PVR specific play actions
- if (action.GetID() == ACTION_PVR_PLAY || action.GetID() == ACTION_PVR_PLAY_TV || action.GetID() == ACTION_PVR_PLAY_RADIO)
- {
- // pvr not active yet, show error message
- if (!IsStarted())
- {
- CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(19045), g_localizeStrings.Get(19044));
- }
- else
- {
- // see if we're already playing a PVR stream and if not or the stream type
- // doesn't match the demanded type, start playback of according type
- bool isPlayingPvr(IsPlaying() && g_application.CurrentFileItem().HasPVRChannelInfoTag());
- switch (action.GetID())
- {
- case ACTION_PVR_PLAY:
- if (!isPlayingPvr)
- StartPlayback(PlaybackTypeAny);
- break;
- case ACTION_PVR_PLAY_TV:
- if (!isPlayingPvr || g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
- StartPlayback(PlaybackTypeTv);
- break;
- case ACTION_PVR_PLAY_RADIO:
- if (!isPlayingPvr || !g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
- StartPlayback(PlaybackTypeRadio);
- break;
- }
- }
- return true;
- }
- return false;
-}
-
bool CPVRChannelSwitchJob::DoWork(void)
{
// announce OnStop and delete m_previous when done
diff --git a/xbmc/pvr/PVRManager.h b/xbmc/pvr/PVRManager.h
index fdd1df77f6..b50f5d7a42 100644
--- a/xbmc/pvr/PVRManager.h
+++ b/xbmc/pvr/PVRManager.h
@@ -544,11 +544,10 @@ namespace PVR
bool SetWakeupCommand(void);
/*!
- * @brief Handle PVR specific cActions
- * @param action The action to process
- * @return True if action could be handled, false otherwise.
+ * @brief Wait until the pvr manager is loaded
+ * @return True when loaded, false otherwise
*/
- bool OnAction(const CAction &action);
+ bool WaitUntilInitialised(void);
/*!
* @brief Create EPG tags for all channels in internal channel groups