Debian Codegraph @

xbmc/pvr/guilib/PVRGUIActionsTimers.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2016-2022 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 "pvr/IPVRComponent.h"
12 #include "pvr/settings/PVRSettings.h"
13
14 #include <memory>
15
16 class CFileItem;
17
18 namespace PVR
19 {
20 class CPVRChannel;
21 class CPVRTimerInfoTag;
22
23 class CPVRGUIActionsTimers : public IPVRComponent
24 {
25 public:
26 CPVRGUIActionsTimers();
27 ~CPVRGUIActionsTimers() override = default;
28
29 /*!
30 * @brief Open the timer settings dialog to create a new tv or radio timer.
31 * @param bRadio indicates whether a radio or tv timer shall be created.
32 * @return true on success, false otherwise.
33 */
34 bool AddTimer(bool bRadio) const;
35
36 /*!
37 * @brief Create a new timer, either interactive or non-interactive.
38 * @param item containing epg data to create a timer for. item must be an epg tag or a channel.
39 * @param bShowTimerSettings is used to control whether a settings dialog will be opened prior
40 * creating the timer.
41 * @return true, if the timer was created successfully, false otherwise.
42 */
43 bool AddTimer(const CFileItem& item, bool bShowTimerSettings) const;
44
45 /*!
46 * @brief Add a timer to the client. Doesn't add the timer to the container. The backend will
47 * do this.
48 * @return True if it was sent correctly, false if not.
49 */
50 bool AddTimer(const std::shared_ptr<CPVRTimerInfoTag>& item) const;
51
52 /*!
53 * @brief Create a new timer rule, either interactive or non-interactive.
54 * @param item containing epg data to create a timer rule for. item must be an epg tag or a
55 * channel.
56 * @param bShowTimerSettings is used to control whether a settings dialog will be opened prior
57 * creating the timer rule.
58 * @param bFallbackToOneShotTimer if no timer rule can be created, try to create a one-shot
59 * timer instead.
60 * @return true, if the timer rule was created successfully, false otherwise.
61 */
62 bool AddTimerRule(const CFileItem& item,
63 bool bShowTimerSettings,
64 bool bFallbackToOneShotTimer) const;
65
66 /*!
67 * @brief Creates or deletes a timer for the given epg tag.
68 * @param item containing an epg tag.
69 * @return true on success, false otherwise.
70 */
71 bool ToggleTimer(const CFileItem& item) const;
72
73 /*!
74 * @brief Toggles a given timer's enabled/disabled state.
75 * @param item containing a timer.
76 * @return true on success, false otherwise.
77 */
78 bool ToggleTimerState(const CFileItem& item) const;
79
80 /*!
81 * @brief Open the timer settings dialog to edit an existing timer.
82 * @param item containing an epg tag or a timer.
83 * @return true on success, false otherwise.
84 */
85 bool EditTimer(const CFileItem& item) const;
86
87 /*!
88 * @brief Open the timer settings dialog to edit an existing timer rule.
89 * @param item containing an epg tag or a timer.
90 * @return true on success, false otherwise.
91 */
92 bool EditTimerRule(const CFileItem& item) const;
93
94 /*!
95 * @brief Get the timer rule for a given timer
96 * @param item containing an item to query the timer rule for. item must be a timer or an epg tag.
97 * @return The timer rule item, or nullptr if none was found.
98 */
99 std::shared_ptr<CFileItem> GetTimerRule(const CFileItem& item) const;
100
101 /*!
102 * @brief Delete a timer, always showing a confirmation dialog.
103 * @param item containing a timer to delete. item must be a timer, an epg tag or a channel.
104 * @return true, if the timer was deleted successfully, false otherwise.
105 */
106 bool DeleteTimer(const CFileItem& item) const;
107
108 /*!
109 * @brief Delete a timer rule, always showing a confirmation dialog.
110 * @param item containing a timer rule to delete. item must be a timer, an epg tag or a channel.
111 * @return true, if the timer rule was deleted successfully, false otherwise.
112 */
113 bool DeleteTimerRule(const CFileItem& item) const;
114
115 /*!
116 * @brief Toggle recording on the currently playing channel, if any.
117 * @return True if the recording was started or stopped successfully, false otherwise.
118 */
119 bool ToggleRecordingOnPlayingChannel();
120
121 /*!
122 * @brief Start or stop recording on a given channel.
123 * @param channel the channel to start/stop recording.
124 * @param bOnOff True to start recording, false to stop.
125 * @return True if the recording was started or stopped successfully, false otherwise.
126 */
127 bool SetRecordingOnChannel(const std::shared_ptr<CPVRChannel>& channel, bool bOnOff);
128
129 /*!
130 * @brief Stop a currently active recording, always showing a confirmation dialog.
131 * @param item containing a recording to stop. item must be a timer, an epg tag or a channel.
132 * @return true, if the recording was stopped successfully, false otherwise.
133 */
134 bool StopRecording(const CFileItem& item) const;
135
136 /*!
137 * @brief Create a new reminder timer, non-interactive.
138 * @param item containing epg data to create a reminder timer for. item must be an epg tag.
139 * @return true, if the timer was created successfully, false otherwise.
140 */
141 bool AddReminder(const CFileItem& item) const;
142
143 /*!
144 * @brief Announce due reminders, if any.
145 */
146 void AnnounceReminders() const;
147
148 private:
149 CPVRGUIActionsTimers(const CPVRGUIActionsTimers&) = delete;
150 CPVRGUIActionsTimers const& operator=(CPVRGUIActionsTimers const&) = delete;
151
152 /*!
153 * @brief Open the timer settings dialog.
154 * @param timer containing the timer the settings shall be displayed for.
155 * @return true, if the dialog was ended successfully, false otherwise.
156 */
157 bool ShowTimerSettings(const std::shared_ptr<CPVRTimerInfoTag>& timer) const;
158
159 /*!
160 * @brief Add a timer or timer rule, either interactive or non-interactive.
161 * @param item containing epg data to create a timer or timer rule for. item must be an epg tag
162 * or a channel.
163 * @param bCreateteRule denotes whether to create a one-shot timer or a timer rule.
164 * @param bShowTimerSettings is used to control whether a settings dialog will be opened prior
165 * creating the timer or timer rule.
166 * @param bFallbackToOneShotTimer if bCreateteRule is true and no timer rule can be created, try
167 * to create a one-shot timer instead.
168 * @return true, if the timer or timer rule was created successfully, false otherwise.
169 */
170 bool AddTimer(const CFileItem& item,
171 bool bCreateRule,
172 bool bShowTimerSettings,
173 bool bFallbackToOneShotTimer) const;
174
175 /*!
176 * @brief Delete a timer or timer rule, always showing a confirmation dialog.
177 * @param item containing a timer or timer rule to delete. item must be a timer, an epg tag or
178 * a channel.
179 * @param bIsRecording denotes whether the timer is currently recording (controls correct
180 * confirmation dialog).
181 * @param bDeleteRule denotes to delete a timer rule. For convenience, one can pass a timer
182 * created by a rule.
183 * @return true, if the timer or timer rule was deleted successfully, false otherwise.
184 */
185 bool DeleteTimer(const CFileItem& item, bool bIsRecording, bool bDeleteRule) const;
186
187 /*!
188 * @brief Delete a timer or timer rule, showing a confirmation dialog in case a timer currently
189 * recording shall be deleted.
190 * @param timer containing a timer or timer rule to delete.
191 * @param bIsRecording denotes whether the timer is currently recording (controls correct
192 * confirmation dialog).
193 * @param bDeleteRule denotes to delete a timer rule. For convenience, one can pass a timer
194 * created by a rule.
195 * @return true, if the timer or timer rule was deleted successfully, false otherwise.
196 */
197 bool DeleteTimer(const std::shared_ptr<CPVRTimerInfoTag>& timer,
198 bool bIsRecording,
199 bool bDeleteRule) const;
200
201 /*!
202 * @brief Open a dialog to confirm timer delete.
203 * @param timer the timer to delete.
204 * @param bDeleteRule in: ignored. out, for one shot timer scheduled by a timer rule: true to
205 * also delete the timer rule that has scheduled this timer, false to only delete the one shot
206 * timer. out, for one shot timer not scheduled by a timer rule: ignored
207 * @return true, to proceed with delete, false otherwise.
208 */
209 bool ConfirmDeleteTimer(const std::shared_ptr<const CPVRTimerInfoTag>& timer,
210 bool& bDeleteRule) const;
211
212 /*!
213 * @brief Open a dialog to confirm stop recording.
214 * @param timer the recording to stop (actually the timer to delete).
215 * @return true, to proceed with delete, false otherwise.
216 */
217 bool ConfirmStopRecording(const std::shared_ptr<const CPVRTimerInfoTag>& timer) const;
218
219 /*!
220 * @brief Announce and process a reminder timer.
221 * @param timer The reminder timer.
222 */
223 void AnnounceReminder(const std::shared_ptr<CPVRTimerInfoTag>& timer) const;
224
225 CPVRSettings m_settings;
226 mutable bool m_bReminderAnnouncementRunning{false};
227 };
228
229 namespace GUI
230 {
231 // pretty scope and name
232 using Timers = CPVRGUIActionsTimers;
233 } // namespace GUI
234
235 } // namespace PVR