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.
11 #include "XBDateTime.h"
12 #include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_channels.h" // PVR_CHANNEL_INVALID_UID
13 #include "settings/SettingConditions.h"
14 #include "settings/dialogs/GUIDialogSettingsManualBase.h"
15 #include "settings/lib/SettingDependency.h"
24 struct IntegerSettingOption
;
28 class CPVRTimerInfoTag
;
31 class CGUIDialogPVRTimerSettings
: public CGUIDialogSettingsManualBase
34 CGUIDialogPVRTimerSettings();
35 ~CGUIDialogPVRTimerSettings() override
;
37 bool CanBeActivated() const override
;
39 void SetTimer(const std::shared_ptr
<CPVRTimerInfoTag
>& timer
);
42 // implementation of ISettingCallback
43 void OnSettingChanged(const std::shared_ptr
<const CSetting
>& setting
) override
;
44 void OnSettingAction(const std::shared_ptr
<const CSetting
>& setting
) override
;
46 // specialization of CGUIDialogSettingsBase
47 bool AllowResettingSettings() const override
{ return false; }
49 void SetupView() override
;
51 // specialization of CGUIDialogSettingsManualBase
52 void InitializeSettings() override
;
56 void InitializeTypesList();
57 void InitializeChannelsList();
58 void SetButtonLabels();
60 static int GetDateAsIndex(const CDateTime
& datetime
);
61 static void SetDateFromIndex(CDateTime
& datetime
, int date
);
62 static void SetTimeFromSystemTime(CDateTime
& datetime
, const KODI::TIME::SystemTime
& time
);
64 static int GetWeekdaysFromSetting(const std::shared_ptr
<const CSetting
>& setting
);
66 static void TypesFiller(const std::shared_ptr
<const CSetting
>& setting
,
67 std::vector
<IntegerSettingOption
>& list
,
70 static void ChannelsFiller(const std::shared_ptr
<const CSetting
>& setting
,
71 std::vector
<IntegerSettingOption
>& list
,
74 static void DaysFiller(const std::shared_ptr
<const CSetting
>& setting
,
75 std::vector
<IntegerSettingOption
>& list
,
78 static void DupEpisodesFiller(const std::shared_ptr
<const CSetting
>& setting
,
79 std::vector
<IntegerSettingOption
>& list
,
82 static void WeekdaysFiller(const std::shared_ptr
<const CSetting
>& setting
,
83 std::vector
<IntegerSettingOption
>& list
,
86 static void PrioritiesFiller(const std::shared_ptr
<const CSetting
>& setting
,
87 std::vector
<IntegerSettingOption
>& list
,
90 static void LifetimesFiller(const std::shared_ptr
<const CSetting
>& setting
,
91 std::vector
<IntegerSettingOption
>& list
,
94 static void MaxRecordingsFiller(const std::shared_ptr
<const CSetting
>& setting
,
95 std::vector
<IntegerSettingOption
>& list
,
98 static void RecordingGroupFiller(const std::shared_ptr
<const CSetting
>& setting
,
99 std::vector
<IntegerSettingOption
>& list
,
102 static void MarginTimeFiller(const std::shared_ptr
<const CSetting
>& setting
,
103 std::vector
<IntegerSettingOption
>& list
,
107 static std::string
WeekdaysValueFormatter(const std::shared_ptr
<const CSetting
>& setting
);
109 void AddCondition(const std::shared_ptr
<CSetting
>& setting
,
110 const std::string
& identifier
,
111 SettingConditionCheck condition
,
112 SettingDependencyType depType
,
113 const std::string
& settingId
);
115 void AddTypeDependentEnableCondition(const std::shared_ptr
<CSetting
>& setting
,
116 const std::string
& identifier
);
117 static bool TypeReadOnlyCondition(const std::string
& condition
,
118 const std::string
& value
,
119 const std::shared_ptr
<const CSetting
>& setting
,
122 void AddTypeDependentVisibilityCondition(const std::shared_ptr
<CSetting
>& setting
,
123 const std::string
& identifier
);
124 static bool TypeSupportsCondition(const std::string
& condition
,
125 const std::string
& value
,
126 const std::shared_ptr
<const CSetting
>& setting
,
129 void AddStartAnytimeDependentVisibilityCondition(const std::shared_ptr
<CSetting
>& setting
,
130 const std::string
& identifier
);
131 static bool StartAnytimeSetCondition(const std::string
& condition
,
132 const std::string
& value
,
133 const std::shared_ptr
<const CSetting
>& setting
,
135 void AddEndAnytimeDependentVisibilityCondition(const std::shared_ptr
<CSetting
>& setting
,
136 const std::string
& identifier
);
137 static bool EndAnytimeSetCondition(const std::string
& condition
,
138 const std::string
& value
,
139 const std::shared_ptr
<const CSetting
>& setting
,
142 typedef std::map
<int, std::shared_ptr
<CPVRTimerType
>> TypeEntriesMap
;
144 typedef struct ChannelDescriptor
148 std::string description
;
150 ChannelDescriptor(int _channelUid
= PVR_CHANNEL_INVALID_UID
,
152 const std::string
& _description
= "")
153 : channelUid(_channelUid
), clientId(_clientId
), description(_description
)
157 inline bool operator==(const ChannelDescriptor
& right
) const
159 return (channelUid
== right
.channelUid
&& clientId
== right
.clientId
&&
160 description
== right
.description
);
165 typedef std::map
<int, ChannelDescriptor
> ChannelEntriesMap
;
167 std::shared_ptr
<CPVRTimerInfoTag
> m_timerInfoTag
;
168 TypeEntriesMap m_typeEntries
;
169 ChannelEntriesMap m_channelEntries
;
170 std::string m_timerStartTimeStr
;
171 std::string m_timerEndTimeStr
;
173 std::shared_ptr
<CPVRTimerType
> m_timerType
;
174 bool m_bIsRadio
= false;
175 bool m_bIsNewTimer
= true;
176 bool m_bTimerActive
= false;
177 std::string m_strTitle
;
178 std::string m_strEpgSearchString
;
179 bool m_bFullTextEpgSearch
= true;
180 ChannelDescriptor m_channel
;
181 CDateTime m_startLocalTime
;
182 CDateTime m_endLocalTime
;
183 bool m_bStartAnyTime
= false;
184 bool m_bEndAnyTime
= false;
185 unsigned int m_iWeekdays
;
186 CDateTime m_firstDayLocalTime
;
187 unsigned int m_iPreventDupEpisodes
= 0;
188 unsigned int m_iMarginStart
= 0;
189 unsigned int m_iMarginEnd
= 0;
192 int m_iMaxRecordings
= 0;
193 std::string m_strDirectory
;
194 unsigned int m_iRecordingGroup
= 0;