Debian Codegraph @

xbmc/peripherals/dialogs/GUIDialogPeripherals.h

raw
1 /*
2 * Copyright (C) 2017-2024 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 "FileItem.h"
12 #include "dialogs/GUIDialogSelect.h"
13 #include "threads/CriticalSection.h"
14 #include "utils/Observer.h"
15
16 namespace PERIPHERALS
17 {
18 class CPeripherals;
19
20 /*!
21 * \ingroup peripherals
22 */
23 class CGUIDialogPeripherals : public CGUIDialogSelect, protected Observer
24 {
25 public:
26 CGUIDialogPeripherals();
27 ~CGUIDialogPeripherals() override;
28
29 void RegisterPeripheralManager(CPeripherals& manager);
30 void UnregisterPeripheralManager();
31
32 CFileItemPtr GetItem(unsigned int pos) const;
33
34 static void Show(CPeripherals& manager);
35
36 // implementation of CGUIControl via CGUIDialogSelect
37 bool OnMessage(CGUIMessage& message) override;
38 void FreeResources(bool immediately = false) override;
39
40 // implementation of Observer
41 void Notify(const Observable& obs, const ObservableMessage msg) override;
42
43 private:
44 // implementation of CGUIWindow via CGUIDialogSelect
45 void OnInitWindow() override;
46
47 void UpdatePeripheralsAsync();
48 void UpdatePeripheralsSync();
49
50 CPeripherals* m_manager = nullptr;
51 CFileItemList m_peripherals;
52 mutable CCriticalSection m_peripheralsMutex;
53 };
54 } // namespace PERIPHERALS