X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Faddon%2Faddon_manager.hpp;h=a58f38cee0ea8622cf14effb42c66a238e5361ee;hb=140e8eab7d0732663de2c1f0a0f2edcc5bc1749f;hp=b87d7ce28eabce93e86b5f6aa4b05191714c5634;hpb=5066ad643acd01cf885d1cc93ad5aa6466520de2;p=supertux.git diff --git a/src/addon/addon_manager.hpp b/src/addon/addon_manager.hpp index b87d7ce28..a58f38cee 100644 --- a/src/addon/addon_manager.hpp +++ b/src/addon/addon_manager.hpp @@ -36,8 +36,36 @@ typedef std::string AddonId; /** Checks for, installs and removes Add-ons */ class AddonManager : public Currenton { +public: + struct InstallStatus + { + InstallStatus() : + now(0), + total(0), + done(false) + {} + + int now; + int total; + bool done; + }; + + struct InstallRequest + { + InstallRequest() : + addon_id(), + install_filename() + {} + + std::string addon_id; + std::string install_filename; + }; + + using InstallStatusPtr = std::shared_ptr; + using InstallRequestPtr = std::shared_ptr; + private: - typedef std::vector > AddonList; + using AddonList = std::vector >; Downloader m_downloader; std::string m_addon_directory; @@ -49,6 +77,10 @@ private: bool m_has_been_updated; + InstallRequestPtr m_install_request; + InstallStatusPtr m_install_status; + TransferStatusPtr m_transfer_status; + public: AddonManager(const std::string& addon_directory, std::vector& addon_config); @@ -64,12 +96,16 @@ public: Addon& get_repository_addon(const AddonId& addon); Addon& get_installed_addon(const AddonId& addon); + InstallStatusPtr request_install_addon(const AddonId& addon_id); + void abort_install(); void install_addon(const AddonId& addon_id); void uninstall_addon(const AddonId& addon_id); void enable_addon(const AddonId& addon_id); void disable_addon(const AddonId& addon_id); + void update(); + private: std::vector scan_for_archives() const; void add_installed_addons();