[Scummvm-git-logs] scummvm master -> 74577f98922fb7b349de4481cb4ce5458a37960f
criezy
criezy at scummvm.org
Sat Apr 27 03:44:19 CEST 2019
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:
40c9930699 ENGINES: Add function in DetectionResults to get list of engines with an unknown variants
74577f9892 GUI: Update code to access the bug tracker in the unknown game dialog
Commit: 40c9930699ab0ee3fc84e40800eb50794c9d93ff
https://github.com/scummvm/scummvm/commit/40c9930699ab0ee3fc84e40800eb50794c9d93ff
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2019-04-27T02:34:48+01:00
Commit Message:
ENGINES: Add function in DetectionResults to get list of engines with an unknown variants
Changed paths:
engines/game.cpp
engines/game.h
diff --git a/engines/game.cpp b/engines/game.cpp
index ee14acf..bb5f4ae 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -142,7 +142,7 @@ bool DetectionResults::foundUnknownGames() const {
return false;
}
-DetectedGames DetectionResults::listRecognizedGames() {
+DetectedGames DetectionResults::listRecognizedGames() const {
DetectedGames candidates;
for (uint i = 0; i < _detectedGames.size(); i++) {
if (_detectedGames[i].canBeAdded) {
@@ -214,3 +214,18 @@ Common::String DetectionResults::generateUnknownGameReport(bool translate, uint3
return report;
}
+
+Common::StringArray DetectionResults::getUnknownGameEngines() const {
+ Common::StringArray engines;
+ const char *currentEngineName = nullptr;
+ for (uint i = 0; i < _detectedGames.size(); i++) {
+ const DetectedGame &game = _detectedGames[i];
+ if (!game.hasUnknownFiles)
+ continue;
+ if (!currentEngineName || strcmp(currentEngineName, game.engineName) != 0) {
+ currentEngineName = game.engineName;
+ engines.push_back(Common::String(currentEngineName));
+ }
+ }
+ return engines;
+}
diff --git a/engines/game.h b/engines/game.h
index 304166d..fcaae62 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -26,6 +26,7 @@
#include "common/array.h"
#include "common/hash-str.h"
#include "common/str.h"
+#include "common/str-array.h"
#include "common/language.h"
#include "common/platform.h"
@@ -198,7 +199,7 @@ public:
*
* Recognized games can be added to the configuration manager and then launched.
*/
- DetectedGames listRecognizedGames();
+ DetectedGames listRecognizedGames() const;
/**
* Were unknown game variants found by the engines?
@@ -216,6 +217,11 @@ public:
*/
Common::String generateUnknownGameReport(bool translate, uint32 wordwrapAt = 0) const;
+ /**
+ * Get the list of engines for which an unknown game variant was found.
+ */
+ Common::StringArray getUnknownGameEngines() const;
+
private:
DetectedGames _detectedGames;
};
Commit: 74577f98922fb7b349de4481cb4ce5458a37960f
https://github.com/scummvm/scummvm/commit/74577f98922fb7b349de4481cb4ce5458a37960f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2019-04-27T02:42:16+01:00
Commit Message:
GUI: Update code to access the bug tracker in the unknown game dialog
The code is still disabled, but it is now in a working state and
can be tested by removing the #if 0 and changing the URL to a test
server with a redirect rule.
Changed paths:
gui/unknown-game-dialog.cpp
gui/unknown-game-dialog.h
diff --git a/gui/unknown-game-dialog.cpp b/gui/unknown-game-dialog.cpp
index ecea160..a96370a 100644
--- a/gui/unknown-game-dialog.cpp
+++ b/gui/unknown-game-dialog.cpp
@@ -63,13 +63,7 @@ UnknownGameDialog::UnknownGameDialog(const DetectionResults &detectionResults) :
//Check if we have support for opening URLs
if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
- buttonPos -= openBugtrackerURLButtonWidth + 5;
_openBugTrackerUrlButton = new ButtonWidget(this, 0, 0, 0, 0, _("Report game"), 0, kOpenBugtrackerURL);
- //Formatting the reportData for bugtracker submission [replace line breaks]...
- _bugtrackerGameData = _reportData;
- while (_bugtrackerGameData.contains("\n")) {
- Common::replace(_bugtrackerGameData, "\n", "%0A");
- }
} else
#endif
_openBugTrackerUrlButton = nullptr;
@@ -113,7 +107,6 @@ void UnknownGameDialog::rebuild() {
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)) {
@@ -174,21 +167,47 @@ void UnknownGameDialog::rebuild() {
}
}
+void UnknownGameDialog::encodeUrlString(Common::String& string) {
+ // First we need to replace the literal %
+ for (uint c = 0 ; c < string.size() ; ++c) {
+ if (string[c] == '%') {
+ string.replace(c, 1, "%25");
+ c += 2;
+ }
+ }
+ // Now replace some other characters that we may have but should not appear literally in the URL
+ while (string.contains("\n")) {
+ Common::replace(string, "\n", "%0A");
+ }
+ while (string.contains(" ")) {
+ Common::replace(string, " ", "%20");
+ }
+ while (string.contains("&")) {
+ Common::replace(string, "&", "%26");
+ }
+ while (string.contains("/")) {
+ Common::replace(string, "/", "%2F");
+ }
+}
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");
+ encodeUrlString(report);
+
+ // Pass engine name if there is only one.
+ Common::String engineName;
+ Common::StringArray engines = _detectionResults.getUnknownGameEngines();
+ if (engines.size() == 1) {
+ engineName = engines.front();
+ encodeUrlString(engineName);
}
return Common::String::format(
- "https://bugs.scummvm.org/newticket?"
- "&description=%s"
- "&type=enhancement"
- "&keywords=unknown-game",
+ "https://bugs.scummvm.org/unknowngame?"
+ "engine=%s"
+ "&description=%s",
+ engineName.c_str(),
report.c_str());
}
diff --git a/gui/unknown-game-dialog.h b/gui/unknown-game-dialog.h
index c2fc764..8effd9b 100644
--- a/gui/unknown-game-dialog.h
+++ b/gui/unknown-game-dialog.h
@@ -46,6 +46,7 @@ private:
void reflowLayout() override;
Common::String generateBugtrackerURL();
+ void encodeUrlString(Common::String&);
const DetectionResults &_detectionResults;
ScrollContainerWidget *_textContainer;
More information about the Scummvm-git-logs
mailing list