Debian Codegraph @

xbmc/guilib/guiinfo/GUIInfoProviders.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2005-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 "guilib/guiinfo/AddonsGUIInfo.h"
12 #include "guilib/guiinfo/GUIControlsGUIInfo.h"
13 #include "guilib/guiinfo/GamesGUIInfo.h"
14 #include "guilib/guiinfo/LibraryGUIInfo.h"
15 #include "guilib/guiinfo/MusicGUIInfo.h"
16 #include "guilib/guiinfo/PicturesGUIInfo.h"
17 #include "guilib/guiinfo/PlayerGUIInfo.h"
18 #include "guilib/guiinfo/SkinGUIInfo.h"
19 #include "guilib/guiinfo/SystemGUIInfo.h"
20 #include "guilib/guiinfo/VideoGUIInfo.h"
21 #include "guilib/guiinfo/VisualisationGUIInfo.h"
22 #include "guilib/guiinfo/WeatherGUIInfo.h"
23
24 #include <string>
25 #include <vector>
26
27 class CFileItem;
28 class CGUIListItem;
29
30 struct AudioStreamInfo;
31 struct VideoStreamInfo;
32
33 namespace KODI
34 {
35 namespace GUILIB
36 {
37 namespace GUIINFO
38 {
39
40 class CGUIInfo;
41 class IGUIInfoProvider;
42
43 class CGUIInfoProviders
44 {
45 public:
46 CGUIInfoProviders();
47 virtual ~CGUIInfoProviders();
48
49 /*!
50 * @brief Register a guiinfo provider.
51 * @param provider The provider to register.
52 * @param bAppend True to append to the list of providers, false to insert before the first provider
53 */
54 void RegisterProvider(IGUIInfoProvider *provider, bool bAppend = true);
55
56 /*!
57 * @brief Unregister a guiinfo provider.
58 * @param provider The provider to unregister.
59 */
60 void UnregisterProvider(IGUIInfoProvider *provider);
61
62 /*!
63 * @brief Init a new current guiinfo manager item. Gets called whenever the active guiinfo manager item changes.
64 * @param item The new item.
65 * @return True if the item was inited by one of the providers, false otherwise.
66 */
67 bool InitCurrentItem(CFileItem *item);
68
69 /*!
70 * @brief Get a GUIInfoManager label string from one of the registered providers.
71 * @param value Will be filled with the requested value.
72 * @param item The item to get the value for. Can be nullptr.
73 * @param contextWindow The context window. Can be 0.
74 * @param info The GUI info (label id + additional data).
75 * @param fallback A fallback value. Can be nullptr.
76 * @return True if the value was filled successfully by one of the providers, false otherwise.
77 */
78 bool GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const;
79
80 /*!
81 * @brief Get a GUIInfoManager integer value from one of the registered providers.
82 * @param value Will be filled with the requested value.
83 * @param item The item to get the value for. Can be nullptr.
84 * @param contextWindow The context window. Can be 0.
85 * @param info The GUI info (label id + additional data).
86 * @return True if the value was filled successfully by one of the providers, false otherwise.
87 */
88 bool GetInt(int& value, const CGUIListItem *item, int contextWindow, const CGUIInfo &info) const;
89
90 /*!
91 * @brief Get a GUIInfoManager bool value from one of the registered providers.
92 * @param value Will be filled with the requested value.
93 * @param item The item to get the value for. Can be nullptr.
94 * @param contextWindow The context window. Can be 0.
95 * @param info The GUI info (label id + additional data).
96 * @return True if the value was filled successfully by one of the providers, false otherwise.
97 */
98 bool GetBool(bool& value, const CGUIListItem *item, int contextWindow, const CGUIInfo &info) const;
99
100 /*!
101 * @brief Set new audio/video/subtitle stream info data at all registered providers.
102 * @param audioInfo New audio stream info.
103 * @param videoInfo New video stream info.
104 * @param subtitleInfo New subtitle stream info.
105 */
106 void UpdateAVInfo(const AudioStreamInfo& audioInfo, const VideoStreamInfo& videoInfo, const SubtitleStreamInfo& subtitleInfo);
107
108 /*!
109 * @brief Get the player guiinfo provider.
110 * @return The player guiinfo provider.
111 */
112 CPlayerGUIInfo& GetPlayerInfoProvider() { return m_playerGUIInfo; }
113
114 /*!
115 * @brief Get the system guiinfo provider.
116 * @return The system guiinfo provider.
117 */
118 CSystemGUIInfo& GetSystemInfoProvider() { return m_systemGUIInfo; }
119
120 /*!
121 * @brief Get the pictures guiinfo provider.
122 * @return The pictures guiinfo provider.
123 */
124 CPicturesGUIInfo& GetPicturesInfoProvider() { return m_picturesGUIInfo; }
125
126 /*!
127 * @brief Get the gui controls guiinfo provider.
128 * @return The gui controls guiinfo provider.
129 */
130 CGUIControlsGUIInfo& GetGUIControlsInfoProvider() { return m_guiControlsGUIInfo; }
131
132 /*!
133 * @brief Get the library guiinfo provider.
134 * @return The library guiinfo provider.
135 */
136 CLibraryGUIInfo& GetLibraryInfoProvider() { return m_libraryGUIInfo; }
137
138 private:
139 std::vector<IGUIInfoProvider *> m_providers;
140
141 CAddonsGUIInfo m_addonsGUIInfo;
142 CGamesGUIInfo m_gamesGUIInfo;
143 CGUIControlsGUIInfo m_guiControlsGUIInfo;
144 CLibraryGUIInfo m_libraryGUIInfo;
145 CMusicGUIInfo m_musicGUIInfo;
146 CPicturesGUIInfo m_picturesGUIInfo;
147 CPlayerGUIInfo m_playerGUIInfo;
148 CSkinGUIInfo m_skinGUIInfo;
149 CSystemGUIInfo m_systemGUIInfo;
150 CVideoGUIInfo m_videoGUIInfo;
151 CVisualisationGUIInfo m_visualisationGUIInfo;
152 CWeatherGUIInfo m_weatherGUIInfo;
153 };
154
155 } // namespace GUIINFO
156 } // namespace GUILIB
157 } // namespace KODI