diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 1079c4de786..11183058bdc 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -67,12 +67,12 @@ public: // Callbacks for reporting various errors and information void onErrorControlROM() { - GUI::MessageDialog dialog(_("MT32Emu: Init Error - Missing or invalid Control ROM image"), _("OK")); + GUI::MessageDialog dialog("MT32Emu: Init Error - Missing or invalid Control ROM image"); dialog.runModal(); error("MT32emu: Init Error - Missing or invalid Control ROM image"); } void onErrorPCMROM() { - GUI::MessageDialog dialog(_("MT32Emu: Init Error - Missing PCM ROM image"), _("OK")); + GUI::MessageDialog dialog("MT32Emu: Init Error - Missing PCM ROM image"); dialog.runModal(); error("MT32emu: Init Error - Missing PCM ROM image"); } diff --git a/backends/cloud/storage.cpp b/backends/cloud/storage.cpp index 2569b38bf5b..25c623e416d 100644 --- a/backends/cloud/storage.cpp +++ b/backends/cloud/storage.cpp @@ -345,8 +345,8 @@ void Storage::directoryDownloadedCallback(FileArrayResponse response) { Common::U32String message; if (response.value.size()) { - message = Common::String::format( - _("Download complete.\nFailed to download %u files.").encode().c_str(), + message = Common::U32String::format( + _("Download complete.\nFailed to download %u files."), response.value.size()); } else { message = _("Download complete."); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index acd46d8340c..843547ef15b 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -2500,14 +2500,12 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) { #ifdef USE_OSD Common::U32String message; if (_videoMode.aspectRatioCorrection) - message = Common::String::format("%s\n%d x %d -> %d x %d", - _("Enabled aspect ratio correction").encode().c_str(), + message = Common::U32String::format(_("Enabled aspect ratio correction") + Common::U32String("\n%d x %d -> %d x %d"), _videoMode.screenWidth, _videoMode.screenHeight, _hwScreen->w, _hwScreen->h ); else - message = Common::String::format("%s\n%d x %d -> %d x %d", - _("Disabled aspect ratio correction").encode().c_str(), + message = Common::U32String::format(_("Disabled aspect ratio correction") + Common::U32String("%s\n%d x %d -> %d x %d"), _videoMode.screenWidth, _videoMode.screenHeight, _hwScreen->w, _hwScreen->h ); diff --git a/backends/text-to-speech/linux/linux-text-to-speech.cpp b/backends/text-to-speech/linux/linux-text-to-speech.cpp index b2215f17543..8ff00047523 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.cpp +++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp @@ -194,24 +194,7 @@ bool SpeechDispatcherManager::say(const Common::U32String &str, Action action, C return true; } - if (charset.empty()) { -#ifdef USE_TRANSLATION - charset = TransMan.getCurrentCharset(); -#else - charset = "ASCII"; -#endif - } - - Common::String strToSpeak = str.encode(); - - char *tmpStr = Common::Encoding::convert("UTF-8", charset, strToSpeak.c_str(), strToSpeak.size()); - if (tmpStr == nullptr) { - warning("Cannot convert from %s encoding for text to speech", charset.c_str()); - pthread_mutex_unlock(&_speechMutex); - return true; - } - Common::String strUtf8 = tmpStr; - free(tmpStr); + Common::String strUtf8 = str.encode();; if (!_speechQueue.empty() && action == INTERRUPT_NO_REPEAT && _speechQueue.front() == strUtf8 && isSpeaking()) { diff --git a/common/achievements.cpp b/common/achievements.cpp index 7a7292522eb..20663a3f6f7 100644 --- a/common/achievements.cpp +++ b/common/achievements.cpp @@ -89,7 +89,7 @@ bool AchievementsManager::setAchievement(const String &id, const String &display if (!displayedMessage.empty() && g_system) { U32String msg; - msg = Common::String::format("%s\n%s", _("Achievement unlocked!").encode().c_str(), displayedMessage.c_str()); + msg = _("Achievement unlocked!") + Common::U32String("\n") + Common::U32String(displayedMessage); g_system->displayMessageOnOSD(msg); } diff --git a/common/translation.h b/common/translation.h index 0ab682ad188..9363c50a8c2 100644 --- a/common/translation.h +++ b/common/translation.h @@ -110,21 +110,21 @@ public: /** * Returns the translation into the current language of the parameter * message. In case the message isn't found in the translation catalog, - * it returns the original untranslated message. + * it returns the original untranslated message, as a U32String. */ U32String getTranslation(const char *message) const; /** * Returns the translation into the current language of the parameter * message. In case the message isn't found in the translation catalog, - * it returns the original untranslated message. + * it returns the original untranslated message, as a U32String. */ U32String getTranslation(const String &message) const; /** * Returns the translation into the current language of the parameter * message. In case the message isn't found in the translation catalog, - * it returns the original untranslated message. + * it returns the original untranslated message, as a U32String. * * If a translation is found for the given context it will return that * translation, otherwise it will look for a translation for the same @@ -135,7 +135,7 @@ public: /** * Returns the translation into the current language of the parameter * message. In case the message isn't found in the translation catalog, - * it returns the original untranslated message. + * it returns the original untranslated message, as a U32String. * * If a translation is found for the given context it will return that * translation, otherwise it will look for a translation for the same diff --git a/common/ustr.cpp b/common/ustr.cpp index 98f2ce6d300..ceaa1ca52b4 100644 --- a/common/ustr.cpp +++ b/common/ustr.cpp @@ -571,6 +571,22 @@ int U32String::vformat(U32String::const_iterator fmt, const U32String::const_ite output.insertString(buffer, pos); pos += len - 1; break; + case 'u': + int_temp = va_arg(args, uint); + itoa(int_temp, buffer, 10); + len = strlen(buffer); + length += len; + + output.insertString(buffer, pos); + pos += len - 1; + case 'i': + int_temp = va_arg(args, uint16); + itoa(int_temp, buffer, 10); + len = strlen(buffer); + length += len; + + output.insertString(buffer, pos); + pos += len - 1; default: warning("Unexpected formatting type for U32String::Format."); break; diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 15546033d00..878d96864f6 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -756,7 +756,7 @@ int AgiEngine::scummVMSaveLoadDialog(bool isSave) { int slot; if (isSave) { - dialog = new GUI::SaveLoadChooser((_("Save game:")), Common::convertToU32String(("Save")), true); + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); slot = dialog->runModalWithCurrentTarget(); desc = dialog->getResultString(); @@ -767,7 +767,7 @@ int AgiEngine::scummVMSaveLoadDialog(bool isSave) { } if (desc.size() > 28) - desc = Common::U32String(desc.c_str(), 28); + desc = Common::U32String(desc.encode().c_str(), 28); } else { dialog = new GUI::SaveLoadChooser((_("Restore game:")), (_("Restore")), false); slot = dialog->runModalWithCurrentTarget(); diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 5592f485eb7..5574c8b16e5 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -228,7 +228,7 @@ Common::Error CGEEngine::run() { Common::U32String msg = Common::U32String(_text->getText(kSayTheEnd)); if (!msg.empty()) { g_system->delayMillis(10); - GUI::MessageDialog dialog(msg, Common::U32String("OK")); + GUI::MessageDialog dialog(msg); dialog.runModal(); } } diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 55e7e8a9cbe..e695cc146d6 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -952,11 +952,11 @@ bool DrasculaEngine::loadDrasculaDat() { ver = in.readByte(); if (ver != DRASCULA_DAT_VER) { - Common::String errorMessage = Common::String::format( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), + Common::U32String errorMessage = Common::U32String::format( + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), filename.c_str(), DRASCULA_DAT_VER, 0, ver, 0); GUIErrorMessage(errorMessage); - warning("%s", errorMessage.c_str()); + warning("%s", errorMessage.encode().c_str()); return false; } diff --git a/engines/engine.cpp b/engines/engine.cpp index 0f50871425b..65f695df9ca 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -38,6 +38,7 @@ #include "common/file.h" #include "common/system.h" #include "common/str.h" +#include "common/ustr.h" #include "common/error.h" #include "common/list.h" #include "common/memstream.h" @@ -430,6 +431,17 @@ void GUIErrorMessageFormat(const char *fmt, ...) { GUIErrorMessage(msg); } +void GUIErrorMessageFormat(Common::U32String fmt, ...) { + Common::U32String msg(""); + + va_list va; + va_start(va, fmt); + Common::U32String::vformat(fmt.begin(), fmt.end(), msg, va); + va_end(va); + + GUIErrorMessage(msg); +} + void Engine::checkCD() { #if defined(WIN32) && !defined(__SYMBIAN32__) // It is a known bug under Windows that games that play CD audio cause diff --git a/engines/engine.h b/engines/engine.h index 9031cd48c44..46f939e9b90 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -55,6 +55,7 @@ class Dialog; */ void GUIErrorMessage(const Common::U32String &msg, const char *url = nullptr); void GUIErrorMessageWithURL(const Common::U32String &msg, const char *url); +void GUIErrorMessageFormat(Common::U32String fmt, ...); void GUIErrorMessageFormat(const char *fmt, ...) GCC_PRINTF(1, 2); class Engine; diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp index eb264b44855..234c93ab7e0 100644 --- a/engines/glk/advsys/vm.cpp +++ b/engines/glk/advsys/vm.cpp @@ -593,8 +593,8 @@ bool VM::getWord(Common::String &line) { _words.push_back(iw); return true; } else { - Common::String msg = Common::String::format(_("I don't know the word \"%s\".\n").encode().c_str(), iw._text.c_str()); - print(msg); + Common::U32String msg = Common::U32String::format(_("I don't know the word \"%s\".\n"), iw._text.c_str()); + print(msg.encode()); return false; } } diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index b39e3002f7d..d6eccb1f30a 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -61,7 +61,7 @@ Common::Error LureEngine::init() { Common::File f; VersionStructure version; if (!f.open(SUPPORT_FILENAME)) { - GUIErrorMessageFormat(Common::convertFromU32String(_("Unable to locate the '%s' engine data file.")).c_str(), SUPPORT_FILENAME); + GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), SUPPORT_FILENAME); return Common::kUnknownError; } @@ -70,10 +70,10 @@ Common::Error LureEngine::init() { f.close(); if (READ_LE_UINT16(&version.id) != 0xffff) { - GUIErrorMessageFormat(Common::convertFromU32String(_("The '%s' engine data file is corrupt.")).c_str(), SUPPORT_FILENAME); + GUIErrorMessageFormat(_("The '%s' engine data file is corrupt."), SUPPORT_FILENAME); return Common::kUnknownError; } else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR)) { - GUIErrorMessageFormat(Common::convertFromU32String(_("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.")).c_str(), + GUIErrorMessageFormat(_("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR, version.vMajor, version.vMinor); return Common::kUnknownError; diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 4b97f623faf..5b99d906b2b 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -352,7 +352,7 @@ void TextDialog::draw() { // Draw the text lines int lineYp = _position.y + 5; #ifdef USE_TTS - Common::U32String text; + Common::String text; #endif for (int lineNum = 0; lineNum <= _numLines; ++lineNum) { if (_lineXp[lineNum] == -1) { @@ -393,7 +393,7 @@ void TextDialog::draw() { Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); if (ttsMan != nullptr) { ttsMan->stop(); - ttsMan->say(text); + ttsMan->say(Common::convertToU32String(text.c_str())); } } #endif diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index e92ac48526a..9471e9faaf4 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -498,8 +498,8 @@ bool MohawkEngine_Riven::checkDatafiles() { return true; } - Common::String message = _("You are missing the following required Riven data files:\n").encode() + missingFiles; - warning("%s", message.c_str()); + Common::U32String message = _("You are missing the following required Riven data files:\n") + Common::convertToU32String(missingFiles.c_str()); + warning("%s", message.encode().c_str()); GUIErrorMessage(message); return false; diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index dd29a10c039..1853f33fe40 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -302,7 +302,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { // Open the mort.dat file if (!f.open(MORT_DAT)) { - GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file.").encode().c_str(), MORT_DAT); + GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), MORT_DAT); return Common::kReadingFailed; } @@ -310,7 +310,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { char fileId[4]; f.read(fileId, 4); if (strncmp(fileId, "MORT", 4) != 0) { - GUIErrorMessageFormat(_("The '%s' engine data file is corrupt.").encode().c_str(), MORT_DAT); + GUIErrorMessageFormat(_("The '%s' engine data file is corrupt."), MORT_DAT); return Common::kReadingFailed; } @@ -320,7 +320,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { if (majVer < MORT_DAT_REQUIRED_VERSION) { GUIErrorMessageFormat( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), MORT_DAT, MORT_DAT_REQUIRED_VERSION, 0, majVer, minVer); return Common::kReadingFailed; } diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 25ac9211d2e..738bb96af65 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -389,7 +389,7 @@ InfoDialog::InfoDialog(ScummEngine *scumm, int res) _text = new GUI::StaticTextWidget(this, 0, 0, 10, 10, _message, kTextAlignCenter); } -InfoDialog::InfoDialog(ScummEngine *scumm, const U32String& message) +InfoDialog::InfoDialog(ScummEngine *scumm, const U32String &message) : ScummDialog(0, 0, 0, 0), _vm(scumm) { // dummy x and w _message = message; @@ -398,7 +398,7 @@ InfoDialog::InfoDialog(ScummEngine *scumm, const U32String& message) _text = new GUI::StaticTextWidget(this, 0, 0, 10, 10, _message, kTextAlignCenter); } -void InfoDialog::setInfoText(const U32String& message) { +void InfoDialog::setInfoText(const U32String &message) { _message = message; _text->setLabel(_message); //reflowLayout(); // FIXME: Should we call this here? Depends on the usage patterns, I guess... @@ -477,8 +477,11 @@ void PauseDialog::handleKeyDown(Common::KeyState state) { ConfirmDialog::ConfirmDialog(ScummEngine *scumm, int res) : InfoDialog(scumm, res), _yesKey('y'), _noKey('n') { - if (_message.encode().lastChar() != ')') { - _yesKey = _message.encode().lastChar(); + if (_message.empty()) + return; + + if (_message[_message.size() - 1] != ')') { + _yesKey = _message[_message.size() - 1]; _message.deleteLastChar(); if (_yesKey >= 'A' && _yesKey <= 'Z') diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index afcf301b288..11c6ea70c41 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -74,11 +74,11 @@ protected: public: // arbitrary message - InfoDialog(ScummEngine *scumm, const U32String& message); + InfoDialog(ScummEngine *scumm, const U32String &message); // from resources InfoDialog(ScummEngine *scumm, int res); - void setInfoText(const U32String& message); + void setInfoText(const U32String &message); void handleMouseDown(int x, int y, int button, int clickCount) override { setResult(0); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index d3851269ca6..a816dbc3fb2 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1894,10 +1894,10 @@ void ScummEngine::setupMusic(int midi) { if (missingFile) { GUI::MessageDialog dialog( - Common::String::format( + Common::U32String::format( _("Native MIDI support requires the Roland Upgrade from LucasArts,\n" - "but %s is missing. Using AdLib instead.").encode().c_str(), fileName.c_str()), - _("OK").encode()); + "but %s is missing. Using AdLib instead."), fileName.c_str()), + _("OK")); dialog.runModal(); _sound->_musicType = MDT_ADLIB; } diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 28e1067c8ef..369a9526c2a 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -184,7 +184,7 @@ Common::Error SupernovaEngine::loadGameStrings() { if (stream == nullptr) { Common::Language l = Common::parseLanguage(ConfMan.get("language")); - GUIErrorMessageFormat(_("Unable to locate the text for %s language in engine data file.").encode().c_str(), Common::getLanguageDescription(l)); + GUIErrorMessageFormat(_("Unable to locate the text for %s language in engine data file."), Common::getLanguageDescription(l)); return Common::kReadingFailed; } @@ -455,19 +455,19 @@ Common::SeekableReadStream *SupernovaEngine::getBlockFromDatFile(Common::String char id[5], lang[5]; id[4] = lang[4] = '\0'; if (!f.open(SUPERNOVA_DAT)) { - GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file.").encode().c_str(), SUPERNOVA_DAT); + GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), SUPERNOVA_DAT); return nullptr; } f.read(id, 3); if (strncmp(id, "MSN", 3) != 0) { - GUIErrorMessageFormat(_("The '%s' engine data file is corrupt.").encode().c_str(), SUPERNOVA_DAT); + GUIErrorMessageFormat(_("The '%s' engine data file is corrupt."), SUPERNOVA_DAT); return nullptr; } int version = f.readByte(); if (version != SUPERNOVA_DAT_VERSION) { GUIErrorMessageFormat( - _("Incorrect version of the '%s' engine data file found. Expected %d but got %d.").encode().c_str(), + _("Incorrect version of the '%s' engine data file found. Expected %d but got %d."), SUPERNOVA_DAT, SUPERNOVA_DAT_VERSION, version); return nullptr; } @@ -477,7 +477,7 @@ Common::SeekableReadStream *SupernovaEngine::getBlockFromDatFile(Common::String int part = f.readByte(); gameBlockSize = f.readUint32LE(); if (f.eos()){ - GUIErrorMessageFormat(_("Unable to find block for part %d").encode().c_str(), _MSPart); + GUIErrorMessageFormat(_("Unable to find block for part %d"), _MSPart); return nullptr; } if (part == _MSPart) { @@ -520,7 +520,7 @@ Common::Error SupernovaEngine::showTextReader(const char *extension) { filename = Common::String::format("ms2.%s", extension); if (!file.open(filename)) { - GUIErrorMessageFormat(_("Unable to find '%s' in game folder or the engine data file.").encode().c_str(), filename.c_str()); + GUIErrorMessageFormat(_("Unable to find '%s' in game folder or the engine data file."), filename.c_str()); return Common::kReadingFailed; } stream = file.readStream(file.size()); diff --git a/engines/zvision/file/save_manager.cpp b/engines/zvision/file/save_manager.cpp index 8d7c7a42b9d..2bba40a7715 100644 --- a/engines/zvision/file/save_manager.cpp +++ b/engines/zvision/file/save_manager.cpp @@ -218,10 +218,10 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea if (header.version > SAVE_VERSION) { uint tempVersion = header.version; GUI::MessageDialog dialog( - Common::String::format( + Common::U32String::format( _("This saved game uses version %u, but this engine only " "supports up to version %d. You will need an updated version " - "of the engine to use this saved game.").encode().c_str(), tempVersion, SAVE_VERSION + "of the engine to use this saved game."), tempVersion, SAVE_VERSION ), _("OK")); dialog.runModal(); diff --git a/gui/about.cpp b/gui/about.cpp index d6c76703503..bfef4f1a39f 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -99,8 +99,8 @@ AboutDialog::AboutDialog() version += gScummVMVersion; _lines.push_back(version); - Common::U32String date = Common::U32String::format(_("(built on %s)"), gScummVMBuildDate); - _lines.push_back(U32String("C2") + date); + Common::U32String date = Common::U32String::format(_("(built on %s)"), gScummVMBuildDate); + _lines.push_back(U32String("C2") + date); for (i = 0; i < ARRAYSIZE(copyright_text); i++) addLine(U32String(copyright_text[i])); @@ -235,7 +235,7 @@ void AboutDialog::drawDialog(DrawLayer layerToDraw) { } // Trim leading whitespaces if center mode is on if (align == Graphics::kTextAlignCenter) - while (*strLineItrBegin && *strLineItrBegin == ' ') + while (strLineItrBegin != strLineItrEnd && *strLineItrBegin == ' ') strLineItrBegin++; U32String renderStr(strLineItrBegin, strLineItrEnd); diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 0ba5629785e..797776e8e34 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -48,7 +48,7 @@ ChooserDialog::ChooserDialog(const U32String &title, String dialogId) _chooseButton->setEnabled(false); } -void ChooserDialog::setList(const U32StringArray& list) { +void ChooserDialog::setList(const U32StringArray &list) { _list->setList(list); } diff --git a/gui/chooser.h b/gui/chooser.h index 06df8fdac7d..2ba416255a4 100644 --- a/gui/chooser.h +++ b/gui/chooser.h @@ -50,7 +50,7 @@ protected: public: ChooserDialog(const U32String &title, String dialogId = "Browser"); - void setList(const U32StringArray& list); + void setList(const U32StringArray &list); void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override; }; diff --git a/gui/downloaddialog.cpp b/gui/downloaddialog.cpp index 44b8ab096be..878bbc2b6c1 100644 --- a/gui/downloaddialog.cpp +++ b/gui/downloaddialog.cpp @@ -224,8 +224,8 @@ Common::U32String DownloadDialog::getSpeedLabelText() { void DownloadDialog::refreshWidgets() { _localDirectory = CloudMan.getDownloadLocalDirectory(); - _remoteDirectoryLabel->setLabel(_("From: ").encode() + CloudMan.getDownloadRemoteDirectory()); - _localDirectoryLabel->setLabel(_("To: ").encode() + _localDirectory); + _remoteDirectoryLabel->setLabel(_("From: ") + Common::U32String(CloudMan.getDownloadRemoteDirectory())); + _localDirectoryLabel->setLabel(_("To: ") + Common::U32String(_localDirectory)); uint32 progress = (uint32)(100 * CloudMan.getDownloadingProgress()); _percentLabel->setLabel(Common::String::format("%u %%", progress)); _downloadSizeLabel->setLabel(getSizeLabelText()); diff --git a/gui/downloaddialog.h b/gui/downloaddialog.h index 837d3cbc520..f0d445e96f7 100644 --- a/gui/downloaddialog.h +++ b/gui/downloaddialog.h @@ -25,6 +25,7 @@ #include "gui/dialog.h" #include "common/str.h" +#include "common/ustr.h" namespace GUI { class LauncherDialog; diff --git a/gui/options.cpp b/gui/options.cpp index 20caef9f3d1..ff7179cd9b4 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -129,11 +129,11 @@ enum { kApplyCmd = 'appl' }; -static const char *savePeriodLabels[] = { _s("Never"), _s("Every 5 mins"), _s("Every 10 mins"), _s("Every 15 mins"), _s("Every 30 mins"), "" }; +static const char *savePeriodLabels[] = { _s("Never"), _s("Every 5 mins"), _s("Every 10 mins"), _s("Every 15 mins"), _s("Every 30 mins"), nullptr }; static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 }; // The keyboard mouse speed values range from 0 to 7 and correspond to speeds shown in the label // "10" (value 3) is the default speed corresponding to the speed before introduction of this control -static const char *kbdMouseSpeedLabels[] = { "3", "5", "8", "10", "13", "15", "18", "20", "" }; +static const char *kbdMouseSpeedLabels[] = { "3", "5", "8", "10", "13", "15", "18", "20", nullptr }; OptionsDialog::OptionsDialog(const Common::String &domain, int x, int y, int w, int h) : Dialog(x, y, w, h), _domain(domain), _graphicsTabId(-1), _midiTabId(-1), _pathsTabId(-1), _tabWidget(nullptr) { diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index ab1d4a2d0a4..e4dc7a0a262 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -485,7 +485,7 @@ void PredictiveDialog::processButton(ButtonId button) { "next", "add", "<", "Cancel", "OK", - "Pre", "(0) ", "" + "Pre", "(0) ", nullptr }; if (_mode == kModeAbc) { diff --git a/gui/widget.cpp b/gui/widget.cpp index 871b1ad7531..0132442d465 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -294,7 +294,7 @@ void Widget::read(const Common::U32String &str) { #pragma mark - StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, Common::U32String tooltip, ThemeEngine::FontStyle font) - : Widget(boss, x, y, w, h, tooltip), _align(align) { + : Widget(boss, x, y, w, h, tooltip) { setFlags(WIDGET_ENABLED); _type = kStaticTextWidget; _label = text;