[Scummvm-git-logs] scummvm master -> 4182c50a92822fb21d2582e2293068777a7ccc15

bgK bastien.bouclet at gmail.com
Sun Jan 5 07:35:23 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4182c50a92 GUI: Fix the SaveLoadDialog with the lowres layouts


Commit: 4182c50a92822fb21d2582e2293068777a7ccc15
    https://github.com/scummvm/scummvm/commit/4182c50a92822fb21d2582e2293068777a7ccc15
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-01-05T08:34:24+01:00

Commit Message:
GUI: Fix the SaveLoadDialog with the lowres layouts

The thumbnail layout element is not available in the lowres layouts.
Issue introduced by c0d8b6d9fc73abc8de4575686e0776e3468d37b2.

Fixes #11304.

Changed paths:
    gui/saveload-dialog.cpp
    gui/saveload-dialog.h


diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index cca3a4d..d300e91 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -372,7 +372,8 @@ enum {
 };
 
 SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &buttonLabel, bool saveMode)
-	: SaveLoadChooserDialog("SaveLoadChooser", saveMode), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0)  {
+	: SaveLoadChooserDialog("SaveLoadChooser", saveMode), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0),
+	_container(0) {
 	_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
 
 	new StaticTextWidget(this, "SaveLoadChooser.Title", title);
@@ -398,7 +399,18 @@ SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &
 
 	_delSupport = _metaInfoSupport = _thumbnailSupport = false;
 
-	_container = new ContainerWidget(this, "SaveLoadChooser.Thumbnail");
+	addThumbnailContainer();
+}
+
+void SaveLoadChooserSimple::addThumbnailContainer() {
+	// When switching layouts, create / remove the thumbnail container as needed
+	if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && !_container) {
+		_container = new ContainerWidget(this, "SaveLoadChooser.Thumbnail");
+	} else if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 0 && _container) {
+		removeWidget(_container);
+		delete _container;
+		_container = nullptr;
+	}
 }
 
 int SaveLoadChooserSimple::runIntern() {
@@ -471,6 +483,8 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin
 }
 
 void SaveLoadChooserSimple::reflowLayout() {
+	addThumbnailContainer();
+
 	SaveLoadChooserDialog::reflowLayout();
 
 	if (g_gui.xmlEval()->getVar("Globals.SaveLoadChooser.ExtInfo.Visible") == 1 && (_thumbnailSupport || _saveDateSupport || _playTimeSupport)) {
@@ -531,7 +545,7 @@ void SaveLoadChooserSimple::reflowLayout() {
 
 		updateSelection(false);
 	} else {
-		_container->setVisible(false);
+		if (_container) _container->setVisible(false);
 		_gfxWidget->setVisible(false);
 		_date->setVisible(false);
 		_time->setVisible(false);
diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h
index 43721aa..b4820ff 100644
--- a/gui/saveload-dialog.h
+++ b/gui/saveload-dialog.h
@@ -164,6 +164,7 @@ private:
 
 	String					_resultString;
 
+	void addThumbnailContainer();
 	void updateSelection(bool redraw);
 };
 




More information about the Scummvm-git-logs mailing list