The UI layout should be improved, but functionality and translatable strings are there as needed.
This commit is contained in:
Alayan 2019-12-18 04:25:18 +01:00
parent 354410dbd2
commit ad8ef2df11
2 changed files with 21 additions and 11 deletions

View File

@ -37,11 +37,12 @@
</tabs>
<box proportion="1" width="98%" align="center" layout="vertical-row" padding="6">
<div layout="horizontal-row" width="100%" height="8%">
<checkbox id="show_possessed"/>
<div layout="horizontal-row" width="100%" height="2f">
<spacer width="1%" />
<label height="100%" I18N="In the addons screen, above the list of addons to be installed"
text="Show only possessed" word_wrap="true"/>
<label text="Installed" align="center" I18N="In addons screen, above the list of addons to be installed"/>
<spacer width="1%" />
<spinner id="filter_installation" proportion="5" align="center" min_value="0" wrap_around="true"/>
<spacer width="50%" />
</div>
<list id="list_addons" x="0" y="0" width="100%" height="92%" word_wrap="true" alternate_bg="true"/>
</box>

View File

@ -127,6 +127,14 @@ void AddonsScreen::beforeAddingWidget()
{
w_filter_rating->addLabel(StringUtils::toWString(n / 2.0));
}
GUIEngine::SpinnerWidget* w_filter_installation =
getWidget<GUIEngine::SpinnerWidget>("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<GUIEngine::SpinnerWidget>("filter_rating");
w_filter_rating->setValue(0);
GUIEngine::CheckBoxWidget* w_show_possessed =
getWidget<GUIEngine::CheckBoxWidget>("show_possessed");
w_show_possessed->setState(false);
GUIEngine::SpinnerWidget* w_filter_installation =
getWidget<GUIEngine::SpinnerWidget>("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<GUIEngine::SpinnerWidget>("filter_rating");
float rating = w_filter_rating->getValue() / 2.0f;
GUIEngine::CheckBoxWidget* w_show_possessed =
getWidget<GUIEngine::CheckBoxWidget>("show_possessed");
GUIEngine::SpinnerWidget* w_filter_installation =
getWidget<GUIEngine::SpinnerWidget>("filter_installation");
// First create a list of sorted entries
PtrVector<const Addon, REF> 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();
}