xbmc
DialogGameSaves.h
1 /*
2  * Copyright (C) 2020-2021 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 "guilib/GUIDialog.h"
12 
13 #include <memory>
14 #include <string>
15 
16 class CFileItem;
17 class CFileItemList;
18 class CGUIMessage;
19 class CGUIViewControl;
20 
21 namespace KODI
22 {
23 namespace GAME
24 {
26 {
27 public:
29  ~CDialogGameSaves() override = default;
30 
31  // implementation of CGUIControl via CGUIDialog
32  bool OnMessage(CGUIMessage& message) override;
33 
34  // implementation of CGUIWindow via CGUIDialog
35  void FrameMove() override;
36 
37  // Player interface
38  void Reset();
39  bool Open(const std::string& gamePath);
40  bool IsConfirmed() const { return m_bConfirmed; }
41  bool IsNewPressed() const { return m_bNewPressed; }
42  std::string GetSelectedItemPath();
43 
44 protected:
45  // implementation of CGUIWIndow via CGUIDialog
46  void OnInitWindow() override;
47  void OnDeinitWindow(int nextWindowID) override;
48  void OnWindowLoaded() override;
49  void OnWindowUnload() override;
50 
51 private:
52  using CGUIControl::OnFocus;
53 
57  void SetItems(const CFileItemList& itemList);
58 
62  void OnSelect(const CFileItem& item);
63 
67  void OnFocus(const CFileItem& item);
68 
72  void OnFocusLost();
73 
77  void OnContextMenu(CFileItem& item);
78 
82  void OnRename(CFileItem& item);
83 
87  void OnDelete(CFileItem& item);
88 
92  void HandleCaption(const std::string& caption);
93 
97  void HandleGameClient(const std::string& gameClientId);
98 
99  // Dialog parameters
100  std::unique_ptr<CGUIViewControl> m_viewControl;
101  std::unique_ptr<CFileItemList> m_vecList;
102  std::shared_ptr<CFileItem> m_selectedItem;
103 
104  // Player parameters
105  bool m_bConfirmed{false};
106  bool m_bNewPressed{false};
107 
108  // State parameters
109  std::string m_currentCaption;
110  std::string m_currentGameClient;
111 };
112 } // namespace GAME
113 } // namespace KODI
void OnInitWindow() override
Called on window open.
Definition: DialogGameSaves.cpp:206
Definition: GUIViewControl.h:19
void FrameMove() override
Main update function, called every frame prior to rendering Any window that requires updating on a fr...
Definition: DialogGameSaves.cpp:182
Definition: DialogGameSaves.h:25
Represents a list of files.
Definition: FileItem.h:713
Definition: GUIDialog.h:35
Controller configuration window.
Definition: AudioDecoder.h:18
Definition: GUIMessage.h:365
Represents a file on a share.
Definition: FileItem.h:102