kodi
GUIWindowPVRSearch.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 "dialogs/GUIDialogContextMenu.h"
12 #include "pvr/dialogs/GUIDialogPVRGuideSearch.h"
13 #include "pvr/windows/GUIWindowPVRBase.h"
14 
15 #include <memory>
16 #include <string>
17 
18 class CFileItem;
19 
20 namespace PVR
21 {
22 class CPVREpgSearchFilter;
23 
25 {
26 public:
27  CGUIWindowPVRSearchBase(bool bRadio, int id, const std::string& xmlFile);
28  ~CGUIWindowPVRSearchBase() override;
29 
30  bool OnAction(const CAction& action) override;
31  bool OnMessage(CGUIMessage& message) override;
32  void GetContextButtons(int itemNumber, CContextButtons& buttons) override;
33  bool OnContextButton(int itemNumber, CONTEXT_BUTTON button) override;
34  bool Update(const std::string& strDirectory, bool updateFilterPath = true) override;
35  void UpdateButtons() override;
36 
41  void SetItemToSearch(const CFileItem& item);
42 
48  CGUIDialogPVRGuideSearch::Result OpenDialogSearch(const CFileItem& item);
49 
50 protected:
51  void OnPrepareFileItems(CFileItemList& items) override;
52 
53 private:
54  bool OnContextButtonClear(CFileItem* item, CONTEXT_BUTTON button);
55 
56  CGUIDialogPVRGuideSearch::Result OpenDialogSearch(
57  const std::shared_ptr<CPVREpgSearchFilter>& searchFilter);
58 
59  void ExecuteSearch();
60 
61  void SetSearchFilter(const std::shared_ptr<CPVREpgSearchFilter>& searchFilter);
62 
63  bool m_bSearchConfirmed = false;
64  std::shared_ptr<CPVREpgSearchFilter> m_searchfilter;
65 };
66 
68 {
69 public:
70  CGUIWindowPVRTVSearch() : CGUIWindowPVRSearchBase(false, WINDOW_TV_SEARCH, "MyPVRSearch.xml") {}
71 
72 protected:
73  std::string GetRootPath() const override;
74  std::string GetStartFolder(const std::string& dir) override;
75  std::string GetDirectoryPath() override;
76 };
77 
79 {
80 public:
81  CGUIWindowPVRRadioSearch() : CGUIWindowPVRSearchBase(true, WINDOW_RADIO_SEARCH, "MyPVRSearch.xml")
82  {
83  }
84 
85 protected:
86  std::string GetRootPath() const override;
87  std::string GetStartFolder(const std::string& dir) override;
88  std::string GetDirectoryPath() override;
89 };
90 } // namespace PVR
Definition: GUIWindowPVRBase.h:54
Definition: ContextMenuManager.h:24
Definition: GUIWindowPVRSearch.h:78
Represents a list of files.
Definition: FileItem.h:702
void OnPrepareFileItems(CFileItemList &items) override
On prepare file items.
Definition: GUIWindowPVRSearch.cpp:155
Definition: GUIWindowPVRSearch.h:24
Class encapsulating information regarding a particular user action to be sent to windows and controls...
Definition: Action.h:21
void UpdateButtons() override
Updates the states.
Definition: GUIWindowPVRSearch.cpp:358
Definition: GUIMessage.h:365
virtual std::string GetStartFolder(const std::string &url)
Translate the folder to start in from the given quick path.
Definition: GUIMediaWindow.cpp:2168
bool Update(const std::string &strDirectory, bool updateFilterPath=true) override
Retrieves the items from the given path and updates the list.
Definition: GUIWindowPVRSearch.cpp:335
Definition: GUIDialogContextMenu.h:93
Definition: GUIWindowPVRSearch.h:67
CGUIDialogPVRGuideSearch::Result OpenDialogSearch(const CFileItem &item)
Open the search dialog for the given search filter item.
Definition: GUIWindowPVRSearch.cpp:407
Represents a file on a share.
Definition: FileItem.h:102
void SetItemToSearch(const CFileItem &item)
set the item to search similar events for.
Definition: GUIWindowPVRSearch.cpp:132