| 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 <string> |
| 12 | |
| 13 | class CFileItem; |
| 14 | class CGUIListItem; |
| 15 | |
| 16 | struct AudioStreamInfo; |
| 17 | struct VideoStreamInfo; |
| 18 | |
| 19 | namespace KODI |
| 20 | { |
| 21 | namespace GUILIB |
| 22 | { |
| 23 | namespace GUIINFO |
| 24 | { |
| 25 | |
| 26 | class CGUIInfo; |
| 27 | |
| 28 | class IGUIInfoProvider |
| 29 | { |
| 30 | public: |
| 31 | virtual ~IGUIInfoProvider() = default; |
| 32 | |
| 33 | /*! |
| 34 | * @brief Init a new current guiinfo manager item. Gets called whenever the active guiinfo manager item changes. |
| 35 | * @param item The new item. |
| 36 | * @return True if the item was inited by the provider, false otherwise. |
| 37 | */ |
| 38 | virtual bool InitCurrentItem(CFileItem *item) = 0; |
| 39 | |
| 40 | /*! |
| 41 | * @brief Get a GUIInfoManager label string. |
| 42 | * @param value Will be filled with the requested value. |
| 43 | * @param item The item to get the value for. Can be nullptr. |
| 44 | * @param contextWindow The context window. Can be 0. |
| 45 | * @param info The GUI info (label id + additional data). |
| 46 | * @param fallback A fallback value. Can be nullptr. |
| 47 | * @return True if the value was filled successfully, false otherwise. |
| 48 | */ |
| 49 | virtual bool GetLabel(std::string &value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const = 0; |
| 50 | |
| 51 | /*! |
| 52 | * @brief Get a GUIInfoManager label fallback string. Will be called if none of the registered |
| 53 | * provider's GetLabel() implementation has returned success. |
| 54 | * @param value Will be filled with the requested value. |
| 55 | * @param item The item to get the value for. Can be nullptr. |
| 56 | * @param contextWindow The context window. Can be 0. |
| 57 | * @param info The GUI info (label id + additional data). |
| 58 | * @param fallback A fallback value. Can be nullptr. |
| 59 | * @return True if the value was filled successfully, false otherwise. |
| 60 | */ |
| 61 | virtual bool GetFallbackLabel(std::string& value, |
| 62 | const CFileItem* item, |
| 63 | int contextWindow, |
| 64 | const CGUIInfo& info, |
| 65 | std::string* fallback) = 0; |
| 66 | |
| 67 | /*! |
| 68 | * @brief Get a GUIInfoManager integer value. |
| 69 | * @param value Will be filled with the requested value. |
| 70 | * @param item The item to get the value for. Can be nullptr. |
| 71 | * @param contextWindow The context window. Can be 0. |
| 72 | * @param info The GUI info (label id + additional data). |
| 73 | * @return True if the value was filled successfully, false otherwise. |
| 74 | */ |
| 75 | virtual bool GetInt(int& value, const CGUIListItem *item, int contextWindow, const CGUIInfo &info) const = 0; |
| 76 | |
| 77 | /*! |
| 78 | * @brief Get a GUIInfoManager bool value. |
| 79 | * @param value Will be filled with the requested value. |
| 80 | * @param item The item to get the value for. Can be nullptr. |
| 81 | * @param contextWindow The context window. Can be 0. |
| 82 | * @param info The GUI info (label id + additional data). |
| 83 | * @return True if the value was filled successfully, false otherwise. |
| 84 | */ |
| 85 | virtual bool GetBool(bool& value, const CGUIListItem *item, int contextWindow, const CGUIInfo &info) const = 0; |
| 86 | |
| 87 | /*! |
| 88 | * @brief Set new audio/video stream info data. |
| 89 | * @param audioInfo New audio stream info. |
| 90 | * @param videoInfo New video stream info. |
| 91 | */ |
| 92 | virtual void UpdateAVInfo(const AudioStreamInfo& audioInfo, const VideoStreamInfo& videoInfo, const SubtitleStreamInfo& subtitleInfo) = 0; |
| 93 | }; |
| 94 | |
| 95 | } // namespace GUIINFO |
| 96 | } // namespace GUILIB |
| 97 | } // namespace KODI |