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.
11 #include "addons/addoninfo/AddonInfo.h"
12 #include "guilib/GUIDialog.h"
22 using AddonPtr
= std::shared_ptr
<IAddon
>;
26 enum class Reactivate
: bool
32 enum class PerformButtonFocus
: bool
38 enum class EntryPoint
: int
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
)
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
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
);
79 void OnInitWindow() override
;
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
);
91 void OnSelectVersion();
94 void OnEnableDisable();
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)
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)
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();
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
;