summaryrefslogtreecommitdiffstats
path: root/xbmc/pvr/guilib/guiinfo/PVRGUITimerInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/pvr/guilib/guiinfo/PVRGUITimerInfo.h')
-rw-r--r--xbmc/pvr/guilib/guiinfo/PVRGUITimerInfo.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/xbmc/pvr/guilib/guiinfo/PVRGUITimerInfo.h b/xbmc/pvr/guilib/guiinfo/PVRGUITimerInfo.h
new file mode 100644
index 0000000..260db6c
--- /dev/null
+++ b/xbmc/pvr/guilib/guiinfo/PVRGUITimerInfo.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "threads/CriticalSection.h"
+
+#include <chrono>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace PVR
+{
+ class CPVRTimerInfoTag;
+
+ class CPVRGUITimerInfo
+ {
+ public:
+ CPVRGUITimerInfo();
+ virtual ~CPVRGUITimerInfo() = default;
+
+ void ResetProperties();
+
+ void UpdateTimersCache();
+ void UpdateTimersToggle();
+ void UpdateNextTimer();
+
+ const std::string& GetActiveTimerTitle() const;
+ const std::string& GetActiveTimerChannelName() const;
+ const std::string& GetActiveTimerChannelIcon() const;
+ const std::string& GetActiveTimerDateTime() const;
+ const std::string& GetNextTimerTitle() const;
+ const std::string& GetNextTimerChannelName() const;
+ const std::string& GetNextTimerChannelIcon() const;
+ const std::string& GetNextTimerDateTime() const;
+ const std::string& GetNextTimer() const;
+
+ bool HasTimers() const { return m_iTimerAmount > 0; }
+ bool HasRecordingTimers() const { return m_iRecordingTimerAmount > 0; }
+ bool HasNonRecordingTimers() const { return m_iTimerAmount - m_iRecordingTimerAmount > 0; }
+
+ private:
+ bool TimerInfoToggle();
+
+ virtual int AmountActiveTimers() = 0;
+ virtual int AmountActiveRecordings() = 0;
+ virtual std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() = 0;
+ virtual std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() = 0;
+
+ unsigned int m_iTimerAmount;
+ unsigned int m_iRecordingTimerAmount;
+
+ std::string m_strActiveTimerTitle;
+ std::string m_strActiveTimerChannelName;
+ std::string m_strActiveTimerChannelIcon;
+ std::string m_strActiveTimerTime;
+ std::string m_strNextRecordingTitle;
+ std::string m_strNextRecordingChannelName;
+ std::string m_strNextRecordingChannelIcon;
+ std::string m_strNextRecordingTime;
+ std::string m_strNextTimerInfo;
+
+ std::chrono::time_point<std::chrono::steady_clock> m_iTimerInfoToggleStart;
+ unsigned int m_iTimerInfoToggleCurrent;
+
+ mutable CCriticalSection m_critSection;
+ };
+
+ class CPVRGUIAnyTimerInfo : public CPVRGUITimerInfo
+ {
+ public:
+ CPVRGUIAnyTimerInfo() = default;
+
+ private:
+ int AmountActiveTimers() override;
+ int AmountActiveRecordings() override;
+ std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() override;
+ std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() override;
+ };
+
+ class CPVRGUITVTimerInfo : public CPVRGUITimerInfo
+ {
+ public:
+ CPVRGUITVTimerInfo() = default;
+
+ private:
+ int AmountActiveTimers() override;
+ int AmountActiveRecordings() override;
+ std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() override;
+ std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() override;
+ };
+
+ class CPVRGUIRadioTimerInfo : public CPVRGUITimerInfo
+ {
+ public:
+ CPVRGUIRadioTimerInfo() = default;
+
+ private:
+ int AmountActiveTimers() override;
+ int AmountActiveRecordings() override;
+ std::vector<std::shared_ptr<CPVRTimerInfoTag>> GetActiveRecordings() override;
+ std::shared_ptr<CPVRTimerInfoTag> GetNextActiveTimer() override;
+ };
+
+} // namespace PVR