19#ifndef HEADER_ADDONS_MANAGER_HPP
20#define HEADER_ADDONS_MANAGER_HPP
30#include "addons/addon.hpp"
31#include "io/xml_node.hpp"
32#include "utils/synchronised.hpp"
62 bool m_downloaded_icons;
64 std::atomic_bool m_has_new_addons;
79 bool anyAddonsInstalled()
const;
81 std::weak_ptr<bool> result);
88 bool wasError()
const {
return m_state.
getAtomic()==STATE_ERROR;}
90 bool isLoading()
const {
return m_state.
getAtomic()==STATE_INIT; }
103 bool hasDownloadedIcons()
const {
return m_downloaded_icons; }
105 bool hasNewAddons()
const {
return m_has_new_addons; }
Definition: addons_manager.hpp:38
const Addon & getAddon(unsigned int i)
Returns the i-th addons.
Definition: addons_manager.hpp:101
std::vector< std::string > m_icon_list
List of loaded icons.
Definition: addons_manager.hpp:48
void saveInstalled()
Saves the information about installed addons and cached icons to addons_installed....
Definition: addons_manager.cpp:644
unsigned int getNumAddons() const
Returns the list of addons (installed and uninstalled).
Definition: addons_manager.hpp:98
void setErrorState()
Marks addon as not being available.
Definition: addons_manager.hpp:93
std::string m_file_installed
Full filename of the addons_installed.xml file.
Definition: addons_manager.hpp:45
void init(const XMLNode *xml, bool force_refresh)
This init function is called from a separate thread (started in news_manager, since the news....
Definition: addons_manager.cpp:97
void checkInstalledAddons()
This function checks if the information in the installed addons file is consistent with what is actua...
Definition: addons_manager.cpp:335
void reInit()
Reinitialises the addon manager, which happens when the user selects 'reload' in the addon manager.
Definition: addons_manager.cpp:324
void initAddons(const XMLNode *xml)
This initialises the online portion of the addons manager.
Definition: addons_manager.cpp:171
AddonsManager()
Initialises the non-online component of the addons manager (i.e.
Definition: addons_manager.cpp:59
Synchronised< std::vector< Addon > > m_addons_list
The list of all addons - installed or uninstalled.
Definition: addons_manager.hpp:43
bool onlineReady() const
Returns true if the list of online addons has been downloaded.
Definition: addons_manager.hpp:86
bool install(const Addon &addon)
Installs or updates (i.e.
Definition: addons_manager.cpp:511
void loadInstalledAddons()
Loads the installed addons from .../addons/addons_installed.xml.
Definition: addons_manager.cpp:444
bool uninstall(const Addon &addon)
Removes all files froma login.
Definition: addons_manager.cpp:595
int getAddonIndex(const std::string &id) const
Returns the index of the addon with the given id, or -1 if no such addon exist.
Definition: addons_manager.cpp:484
STATE_TYPE
Which state the addons manager is: INIT: Waiting to download the list of addons.
Definition: addons_manager.hpp:54
~AddonsManager()
The destructor saves the installed addons file again.
Definition: addons_manager.cpp:83
void downloadIconForAddon(const std::string &addon_id, std::weak_ptr< bool > result)
Download icon for specific addon.
Definition: addons_manager.cpp:388
Addon * getAddon(const std::string &id)
Returns an addon with a given id.
Definition: addons_manager.cpp:473
A variable that is automatically synchronised using pthreads mutex.
Definition: synchronised.hpp:28
TYPE & getData()
Returns a reference to the original data file.
Definition: synchronised.hpp:82
void setAtomic(const TYPE &v)
Sets the value of this variable using a mutex.
Definition: synchronised.hpp:59
TYPE getAtomic() const
Returns a copy of this variable.
Definition: synchronised.hpp:68
utility class used to parse XML files
Definition: xml_node.hpp:48