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);
if (detectionResults.foundUnknownGames()) {
Common::String report = detectionResults.generateUnknownGameReport(false, 80);
g_system->logMessage(LogMessageType::kInfo, report.c_str());
Common::U32String report = detectionResults.generateUnknownGameReport(false, 80);
g_system->logMessage(LogMessageType::kInfo, report.encode().c_str());
}
return detectionResults.listRecognizedGames();

View file

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

View file

@ -187,8 +187,8 @@ void MassAddDialog::handleTickle() {
DetectionResults detectionResults = EngineMan.detectGames(files);
if (detectionResults.foundUnknownGames()) {
Common::String report = detectionResults.generateUnknownGameReport(false, 80);
g_system->logMessage(LogMessageType::kInfo, report.c_str());
Common::U32String report = detectionResults.generateUnknownGameReport(false, 80);
g_system->logMessage(LogMessageType::kInfo, report.encode().c_str());
}
// 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::String encoded;
Common::U32String UnknownGameDialog::encodeUrlString(const Common::U32String &string) {
Common::U32String encoded;
for (uint i = 0 ; i < string.size() ; ++i) {
char c = string[i];
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;
}
Common::String UnknownGameDialog::generateBugtrackerURL() {
Common::String report = generateUnknownGameReport(_detectedGame, false, false);
Common::U32String UnknownGameDialog::generateBugtrackerURL() {
Common::U32String report = generateUnknownGameReport(_detectedGame, false, false);
report = encodeUrlString(report);
Common::String engineId = encodeUrlString(_detectedGame.engineId);
return Common::String::format(
Common::String preFinalReport = Common::String::format(
"https://www.scummvm.org/unknowngame?"
"engine=%s"
"&description=%s",
engineId.c_str(),
report.c_str());
"engine=%s",
engineId.c_str());
Common::U32String repDesc("&description=");
repDesc += report;
return Common::U32String(preFinalReport) + repDesc;
}
void UnknownGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch(cmd) {
case kCopyToClipboard: {
Common::String report = generateUnknownGameReport(_detectedGame, false, false);
Common::U32String report = generateUnknownGameReport(_detectedGame, false, false);
if (g_system->setTextInClipboard(report)) {
g_system->displayMessageOnOSD(

View file

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