kodi
PVRGUIActionsChannels.h
1 /*
2  * Copyright (C) 2016-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 "pvr/IPVRComponent.h"
12 #include "pvr/PVRChannelNumberInputHandler.h"
13 #include "pvr/guilib/PVRGUIChannelNavigator.h"
14 #include "pvr/settings/PVRSettings.h"
15 #include "threads/CriticalSection.h"
16 
17 #include <memory>
18 #include <string>
19 #include <vector>
20 
21 class CFileItem;
22 
23 namespace PVR
24 {
25 class CPVRChannel;
26 class CPVRChannelGroupMember;
27 
29 {
30 public:
31  // CPVRChannelNumberInputHandler implementation
32  void GetChannelNumbers(std::vector<std::string>& channelNumbers) override;
33  void AppendChannelNumberCharacter(char cCharacter) override;
34  void OnInputDone() override;
35 
36 private:
41  void SwitchToChannel(const CPVRChannelNumber& channelNumber);
42 
46  void SwitchToPreviousChannel();
47 };
48 
50 {
51 public:
53  ~CPVRGUIActionsChannels() override;
54 
60 
65  void RegisterChannelNumberInputHandler(CPVRChannelNumberInputHandler* handler);
66 
71  void DeregisterChannelNumberInputHandler(CPVRChannelNumberInputHandler* handler);
72 
77  void Notify(const PVRChannelNumberInputChangedEvent& event);
78 
84  bool HideChannel(const CFileItem& item) const;
85 
90  bool StartChannelScan();
91 
97  bool StartChannelScan(int clientId);
98 
102  bool IsRunningChannelScan() const { return m_bChannelScanRunning; }
103 
110  std::shared_ptr<CPVRChannelGroupMember> GetChannelGroupMember(
111  const std::shared_ptr<const CPVRChannel>& channel) const;
112 
119  std::shared_ptr<CPVRChannelGroupMember> GetChannelGroupMember(const CFileItem& item) const;
120 
125  CPVRChannelNumberInputHandler& GetChannelNumberInputHandler();
126 
131  CPVRGUIChannelNavigator& GetChannelNavigator();
132 
137  void OnPlaybackStarted(const CFileItem& item);
138 
143  void OnPlaybackStopped(const CFileItem& item);
144 
151  std::string GetSelectedChannelPath(bool bRadio) const;
152 
159  void SetSelectedChannelPath(bool bRadio, const std::string& path);
160 
161 private:
163  CPVRGUIActionsChannels const& operator=(CPVRGUIActionsChannels const&) = delete;
164 
165  CPVRChannelSwitchingInputHandler m_channelNumberInputHandler;
166  bool m_bChannelScanRunning{false};
167  CPVRGUIChannelNavigator m_channelNavigator;
169 
170  mutable CCriticalSection m_critSection;
171  CPVRSettings m_settings;
172  std::string m_selectedChannelPathTV;
173  std::string m_selectedChannelPathRadio;
174 };
175 
176 namespace GUI
177 {
178 // pretty scope and name
179 using Channels = CPVRGUIActionsChannels;
180 } // namespace GUI
181 
182 } // namespace PVR
Definition: PVRGUIActionsChannels.h:28
Definition: PVRGUIChannelNavigator.h:48
void OnInputDone() override
This method gets called after the channel number input timer has expired.
Definition: PVRGUIActionsChannels.cpp:74
Definition: ContextMenuManager.h:24
Definition: EventStream.h:65
Definition: PVRChannelNumberInputHandler.h:29
void GetChannelNumbers(std::vector< std::string > &channelNumbers) override
Get the currently available channel numbers.
Definition: PVRGUIActionsChannels.cpp:60
CEventStream< PVRChannelNumberInputChangedEvent > & Events()
Get the events available for CEventStream.
Definition: PVRGUIActionsChannels.h:59
void AppendChannelNumberCharacter(char cCharacter) override
Appends a channel number character.
Definition: PVRGUIActionsChannels.cpp:48
bool IsRunningChannelScan() const
Definition: PVRGUIActionsChannels.h:102
Definition: IPVRComponent.h:13
Definition: PVRChannelNumberInputHandler.h:21
Definition: PVRChannelNumber.h:15
Definition: PVRGUIActionsChannels.h:49
Definition: PVRSettings.h:27
Represents a file on a share.
Definition: FileItem.h:102
Definition: EventStream.h:22