summaryrefslogtreecommitdiffstats
path: root/xbmc/pvr/dialogs/GUIDialogPVRChannelsOSD.h
blob: c23fb9211ad8ce21e8148aaf6dc3f9b7562e0cee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 *  Copyright (C) 2012-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "pvr/PVRChannelNumberInputHandler.h"
#include "pvr/dialogs/GUIDialogPVRItemsViewBase.h"
#include "threads/SystemClock.h"

#include <map>
#include <memory>
#include <string>

namespace PVR
{
enum class PVREvent;

class CPVRChannelGroup;

class CGUIDialogPVRChannelsOSD : public CGUIDialogPVRItemsViewBase,
                                 public CPVRChannelNumberInputHandler
{
public:
  CGUIDialogPVRChannelsOSD();
  ~CGUIDialogPVRChannelsOSD() override;
  bool OnMessage(CGUIMessage& message) override;
  bool OnAction(const CAction& action) override;

  /*!
   * @brief CEventStream callback for PVR events.
   * @param event The event.
   */
  void Notify(const PVREvent& event);

  // CPVRChannelNumberInputHandler implementation
  void GetChannelNumbers(std::vector<std::string>& channelNumbers) override;
  void OnInputDone() override;

protected:
  void OnInitWindow() override;
  void OnDeinitWindow(int nextWindowID) override;
  void RestoreControlStates() override;
  void SaveControlStates() override;
  void SetInvalid() override;

private:
  void GotoChannel(int iItem);
  void Update();
  void SaveSelectedItemPath(int iGroupID);
  std::string GetLastSelectedItemPath(int iGroupID) const;

  std::shared_ptr<CPVRChannelGroup> m_group;
  std::map<int, std::string> m_groupSelectedItemPaths;
  XbmcThreads::EndTime<> m_refreshTimeout;
};
} // namespace PVR