[gui] new gui info properties PVR.HasTVChannels and PVR.HasRadioChannels
authorxhaggi <sascha.woo@gmail.com>
Sat, 9 Nov 2013 22:41:54 +0000 (23:41 +0100)
committerxhaggi <sascha.woo@gmail.com>
Sun, 13 Jul 2014 12:28:35 +0000 (14:28 +0200)
xbmc/GUIInfoManager.cpp
xbmc/GUIInfoManager.h
xbmc/pvr/PVRGUIInfo.cpp
xbmc/pvr/PVRGUIInfo.h
xbmc/pvr/channels/PVRChannelGroup.cpp
xbmc/pvr/channels/PVRChannelGroup.h

index 97835bd..66a7437 100644 (file)
@@ -631,6 +631,8 @@ const infomap playlist[] =       {{ "length",           PLAYLIST_LENGTH },
 
 const infomap pvr[] =            {{ "isrecording",              PVR_IS_RECORDING },
                                   { "hastimer",                 PVR_HAS_TIMER },
+                                  { "hastvchannels",            PVR_HAS_TV_CHANNELS },
+                                  { "hasradiochannels",         PVR_HAS_RADIO_CHANNELS },
                                   { "hasnonrecordingtimer",     PVR_HAS_NONRECORDING_TIMER },
                                   { "nowrecordingtitle",        PVR_NOW_RECORDING_TITLE },
                                   { "nowrecordingdatetime",     PVR_NOW_RECORDING_DATETIME },
index 2529ead..b9867dd 100644 (file)
@@ -442,7 +442,9 @@ namespace INFO
 #define PVR_IS_PLAYING_RADIO        (PVR_CONDITIONS_START + 7)
 #define PVR_IS_PLAYING_RECORDING    (PVR_CONDITIONS_START + 8)
 #define PVR_ACTUAL_STREAM_ENCRYPTED (PVR_CONDITIONS_START + 9)
-#define PVR_CONDITIONS_END          PVR_ACTUAL_STREAM_ENCRYPTED
+#define PVR_HAS_TV_CHANNELS         (PVR_CONDITIONS_START + 10)
+#define PVR_HAS_RADIO_CHANNELS      (PVR_CONDITIONS_START + 11)
+#define PVR_CONDITIONS_END          PVR_HAS_RADIO_CHANNELS
 
 #define PVR_STRINGS_START           1200
 #define PVR_NEXT_RECORDING_CHANNEL  (PVR_STRINGS_START)
index c373b35..05a80c0 100644 (file)
@@ -30,6 +30,7 @@
 #include "pvr/timers/PVRTimers.h"
 #include "pvr/recordings/PVRRecordings.h"
 #include "pvr/channels/PVRChannel.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
 #include "epg/EpgInfoTag.h"
 #include "settings/AdvancedSettings.h"
 #include "settings/Settings.h"
@@ -256,6 +257,9 @@ void CPVRGUIInfo::UpdateMisc(void)
   bool       bIsPlayingRadio           = bStarted && g_PVRClients->IsPlayingRadio();
   bool       bIsPlayingRecording       = bStarted && g_PVRClients->IsPlayingRecording();
   bool       bIsPlayingEncryptedStream = bStarted && g_PVRClients->IsEncrypted();
+  bool       bHasTVChannels            = bStarted && g_PVRChannelGroups->GetGroupAllTV()->HasChannels();
+  bool       bHasRadioChannels         = bStarted && g_PVRChannelGroups->GetGroupAllRadio()->HasChannels();
+  
   /* safe to fetch these unlocked, since they're updated from the same thread as this one */
   bool       bHasNonRecordingTimers    = bStarted && m_iTimerAmount - m_iRecordingTimerAmount > 0;
 
@@ -267,6 +271,8 @@ void CPVRGUIInfo::UpdateMisc(void)
   m_bIsPlayingRadio           = bIsPlayingRadio;
   m_bIsPlayingRecording       = bIsPlayingRecording;
   m_bIsPlayingEncryptedStream = bIsPlayingEncryptedStream;
+  m_bHasTVChannels            = bHasTVChannels;
+  m_bHasRadioChannels         = bHasRadioChannels;
 }
 
 bool CPVRGUIInfo::TranslateCharInfo(DWORD dwInfo, CStdString &strValue) const
@@ -400,6 +406,12 @@ bool CPVRGUIInfo::TranslateBoolInfo(DWORD dwInfo) const
   case PVR_HAS_TIMER:
     bReturn = m_iTimerAmount > 0;
     break;
+  case PVR_HAS_TV_CHANNELS:
+    bReturn = m_bHasTVChannels;
+    break;
+  case PVR_HAS_RADIO_CHANNELS:
+    bReturn = m_bHasRadioChannels;
+    break;
   case PVR_HAS_NONRECORDING_TIMER:
     bReturn = m_bHasNonRecordingTimers;
     break;
index 34bc258..fc587e0 100644 (file)
@@ -160,6 +160,8 @@ namespace PVR
     bool                            m_bIsPlayingRadio;
     bool                            m_bIsPlayingRecording;
     bool                            m_bIsPlayingEncryptedStream;
+    bool                            m_bHasTVChannels;
+    bool                            m_bHasRadioChannels;
     //@}
 
     PVR_SIGNAL_STATUS               m_qualityInfo;       /*!< stream quality information */
index 1329912..58602d1 100644 (file)
@@ -1292,6 +1292,16 @@ bool CPVRChannelGroup::UpdateChannel(const CFileItem &item, bool bHidden, bool b
   return true;
 }
 
+int CPVRChannelGroup::GetNumChannels() const
+{
+  return m_members.size();
+}
+
+bool CPVRChannelGroup::HasChannels() const
+{
+  return !m_members.empty();
+}
+
 bool CPVRChannelGroup::ToggleChannelLocked(const CFileItem &item)
 {
   if (!item.HasPVRChannelInfoTag())
index c102c24..836670e 100644 (file)
@@ -332,6 +332,18 @@ namespace PVR
      * @return The amount of hidden channels in this container.
      */
     virtual int GetNumHiddenChannels(void) const { return 0; }
+    
+    /*!
+     * @brief The amount of channels in this container.
+     * @return The amount of channels in this container.
+     */
+    int GetNumChannels(void) const;
+
+    /*!
+     * @brief Does this container holds channels.
+     * @return True if there is at least one channel in this container, otherwise false.
+     */
+    bool HasChannels(void) const;
 
     /*!
      * @return True if there is at least one channel in this group with changes that haven't been persisted, false otherwise.