GUI: Display last browse path and add button for resetting it

This bumps the theme version.

The primary target is Android where a user may navigate to a location
where there is no read permission which leads to them being stuck.

This option has no effect on those native browse dialogs that do not
use the "browser_lastpath" config setting. Particularly, macOS is
not affected.
This commit is contained in:
Eugene Sandulenko 2021-08-02 17:04:23 +02:00
parent 8b29bf5271
commit 8d8e6765a2
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
20 changed files with 121 additions and 13 deletions

View File

@ -37,7 +37,7 @@
#include "graphics/pixelformat.h"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.48"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.49"
class OSystem;

View File

@ -82,6 +82,7 @@ enum {
kSavePathClearCmd = 'clsp',
kChooseThemeDirCmd = 'chth',
kThemePathClearCmd = 'clth',
kBrowserPathClearCmd = 'clbr',
kChooseExtraDirCmd = 'chex',
kExtraPathClearCmd = 'clex',
kChoosePluginsDirCmd = 'chpl',
@ -1867,6 +1868,8 @@ GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher)
_pluginsPath = nullptr;
_pluginsPathClearButton = nullptr;
#endif
_browserPath = nullptr;
_browserPathClearButton = nullptr;
_curTheme = nullptr;
_guiBasePopUpDesc = nullptr;
_guiBasePopUp = nullptr;
@ -2242,6 +2245,14 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
if (confPath.empty())
confPath = g_system->getDefaultConfigFileName();
new StaticTextWidget(boss, prefix + "ConfigPath", _("ScummVM config path: ") + confPath, confPath);
Common::U32String browserPath = _("<default>");
if (ConfMan.hasKey("browser_lastpath"))
browserPath = ConfMan.get("browser_lastpath");
// I18N: Referring to the last path memorized when adding a game
_browserPath = new StaticTextWidget(boss, prefix + "BrowserPath", _("Last browser path: ") + browserPath, browserPath);
_browserPathClearButton = addClearButton(boss, prefix + "BrowserPathClearButton", kBrowserPathClearCmd);
}
void GlobalOptionsDialog::addMiscControls(GuiObject *boss, const Common::String &prefix, bool lowres) {
@ -2778,6 +2789,12 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
_pluginsPath->setLabel(_c("None", "path"));
break;
#endif
case kBrowserPathClearCmd:
ConfMan.removeKey("browser_lastpath", Common::ConfigManager::kApplicationDomain);
ConfMan.flushToDisk();
_browserPath->setLabel(_("Last browser path: ") + _("<default>"));
break;
#ifdef USE_CLOUD
#ifdef USE_SDL_NET
case kRootPathClearCmd:
@ -3046,6 +3063,11 @@ void GlobalOptionsDialog::reflowLayout() {
_extraPathClearButton->setNext(nullptr);
delete _extraPathClearButton;
_extraPathClearButton = addClearButton(_tabWidget, "GlobalOptions_Paths.ExtraPathClearButton", kExtraPathClearCmd);
_tabWidget->removeWidget(_browserPathClearButton);
_browserPathClearButton->setNext(nullptr);
delete _browserPathClearButton;
_browserPathClearButton = addClearButton(_tabWidget, "GlobalOptions_Paths.BrowserPathClearButton", kBrowserPathClearCmd);
}
_tabWidget->setActiveTab(activeTab);

View File

@ -290,6 +290,8 @@ protected:
StaticTextWidget *_pluginsPath;
ButtonWidget *_pluginsPathClearButton;
#endif
StaticTextWidget *_browserPath;
ButtonWidget *_browserPathClearButton;
void addPathsControls(GuiObject *boss, const Common::String &prefix, bool lowres);

View File

@ -1633,9 +1633,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<widget name='grTouchpadCheckbox' "
"type='Checkbox' "
"/>"
"<widget name='grOnScreenSAFRevokeCheckbox' "
"type='Checkbox' "
"/>"
"<widget name='grSwapMenuAndBackBtnsCheckbox' "
"type='Checkbox' "
"/>"
@ -1952,7 +1949,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"width='Globals.Line.Height' "
"/>"
"</layout>"
"<layout type='horizontal' padding='0,0,0,0' spacing='16'>"
"<layout type='horizontal' padding='0,0,0,0' spacing='10' align='center'>"
"<widget name='PluginsButton' "
"type='Button' "
"/>"
@ -1965,6 +1962,15 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"/>"
"</layout>"
"<widget name='ConfigPath' height='Globals.Line.Height' />"
"<layout type='horizontal' padding='0,0,0,0' spacing='10' align='center'>"
"<widget name='BrowserPath' "
"height='Globals.Line.Height' "
"/>"
"<widget name='BrowserPathClearButton' "
"height='Globals.Line.Height' "
"width='Globals.Line.Height' "
"/>"
"</layout>"
"</layout>"
"</dialog>"
"<dialog name='GlobalOptions_Misc' overlays='Dialog.GlobalOptions.TabWidget'>"
@ -3476,9 +3482,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<widget name='grTouchpadCheckbox' "
"type='Checkbox' "
"/>"
"<widget name='grOnScreenSAFRevokeCheckbox' "
"type='Checkbox' "
"/>"
"<widget name='grSwapMenuAndBackBtnsCheckbox' "
"type='Checkbox' "
"/>"
@ -3807,6 +3810,15 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"/>"
"</layout>"
"<widget name='ConfigPath' height='Globals.Line.Height' />"
"<layout type='horizontal' padding='0,0,0,0' spacing='16'>"
"<widget name='BrowserPath' "
"height='Globals.Line.Height' "
"/>"
"<widget name='BrowserPathClearButton' "
"height='Globals.Line.Height' "
"width='Globals.Line.Height' "
"/>"
"</layout>"
"</layout>"
"</dialog>"
"<dialog name='GlobalOptions_Misc' overlays='Dialog.GlobalOptions.TabWidget'>"

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.48:ResidualVM Modern Theme:No Author]
[SCUMMVM_STX0.8.49:ResidualVM Modern Theme:No Author]

View File

@ -615,6 +615,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>

View File

@ -596,6 +596,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16' align = 'center'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.48:ScummVM Classic Theme:No Author]
[SCUMMVM_STX0.8.49:ScummVM Classic Theme:No Author]

View File

@ -585,7 +585,7 @@
width = 'Globals.Line.Height'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16'>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'PluginsButton'
type = 'Button'
/>
@ -598,6 +598,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>

View File

@ -593,6 +593,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.48:ScummVM Modern Theme:No Author]
[SCUMMVM_STX0.8.49:ScummVM Modern Theme:No Author]

View File

@ -615,6 +615,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>

View File

@ -596,6 +596,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16' align = 'center'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>

Binary file not shown.

View File

@ -1 +1 @@
[SCUMMVM_STX0.8.48:ScummVM Modern Theme Remastered:No Author]
[SCUMMVM_STX0.8.49:ScummVM Modern Theme Remastered:No Author]

View File

@ -617,6 +617,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' align = 'center'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>

View File

@ -598,6 +598,15 @@
/>
</layout>
<widget name = 'ConfigPath' height = 'Globals.Line.Height' />
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16' align = 'center'>
<widget name = 'BrowserPath'
height = 'Globals.Line.Height'
/>
<widget name = 'BrowserPathClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>