GUI: Improve support for group selection in the launcher on small screens

This commit is contained in:
Cameron Cawley 2022-12-23 11:18:10 +00:00 committed by Eugene Sandulenko
parent 9728584687
commit 67a57e945d
9 changed files with 67 additions and 43 deletions

View file

@ -96,20 +96,20 @@ enum {
const GroupingMode groupingModes[] = {
// I18N: Group name for the game list
{"none", _sc("None", "group"), kGroupByNone},
{"none", _sc("None", "group"), nullptr, kGroupByNone},
// I18N: Group name for the game list, grouped by the first letter of the game title
{"initial", _sc("First letter", "group"), kGroupByFirstLetter},
{"initial", _sc("First letter", "group"), _sc("Initial", "group"), kGroupByFirstLetter},
// I18N: Group name for the game list, grouped by game engine
{"engine", _sc("Engine", "group"), kGroupByEngine},
{"engine", _sc("Engine", "group"), nullptr, kGroupByEngine},
// I18N: Group name for the game list, grouped by game series
{"series", _sc("Series", "group"), kGroupBySeries},
{"series", _sc("Series", "group"), nullptr, kGroupBySeries},
// I18N: Group name for the game list, grouped by game publisher
{"company", _sc("Publisher", "group"), kGroupByCompany},
{"company", _sc("Publisher", "group"), nullptr, kGroupByCompany},
// I18N: Group name for the game list, grouped by language
{"language", _sc("Language", "group"), kGroupByLanguage},
{"language", _sc("Language", "group"), nullptr, kGroupByLanguage},
// I18N: Group name for the game list, grouped by game platform
{"platform", _sc("Platform", "group"), kGroupByPlatform},
{nullptr, nullptr, kGroupByNone}
{"platform", _sc("Platform", "group"), nullptr, kGroupByPlatform},
{nullptr, nullptr, nullptr, kGroupByNone}
};
#pragma mark -
@ -206,9 +206,6 @@ LauncherDialog::~LauncherDialog() {
}
void LauncherDialog::build() {
#ifndef DISABLE_FANCY_THEMES
_logo = nullptr;
#ifndef DISABLE_FANCY_THEMES
if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
_grpChooserDesc = nullptr;
@ -217,18 +214,26 @@ void LauncherDialog::build() {
_groupPic->useThemeTransparency(true);
} else
#endif
_grpChooserDesc = new StaticTextWidget(this, Common::String(_title + ".laGroupPopupDesc"), Common::U32String(_("Group by: ")));
_grpChooserDesc = new StaticTextWidget(this, Common::String(_title + ".laGroupPopupDesc"), _("Group:"));
_grpChooserPopup = new PopUpWidget(this, Common::String(_title + ".laGroupPopup"), Common::U32String(_("Select a criteria to group the entries")), kSetGroupMethodCmd);
_grpChooserPopup = new PopUpWidget(this, Common::String(_title + ".laGroupPopup"), _("Select a criteria to group the entries"), kSetGroupMethodCmd);
Common::String grouping = ConfMan.get("grouping");
const GroupingMode *mode = groupingModes;
while (mode->name) {
_grpChooserPopup->appendEntry(_c(mode->description, "group"), mode->id);
if (mode->lowresDescription && g_system->getOverlayWidth() <= 320) {
_grpChooserPopup->appendEntry(_c(mode->lowresDescription, "group"), mode->id);
} else {
_grpChooserPopup->appendEntry(_c(mode->description, "group"), mode->id);
}
if (grouping == mode->name)
_groupBy = mode->id;
++mode;
}
_grpChooserPopup->setSelected(_groupBy);
#ifndef DISABLE_FANCY_THEMES
_logo = nullptr;
if (g_gui.xmlEval()->getVar("Globals.ShowLauncherLogo") == 1 && g_gui.theme()->supportsImages()) {
_logo = new GraphicsWidget(this, _title + ".Logo");
_logo->useThemeTransparency(true);
@ -236,11 +241,9 @@ void LauncherDialog::build() {
new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMVersionDate));
} else
new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMFullVersion));
#else
// Show ScummVM version
new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMFullVersion));
#endif
new StaticTextWidget(this, _title + ".Version", Common::U32String(gScummVMFullVersion));
if (!g_system->hasFeature(OSystem::kFeatureNoQuit))
new ButtonWidget(this, _title + ".QuitButton", _("~Q~uit"), _("Quit ScummVM"), kQuitCmd);
@ -793,7 +796,7 @@ void LauncherDialog::reflowLayout() {
}
if (!_grpChooserDesc)
_grpChooserDesc = new StaticTextWidget(this, _title + ".SearchDesc", _("Group by:"));
_grpChooserDesc = new StaticTextWidget(this, _title + ".SearchDesc", _("Group:"));
if (_groupPic) {
removeWidget(_groupPic);

View file

@ -62,6 +62,11 @@ struct GroupingMode {
*/
const char *description;
/**
* A short human-readable description for the mode.
*/
const char *lowresDescription;
/**
* ID of he mode.
*/

View file

@ -145,30 +145,30 @@
height = 'Globals.Line.Height'
textalign = 'center'
/>
<layout type = 'horizontal' spacing = '5' padding = '0, 0, 2, 2'>
<layout type = 'horizontal' spacing = '2' padding = '0, 0, 0, 0'>
<widget name = 'SearchDesc'
width = '50'
width = '45'
height = 'Globals.Line.Height'
textalign = 'end'
/>
<widget name = 'Search'
width = '150'
height = 'Globals.Line.Height'
/>
<widget name = 'SearchClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
<space size = '2' />
<widget name = 'laGroupPopupDesc'
type = 'OptionsLabel'
width = '40'
height = 'Globals.Line.Height'
textalign = 'end'
/>
<widget name = 'laGroupPopup'
width = '150'
width = '80'
type = 'PopUp'
/>
<space />
<space size = '2' />
<widget name = 'ListSwitch'
height = 'Globals.Button.Height'
width = 'Globals.Button.Height'
@ -215,30 +215,30 @@
height = 'Globals.Line.Height'
textalign = 'center'
/>
<layout type = 'horizontal' spacing = '5' padding = '0, 0, 2, 2'>
<layout type = 'horizontal' spacing = '2' padding = '0, 0, 0, 0'>
<widget name = 'SearchDesc'
width = '50'
width = '45'
height = 'Globals.Line.Height'
textalign = 'end'
/>
<widget name = 'Search'
width = '150'
height = 'Globals.Line.Height'
/>
<widget name = 'SearchClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
<space size = '2' />
<widget name = 'laGroupPopupDesc'
type = 'OptionsLabel'
width = '40'
height = 'Globals.Line.Height'
textalign = 'end'
/>
<widget name = 'laGroupPopup'
width = '150'
width = '80'
type = 'PopUp'
/>
<space />
<space size = '2' />
<widget name = 'ListSwitch'
height = 'Globals.Button.Height'
width = 'Globals.Button.Height'

View file

@ -3449,30 +3449,38 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='Globals.Line.Height' "
"textalign='center' "
"/>"
"<layout type='horizontal' spacing='5' padding='0,0,0,0'>"
"<layout type='horizontal' spacing='2' padding='0,0,0,0'>"
"<widget name='SearchDesc' "
"width='50' "
"width='45' "
"height='Globals.Line.Height' "
"textalign='end' "
"/>"
"<widget name='Search' "
"width='150' "
"height='Globals.Line.Height' "
"/>"
"<widget name='SearchClearButton' "
"height='Globals.Line.Height' "
"width='Globals.Line.Height' "
"/>"
"<space size='2' />"
"<widget name='laGroupPopupDesc' "
"type='OptionsLabel' "
"width='40' "
"height='Globals.Line.Height' "
"textalign='end' "
"/>"
"<widget name='laGroupPopup' "
"width='150' "
"width='80' "
"type='PopUp' "
"/>"
"<space />"
"<space size='2' />"
"<widget name='ListSwitch' "
"height='Globals.Button.Height' "
"width='Globals.Button.Height' "
"/>"
"<widget name='GridSwitch' "
"height='Globals.Button.Height' "
"width='Globals.Button.Height' "
"/>"
"</layout>"
"<widget name='GameList'/>"
"<layout type='horizontal' padding='0,0,0,0' spacing='8'>"

Binary file not shown.

Binary file not shown.

View file

@ -139,30 +139,38 @@
height = 'Globals.Line.Height'
textalign = 'center'
/>
<layout type = 'horizontal' spacing = '5' padding = '0, 0, 0, 0'>
<layout type = 'horizontal' spacing = '2' padding = '0, 0, 0, 0'>
<widget name = 'SearchDesc'
width = '50'
width = '45'
height = 'Globals.Line.Height'
textalign = 'end'
/>
<widget name = 'Search'
width = '150'
height = 'Globals.Line.Height'
/>
<widget name = 'SearchClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
<space size = '2' />
<widget name = 'laGroupPopupDesc'
type = 'OptionsLabel'
width = '40'
height = 'Globals.Line.Height'
textalign = 'end'
/>
<widget name = 'laGroupPopup'
width = '150'
width = '80'
type = 'PopUp'
/>
<space />
<space size = '2' />
<widget name = 'ListSwitch'
height = 'Globals.Button.Height'
width = 'Globals.Button.Height'
/>
<widget name = 'GridSwitch'
height = 'Globals.Button.Height'
width = 'Globals.Button.Height'
/>
</layout>
<widget name = 'GameList'/>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '8'>

Binary file not shown.

Binary file not shown.