aboutsummaryrefslogtreecommitdiff
path: root/gui/saveload-dialog.cpp
diff options
context:
space:
mode:
authorDavid Fioramonti2018-07-07 02:12:33 -0700
committerThierry Crozat2018-07-09 21:31:23 +0100
commit81e0fa37ffaa4d711c7d5727e2b6caa969808bd0 (patch)
tree5aaa6e8f4ed965e183dffc0d34d554bfc70721e4 /gui/saveload-dialog.cpp
parentc2476703ade6662e97260ee4f62194b56bd44622 (diff)
downloadscummvm-rg350-81e0fa37ffaa4d711c7d5727e2b6caa969808bd0.tar.gz
scummvm-rg350-81e0fa37ffaa4d711c7d5727e2b6caa969808bd0.tar.bz2
scummvm-rg350-81e0fa37ffaa4d711c7d5727e2b6caa969808bd0.zip
GUI: Show saveload date/time, or playtime even if thumbnail not enabled
Previously, if playtime or date/time support was added it would not be displayed unless thumbnail support was also valid. Now they will be shown even if the thumbnail is not valid. No container is shown if only metainfo support is enabled.
Diffstat (limited to 'gui/saveload-dialog.cpp')
-rw-r--r--gui/saveload-dialog.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 8d59a6318a..2702cbe31b 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -463,13 +463,14 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin
}
void SaveLoadChooserSimple::reflowLayout() {
- if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && _thumbnailSupport) {
+ if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && (_thumbnailSupport || _saveDateSupport || _playTimeSupport)) {
int16 x, y;
uint16 w, h;
if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h))
error("Error when loading position data for Save/Load Thumbnails");
+ // Even if there is no thumbnail support, getWidgetData() will provide default thumbnail values
int thumbW = kThumbnailWidth;
int thumbH = kThumbnailHeight2;
int thumbX = x + (w >> 1) - (thumbW >> 1);
@@ -483,28 +484,40 @@ void SaveLoadChooserSimple::reflowLayout() {
if (textLines > 0)
textLines++; // add a line of padding at the bottom
- _container->resize(x, y, w, h + (kLineHeight * textLines));
- _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH);
+ if (_thumbnailSupport) {
+ _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH);
+ _gfxWidget->setVisible(true);
+ } else {
+ // choose sensible values for displaying playtime and date/time when a thumbnail is not being used
+ thumbH = 0;
+ thumbY = y;
+ h = kLineHeight;
+ _gfxWidget->setVisible(false);
+ }
int height = thumbY + thumbH + kLineHeight;
if (_saveDateSupport) {
- _date->resize(thumbX, height, kThumbnailWidth, kLineHeight);
+ _date->resize(thumbX, height, thumbW, kLineHeight);
height += kLineHeight;
- _time->resize(thumbX, height, kThumbnailWidth, kLineHeight);
+ _time->resize(thumbX, height, thumbW, kLineHeight);
height += kLineHeight;
+ _date->setVisible(_saveDateSupport);
+ _time->setVisible(_saveDateSupport);
+ } else {
+ _date->setVisible(false);
+ _time->setVisible(false);
}
- if (_playTimeSupport)
- _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight);
+ if (_playTimeSupport) {
+ _playtime->resize(thumbX, height, thumbW, kLineHeight);
+ _playtime->setVisible(_playTimeSupport);
+ } else {
+ _playtime->setVisible(false);
+ }
+ _container->resize(x, y, w, h + (kLineHeight * textLines));
_container->setVisible(true);
- _gfxWidget->setVisible(true);
-
- _date->setVisible(_saveDateSupport);
- _time->setVisible(_saveDateSupport);
-
- _playtime->setVisible(_playTimeSupport);
updateSelection(false);
} else {