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 "pvr/PVRChannelNumberInputHandler.h"
12 #include "pvr/windows/GUIWindowPVRBase.h"
13 #include "threads/Event.h"
14 #include "threads/Thread.h"
27 class CPVRChannelGroup
;
28 class CGUIEPGGridContainer
;
29 class CPVRRefreshTimelineItemsThread
;
31 class CGUIWindowPVRGuideBase
: public CGUIWindowPVRBase
, public CPVRChannelNumberInputHandler
34 CGUIWindowPVRGuideBase(bool bRadio
, int id
, const std::string
& xmlFile
);
35 ~CGUIWindowPVRGuideBase() override
;
37 void OnInitWindow() override
;
38 void OnDeinitWindow(int nextWindowID
) override
;
39 bool OnMessage(CGUIMessage
& message
) override
;
40 bool OnAction(const CAction
& action
) override
;
41 void GetContextButtons(int itemNumber
, CContextButtons
& buttons
) override
;
42 bool OnContextButton(int itemNumber
, CONTEXT_BUTTON button
) override
;
43 void UpdateButtons() override
;
44 void SetInvalid() override
;
45 bool Update(const std::string
& strDirectory
, bool updateFilterPath
= true) override
;
47 void NotifyEvent(const PVREvent
& event
) override
;
49 bool RefreshTimelineItems();
51 // CPVRChannelNumberInputHandler implementation
52 void GetChannelNumbers(std::vector
<std::string
>& channelNumbers
) override
;
53 void OnInputDone() override
;
57 bool GotoCurrentProgramme();
58 bool GotoDate(int deltaHours
);
59 bool OpenDateSelectionDialog();
61 bool Go12HoursForward();
62 bool GotoFirstChannel();
63 bool GotoLastChannel();
64 bool GotoPlayingChannel();
67 void UpdateSelectedItemPath() override
;
68 std::string
GetDirectoryPath() override
{ return ""; }
69 bool GetDirectory(const std::string
& strDirectory
, CFileItemList
& items
) override
;
70 void FormatAndSort(CFileItemList
& items
) override
;
71 CFileItemPtr
GetCurrentListItem(int offset
= 0) override
;
73 void ClearData() override
;
76 CGUIEPGGridContainer
* GetGridControl();
77 void InitEpgGridControl();
79 bool OnContextButtonNavigate(CONTEXT_BUTTON button
);
81 bool ShouldNavigateToGridContainer(int iAction
);
83 void StartRefreshTimelineItemsThread();
84 void StopRefreshTimelineItemsThread();
86 void RefreshView(CGUIMessage
& message
, bool bInitGridControl
);
88 int GetCurrentListItemIndex(const std::shared_ptr
<const CFileItem
>& item
);
90 std::unique_ptr
<CPVRRefreshTimelineItemsThread
> m_refreshTimelineItemsThread
;
91 std::atomic_bool m_bRefreshTimelineItems
{false};
92 std::atomic_bool m_bSyncRefreshTimelineItems
{false};
94 std::shared_ptr
<CPVRChannelGroup
> m_cachedChannelGroup
;
96 bool m_bChannelSelectionRestored
{false};
99 class CGUIWindowPVRTVGuide
: public CGUIWindowPVRGuideBase
102 CGUIWindowPVRTVGuide() : CGUIWindowPVRGuideBase(false, WINDOW_TV_GUIDE
, "MyPVRGuide.xml") {}
103 std::string
GetRootPath() const override
;
106 class CGUIWindowPVRRadioGuide
: public CGUIWindowPVRGuideBase
109 CGUIWindowPVRRadioGuide() : CGUIWindowPVRGuideBase(true, WINDOW_RADIO_GUIDE
, "MyPVRGuide.xml") {}
110 std::string
GetRootPath() const override
;
113 class CPVRRefreshTimelineItemsThread
: public CThread
116 explicit CPVRRefreshTimelineItemsThread(CGUIWindowPVRGuideBase
* pGuideWindow
);
117 ~CPVRRefreshTimelineItemsThread() override
;
119 void Process() override
;
121 void DoRefresh(bool bWait
);
125 CGUIWindowPVRGuideBase
* m_pGuideWindow
;