[video] fix selection after changing video or extra art
[xbmc.git] / xbmc / pvr / guilib / guiinfo / PVRGUITimerInfo.h
blob260db6ccd3b411f0bc29aaf53ac8eed42cf516f8
1 /*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "threads/CriticalSection.h"
13 #include <chrono>
14 #include <memory>
15 #include <string>
16 #include <vector>
18 namespace PVR
20 class CPVRTimerInfoTag;
22 class CPVRGUITimerInfo
24 public:
25 CPVRGUITimerInfo();
26 virtual ~CPVRGUITimerInfo() = default;
28 void ResetProperties();
30 void UpdateTimersCache();
31 void UpdateTimersToggle();
32 void UpdateNextTimer();
34 const std::string& GetActiveTimerTitle() const;
35 const std::string& GetActiveTimerChannelName() const;
36 const std::string& GetActiveTimerChannelIcon() const;
37 const std::string& GetActiveTimerDateTime() const;
38 const std::string& GetNextTimerTitle() const;
39 const std::string& GetNextTimerChannelName() const;
40 const std::string& GetNextTimerChannelIcon() const;
41 const std::string& GetNextTimerDateTime() const;
42 const std::string& GetNextTimer() const;
44 bool HasTimers() const { return m_iTimerAmount > 0; }
45 bool HasRecordingTimers() const { return m_iRecordingTimerAmount > 0; }
46 bool HasNonRecordingTimers() const { return m_iTimerAmount - m_iRecordingTimerAmount > 0; }
48 private:
49 bool TimerInfoToggle();
51 virtual int AmountActiveTimers() = 0;
52 virtual int AmountActiveRecordings() = 0;
53 virtual std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() = 0;
54 virtual std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() = 0;
56 unsigned int m_iTimerAmount;
57 unsigned int m_iRecordingTimerAmount;
59 std::string m_strActiveTimerTitle;
60 std::string m_strActiveTimerChannelName;
61 std::string m_strActiveTimerChannelIcon;
62 std::string m_strActiveTimerTime;
63 std::string m_strNextRecordingTitle;
64 std::string m_strNextRecordingChannelName;
65 std::string m_strNextRecordingChannelIcon;
66 std::string m_strNextRecordingTime;
67 std::string m_strNextTimerInfo;
69 std::chrono::time_point<std::chrono::steady_clock> m_iTimerInfoToggleStart;
70 unsigned int m_iTimerInfoToggleCurrent;
72 mutable CCriticalSection m_critSection;
75 class CPVRGUIAnyTimerInfo : public CPVRGUITimerInfo
77 public:
78 CPVRGUIAnyTimerInfo() = default;
80 private:
81 int AmountActiveTimers() override;
82 int AmountActiveRecordings() override;
83 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() override;
84 std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() override;
87 class CPVRGUITVTimerInfo : public CPVRGUITimerInfo
89 public:
90 CPVRGUITVTimerInfo() = default;
92 private:
93 int AmountActiveTimers() override;
94 int AmountActiveRecordings() override;
95 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() override;
96 std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() override;
99 class CPVRGUIRadioTimerInfo : public CPVRGUITimerInfo
101 public:
102 CPVRGUIRadioTimerInfo() = default;
104 private:
105 int AmountActiveTimers() override;
106 int AmountActiveRecordings() override;
107 std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() override;
108 std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() override;
111 } // namespace PVR