kodi
PVRGUIInfo.h
1 /*
2  * Copyright (C) 2012-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channels.h"
12 #include "guilib/guiinfo/GUIInfoProvider.h"
13 #include "pvr/addons/PVRClients.h"
14 #include "pvr/guilib/guiinfo/PVRGUITimerInfo.h"
15 #include "pvr/guilib/guiinfo/PVRGUITimesInfo.h"
16 #include "threads/CriticalSection.h"
17 #include "threads/Thread.h"
18 
19 #include <atomic>
20 #include <string>
21 #include <vector>
22 
23 class CFileItem;
24 
25 namespace KODI
26 {
27 namespace GUILIB
28 {
29 namespace GUIINFO
30 {
31 class CGUIInfo;
32 }
33 } // namespace GUILIB
34 } // namespace KODI
35 
36 namespace PVR
37 {
38 enum class PVREvent;
39 struct PVRChannelNumberInputChangedEvent;
40 struct PVRPreviewAndPlayerShowInfoChangedEvent;
41 
43 {
44 public:
45  CPVRGUIInfo();
46  ~CPVRGUIInfo() override = default;
47 
48  void Start();
49  void Stop();
50 
55  void Notify(const PVREvent& event);
56 
61  void Notify(const PVRChannelNumberInputChangedEvent& event);
62 
67  void Notify(const PVRPreviewAndPlayerShowInfoChangedEvent& event);
68 
69  // KODI::GUILIB::GUIINFO::IGUIInfoProvider implementation
70  bool InitCurrentItem(CFileItem* item) override;
71  bool GetLabel(std::string& value,
72  const CFileItem* item,
73  int contextWindow,
75  std::string* fallback) const override;
76  bool GetFallbackLabel(std::string& value,
77  const CFileItem* item,
78  int contextWindow,
80  std::string* fallback) override;
81  bool GetInt(int& value,
82  const CGUIListItem* item,
83  int contextWindow,
84  const KODI::GUILIB::GUIINFO::CGUIInfo& info) const override;
85  bool GetBool(bool& value,
86  const CGUIListItem* item,
87  int contextWindow,
88  const KODI::GUILIB::GUIINFO::CGUIInfo& info) const override;
89 
90 private:
91  void ResetProperties();
92  void ClearQualityInfo(PVR_SIGNAL_STATUS& qualityInfo);
93  void ClearDescrambleInfo(PVR_DESCRAMBLE_INFO& descrambleInfo);
94 
95  void Process() override;
96 
97  void UpdateTimersCache();
98  void UpdateBackendCache();
99  void UpdateQualityData();
100  void UpdateDescrambleData();
101  void UpdateMisc();
102  void UpdateNextTimer();
103  void UpdateTimeshiftData();
104  void UpdateTimeshiftProgressData();
105 
106  void UpdateTimersToggle();
107 
108  bool GetListItemAndPlayerLabel(const CFileItem* item,
110  std::string& strValue) const;
111  bool GetPVRLabel(const CFileItem* item,
113  std::string& strValue) const;
114  bool GetRadioRDSLabel(const CFileItem* item,
116  std::string& strValue) const;
117 
118  bool GetListItemAndPlayerInt(const CFileItem* item,
120  int& iValue) const;
121  bool GetPVRInt(const CFileItem* item,
123  int& iValue) const;
124  int GetTimeShiftSeekPercent() const;
125 
126  bool GetListItemAndPlayerBool(const CFileItem* item,
128  bool& bValue) const;
129  bool GetPVRBool(const CFileItem* item,
131  bool& bValue) const;
132  bool GetRadioRDSBool(const CFileItem* item,
134  bool& bValue) const;
135 
136  void CharInfoBackendNumber(std::string& strValue) const;
137  void CharInfoTotalDiskSpace(std::string& strValue) const;
138  void CharInfoSignal(std::string& strValue) const;
139  void CharInfoSNR(std::string& strValue) const;
140  void CharInfoBER(std::string& strValue) const;
141  void CharInfoUNC(std::string& strValue) const;
142  void CharInfoFrontendName(std::string& strValue) const;
143  void CharInfoFrontendStatus(std::string& strValue) const;
144  void CharInfoBackendName(std::string& strValue) const;
145  void CharInfoBackendVersion(std::string& strValue) const;
146  void CharInfoBackendHost(std::string& strValue) const;
147  void CharInfoBackendDiskspace(std::string& strValue) const;
148  void CharInfoBackendProviders(std::string& strValue) const;
149  void CharInfoBackendChannelGroups(std::string& strValue) const;
150  void CharInfoBackendChannels(std::string& strValue) const;
151  void CharInfoBackendTimers(std::string& strValue) const;
152  void CharInfoBackendRecordings(std::string& strValue) const;
153  void CharInfoBackendDeletedRecordings(std::string& strValue) const;
154  void CharInfoPlayingClientName(std::string& strValue) const;
155  void CharInfoEncryption(std::string& strValue) const;
156  void CharInfoService(std::string& strValue) const;
157  void CharInfoMux(std::string& strValue) const;
158  void CharInfoProvider(std::string& strValue) const;
159 
162  CPVRGUIAnyTimerInfo m_anyTimersInfo; // tv + radio
163  CPVRGUITVTimerInfo m_tvTimersInfo;
164  CPVRGUIRadioTimerInfo m_radioTimersInfo;
165 
166  CPVRGUITimesInfo m_timesInfo;
167 
168  bool m_bHasTVRecordings;
169  bool m_bHasRadioRecordings;
170  unsigned int m_iCurrentActiveClient;
171  std::string m_strPlayingClientName;
172  std::string m_strBackendName;
173  std::string m_strBackendVersion;
174  std::string m_strBackendHost;
175  std::string m_strBackendTimers;
176  std::string m_strBackendRecordings;
177  std::string m_strBackendDeletedRecordings;
178  std::string m_strBackendProviders;
179  std::string m_strBackendChannelGroups;
180  std::string m_strBackendChannels;
181  long long m_iBackendDiskTotal;
182  long long m_iBackendDiskUsed;
183  bool m_bIsPlayingTV;
184  bool m_bIsPlayingRadio;
185  bool m_bIsPlayingRecording;
186  bool m_bIsPlayingEpgTag;
187  bool m_bIsPlayingEncryptedStream;
188  bool m_bHasTVChannels;
189  bool m_bHasRadioChannels;
190  bool m_bCanRecordPlayingChannel;
191  bool m_bIsRecordingPlayingChannel;
192  bool m_bIsPlayingActiveRecording;
193  std::string m_strPlayingTVGroup;
194  std::string m_strPlayingRadioGroup;
195 
197 
198  PVR_SIGNAL_STATUS m_qualityInfo;
199  PVR_DESCRAMBLE_INFO m_descrambleInfo;
200  std::vector<SBackend> m_backendProperties;
201 
202  std::string m_channelNumberInput;
203  bool m_previewAndPlayerShowInfo{false};
204 
205  mutable CCriticalSection m_critSection;
206 
213  mutable std::atomic<bool> m_updateBackendCacheRequested;
214 
215  bool m_bRegistered;
216 };
217 } // namespace PVR
Definition: PVRGUITimerInfo.h:99
Definition: GUIListItem.h:29
Definition: Thread.h:44
Definition: PVRGUITimerInfo.h:87
"C" PVR add-on descramble information.
Definition: pvr_channels.h:91
Definition: ContextMenuManager.h:24
Definition: GUIInfoProvider.h:23
Definition: PVRGUIChannelNavigator.h:35
Definition: AudioDecoder.h:18
Definition: PVRChannelNumberInputHandler.h:21
Definition: PVRGUITimesInfo.h:21
"C" PVR add-on signal status information.
Definition: pvr_channels.h:63
Definition: PVRGUITimerInfo.h:75
Definition: GUIInfo.h:23
Definition: PVRGUIInfo.h:42
Represents a file on a share.
Definition: FileItem.h:102