[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / addons / gui / GUIDialogAddonInfo.h
blobb28a858087dcb30a5e1aaf39a4645d821233ac6d
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "addons/addoninfo/AddonInfo.h"
12 #include "guilib/GUIDialog.h"
14 #include <memory>
15 #include <string>
16 #include <utility>
17 #include <vector>
19 namespace ADDON
21 class IAddon;
22 using AddonPtr = std::shared_ptr<IAddon>;
24 } // namespace ADDON
26 enum class Reactivate : bool
28 CHOICE_YES = true,
29 CHOICE_NO = false,
32 enum class PerformButtonFocus : bool
34 CHOICE_YES = true,
35 CHOICE_NO = false,
38 enum class EntryPoint : int
40 INSTALL,
41 UPDATE,
42 SHOW_DEPENDENCIES,
45 struct CInstalledWithAvailable
47 CInstalledWithAvailable(const ADDON::DependencyInfo& depInfo,
48 const std::shared_ptr<ADDON::IAddon>& installed,
49 const std::shared_ptr<ADDON::IAddon>& available)
50 : m_depInfo(depInfo), m_installed(installed), m_available(available)
54 /*!
55 * @brief Returns true if the currently installed dependency version is up to date
56 * or the dependency is not available from a repository
58 bool IsInstalledUpToDate() const;
60 ADDON::DependencyInfo m_depInfo;
61 std::shared_ptr<ADDON::IAddon> m_installed;
62 std::shared_ptr<ADDON::IAddon> m_available;
65 class CGUIDialogAddonInfo : public CGUIDialog
67 public:
68 CGUIDialogAddonInfo(void);
69 ~CGUIDialogAddonInfo(void) override;
70 bool OnMessage(CGUIMessage& message) override;
71 bool OnAction(const CAction& action) override;
73 CFileItemPtr GetCurrentListItem(int offset = 0) override { return m_item; }
74 bool HasListItems() const override { return true; }
76 static bool ShowForItem(const CFileItemPtr& item);
78 private:
79 void OnInitWindow() override;
81 /*!
82 * @brief Set the item to display addon info on.
84 * @param[in] item to display
85 * @return true if we can display information, false otherwise
87 bool SetItem(const CFileItemPtr& item);
88 void UpdateControls(PerformButtonFocus performButtonFocus);
90 void OnUpdate();
91 void OnSelectVersion();
92 void OnInstall();
93 void OnUninstall();
94 void OnEnableDisable();
95 void OnSettings();
96 void OnSelect();
97 void OnToggleAutoUpdates();
98 int AskForVersion(std::vector<std::pair<ADDON::CAddonVersion, std::string>>& versions);
101 * @brief Returns true if current addon can be opened (i.e is a plugin)
103 bool CanOpen() const;
106 * @brief Returns true if current addon can be run (i.e is a script)
108 bool CanRun() const;
111 * @brief Returns true if current addon is of a type that can only have one active
112 * in use at a time and can be changed (e.g skins)
114 bool CanUse() const;
117 * @brief Returns true if current addon can be show list about supported parts
119 bool CanShowSupportList() const;
122 * @brief check if the add-on is a dependency of others, and if so prompt the user.
124 * @param[in] heading the label for the heading of the prompt dialog
125 * @param[in] line2 the action that could not be completed.
126 * @return true if prompted, false otherwise.
128 bool PromptIfDependency(int heading, int line2);
131 * @brief Show a dialog with the addon's dependencies.
133 * @param[in] reactivate If true, reactivate info dialog when done
134 * @param[in] entryPoint INSTALL, UPDATE or SHOW_DEPENDENCIES
135 * @return True if okay was selected, false otherwise
137 bool ShowDependencyList(Reactivate reactivate, EntryPoint entryPoint);
140 * @brief Show a dialog with the addon's supported extensions and mimetypes.
142 void ShowSupportList();
145 * @brief Used to build up the dependency list shown by @ref ShowDependencyList()
147 void BuildDependencyList();
149 CFileItemPtr m_item;
150 ADDON::AddonPtr m_localAddon;
151 bool m_addonEnabled = false;
153 /*!< a switch to force @ref OnUninstall() to proceed without user interaction.
154 * useful for cases like where another repo’s version of an addon must
155 * be removed before installing a new version.
157 bool m_silentUninstall = false;
159 bool m_showDepDialogOnInstall = false;
160 std::vector<ADDON::DependencyInfo> m_deps;
161 std::vector<CInstalledWithAvailable> m_depsInstalledWithAvailable;