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 "threads/CriticalSection.h"
12 #include "threads/SystemClock.h"
13 #include "windows/GUIMediaWindow.h"
19 #define CONTROL_BTNVIEWASICONS 2
20 #define CONTROL_BTNSORTBY 3
21 #define CONTROL_BTNSORTASC 4
22 #define CONTROL_BTNGROUPITEMS 5
23 #define CONTROL_BTNSHOWHIDDEN 6
24 #define CONTROL_BTNSHOWDELETED 7
25 #define CONTROL_BTNHIDEDISABLEDTIMERS 8
26 #define CONTROL_BTNSHOWMODE 10
27 #define CONTROL_LSTCHANNELGROUPS 11
29 #define CONTROL_BTNCHANNELGROUPS 28
30 #define CONTROL_BTNFILTERCHANNELS 31
32 #define CONTROL_LABEL_HEADER1 29
33 #define CONTROL_LABEL_HEADER2 30
35 class CGUIDialogProgressBarHandle
;
43 EPG_SELECT_ACTION_CONTEXT_MENU
= 0,
44 EPG_SELECT_ACTION_SWITCH
= 1,
45 EPG_SELECT_ACTION_INFO
= 2,
46 EPG_SELECT_ACTION_RECORD
= 3,
47 EPG_SELECT_ACTION_PLAY_RECORDING
= 4,
48 EPG_SELECT_ACTION_SMART_SELECT
= 5
51 class CPVRChannelGroup
;
52 class CGUIPVRChannelGroupsSelector
;
54 class CGUIWindowPVRBase
: public CGUIMediaWindow
57 ~CGUIWindowPVRBase() override
;
59 void OnInitWindow() override
;
60 void OnDeinitWindow(int nextWindowID
) override
;
61 bool OnMessage(CGUIMessage
& message
) override
;
62 bool Update(const std::string
& strDirectory
, bool updateFilterPath
= true) override
;
63 void UpdateButtons() override
;
64 bool OnAction(const CAction
& action
) override
;
65 void SetInvalid() override
;
66 bool CanBeActivated() const override
;
68 bool UseFileDirectories() override
{ return false; }
71 * @brief CEventStream callback for PVR events.
72 * @param event The event.
74 void Notify(const PVREvent
& event
);
75 virtual void NotifyEvent(const PVREvent
& event
);
78 * @brief Refresh window content.
79 * @return true, if refresh succeeded, false otherwise.
81 bool DoRefresh() { return Refresh(true); }
83 bool ActivatePreviousChannelGroup();
84 bool ActivateNextChannelGroup();
85 bool OpenChannelGroupSelectionDialog();
88 CGUIWindowPVRBase(bool bRadio
, int id
, const std::string
& xmlFile
);
90 virtual std::string
GetDirectoryPath() = 0;
92 virtual void ClearData();
95 * @brief Init this window's channel group with the currently active (the "playing") channel group.
96 * @return true if group could be set, false otherwise.
98 bool InitChannelGroup();
101 * @brief Get the channel group for this window.
102 * @return the group or null, if no group set.
104 std::shared_ptr
<CPVRChannelGroup
> GetChannelGroup();
107 * @brief Set a new channel group, start listening to this group, optionally update window content.
108 * @param group The new group.
109 * @param bUpdate if true, window content will be updated.
111 void SetChannelGroup(std::shared_ptr
<CPVRChannelGroup
> &&group
, bool bUpdate
= true);
113 virtual void UpdateSelectedItemPath();
115 CCriticalSection m_critSection
;
116 std::string m_channelGroupPath
;
118 std::atomic_bool m_bUpdating
= {false};
122 * @brief Show or update the progress dialog.
123 * @param strText The current status.
124 * @param iProgress The current progress in %.
126 void ShowProgressDialog(const std::string
& strText
, int iProgress
);
129 * @brief Hide the progress dialog if it's visible.
131 void HideProgressDialog();
133 std::unique_ptr
<CGUIPVRChannelGroupsSelector
> m_channelGroupsSelector
;
134 std::shared_ptr
<CPVRChannelGroup
> m_channelGroup
;
135 XbmcThreads::EndTime
<> m_refreshTimeout
;
136 CGUIDialogProgressBarHandle
* m_progressHandle
=
137 nullptr; /*!< progress dialog that is displayed while the pvr manager is loading */