xbmc
GUIWindowPVRBase.h
1 /*
2  * Copyright (C) 2012-2018 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 "threads/CriticalSection.h"
12 #include "threads/SystemClock.h"
13 #include "windows/GUIMediaWindow.h"
14 
15 #include <atomic>
16 #include <memory>
17 #include <string>
18 
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
28 
29 #define CONTROL_BTNCHANNELGROUPS 28
30 #define CONTROL_BTNFILTERCHANNELS 31
31 
32 #define CONTROL_LABEL_HEADER1 29
33 #define CONTROL_LABEL_HEADER2 30
34 
36 
37 namespace PVR
38 {
39  enum class PVREvent;
40 
41  enum EPGSelectAction
42  {
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
49  };
50 
51  class CPVRChannelGroup;
52  class CGUIPVRChannelGroupsSelector;
53 
55  {
56  public:
57  ~CGUIWindowPVRBase() override;
58 
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;
67 
68  bool UseFileDirectories() override { return false; }
69 
74  void Notify(const PVREvent& event);
75  virtual void NotifyEvent(const PVREvent& event);
76 
81  bool DoRefresh() { return Refresh(true); }
82 
83  bool ActivatePreviousChannelGroup();
84  bool ActivateNextChannelGroup();
85  bool OpenChannelGroupSelectionDialog();
86 
87  protected:
88  CGUIWindowPVRBase(bool bRadio, int id, const std::string& xmlFile);
89 
90  virtual std::string GetDirectoryPath() = 0;
91 
92  virtual void ClearData();
93 
98  bool InitChannelGroup();
99 
104  std::shared_ptr<CPVRChannelGroup> GetChannelGroup();
105 
111  void SetChannelGroup(std::shared_ptr<CPVRChannelGroup> &&group, bool bUpdate = true);
112 
113  virtual void UpdateSelectedItemPath();
114 
115  void RegisterObservers();
116  void UnregisterObservers();
117 
118  CCriticalSection m_critSection;
119  std::string m_channelGroupPath;
120  bool m_bRadio;
121  std::atomic_bool m_bUpdating = {false};
122 
123  private:
129  void ShowProgressDialog(const std::string& strText, int iProgress);
130 
134  void HideProgressDialog();
135 
136  std::unique_ptr<CGUIPVRChannelGroupsSelector> m_channelGroupsSelector;
137  std::shared_ptr<CPVRChannelGroup> m_channelGroup;
138  XbmcThreads::EndTime<> m_refreshTimeout;
139  CGUIDialogProgressBarHandle* m_progressHandle;
140  };
141 }
Definition: GUIWindowPVRBase.h:54
std::shared_ptr< CPVRChannelGroup > GetChannelGroup()
Get the channel group for this window.
Definition: GUIWindowPVRBase.cpp:474
Definition: ContextMenuManager.h:24
Definition: SystemClock.h:31
void OnInitWindow() override
Called on window open.
Definition: GUIWindowPVRBase.cpp:266
class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:22
bool InitChannelGroup()
Init this window&#39;s channel group with the currently active (the "playing") channel group...
Definition: GUIWindowPVRBase.cpp:440
bool DoRefresh()
Refresh window content.
Definition: GUIWindowPVRBase.h:81
virtual bool Refresh(bool clearCache=false)
Refreshes the current list by retrieving the lists&#39;s path.
Definition: GUIMediaWindow.cpp:952
Definition: GUIMessage.h:365
Definition: SmartPlayList.cpp:137
void UpdateButtons() override
Updates the states.
Definition: GUIWindowPVRBase.cpp:547
Definition: GUIDialogExtendedProgressBar.h:16
void SetChannelGroup(std::shared_ptr< CPVRChannelGroup > &&group, bool bUpdate=true)
Set a new channel group, start listening to this group, optionally update window content.
Definition: GUIWindowPVRBase.cpp:480
Definition: GUIMediaWindow.h:28
bool Update(const std::string &strDirectory, bool updateFilterPath=true) override
Retrieves the items from the given path and updates the list.
Definition: GUIWindowPVRBase.cpp:507
void Notify(const PVREvent &event)
CEventStream callback for PVR events.
Definition: GUIWindowPVRBase.cpp:171