Merge pull request #26264 from the-black-eagle/mka_end_durations
[xbmc.git] / xbmc / addons / AddonSystemSettings.h
blobbf5ca3858d3d6f648918d23b724e7d04f0d61624
1 /*
2 * Copyright (C) 2015-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 "settings/lib/ISettingCallback.h"
13 #include <map>
14 #include <memory>
15 #include <string>
17 namespace ADDON
20 const int AUTO_UPDATES_ON = 0;
21 const int AUTO_UPDATES_NOTIFY = 1;
22 const int AUTO_UPDATES_NEVER = 2;
24 enum class AddonRepoUpdateMode
26 OFFICIAL_ONLY = 0,
27 ANY_REPOSITORY = 1
30 enum class AddonType;
32 class CAddonInfo;
33 using AddonInfoPtr = std::shared_ptr<CAddonInfo>;
35 class IAddon;
36 using AddonPtr = std::shared_ptr<IAddon>;
38 class CAddonSystemSettings : public ISettingCallback
40 public:
41 static CAddonSystemSettings& GetInstance();
42 void OnSettingAction(const std::shared_ptr<const CSetting>& setting) override;
43 void OnSettingChanged(const std::shared_ptr<const CSetting>& setting) override;
45 bool GetActive(AddonType type, AddonPtr& addon);
46 bool SetActive(AddonType type, const std::string& addonID);
47 bool IsActive(const IAddon& addon);
49 /*!
50 * Gets Kodi addon auto update mode
52 * @return the autoupdate mode value
54 int GetAddonAutoUpdateMode() const;
57 /*!
58 * Gets Kodi preferred addon repository update mode
60 * @return the preferred mode value
62 AddonRepoUpdateMode GetAddonRepoUpdateMode() const;
64 /*!
65 * Attempt to unset addon as active. Returns true if addon is no longer active,
66 * false if it could not be unset (e.g. if the addon is the default)
68 bool UnsetActive(const AddonInfoPtr& addon);
70 private:
71 CAddonSystemSettings();
72 CAddonSystemSettings(const CAddonSystemSettings&) = delete;
73 CAddonSystemSettings& operator=(const CAddonSystemSettings&) = delete;
74 ~CAddonSystemSettings() override = default;
76 const std::map<AddonType, std::string> m_activeSettings;