The Battle for Wesnoth  1.15.1+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. More...

#include <manager.hpp>

Inheritance diagram for gui2::dialogs::addon_manager:
Inheritance graph

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
 
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_filtertext_changed (text_box_base *textbox)
 
void on_addon_select (window &window)
 
void toggle_details (button &btn, stacked_widget &stk)
 
virtual const std::string & window_id () const override
 Inherited from modal_dialog, implemented by REGISTER_DIALOG. More...
 
virtual void pre_show (window &window) override
 Inherited from modal_dialog. More...
 
void fetch_addons_list (window &window)
 
void load_addon_list (window &window)
 
void reload_list_and_reselect_item (const std::string id, window &window)
 
template<void(addon_manager::*)(const addon_info &addon, window &window) fptr>
void execute_action_on_selected_addon (window &window)
 
void install_addon (const addon_info &addon, window &window)
 
void install_selected_addon (window &window)
 
void uninstall_addon (const addon_info &addon, window &window)
 
void uninstall_selected_addon (window &window)
 
void update_addon (const addon_info &addon, window &window)
 
void update_selected_addon (window &window)
 
void publish_addon (const addon_info &addon, window &window)
 Performs all backend and UI actions for publishing the specified add-on. More...
 
void publish_selected_addon (window &window)
 
void delete_addon (const addon_info &addon, window &window)
 Performs all backend and UI actions for taking down the specified add-on. More...
 
void delete_selected_addon (window &window)
 
void execute_default_action (const addon_info &addon, window &window)
 Called when the player double-clicks an add-on. More...
 
void execute_default_action_on_selected_addon (window &window)
 
void update_all_addons (window &window)
 
void browse_url_callback (text_box &url_box)
 
void copy_url_callback (text_box &url_box)
 
void apply_filters (window &window)
 
void order_addons (window &window)
 
void on_order_changed (window &window, unsigned int sort_column, listbox::SORT_ORDER order)
 
void show_help ()
 
boost::dynamic_bitset get_name_filter_visibility (const window &window) const
 
boost::dynamic_bitset get_status_filter_visibility (const window &window) const
 
boost::dynamic_bitset get_type_filter_visibility (const window &window) const
 
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.

Definition at line 39 of file manager.hpp.

Constructor & Destructor Documentation

◆ addon_manager()

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

Definition at line 232 of file manager.cpp.

Member Function Documentation

◆ apply_filters()

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

◆ browse_url_callback()

void gui2::dialogs::addon_manager::browse_url_callback ( text_box url_box)
private

◆ copy_url_callback()

void gui2::dialogs::addon_manager::copy_url_callback ( text_box url_box)
private

◆ delete_addon()

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

◆ delete_selected_addon()

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

Definition at line 123 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, window &window) fptr>
void gui2::dialogs::addon_manager::execute_action_on_selected_addon ( window window)
private

Definition at line 636 of file manager.cpp.

References _().

◆ execute_default_action()

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

◆ execute_default_action_on_selected_addon()

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

◆ exit_hook()

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

◆ fetch_addons_list()

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

◆ get_name_filter_visibility()

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

◆ get_need_wml_cache_refresh()

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

Definition at line 44 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 window window) const
private

◆ get_type_filter_visibility()

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

◆ install_addon()

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

◆ install_selected_addon()

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

Definition at line 99 of file manager.hpp.

References uninstall_addon().

Referenced by pre_show().

◆ load_addon_list()

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

◆ on_addon_select()

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

◆ on_filtertext_changed()

void gui2::dialogs::addon_manager::on_filtertext_changed ( text_box_base textbox)
private

◆ on_order_changed()

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

◆ order_addons()

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

◆ pre_show()

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

◆ publish_addon()

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

◆ publish_selected_addon()

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

Definition at line 117 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,
window window 
)
private

Definition at line 519 of file manager.cpp.

References load_addon_list(), and on_addon_select().

Referenced by delete_addon(), install_addon(), publish_addon(), and uninstall_addon().

◆ show_help()

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

Definition at line 822 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,
window window 
)
private

◆ uninstall_selected_addon()

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

Definition at line 105 of file manager.hpp.

References update_addon().

Referenced by pre_show().

◆ update_addon()

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

Definition at line 690 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 ( window window)
private

◆ update_selected_addon()

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

Definition at line 111 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

Inherited from modal_dialog, implemented by REGISTER_DIALOG.

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)"), 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)"), 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)"), 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)"), 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)"), 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)"), -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)"), -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 91 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 81 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 64 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 89 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 90 of file manager.hpp.

Referenced by get_type_filter_visibility(), and pre_show().


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