aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorThierry Crozat2019-04-27 02:42:16 +0100
committerThierry Crozat2019-04-27 02:42:16 +0100
commit74577f98922fb7b349de4481cb4ce5458a37960f (patch)
tree320a175a43f0064278e6d4914557be22bef78d43 /gui
parent40c9930699ab0ee3fc84e40800eb50794c9d93ff (diff)
downloadscummvm-rg350-74577f98922fb7b349de4481cb4ce5458a37960f.tar.gz
scummvm-rg350-74577f98922fb7b349de4481cb4ce5458a37960f.tar.bz2
scummvm-rg350-74577f98922fb7b349de4481cb4ce5458a37960f.zip
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.
Diffstat (limited to 'gui')
-rw-r--r--gui/unknown-game-dialog.cpp49
-rw-r--r--gui/unknown-game-dialog.h1
2 files changed, 35 insertions, 15 deletions
diff --git a/gui/unknown-game-dialog.cpp b/gui/unknown-game-dialog.cpp
index ecea16023f..a96370adb7 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 c2fc76473c..8effd9b5c7 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;