mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-13 04:00:29 +00:00
GUI: Do not show groups when only "ALL" is present in the grouped list
This commit is contained in:
parent
3011084703
commit
a497d25640
@ -1009,6 +1009,7 @@ void LauncherSimple::updateListing() {
|
||||
void LauncherSimple::groupEntries(const Array<const Common::ConfigManager::Domain *> &metadata) {
|
||||
U32StringArray attrs;
|
||||
Common::StringMap metadataNames;
|
||||
_list->setGroupsVisibility(true);
|
||||
switch (_groupBy) {
|
||||
case kGroupByFirstLetter: {
|
||||
for (uint i = 0; i < metadata.size(); ++i) {
|
||||
@ -1095,10 +1096,7 @@ void LauncherSimple::groupEntries(const Array<const Common::ConfigManager::Domai
|
||||
}
|
||||
case kGroupByNone: // Fall-through intentional
|
||||
default:
|
||||
for (uint i = 0; i < metadata.size(); ++i) {
|
||||
attrs.push_back(String("All"));
|
||||
}
|
||||
_list->setGroupHeaderFormat(U32String(""), U32String(""));
|
||||
_list->setGroupsVisibility(false);
|
||||
break;
|
||||
}
|
||||
_list->setMetadataNames(metadataNames);
|
||||
|
@ -32,14 +32,14 @@
|
||||
#include "gui/ThemeEval.h"
|
||||
|
||||
#define kGroupTag -2
|
||||
#define isGroupHeader(x) (x <= kGroupTag)
|
||||
#define isGroupHeader(x) (_groupsVisible && ((x) <= kGroupTag))
|
||||
#define indexToGroupID(x) (kGroupTag - x)
|
||||
|
||||
namespace GUI {
|
||||
|
||||
GroupedListWidget::GroupedListWidget(Dialog *boss, const String &name, const Common::U32String &tooltip, uint32 cmd)
|
||||
: ListWidget(boss, name, tooltip, cmd) {
|
||||
|
||||
_groupsVisible = true;
|
||||
}
|
||||
|
||||
void GroupedListWidget::setList(const U32StringArray &list, const ColorList *colors) {
|
||||
@ -161,16 +161,19 @@ void GroupedListWidget::sortGroups() {
|
||||
}
|
||||
uint groupID = _groupValueIndex[header];
|
||||
|
||||
_listColors.insert_at(curListSize, ThemeEngine::kFontColorNormal);
|
||||
_listIndex.push_back(kGroupTag - groupID);
|
||||
if (_groupsVisible) {
|
||||
_listColors.insert_at(curListSize, ThemeEngine::kFontColorNormal);
|
||||
_listIndex.push_back(kGroupTag - groupID);
|
||||
|
||||
displayedHeader.toUppercase();
|
||||
|
||||
_list.push_back(_groupHeaderPrefix + displayedHeader + _groupHeaderSuffix);
|
||||
++curListSize;
|
||||
}
|
||||
|
||||
displayedHeader.toUppercase();
|
||||
_list.push_back(_groupHeaderPrefix + displayedHeader + _groupHeaderSuffix);
|
||||
++curListSize;
|
||||
|
||||
if (_groupExpanded[groupID]) {
|
||||
for (int *k = _itemsInGroup[groupID].begin(); k != _itemsInGroup[groupID].end(); ++k) {
|
||||
_list.push_back(Common::U32String(" ") + _dataList[*k]);
|
||||
_list.push_back(Common::U32String(_groupsVisible ? " " : "") + _dataList[*k]);
|
||||
_listIndex.push_back(*k);
|
||||
++curListSize;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ protected:
|
||||
U32StringArray _attributeValues;
|
||||
Common::StringMap _metadataNames;
|
||||
Common::HashMap<int, Common::Array<int> > _itemsInGroup;
|
||||
bool _groupsVisible;
|
||||
|
||||
public:
|
||||
GroupedListWidget(Dialog *boss, const String &name, const Common::U32String &tooltip = Common::U32String(), uint32 cmd = 0);
|
||||
@ -67,6 +68,8 @@ public:
|
||||
|
||||
void reflowLayout() override;
|
||||
|
||||
void setGroupsVisibility(bool val) { _groupsVisible = val; }
|
||||
|
||||
protected:
|
||||
void sortGroups();
|
||||
void toggleGroup(int groupID);
|
||||
|
Loading…
x
Reference in New Issue
Block a user