The Battle for Wesnoth  1.15.12+dev
Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
gui2::dialogs::addon_manager Class Reference

Shows the list of addons on the server available for installation. More...

#include <manager.hpp>

Inheritance diagram for gui2::dialogs::addon_manager:

Classes

struct  addon_order
 

Public Member Functions

 addon_manager (addons_client &client)
 
bool get_need_wml_cache_refresh () const
 
- Public Member Functions inherited from gui2::dialogs::modal_dialog
 modal_dialog ()
 
virtual ~modal_dialog ()
 
bool show (const unsigned auto_close_time=0)
 Shows the window. More...
 
windowget_window () const
 Returns a pointer to the dialog's window. More...
 
int get_retval () const
 Returns the cached window exit code. More...
 
void set_retval (int retval)
 Convenience wrapper to set the window's exit code. More...
 
void set_always_save_fields (const bool always_save_fields)
 
void set_restore (const bool restore)
 
void set_allow_plugin_skip (const bool allow_plugin_skip)
 
void set_show_even_without_video (const bool show_even_without_video)
 

Private Member Functions

void on_addon_select ()
 
void toggle_details (button &btn, stacked_widget &stk)
 
virtual const std::string & window_id () const override
 The id of the window to build. More...
 
virtual void pre_show (window &window) override
 Actions to be taken before showing the window. More...
 
void fetch_addons_list ()
 
void load_addon_list ()
 
void reload_list_and_reselect_item (const std::string id)
 
template<void(addon_manager::*)(const addon_info &addon) fptr>
void execute_action_on_selected_addon ()
 
void install_addon (const addon_info &addon)
 
void install_selected_addon ()
 
void uninstall_addon (const addon_info &addon)
 
void uninstall_selected_addon ()
 
void update_addon (const addon_info &addon)
 
void update_selected_addon ()
 
void publish_addon (const addon_info &addon)
 Performs all backend and UI actions for publishing the specified add-on. More...
 
void publish_selected_addon ()
 
void delete_addon (const addon_info &addon)
 Performs all backend and UI actions for taking down the specified add-on. More...
 
void delete_selected_addon ()
 
void execute_default_action (const addon_info &addon)
 Called when the player double-clicks an add-on. More...
 
void execute_default_action_on_selected_addon ()
 
void update_all_addons ()
 
void apply_filters ()
 
void order_addons ()
 
void on_order_changed (unsigned int sort_column, preferences::SORT_ORDER order)
 
void show_help ()
 
boost::dynamic_bitset get_name_filter_visibility () const
 
boost::dynamic_bitset get_status_filter_visibility () const
 
boost::dynamic_bitset get_type_filter_visibility () const
 
void on_selected_version_change ()
 
bool exit_hook (window &window)
 

Private Attributes

std::vector< selectable_item * > orders_
 
config cfg_
 Config which contains the list with the campaigns. More...
 
addons_clientclient_
 
addons_list addons_
 
addons_tracking_list tracking_info_
 
bool need_wml_cache_refresh_
 

Static Private Attributes

static const std::vector< std::pair< ADDON_STATUS_FILTER, std::string > > status_filter_types_
 
static const std::vector< std::pair< ADDON_TYPE, std::string > > type_filter_types_
 
static const std::vector< addon_orderall_orders_
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::dialogs::modal_dialog
field_boolregister_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_boolregister_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false)
 Creates a new boolean field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr)
 Creates a new integer field. More...
 
field_integerregister_integer (const std::string &id, const bool mandatory, int &linked_variable)
 Creates a new integer field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false)
 Creates a new text field. More...
 
field_textregister_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false)
 Creates a new text field. More...
 
field_labelregister_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false)
 Registers a new styled_widget as a label. More...
 
field_labelregister_image (const std::string &id, const bool mandatory, const std::string &filename)
 Registers a new styled_widget as image. More...
 
- Protected Attributes inherited from gui2::dialogs::modal_dialog
std::unique_ptr< windowwindow_
 The window object build for this dialog. More...
 

Detailed Description

Shows the list of addons on the server available for installation.

This dialog is under construction and only used with –new-widgets.

Key Type MandatoryDescription
addons listbox yes A listbox that will contain the info about all addons on the server.
name control no The name of the addon.
version control no The version number of the addon.
author control no The author of the addon.
downloads control no The number of times the addon has been downloaded.
size control no The size of the addon.

Definition at line 52 of file manager.hpp.

Constructor & Destructor Documentation

◆ addon_manager()

gui2::dialogs::addon_manager::addon_manager ( addons_client client)
explicit

Definition at line 209 of file manager.cpp.

Member Function Documentation

◆ apply_filters()

void gui2::dialogs::addon_manager::apply_filters ( )
private

◆ delete_addon()

void gui2::dialogs::addon_manager::delete_addon ( const addon_info addon)
private

◆ delete_selected_addon()

void gui2::dialogs::addon_manager::delete_selected_addon ( )
inlineprivate

Definition at line 138 of file manager.hpp.

References execute_default_action().

Referenced by pre_show().

◆ execute_action_on_selected_addon()

template<void(addon_manager::*)(const addon_info &addon) fptr>
void gui2::dialogs::addon_manager::execute_action_on_selected_addon ( )
private

Definition at line 625 of file manager.cpp.

References _(), and gui2::dialogs::modal_dialog::get_window().

◆ execute_default_action()

void gui2::dialogs::addon_manager::execute_default_action ( const addon_info addon)
private

◆ execute_default_action_on_selected_addon()

void gui2::dialogs::addon_manager::execute_default_action_on_selected_addon ( )
inlineprivate

◆ exit_hook()

bool gui2::dialogs::addon_manager::exit_hook ( window window)
private

◆ fetch_addons_list()

void gui2::dialogs::addon_manager::fetch_addons_list ( )
private

◆ get_name_filter_visibility()

boost::dynamic_bitset gui2::dialogs::addon_manager::get_name_filter_visibility ( ) const
private

◆ get_need_wml_cache_refresh()

bool gui2::dialogs::addon_manager::get_need_wml_cache_refresh ( ) const
inline

Definition at line 57 of file manager.hpp.

References need_wml_cache_refresh_.

◆ get_status_filter_visibility()

boost::dynamic_bitset gui2::dialogs::addon_manager::get_status_filter_visibility ( ) const
private

◆ get_type_filter_visibility()

boost::dynamic_bitset gui2::dialogs::addon_manager::get_type_filter_visibility ( ) const
private

◆ install_addon()

void gui2::dialogs::addon_manager::install_addon ( const addon_info addon)
private

◆ install_selected_addon()

void gui2::dialogs::addon_manager::install_selected_addon ( )
inlineprivate

Definition at line 114 of file manager.hpp.

References uninstall_addon().

Referenced by pre_show().

◆ load_addon_list()

void gui2::dialogs::addon_manager::load_addon_list ( )
private

◆ on_addon_select()

void gui2::dialogs::addon_manager::on_addon_select ( )
private

◆ on_order_changed()

void gui2::dialogs::addon_manager::on_order_changed ( unsigned int  sort_column,
preferences::SORT_ORDER  order 
)
private

◆ on_selected_version_change()

void gui2::dialogs::addon_manager::on_selected_version_change ( )
private

◆ order_addons()

void gui2::dialogs::addon_manager::order_addons ( )
private

◆ pre_show()

void gui2::dialogs::addon_manager::pre_show ( window window)
overrideprivatevirtual

Actions to be taken before showing the window.

At this point the registered fields are registered and initialized with their initial values.

Parameters
windowThe window to be shown.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 274 of file manager.cpp.

References _(), gui2::addon_list::add_list_to_keyboard_chain(), preferences::addon_manager_saved_order_direction(), preferences::addon_manager_saved_order_name(), all_orders_, apply_filters(), gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), delete_addon(), delete_selected_addon(), exit_hook(), f, fetch_addons_list(), GETTEXT_DOMAIN, utf8::index(), install_addon(), install_selected_addon(), load_addon_list(), on_addon_select(), on_order_changed(), on_selected_version_change(), order_addons(), publish_addon(), publish_selected_addon(), gui2::addon_list::set_callback_order_change(), gui2::addon_list::set_delete_function(), gui2::window::set_escape_disabled(), gui2::addon_list::set_install_function(), gui2::label::set_link_aware(), gui2::addon_list::set_modified_signal_handler(), gui2::addon_list::set_publish_function(), gui2::text_box_base::set_text_changed_callback(), gui2::addon_list::set_uninstall_function(), gui2::addon_list::set_update_function(), gui2::styled_widget::set_use_markup(), gui2::menu_button::set_values(), gui2::multimenu_button::set_values(), show_help(), status_filter_types_, toggle_details(), type_filter_types_, uninstall_addon(), uninstall_selected_addon(), update_addon(), update_all_addons(), update_selected_addon(), and VGETTEXT.

◆ publish_addon()

void gui2::dialogs::addon_manager::publish_addon ( const addon_info addon)
private

◆ publish_selected_addon()

void gui2::dialogs::addon_manager::publish_selected_addon ( )
inlineprivate

Definition at line 132 of file manager.hpp.

References delete_addon().

Referenced by pre_show().

◆ reload_list_and_reselect_item()

void gui2::dialogs::addon_manager::reload_list_and_reselect_item ( const std::string  id)
private

◆ show_help()

void gui2::dialogs::addon_manager::show_help ( )
private

Definition at line 834 of file manager.cpp.

References help::show_help().

Referenced by execute_default_action_on_selected_addon(), and pre_show().

◆ toggle_details()

void gui2::dialogs::addon_manager::toggle_details ( button btn,
stacked_widget stk 
)
private

◆ uninstall_addon()

void gui2::dialogs::addon_manager::uninstall_addon ( const addon_info addon)
private

◆ uninstall_selected_addon()

void gui2::dialogs::addon_manager::uninstall_selected_addon ( )
inlineprivate

Definition at line 120 of file manager.hpp.

References update_addon().

Referenced by pre_show().

◆ update_addon()

void gui2::dialogs::addon_manager::update_addon ( const addon_info addon)
private

Definition at line 688 of file manager.cpp.

References install_addon().

Referenced by execute_default_action(), pre_show(), and uninstall_selected_addon().

◆ update_all_addons()

void gui2::dialogs::addon_manager::update_all_addons ( )
private

◆ update_selected_addon()

void gui2::dialogs::addon_manager::update_selected_addon ( )
inlineprivate

Definition at line 126 of file manager.hpp.

References publish_addon().

Referenced by pre_show().

◆ window_id()

virtual const std::string& gui2::dialogs::addon_manager::window_id ( ) const
overrideprivatevirtual

The id of the window to build.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ addons_

addons_list gui2::dialogs::addon_manager::addons_
private

◆ all_orders_

const std::vector< addon_manager::addon_order > gui2::dialogs::addon_manager::all_orders_
staticprivate
Initial value:
{
{N_("addons_order^Name ($order)"), "name", 0,
[](const addon_info& a, const addon_info& b) { return a.title < b.title; },
[](const addon_info& a, const addon_info& b) { return a.title > b.title; }},
{N_("addons_order^Author ($order)"), "author", 1,
[](const addon_info& a, const addon_info& b) { return a.author < b.author; },
[](const addon_info& a, const addon_info& b) { return a.author > b.author; }},
{N_("addons_order^Size ($order)"), "size", 2,
[](const addon_info& a, const addon_info& b) { return a.size < b.size; },
[](const addon_info& a, const addon_info& b) { return a.size > b.size; }},
{N_("addons_order^Downloads ($order)"), "downloads", 3,
[](const addon_info& a, const addon_info& b) { return a.downloads < b.downloads; },
[](const addon_info& a, const addon_info& b) { return a.downloads > b.downloads; }},
{N_("addons_order^Type ($order)"), "type", 4,
[](const addon_info& a, const addon_info& b) { return a.display_type() < b.display_type(); },
[](const addon_info& a, const addon_info& b) { return a.display_type() > b.display_type(); }},
{N_("addons_order^Last updated ($datelike_order)"), "last_updated", -1,
[](const addon_info& a, const addon_info& b) { return a.updated < b.updated; },
[](const addon_info& a, const addon_info& b) { return a.updated > b.updated; }},
{N_("addons_order^First uploaded ($datelike_order)"), "first_uploaded", -1,
[](const addon_info& a, const addon_info& b) { return a.created < b.created; },
[](const addon_info& a, const addon_info& b) { return a.created > b.created; }}
}

Definition at line 106 of file manager.hpp.

Referenced by on_order_changed(), order_addons(), and pre_show().

◆ cfg_

config gui2::dialogs::addon_manager::cfg_
private

Config which contains the list with the campaigns.

Definition at line 96 of file manager.hpp.

Referenced by fetch_addons_list(), get_name_filter_visibility(), and load_addon_list().

◆ client_

addons_client& gui2::dialogs::addon_manager::client_
private

◆ need_wml_cache_refresh_

bool gui2::dialogs::addon_manager::need_wml_cache_refresh_
private

◆ orders_

std::vector<selectable_item*> gui2::dialogs::addon_manager::orders_
private

Definition at line 81 of file manager.hpp.

◆ status_filter_types_

const std::vector< std::pair< ADDON_STATUS_FILTER, std::string > > gui2::dialogs::addon_manager::status_filter_types_
staticprivate
Initial value:
{
{FILTER_ALL, N_("addons_view^All Add-ons")},
{FILTER_INSTALLED, N_("addons_view^Installed")},
{FILTER_UPGRADABLE, N_("addons_view^Upgradable")},
{FILTER_PUBLISHABLE, N_("addons_view^Publishable")},
{FILTER_NOT_INSTALLED, N_("addons_view^Not Installed")},
}

Definition at line 104 of file manager.hpp.

Referenced by get_status_filter_visibility(), and pre_show().

◆ tracking_info_

addons_tracking_list gui2::dialogs::addon_manager::tracking_info_
private

◆ type_filter_types_

const std::vector< std::pair< ADDON_TYPE, std::string > > gui2::dialogs::addon_manager::type_filter_types_
staticprivate
Initial value:
{
{ADDON_SP_CAMPAIGN, N_("addons_of_type^Campaigns")},
{ADDON_SP_SCENARIO, N_("addons_of_type^Scenarios")},
{ADDON_SP_MP_CAMPAIGN, N_("addons_of_type^SP/MP campaigns")},
{ADDON_MP_CAMPAIGN, N_("addons_of_type^MP campaigns")},
{ADDON_MP_SCENARIO, N_("addons_of_type^MP scenarios")},
{ADDON_MP_MAPS, N_("addons_of_type^MP map-packs")},
{ADDON_MP_ERA, N_("addons_of_type^MP eras")},
{ADDON_MP_FACTION, N_("addons_of_type^MP factions")},
{ADDON_MOD, N_("addons_of_type^Modifications")},
{ADDON_CORE, N_("addons_of_type^Cores")},
{ADDON_MEDIA, N_("addons_of_type^Resources")},
{ADDON_OTHER, N_("addons_of_type^Other")},
{ADDON_UNKNOWN, N_("addons_of_type^Unknown")},
}

Definition at line 105 of file manager.hpp.

Referenced by get_type_filter_visibility(), and pre_show().


The documentation for this class was generated from the following files: