[Scummvm-git-logs] scummvm master -> 44bc04e0d94d2cca2c575a05c8be298bf686c371

criezy criezy at scummvm.org
Mon May 28 21:58:31 CEST 2018


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:
44bc04e0d9 GUI: Move UnknownGameDialog to gui


Commit: 44bc04e0d94d2cca2c575a05c8be298bf686c371
    https://github.com/scummvm/scummvm/commit/44bc04e0d94d2cca2c575a05c8be298bf686c371
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2018-05-28T20:55:00+01:00

Commit Message:
GUI: Move UnknownGameDialog to gui

Changed paths:
  A gui/unknown-game-dialog.cpp
  A gui/unknown-game-dialog.h
  R engines/unknown-game-dialog.cpp
  R engines/unknown-game-dialog.h
    engines/module.mk
    gui/launcher.cpp
    gui/module.mk
    po/POTFILES


diff --git a/engines/module.mk b/engines/module.mk
index 6c05921..7849c2f 100644
--- a/engines/module.mk
+++ b/engines/module.mk
@@ -6,8 +6,7 @@ MODULE_OBJS := \
 	engine.o \
 	game.o \
 	obsolete.o \
-	savestate.o \
-	unknown-game-dialog.o
+	savestate.o
 
 # Include common rules
 include $(srcdir)/rules.mk
diff --git a/engines/unknown-game-dialog.cpp b/engines/unknown-game-dialog.cpp
deleted file mode 100644
index 1b7dd73..0000000
--- a/engines/unknown-game-dialog.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "engines/unknown-game-dialog.h"
-
-#include "common/translation.h"
-#include "common/str-array.h"
-#include "common/system.h"
-
-#include "gui/gui-manager.h"
-#include "gui/message.h"
-#include "gui/ThemeEval.h"
-#include "gui/widgets/popup.h"
-
-enum {
-	kCopyToClipboard = 'cpcl',
-	kOpenBugtrackerURL = 'ourl',
-	kClose = 'clse'
-};
-
-UnknownGameDialog::UnknownGameDialog(const DetectionResults &detectionResults) :
-		Dialog(30, 20, 260, 124),
-		_detectionResults(detectionResults) {
-	Common::String reportTranslated = _detectionResults.generateUnknownGameReport(true);
-
-	// Check if we have clipboard functionality and expand the reportTranslated message if needed...
-	if (g_system->hasFeature(OSystem::kFeatureClipboardSupport)) {
-		reportTranslated += "\n";
-		reportTranslated += _("Use the button below to copy the required game information into your clipboard.");
-	}
-
-#if 0
-	// Check if we have support for opening URLs and expand the reportTranslated message if needed...
-	if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
-		reportTranslated += "\n";
-		reportTranslated += _("You can also directly report your game to the Bug Tracker.");
-	}
-#endif
-
-	const int screenW = g_system->getOverlayWidth();
-
-	int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0);
-	int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
-
-	// Calculate the size the dialog needs
-	Common::Array<Common::String> lines;
-	int maxlineWidth = g_gui.getFont().wordWrapText(reportTranslated, screenW - 2 * 20, lines);
-	int lineCount = lines.size() + 1;
-
-	_h =  3 * kLineHeight + lineCount * kLineHeight;
-
-	// Buttons
-	int closeButtonWidth = MAX(buttonWidth, g_gui.getFont().getStringWidth(_("Close")) + 10);
-	int copyToClipboardButtonWidth = MAX(buttonWidth, g_gui.getFont().getStringWidth(_("Copy to clipboard")) + 10);
-	int openBugtrackerURLButtonWidth = MAX(buttonWidth, g_gui.getFont().getStringWidth(_("Report game")) + 10);
-	int totalButtonWidth = closeButtonWidth;
-	if (g_system->hasFeature(OSystem::kFeatureClipboardSupport))
-		totalButtonWidth += 10 + copyToClipboardButtonWidth;
-	if (g_system->hasFeature(OSystem::kFeatureOpenUrl))
-		totalButtonWidth += 10 + openBugtrackerURLButtonWidth;
-
-	_w = MAX(MAX(maxlineWidth, 0), totalButtonWidth) + 20;
-
-	int buttonPos = _w - closeButtonWidth - 10;
-	new GUI::ButtonWidget(this, buttonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Close"), 0, kClose);
-
-	// Check if we have clipboard functionality
-	if (g_system->hasFeature(OSystem::kFeatureClipboardSupport)) {
-		buttonPos -= copyToClipboardButtonWidth + 5;
-		new GUI::ButtonWidget(this, buttonPos, _h - buttonHeight - 8, copyToClipboardButtonWidth, buttonHeight, _("Copy to clipboard"), 0, kCopyToClipboard);
-	}
-
-#if 0
-	// Do not create the button for reporting the game directly to the bugtracker
-	// for now until we find a proper solution for the problem that a change
-	// to our bugtracker system might break the URL generation. A possible approach
-	// for solving this would be to have a ULR under the .scummvm.org (of the type
-	// https://www.scummvm.org/unknowngame?engine=Foo&description=Bar) that would
-	// redirect to whatever our bugtracker system is.
-
-	// Check if we have support for opening URLs
-	if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
-		buttonPos -= openBugtrackerURLButtonWidth + 5;
-		new GUI::ButtonWidget(this, buttonPos, _h - buttonHeight - 8, openBugtrackerURLButtonWidth, buttonHeight, _("Report game"), 0, kOpenBugtrackerURL);
-	}
-#endif
-
-	// Each line is represented by one static text item.
-	// TODO: Use a ScrollContainer widget instead of truncated text.
-	uint y = 10;
-	for (uint i = 0; i < lines.size(); i++) {
-		new GUI::StaticTextWidget(this, 10, y, _w, kLineHeight, lines[i], Graphics::kTextAlignLeft);
-		y += kLineHeight;
-	}
-}
-
-void UnknownGameDialog::reflowLayout() {
-	_x = (g_system->getOverlayWidth() - _w) / 2;
-	_y = (g_system->getOverlayHeight() - _h) / 2;
-	GUI::Dialog::reflowLayout();
-}
-
-Common::String UnknownGameDialog::generateBugtrackerURL() {
-	// TODO: Remove the filesystem path from the bugtracker report
-	Common::String report = _detectionResults.generateUnknownGameReport(false);
-
-	// Formatting the report for bugtracker submission [replace line breaks]...
-	while (report.contains("\n")) {
-		Common::replace(report, "\n", "%0A");
-	}
-
-	return Common::String::format(
-		"https://bugs.scummvm.org/newticket?"
-		"&description=%s"
-		"&type=enhancement"
-		"&keywords=unknown-game",
-		report.c_str());
-}
-
-void UnknownGameDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
-	switch(cmd) {
-	case kCopyToClipboard: {
-		// TODO: Remove the filesystem path from the report
-		Common::String report = _detectionResults.generateUnknownGameReport(false);
-
-		if (g_system->setTextInClipboard(report)) {
-			g_system->displayMessageOnOSD(
-					_("All necessary information about your game has been copied into the clipboard"));
-		} else {
-			g_system->displayMessageOnOSD(_("Copying the game information to the clipboard has failed!"));
-		}
-		break;
-	}
-	case kClose:
-		// When the detection entry comes from the fallback detector, the game can be added / launched anyways.
-		// TODO: Add a button to cancel adding the game. And make it clear that launching the game may not work properly.
-		close();
-		break;
-	case kOpenBugtrackerURL:
-		g_system->openUrl(generateBugtrackerURL());
-		break;
-	}
-}
diff --git a/engines/unknown-game-dialog.h b/engines/unknown-game-dialog.h
deleted file mode 100644
index 0878406..0000000
--- a/engines/unknown-game-dialog.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "gui/dialog.h"
-
-#include "engines/metaengine.h"
-
-class UnknownGameDialog : public GUI::Dialog {
-public:
-	UnknownGameDialog(const DetectionResults &detectionResults);
-
-private:
-	// Dialog API
-	void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
-	void reflowLayout() override;
-
-	Common::String generateBugtrackerURL();
-
-	const DetectionResults &_detectionResults;
-};
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 7a37a7d..214dc30 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -45,7 +45,7 @@
 #include "gui/EventRecorder.h"
 #endif
 #include "gui/saveload.h"
-#include "engines/unknown-game-dialog.h"
+#include "gui/unknown-game-dialog.h"
 #include "gui/widgets/edittext.h"
 #include "gui/widgets/list.h"
 #include "gui/widgets/tab.h"
diff --git a/gui/module.mk b/gui/module.mk
index eb3ee88..0218e08 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -25,6 +25,7 @@ MODULE_OBJS := \
 	ThemeLayout.o \
 	ThemeParser.o \
 	Tooltip.o \
+	unknown-game-dialog.o \
 	animation/Animation.o \
 	animation/RepeatAnimationWrapper.o \
 	animation/SequenceAnimationComposite.o \
diff --git a/gui/unknown-game-dialog.cpp b/gui/unknown-game-dialog.cpp
new file mode 100644
index 0000000..01526d2
--- /dev/null
+++ b/gui/unknown-game-dialog.cpp
@@ -0,0 +1,166 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "gui/unknown-game-dialog.h"
+
+#include "common/translation.h"
+#include "common/str-array.h"
+#include "common/system.h"
+
+#include "gui/gui-manager.h"
+#include "gui/message.h"
+#include "gui/ThemeEval.h"
+#include "gui/widgets/popup.h"
+
+namespace GUI {
+
+enum {
+	kCopyToClipboard = 'cpcl',
+	kOpenBugtrackerURL = 'ourl',
+	kClose = 'clse'
+};
+
+UnknownGameDialog::UnknownGameDialog(const DetectionResults &detectionResults) :
+		Dialog(30, 20, 260, 124),
+		_detectionResults(detectionResults) {
+	Common::String reportTranslated = _detectionResults.generateUnknownGameReport(true);
+
+	// Check if we have clipboard functionality and expand the reportTranslated message if needed...
+	if (g_system->hasFeature(OSystem::kFeatureClipboardSupport)) {
+		reportTranslated += "\n";
+		reportTranslated += _("Use the button below to copy the required game information into your clipboard.");
+	}
+
+#if 0
+	// Check if we have support for opening URLs and expand the reportTranslated message if needed...
+	if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
+		reportTranslated += "\n";
+		reportTranslated += _("You can also directly report your game to the Bug Tracker.");
+	}
+#endif
+
+	const int screenW = g_system->getOverlayWidth();
+
+	int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0);
+	int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
+
+	// Calculate the size the dialog needs
+	Common::Array<Common::String> lines;
+	int maxlineWidth = g_gui.getFont().wordWrapText(reportTranslated, screenW - 2 * 20, lines);
+	int lineCount = lines.size() + 1;
+
+	_h =  3 * kLineHeight + lineCount * kLineHeight;
+
+	// Buttons
+	int closeButtonWidth = MAX(buttonWidth, g_gui.getFont().getStringWidth(_("Close")) + 10);
+	int copyToClipboardButtonWidth = MAX(buttonWidth, g_gui.getFont().getStringWidth(_("Copy to clipboard")) + 10);
+	int openBugtrackerURLButtonWidth = MAX(buttonWidth, g_gui.getFont().getStringWidth(_("Report game")) + 10);
+	int totalButtonWidth = closeButtonWidth;
+	if (g_system->hasFeature(OSystem::kFeatureClipboardSupport))
+		totalButtonWidth += 10 + copyToClipboardButtonWidth;
+	if (g_system->hasFeature(OSystem::kFeatureOpenUrl))
+		totalButtonWidth += 10 + openBugtrackerURLButtonWidth;
+
+	_w = MAX(MAX(maxlineWidth, 0), totalButtonWidth) + 20;
+
+	int buttonPos = _w - closeButtonWidth - 10;
+	new ButtonWidget(this, buttonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, _("Close"), 0, kClose);
+
+	// Check if we have clipboard functionality
+	if (g_system->hasFeature(OSystem::kFeatureClipboardSupport)) {
+		buttonPos -= copyToClipboardButtonWidth + 5;
+		new ButtonWidget(this, buttonPos, _h - buttonHeight - 8, copyToClipboardButtonWidth, buttonHeight, _("Copy to clipboard"), 0, kCopyToClipboard);
+	}
+
+#if 0
+	// Do not create the button for reporting the game directly to the bugtracker
+	// for now until we find a proper solution for the problem that a change
+	// to our bugtracker system might break the URL generation. A possible approach
+	// for solving this would be to have a ULR under the .scummvm.org (of the type
+	// https://www.scummvm.org/unknowngame?engine=Foo&description=Bar) that would
+	// redirect to whatever our bugtracker system is.
+
+	// Check if we have support for opening URLs
+	if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
+		buttonPos -= openBugtrackerURLButtonWidth + 5;
+		new ButtonWidget(this, buttonPos, _h - buttonHeight - 8, openBugtrackerURLButtonWidth, buttonHeight, _("Report game"), 0, kOpenBugtrackerURL);
+	}
+#endif
+
+	// Each line is represented by one static text item.
+	// TODO: Use a ScrollContainer widget instead of truncated text.
+	uint y = 10;
+	for (uint i = 0; i < lines.size(); i++) {
+		new StaticTextWidget(this, 10, y, _w, kLineHeight, lines[i], Graphics::kTextAlignLeft);
+		y += kLineHeight;
+	}
+}
+
+void UnknownGameDialog::reflowLayout() {
+	_x = (g_system->getOverlayWidth() - _w) / 2;
+	_y = (g_system->getOverlayHeight() - _h) / 2;
+	Dialog::reflowLayout();
+}
+
+Common::String UnknownGameDialog::generateBugtrackerURL() {
+	// TODO: Remove the filesystem path from the bugtracker report
+	Common::String report = _detectionResults.generateUnknownGameReport(false);
+
+	// Formatting the report for bugtracker submission [replace line breaks]...
+	while (report.contains("\n")) {
+		Common::replace(report, "\n", "%0A");
+	}
+
+	return Common::String::format(
+		"https://bugs.scummvm.org/newticket?"
+		"&description=%s"
+		"&type=enhancement"
+		"&keywords=unknown-game",
+		report.c_str());
+}
+
+void UnknownGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+	switch(cmd) {
+	case kCopyToClipboard: {
+		// TODO: Remove the filesystem path from the report
+		Common::String report = _detectionResults.generateUnknownGameReport(false);
+
+		if (g_system->setTextInClipboard(report)) {
+			g_system->displayMessageOnOSD(
+					_("All necessary information about your game has been copied into the clipboard"));
+		} else {
+			g_system->displayMessageOnOSD(_("Copying the game information to the clipboard has failed!"));
+		}
+		break;
+	}
+	case kClose:
+		// When the detection entry comes from the fallback detector, the game can be added / launched anyways.
+		// TODO: Add a button to cancel adding the game. And make it clear that launching the game may not work properly.
+		close();
+		break;
+	case kOpenBugtrackerURL:
+		g_system->openUrl(generateBugtrackerURL());
+		break;
+	}
+}
+
+} // End of namespace GUI
diff --git a/gui/unknown-game-dialog.h b/gui/unknown-game-dialog.h
new file mode 100644
index 0000000..f7f9d5c
--- /dev/null
+++ b/gui/unknown-game-dialog.h
@@ -0,0 +1,48 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GUI_UNKNOWN_GAME_DIALOG_H
+#define GUI_UNKNOWN_GAME_DIALOG_H
+
+#include "gui/dialog.h"
+
+#include "engines/game.h"
+
+namespace GUI {
+
+class UnknownGameDialog : public Dialog {
+public:
+	UnknownGameDialog(const DetectionResults &detectionResults);
+
+private:
+	// Dialog API
+	void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+	void reflowLayout() override;
+
+	Common::String generateBugtrackerURL();
+
+	const DetectionResults &_detectionResults;
+};
+
+} // End of namespace GUI
+
+#endif
diff --git a/po/POTFILES b/po/POTFILES
index 451db74..dc427a2 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -23,6 +23,7 @@ gui/saveload-dialog.cpp
 gui/storagewizarddialog.cpp
 gui/themebrowser.cpp
 gui/ThemeEngine.cpp
+gui/unknown-game-dialog.cpp
 gui/updates-dialog.cpp
 gui/widget.cpp
 
@@ -35,7 +36,6 @@ common/updates.cpp
 engines/advancedDetector.cpp
 engines/dialogs.cpp
 engines/engine.cpp
-engines/unknown-game-dialog.cpp
 
 audio/adlib.cpp
 audio/fmopl.cpp





More information about the Scummvm-git-logs mailing list