[Scummvm-git-logs] scummvm master -> 7bbd62e846ba63731f8a197951b21ddfc7a93b80
sev-
noreply at scummvm.org
Sun May 14 20:47:26 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f96eb9a7f1 GUI: Dump .png files of launcher to check UI for various translations
7bbd62e846 GUI: Add message and about dialogs to dumpAllDialogs()
Commit: f96eb9a7f1047f15d47afa78defa8b580154352a
https://github.com/scummvm/scummvm/commit/f96eb9a7f1047f15d47afa78defa8b580154352a
Author: Abhinav Chennubhotla (51199011+PhoenixFlame101 at users.noreply.github.com)
Date: 2023-05-14T22:47:22+02:00
Commit Message:
GUI: Dump .png files of launcher to check UI for various translations
- Each resolution needs to be cycled manually in the code, default is
800x640.
- Dumps .png files in a snapshots folder for all languages at a given
resolution.
TODO:
- Cycle resolutions automatically through code.
- Add more dialogs to the dumper.
Changed paths:
A gui/dump-all-dialogs.cpp
A gui/dump-all-dialogs.h
.gitignore
gui/module.mk
diff --git a/.gitignore b/.gitignore
index b33ad8edfbd..151b5e3b359 100644
--- a/.gitignore
+++ b/.gitignore
@@ -173,6 +173,8 @@ project.xcworkspace
/devtools/qtable/qtable
/devtools/skycpt/skycpt
+/snapshots
+
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
diff --git a/gui/dump-all-dialogs.cpp b/gui/dump-all-dialogs.cpp
new file mode 100644
index 00000000000..a4bf287d97a
--- /dev/null
+++ b/gui/dump-all-dialogs.cpp
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "gui/dump-all-dialogs.h"
+
+#include "common/file.h"
+#include "common/fs.h"
+#include "common/language.h"
+#include "common/translation.h"
+
+#include "gui/ThemeEngine.h"
+#include "gui/gui-manager.h"
+#include "gui/launcher.h"
+
+#include "image/png.h"
+
+namespace GUI {
+
+void saveGUISnapshot(Graphics::Surface surf, const Common::String &filename) {
+ Common::DumpFile outFile;
+ Common::String outName = Common::String::format("snapshots/%s", filename.c_str());
+
+ if (outFile.open(outName)) {
+ Image::writePNG(outFile, surf);
+ outFile.finalize();
+ outFile.close();
+ }
+}
+
+void dumpDialogs(const Common::String &dialogName, int res, const Common::String &lang) {
+ // Update GUI language
+ TransMan.setLanguage(lang);
+
+ // Update resolution
+ ConfMan.setInt("last_window_width", res, Common::ConfigManager::kApplicationDomain);
+ ConfMan.setInt("last_window_height", 600, Common::ConfigManager::kApplicationDomain);
+ g_system->initSize(res, 600);
+
+ Graphics::Surface surf;
+ surf.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat());
+
+ // LauncherDialog
+ GUI::LauncherChooser chooser;
+ chooser.selectLauncher();
+ chooser.runModal();
+ g_system->grabOverlay(surf);
+
+ Common::String filename = Common::String::format("%d-%s.png", res, lang.c_str());
+ saveGUISnapshot(surf, filename);
+}
+
+void dumpAllDialogs() {
+ auto originalLang = TransMan.getCurrentLanguage();
+ int original_window_width = ConfMan.getInt("last_window_width", Common::ConfigManager::kApplicationDomain);
+ int original_window_height = ConfMan.getInt("last_window_height", Common::ConfigManager::kApplicationDomain);
+ Common::List<Common::String> list = Common::getLanguageList();
+
+ Common::FSNode dumpDir("snapshots");
+ if (!dumpDir.isDirectory())
+ dumpDir.createDirectory();
+
+ // Iterate through all languages available
+ for (Common::String lang : list) {
+ // Iterating through the resolutions doesn't work so you have to manually change it here.
+ // TODO: Find a way to iterate through the resolutions using code.
+ Common::Array<int> res_to_test = {800, 640, 320};
+ dumpDialogs("test", res_to_test[0], lang);
+ }
+
+ TransMan.setLanguage(originalLang);
+ ConfMan.setInt("last_window_width", original_window_width, Common::ConfigManager::kApplicationDomain);
+ ConfMan.setInt("last_window_height", original_window_height, Common::ConfigManager::kApplicationDomain);
+ g_system->initSize(original_window_width, original_window_height);
+}
+
+} // End of namespace GUI
diff --git a/gui/dump-all-dialogs.h b/gui/dump-all-dialogs.h
new file mode 100644
index 00000000000..b1c89e05690
--- /dev/null
+++ b/gui/dump-all-dialogs.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef GUI_DUMP_ALL_DIALOGS_H
+#define GUI_DUMP_ALL_DIALOGS_H
+
+#include "common/str.h"
+#include "graphics/surface.h"
+
+namespace GUI {
+
+void saveGUISnapshot(Graphics::Surface surf, const Common::String &filename);
+void dumpDialogs(const Common::String &dialogName, int resolution, const Common::String &lang);
+void dumpAllDialogs();
+
+} // End of namespace GUI
+
+#endif // GUI_DUMP_ALL_DIALOGS_H
diff --git a/gui/module.mk b/gui/module.mk
index 4edf3dcd4ca..0c16927c1d7 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
console.o \
debugger.o \
dialog.o \
+ dump-all-dialogs.o \
editgamedialog.o \
error.o \
EventRecorder.o \
Commit: 7bbd62e846ba63731f8a197951b21ddfc7a93b80
https://github.com/scummvm/scummvm/commit/7bbd62e846ba63731f8a197951b21ddfc7a93b80
Author: Abhinav Chennubhotla (51199011+PhoenixFlame101 at users.noreply.github.com)
Date: 2023-05-14T22:47:22+02:00
Commit Message:
GUI: Add message and about dialogs to dumpAllDialogs()
- Add arguement message with default arguement "test"
- Create separate .png files for all dialogs
Changed paths:
gui/dump-all-dialogs.cpp
gui/dump-all-dialogs.h
diff --git a/gui/dump-all-dialogs.cpp b/gui/dump-all-dialogs.cpp
index a4bf287d97a..3ed5c2ed4e6 100644
--- a/gui/dump-all-dialogs.cpp
+++ b/gui/dump-all-dialogs.cpp
@@ -27,8 +27,10 @@
#include "common/translation.h"
#include "gui/ThemeEngine.h"
+#include "gui/about.h"
#include "gui/gui-manager.h"
#include "gui/launcher.h"
+#include "gui/message.h"
#include "image/png.h"
@@ -45,7 +47,7 @@ void saveGUISnapshot(Graphics::Surface surf, const Common::String &filename) {
}
}
-void dumpDialogs(const Common::String &dialogName, int res, const Common::String &lang) {
+void dumpDialogs(const Common::String &message, int res, const Common::String &lang) {
// Update GUI language
TransMan.setLanguage(lang);
@@ -57,17 +59,34 @@ void dumpDialogs(const Common::String &dialogName, int res, const Common::String
Graphics::Surface surf;
surf.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat());
+ Common::String filename = Common::String::format("%d-%s.png", res, lang.c_str());
+
+ // MessageDialog
+ GUI::MessageDialog messageDialog(message);
+ messageDialog.runModal(); // For rendering
+ messageDialog.reflowLayout(); // For updating surface
+ g_gui.redrawFull();
+ g_system->grabOverlay(surf);
+ saveGUISnapshot(surf, "message-" + filename);
+
+ // AboutDialog
+ GUI::AboutDialog aboutDialog;
+ aboutDialog.runModal(); // For rendering
+ aboutDialog.reflowLayout(); // For updating surface
+ g_gui.redrawFull();
+ g_system->grabOverlay(surf);
+ saveGUISnapshot(surf, "about-" + filename);
+ aboutDialog.close();
+
// LauncherDialog
GUI::LauncherChooser chooser;
chooser.selectLauncher();
chooser.runModal();
g_system->grabOverlay(surf);
-
- Common::String filename = Common::String::format("%d-%s.png", res, lang.c_str());
- saveGUISnapshot(surf, filename);
+ saveGUISnapshot(surf, "launcher-" + filename);
}
-void dumpAllDialogs() {
+void dumpAllDialogs(const Common::String &message) {
auto originalLang = TransMan.getCurrentLanguage();
int original_window_width = ConfMan.getInt("last_window_width", Common::ConfigManager::kApplicationDomain);
int original_window_height = ConfMan.getInt("last_window_height", Common::ConfigManager::kApplicationDomain);
@@ -82,7 +101,7 @@ void dumpAllDialogs() {
// Iterating through the resolutions doesn't work so you have to manually change it here.
// TODO: Find a way to iterate through the resolutions using code.
Common::Array<int> res_to_test = {800, 640, 320};
- dumpDialogs("test", res_to_test[0], lang);
+ dumpDialogs(message, res_to_test[0], lang);
}
TransMan.setLanguage(originalLang);
diff --git a/gui/dump-all-dialogs.h b/gui/dump-all-dialogs.h
index b1c89e05690..154a60ea269 100644
--- a/gui/dump-all-dialogs.h
+++ b/gui/dump-all-dialogs.h
@@ -28,8 +28,8 @@
namespace GUI {
void saveGUISnapshot(Graphics::Surface surf, const Common::String &filename);
-void dumpDialogs(const Common::String &dialogName, int resolution, const Common::String &lang);
-void dumpAllDialogs();
+void dumpDialogs(const Common::String &message, int resolution, const Common::String &lang);
+void dumpAllDialogs(const Common::String &message = "test");
} // End of namespace GUI
More information about the Scummvm-git-logs
mailing list