Merge pull request #26359 from garbear/fix-settings-crop
[xbmc.git] / xbmc / addons / gui / GUIWindowAddonBrowser.h
blob7f605eefe32b00e303b037f5283e8968741f797f
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 "ThumbLoader.h"
12 #include "addons/RepositoryUpdater.h"
13 #include "windows/GUIMediaWindow.h"
15 #include <string>
16 #include <vector>
18 class CFileItemList;
20 namespace ADDON
22 enum class AddonType;
23 struct AddonEvent;
26 class CGUIWindowAddonBrowser : public CGUIMediaWindow
28 public:
29 CGUIWindowAddonBrowser(void);
30 ~CGUIWindowAddonBrowser(void) override;
31 bool OnMessage(CGUIMessage& message) override;
33 /*!
34 * @brief Popup a selection dialog with a list of addons of the given type
36 * @param[in] type the type of addon wanted
37 * @param[in] addonID [in/out] the addon ID of the (pre) selected item
38 * @param[in] showNone whether there should be a "None" item in the list (defaults to false)
39 * @param[in] showDetails whether to show details of the addons or not
40 * @param[in] showInstalled whether installed addons should be in the list
41 * @param[in] showInstallable whether installable addons should be in the list
42 * @param[in] showMore whether to show the "Get More" button (only makes sense
43 * if showInstalled is true and showInstallable is false)
44 * @return 1 if an addon was selected or multiple selection was specified, 2 if
45 * "Get More" was chosen, 0 if the selection process was cancelled or -1
46 * if an error occurred or
48 static int SelectAddonID(ADDON::AddonType type,
49 std::string& addonID,
50 bool showNone = false,
51 bool showDetails = true,
52 bool showInstalled = true,
53 bool showInstallable = false,
54 bool showMore = true);
55 static int SelectAddonID(const std::vector<ADDON::AddonType>& types,
56 std::string& addonID,
57 bool showNone = false,
58 bool showDetails = true,
59 bool showInstalled = true,
60 bool showInstallable = false,
61 bool showMore = true);
62 /*!
63 * @brief Popup a selection dialog with a list of addons of the given type
65 * @param[in] type the type of addon wanted
66 * @param[in] addonIDs [in/out] array of (pre) selected addon IDs
67 * @param[in] showNone whether there should be a "None" item in the list (defaults to false)
68 * @param[in] showDetails whether to show details of the addons or not
69 * @param[in] multipleSelection allow selection of multiple addons, if set to
70 * true showNone will automatically switch to false
71 * @param[in] showInstalled whether installed addons should be in the list
72 * @param[in] showInstallable whether installable addons should be in the list
73 * @param[in] showMore whether to show the "Get More" button (only makes sense
74 * if showInstalled is true and showInstallable is false)
75 * @return 1 if an addon was selected or multiple selection was specified, 2 if
76 * "Get More" was chosen, 0 if the selection process was cancelled or -1
77 * if an error occurred or
79 static int SelectAddonID(ADDON::AddonType type,
80 std::vector<std::string>& addonIDs,
81 bool showNone = false,
82 bool showDetails = true,
83 bool multipleSelection = true,
84 bool showInstalled = true,
85 bool showInstallable = false,
86 bool showMore = true);
87 static int SelectAddonID(const std::vector<ADDON::AddonType>& types,
88 std::vector<std::string>& addonIDs,
89 bool showNone = false,
90 bool showDetails = true,
91 bool multipleSelection = true,
92 bool showInstalled = true,
93 bool showInstallable = false,
94 bool showMore = true);
96 bool UseFileDirectories() override { return false; }
98 static void InstallFromZip();
100 protected:
101 bool OnClick(int iItem, const std::string& player = "") override;
102 void UpdateButtons() override;
103 bool GetDirectory(const std::string& strDirectory, CFileItemList& items) override;
104 bool Update(const std::string& strDirectory, bool updateFilterPath = true) override;
105 std::string GetStartFolder(const std::string& dir) override;
107 std::string GetRootPath() const override { return "addons://"; }
109 private:
110 void SetProperties();
111 void UpdateStatus(const CFileItemPtr& item);
112 void OnEvent(const ADDON::CRepositoryUpdater::RepositoryUpdated& event);
113 void OnEvent(const ADDON::AddonEvent& event);
114 CProgramThumbLoader m_thumbLoader;