18 #ifndef HEADER_SUPERTUX_ADDON_ADDON_MANAGER_HPP 19 #define HEADER_SUPERTUX_ADDON_ADDON_MANAGER_HPP 26 #include "addon/downloader.hpp" 27 #include "supertux/gameconfig.hpp" 28 #include "util/currenton.hpp" 31 class AddonDependencyManager;
33 typedef std::string AddonId;
39 using AddonMap = std::map<AddonId, std::unique_ptr<Addon> >;
43 const std::string m_addon_directory;
44 const std::string m_cache_directory;
45 const std::string m_screenshots_cache_directory;
46 std::string m_repository_url;
47 std::vector<Config::Addon>& m_addon_config;
49 AddonMap m_installed_addons;
50 AddonMap m_repository_addons;
53 bool m_has_been_updated;
55 TransferStatusListPtr m_transfer_statuses;
59 std::vector<Config::Addon>& addon_config);
62 void empty_cache_directory();
64 bool has_online_support()
const;
65 bool has_been_updated()
const;
67 TransferStatusPtr request_check_online();
69 std::vector<AddonId> get_repository_addons()
const;
70 std::vector<AddonId> get_installed_addons()
const;
72 Addon& get_repository_addon(
const AddonId& addon)
const;
73 Addon& get_installed_addon(
const AddonId& addon)
const;
75 TransferStatusListPtr request_install_addon(
const AddonId& addon_id);
76 TransferStatusListPtr request_install_addon_dependencies(
const AddonId& addon_id);
77 void install_addon(
const AddonId& addon_id);
78 void uninstall_addon(
const AddonId& addon_id);
79 void install_addon_from_local_file(
const std::string& filename);
81 TransferStatusListPtr request_download_addon_screenshots(
const AddonId& addon_id);
82 std::vector<std::string> get_local_addon_screenshots(
const AddonId& addon_id);
84 void enable_addon(
const AddonId& addon_id);
85 void disable_addon(
const AddonId& addon_id);
87 bool is_old_enabled_addon(
const std::unique_ptr<Addon>& addon)
const;
88 bool is_old_addon_enabled()
const;
89 void disable_old_addons();
90 void mount_old_addons();
91 void unmount_old_addons();
92 bool is_from_old_addon(
const std::string& filename)
const;
93 bool is_addon_installed(
const std::string&
id)
const;
95 std::vector<AddonId> get_depending_addons(
const std::string&
id)
const;
98 void check_for_langpack_updates();
101 void onDownloadProgress(
int id,
int loaded,
int total);
102 void onDownloadFinished(
int id);
103 void onDownloadError(
int id);
104 void onDownloadAborted(
int id);
108 TransferStatusListPtr request_install_addon_dependencies(
const Addon& addon);
110 std::vector<std::string> scan_for_archives()
const;
111 void add_installed_addons();
112 AddonMap parse_addon_infos(
const std::string& filename)
const;
116 void add_installed_archive(
const std::string& archive,
const std::string& md5,
bool user_install =
false);
120 std::string scan_for_info(
const std::string& archive)
const;
Definition: downloader.hpp:118
A 'Currenton' allows access to the currently active instance of a class via the static current() func...
Definition: currenton.hpp:30
Checks for, installs and removes Add-ons.
Definition: addon_manager.hpp:36