Skip to content

Commit

Permalink
Addon Manager: Make type lists static since they never change
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Apr 27, 2017
1 parent 77cce6e commit f591899
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
47 changes: 24 additions & 23 deletions src/gui/dialogs/addon/manager.cpp
Expand Up @@ -211,6 +211,30 @@ namespace {

REGISTER_DIALOG(addon_manager)

const std::vector<std::pair<ADDON_STATUS_FILTER, std::string>> addon_manager::status_filter_types_{
{FILTER_ALL, _("addons_view^All Add-ons")},
{FILTER_INSTALLED, _("addons_view^Installed")},
{FILTER_UPGRADABLE, _("addons_view^Upgradable")},
{FILTER_NOT_INSTALLED, _("addons_view^Not Installed")},
};

const std::vector<std::pair<ADDON_TYPE, std::string>> addon_manager::type_filter_types_{
{ADDON_SP_CAMPAIGN, _("addons_of_type^Campaigns")},
{ADDON_SP_SCENARIO, _("addons_of_type^Scenarios")},
{ADDON_SP_MP_CAMPAIGN, _("addons_of_type^SP/MP campaigns")},
{ADDON_MP_CAMPAIGN, _("addons_of_type^MP campaigns")},
{ADDON_MP_SCENARIO, _("addons_of_type^MP scenarios")},
{ADDON_MP_MAPS, _("addons_of_type^MP map-packs")},
{ADDON_MP_ERA, _("addons_of_type^MP eras")},
{ADDON_MP_FACTION, _("addons_of_type^MP factions")},
{ADDON_MP_MOD, _("addons_of_type^MP modifications")},
{ADDON_CORE, _("addons_of_type^Cores")},
{ADDON_MEDIA, _("addons_of_type^Resources")},
// FIXME: (also in WML) should this and Unknown be a single option in the UI?
{ADDON_OTHER, _("addons_of_type^Other")},
{ADDON_UNKNOWN, _("addons_of_type^Unknown")},
};

addon_manager::addon_manager(addons_client& client)
: orders_()
, cfg_()
Expand All @@ -219,29 +243,6 @@ addon_manager::addon_manager(addons_client& client)
, tracking_info_()
, need_wml_cache_refresh_(false)
{
status_filter_types_ = {
{FILTER_ALL, _("addons_view^All Add-ons")},
{FILTER_INSTALLED, _("addons_view^Installed")},
{FILTER_UPGRADABLE, _("addons_view^Upgradable")},
{FILTER_NOT_INSTALLED, _("addons_view^Not Installed")},
};

type_filter_types_ = {
{ADDON_SP_CAMPAIGN, _("addons_of_type^Campaigns")},
{ADDON_SP_SCENARIO, _("addons_of_type^Scenarios")},
{ADDON_SP_MP_CAMPAIGN, _("addons_of_type^SP/MP campaigns")},
{ADDON_MP_CAMPAIGN, _("addons_of_type^MP campaigns")},
{ADDON_MP_SCENARIO, _("addons_of_type^MP scenarios")},
{ADDON_MP_MAPS, _("addons_of_type^MP map-packs")},
{ADDON_MP_ERA, _("addons_of_type^MP eras")},
{ADDON_MP_FACTION, _("addons_of_type^MP factions")},
{ADDON_MP_MOD, _("addons_of_type^MP modifications")},
{ADDON_CORE, _("addons_of_type^Cores")},
{ADDON_MEDIA, _("addons_of_type^Resources")},
// FIXME: (also in WML) should this and Unknown be a single option in the UI?
{ADDON_OTHER, _("addons_of_type^Other")},
{ADDON_UNKNOWN, _("addons_of_type^Unknown")},
};
}

void addon_manager::on_filtertext_changed(text_box_base* textbox, const std::string& text)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/dialogs/addon/manager.hpp
Expand Up @@ -74,8 +74,8 @@ class addon_manager : public modal_dialog

addons_tracking_list tracking_info_;

std::vector<std::pair<ADDON_STATUS_FILTER, std::string>> status_filter_types_;
std::vector<std::pair<ADDON_TYPE, std::string>> type_filter_types_;
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_;

bool need_wml_cache_refresh_;

Expand Down

0 comments on commit f591899

Please sign in to comment.