GUI: U32: Use unicode based generateGameReport correctly in all places

- UnknownGameDialog: Use u32 for gameReport dependant functions
This commit is contained in:
aryanrawlani28 2020-07-22 04:53:38 +05:30 committed by Eugene Sandulenko
parent f95762881e
commit 01176e43f7
5 changed files with 21 additions and 18 deletions

View file

@ -980,8 +980,8 @@ static DetectedGames getGameList(const Common::FSNode &dir) {
DetectionResults detectionResults = EngineMan.detectGames(files); DetectionResults detectionResults = EngineMan.detectGames(files);
if (detectionResults.foundUnknownGames()) { if (detectionResults.foundUnknownGames()) {
Common::String report = detectionResults.generateUnknownGameReport(false, 80); Common::U32String report = detectionResults.generateUnknownGameReport(false, 80);
g_system->logMessage(LogMessageType::kInfo, report.c_str()); g_system->logMessage(LogMessageType::kInfo, report.encode().c_str());
} }
return detectionResults.listRecognizedGames(); return detectionResults.listRecognizedGames();

View file

@ -544,8 +544,8 @@ bool LauncherDialog::doGameDetection(const Common::String &path) {
DetectionResults detectionResults = EngineMan.detectGames(files); DetectionResults detectionResults = EngineMan.detectGames(files);
if (detectionResults.foundUnknownGames()) { if (detectionResults.foundUnknownGames()) {
Common::String report = detectionResults.generateUnknownGameReport(false, 80); Common::U32String report = detectionResults.generateUnknownGameReport(false, 80);
g_system->logMessage(LogMessageType::kInfo, report.c_str()); g_system->logMessage(LogMessageType::kInfo, report.encode().c_str());
} }
Common::Array<DetectedGame> candidates = detectionResults.listDetectedGames(); Common::Array<DetectedGame> candidates = detectionResults.listDetectedGames();

View file

@ -187,8 +187,8 @@ void MassAddDialog::handleTickle() {
DetectionResults detectionResults = EngineMan.detectGames(files); DetectionResults detectionResults = EngineMan.detectGames(files);
if (detectionResults.foundUnknownGames()) { if (detectionResults.foundUnknownGames()) {
Common::String report = detectionResults.generateUnknownGameReport(false, 80); Common::U32String report = detectionResults.generateUnknownGameReport(false, 80);
g_system->logMessage(LogMessageType::kInfo, report.c_str()); g_system->logMessage(LogMessageType::kInfo, report.encode().c_str());
} }
// Just add all detected games / game variants. If we get more than one, // Just add all detected games / game variants. If we get more than one,

View file

@ -119,8 +119,8 @@ void UnknownGameDialog::rebuild() {
} }
} }
Common::String UnknownGameDialog::encodeUrlString(const Common::String &string) { Common::U32String UnknownGameDialog::encodeUrlString(const Common::U32String &string) {
Common::String encoded; Common::U32String encoded;
for (uint i = 0 ; i < string.size() ; ++i) { for (uint i = 0 ; i < string.size() ; ++i) {
char c = string[i]; char c = string[i];
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') ||
@ -132,24 +132,27 @@ Common::String UnknownGameDialog::encodeUrlString(const Common::String &string)
return encoded; return encoded;
} }
Common::String UnknownGameDialog::generateBugtrackerURL() { Common::U32String UnknownGameDialog::generateBugtrackerURL() {
Common::String report = generateUnknownGameReport(_detectedGame, false, false); Common::U32String report = generateUnknownGameReport(_detectedGame, false, false);
report = encodeUrlString(report); report = encodeUrlString(report);
Common::String engineId = encodeUrlString(_detectedGame.engineId); Common::String engineId = encodeUrlString(_detectedGame.engineId);
return Common::String::format( Common::String preFinalReport = Common::String::format(
"https://www.scummvm.org/unknowngame?" "https://www.scummvm.org/unknowngame?"
"engine=%s" "engine=%s",
"&description=%s", engineId.c_str());
engineId.c_str(),
report.c_str()); Common::U32String repDesc("&description=");
repDesc += report;
return Common::U32String(preFinalReport) + repDesc;
} }
void UnknownGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { void UnknownGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch(cmd) { switch(cmd) {
case kCopyToClipboard: { case kCopyToClipboard: {
Common::String report = generateUnknownGameReport(_detectedGame, false, false); Common::U32String report = generateUnknownGameReport(_detectedGame, false, false);
if (g_system->setTextInClipboard(report)) { if (g_system->setTextInClipboard(report)) {
g_system->displayMessageOnOSD( g_system->displayMessageOnOSD(

View file

@ -45,8 +45,8 @@ private:
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override; void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
void reflowLayout() override; void reflowLayout() override;
Common::String generateBugtrackerURL(); Common::U32String generateBugtrackerURL();
static Common::String encodeUrlString(const Common::String &string); static Common::U32String encodeUrlString(const Common::U32String &string);
const DetectedGame &_detectedGame; const DetectedGame &_detectedGame;
ScrollContainerWidget *_textContainer; ScrollContainerWidget *_textContainer;