diff --git a/data/gui/screens/addons_screen.stkgui b/data/gui/screens/addons_screen.stkgui index 9f1f9235d..50c241ef4 100644 --- a/data/gui/screens/addons_screen.stkgui +++ b/data/gui/screens/addons_screen.stkgui @@ -37,11 +37,12 @@ -
- +
-
diff --git a/src/states_screens/addons_screen.cpp b/src/states_screens/addons_screen.cpp index 1e155a880..fda649b9f 100644 --- a/src/states_screens/addons_screen.cpp +++ b/src/states_screens/addons_screen.cpp @@ -127,6 +127,14 @@ void AddonsScreen::beforeAddingWidget() { w_filter_rating->addLabel(StringUtils::toWString(n / 2.0)); } + + GUIEngine::SpinnerWidget* w_filter_installation = + getWidget("filter_installation"); + w_filter_installation->m_properties[GUIEngine::PROP_MIN_VALUE] = "0"; + w_filter_installation->m_properties[GUIEngine::PROP_MAX_VALUE] = "2"; + w_filter_installation->addLabel(_("All")); + w_filter_installation->addLabel(_("Installed")); + w_filter_installation->addLabel(_("Not installed")); } // ---------------------------------------------------------------------------- @@ -167,9 +175,9 @@ void AddonsScreen::init() getWidget("filter_rating"); w_filter_rating->setValue(0); - GUIEngine::CheckBoxWidget* w_show_possessed = - getWidget("show_possessed"); - w_show_possessed->setState(false); + GUIEngine::SpinnerWidget* w_filter_installation = + getWidget("filter_installation"); + w_filter_installation->setValue(0); // Set the default sort order Addon::setSortOrder(Addon::SO_DEFAULT); @@ -217,8 +225,8 @@ void AddonsScreen::loadList() getWidget("filter_rating"); float rating = w_filter_rating->getValue() / 2.0f; - GUIEngine::CheckBoxWidget* w_show_possessed = - getWidget("show_possessed"); + GUIEngine::SpinnerWidget* w_filter_installation = + getWidget("filter_installation"); // First create a list of sorted entries PtrVector sorted_list; @@ -226,7 +234,8 @@ void AddonsScreen::loadList() { const Addon & addon = addons_manager->getAddon(i); // Ignore not installed addons if the checkbox is enabled - if(w_show_possessed->getState() && !addon.isInstalled()) + if( (w_filter_installation->getValue() == 1 && !addon.isInstalled()) + || (w_filter_installation->getValue() == 2 && addon.isInstalled())) continue; // Ignore addons of a different type if(addon.getType()!=m_type) continue; @@ -463,7 +472,7 @@ void AddonsScreen::eventCallback(GUIEngine::Widget* widget, loadList(); } } - else if (name == "filter_search" || name == "show_possessed") + else if (name == "filter_search" || name == "filter_installation") { loadList(); }