* Show only possessed checkbox in addons screen * add var w_show_possessed * Update addons_screen.stkgui
This commit is contained in:
parent
0b480e7a71
commit
1115118a13
@ -37,6 +37,10 @@
|
||||
</tabs>
|
||||
|
||||
<box proportion="1" width="98%" align="center" layout="vertical-row" padding="6">
|
||||
<div layout="horizontal-row" width="100%" height="fit">
|
||||
<checkbox id="show_possessed"/>
|
||||
<label height="100%" I18N="In the addons screen, above the list of addons to be installed" text="Show only possessed" word_wrap="true"/>
|
||||
</div>
|
||||
<list id="list_addons" x="0" y="0" width="100%" height="100%" word_wrap="true" alternate_bg="true"/>
|
||||
</box>
|
||||
</div>
|
||||
|
@ -167,6 +167,10 @@ 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);
|
||||
|
||||
// Set the default sort order
|
||||
Addon::setSortOrder(Addon::SO_DEFAULT);
|
||||
loadList();
|
||||
@ -213,11 +217,17 @@ 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");
|
||||
|
||||
// First create a list of sorted entries
|
||||
PtrVector<const Addon, REF> sorted_list;
|
||||
for(unsigned int i=0; i<addons_manager->getNumAddons(); i++)
|
||||
{
|
||||
const Addon & addon = addons_manager->getAddon(i);
|
||||
// Ignore not installed addons if the checkbox is enabled
|
||||
if(w_show_possessed->getState() && !addon.isInstalled())
|
||||
continue;
|
||||
// Ignore addons of a different type
|
||||
if(addon.getType()!=m_type) continue;
|
||||
// Ignore invisible addons
|
||||
@ -453,7 +463,7 @@ void AddonsScreen::eventCallback(GUIEngine::Widget* widget,
|
||||
loadList();
|
||||
}
|
||||
}
|
||||
else if (name == "filter_search")
|
||||
else if (name == "filter_search" || name == "show_possessed")
|
||||
{
|
||||
loadList();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user