GUI: Translate the default OK button in message boxes

This commit is contained in:
Cameron Cawley
2026-01-03 20:05:55 +00:00
committed by Eugene Sandulenko
parent 53b89d7db9
commit a166015406
33 changed files with 113 additions and 85 deletions
+2 -2
View File
@@ -65,12 +65,12 @@ public:
// Callbacks for reporting various errors and information
void onErrorControlROM() override {
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() override {
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");
}
+2 -2
View File
@@ -656,7 +656,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
"Select the folder containing the game's files, then tap **Choose**. \n"
"\n"
"Repeat steps 1 and 6 for each game."
), _("Ok"),
), _("OK"),
// I18N: A button caption to dismiss a message and read it later
_("Read Later"), Graphics::kTextAlignLeft);
@@ -681,7 +681,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
"Select the sub-folder containing the game's files, then tap **Choose**."
"\n"
"Repeat steps 1 and 6 for each game."
), _("Ok"),
), _("OK"),
// I18N: A button caption to dismiss a message and read it later
_("Read Later"), Graphics::kTextAlignLeft);
+1 -1
View File
@@ -574,7 +574,7 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) {
}
Common::U32String buf = Common::U32String::format(_("Cutscene file '%s' not found!"), baseName);
GUI::MessageDialog dialog(buf, _("OK"));
GUI::MessageDialog dialog(buf);
dialog.runModal();
return NULL;
+3 -6
View File
@@ -316,8 +316,7 @@ int MidiPlayer::open() {
_("Could not find AdLib instrument definition file\n"
"%s. Without this file,\n"
"the music will not sound the same as the original game."),
"MT_FM.IBK"),
_("OK"));
"MT_FM.IBK"));
dialog.runModal();
_driverMsMusic = new MidiDriver_ADLIB_Multisource(oplType);
@@ -374,8 +373,7 @@ int MidiPlayer::open() {
_("Could not find AdLib instrument definition file\n"
"%s. Without this file,\n"
"the sound effects will not sound the same as the original game."),
"MT_FM.IBK"),
_("OK"));
"MT_FM.IBK"));
dialog.runModal();
_driverMsSfx = new MidiDriver_ADLIB_Multisource(oplType);
@@ -453,8 +451,7 @@ int MidiPlayer::open() {
_("Could not find AdLib instrument definition file\n"
"%s or %s. Without one of these files,\n"
"the music will not sound the same as the original game."),
"MIDPAK.AD", "SETUP.SHR"),
_("OK"));
"MIDPAK.AD", "SETUP.SHR"));
dialog.runModal();
_driverMsMusic = new MidiDriver_ADLIB_Multisource(oplType);
+1 -1
View File
@@ -77,7 +77,7 @@ static void FillSaveList(std::set<String> &files, const String &filePattern) {
if ((strcmp(_GP(game).guid, "{a46a9171-f6f9-456c-9b2b-a509b560ddc0}") == 0) && _G(displayed_room) == 1) {
::GUI::MessageDialog dialog(_("The game will now list characters exported from the Sierra games that can be imported:\n"
"1. Save files named qfg1*.sav or qfg1vga*.sav inside ScummVM save directory, or\n"
"2. Any .sav file inside the QfG2 Remake game directory"), "Ok");
"2. Any .sav file inside the QfG2 Remake game directory"));
dialog.runModal();
matches = g_system->getSavefileManager()->listSavefiles("qfg1*.sav");
+1 -1
View File
@@ -619,7 +619,7 @@ void BuriedEngine::showPoints() {
GUI::MessageDialog dialog(
agentEvaluation->_scoringTextDescriptionsWithScores,
"OK",
_("OK"),
Common::U32String(),
Graphics::kTextAlignLeft
);
+2 -2
View File
@@ -1715,7 +1715,7 @@ void LB::b_open(int nargs) {
if (!debugChannelSet(-1, kDebugFewFramesOnly) &&
!(g_director->getGameGID() == GID_TEST || g_director->getGameGID() == GID_TESTALL)) {
Common::U32String message = Common::String::format("Unsupported command open encountered -> The movie tried to execute open %s %s!", ex.asString().c_str(), d.type != VOID ? d.asString().c_str() : "");
GUI::MessageDialog dialog(message, _("Ok"));
GUI::MessageDialog dialog(message);
dialog.runModal();
}
}
@@ -2466,7 +2466,7 @@ void LB::b_alert(int nargs) {
if (!debugChannelSet(-1, kDebugFewFramesOnly)) {
g_director->_wm->clearHandlingWidgets();
GUI::MessageDialog dialog(alert.c_str(), _("OK"));
GUI::MessageDialog dialog(alert.c_str());
dialog.runModal();
}
+2 -2
View File
@@ -120,7 +120,7 @@ XOBJSTUB(JITDraw3XObj::m_checkifcdrom, 0)
void JITDraw3XObj::m_msgokcancel(int nargs) {
Common::U32String caption = g_lingo->pop().asString(); // Title of the message box
Common::U32String message = g_lingo->pop().asString();
GUI::MessageDialog dialog(message, _("Ok"), _("Cancel"));
GUI::MessageDialog dialog(message, _("OK"), _("Cancel"));
int result = dialog.runModal();
g_lingo->push(Datum(result == GUI::kMessageOK ? 1 : 0));
}
@@ -128,7 +128,7 @@ void JITDraw3XObj::m_msgokcancel(int nargs) {
void JITDraw3XObj::m_msgok(int nargs) {
Common::U32String caption = g_lingo->pop().asString(); // Title of the message box
Common::U32String message = g_lingo->pop().asString();
GUI::MessageDialog dialog(message, _("Ok"));
GUI::MessageDialog dialog(message);
dialog.runModal();
g_lingo->push(Datum());
}
+2 -2
View File
@@ -600,7 +600,7 @@ bool Engine::isDataAndCDAudioReadFromSameCD() {
"from the CD. This is known to cause problems,\n"
"and it is therefore recommended that you copy\n"
"the data files to your hard disk instead.\n"
"See the documentation (CD audio) for details."), _("OK"));
"See the documentation (CD audio) for details."));
dialog.runModal();
return true;
}
@@ -623,7 +623,7 @@ void Engine::warnMissingExtractedCDAudio() {
"tracks need to be ripped from the CD using\n"
"an appropriate CD audio extracting tool in\n"
"order to listen to the game's music.\n"
"See the documentation (CD audio) for details."), _("OK"));
"See the documentation (CD audio) for details."));
dialog.runModal();
}
+1 -1
View File
@@ -662,7 +662,7 @@ void Script::savegame(uint slot, const Common::String &name) {
if (!file) {
debugC(9, kDebugScript, "Save file pointer is null");
GUI::MessageDialog dialog(_("Failed to save game"), _("OK"));
GUI::MessageDialog dialog(_("Failed to save game"));
dialog.runModal();
return;
}
+2 -4
View File
@@ -110,8 +110,7 @@ Common::Error MTropolisEngine::run() {
GUI::MessageDialog dialog(
_("This game requires MPEG video support for some\n"
"content but MPEG video support was not compiled in.\n"
"The game will still play, but MPEG videos will not work."),
_("OK"));
"The game will still play, but MPEG videos will not work."));
dialog.runModal();
}
#endif
@@ -120,8 +119,7 @@ Common::Error MTropolisEngine::run() {
GUI::MessageDialog dialog(
_("This game requires MPEG audio support for some\n"
"content but MPEG audio support was not compiled in.\n"
"The game will still play, but some audio will not work."),
_("OK"));
"The game will still play, but some audio will not work."));
dialog.runModal();
}
#endif
+1 -2
View File
@@ -98,8 +98,7 @@ Music::Music(SagaEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer), _par
_("Could not find AdLib instrument definition files\n"
"%s and %s. Without these files,\n"
"the music will not sound the same as the original game."),
opl2InstDefFilename, opl3InstDefFilename),
_("OK"));
opl2InstDefFilename, opl3InstDefFilename));
dialog.runModal();
OPL::Config::OplType oplType =
+1 -1
View File
@@ -341,7 +341,7 @@ void Lobby::openUrl(const char *url) {
urlString == "http://www.humongoussports.com/backyard/registration/register.asp") {
if (_vm->displayMessageYesNo("Online Play for this game is provided by Backyard Sports Online, which is a\nservice provided by the ScummVM project.\nWould you like to go to their registration page?")) {
if (!g_system->openUrl("https://backyardsports.online/register")) {
_vm->displayMessage(0, "Failed to open registration URL. Please navigate to this page manually.\n\n\"https://backyardsports.online/register\"");
_vm->displayMessage("Failed to open registration URL. Please navigate to this page manually.\n\n\"https://backyardsports.online/register\"");
}
}
} else {
+6 -6
View File
@@ -131,12 +131,12 @@ int Net::hostGame(char *sessionName, char *userName) {
_userIdToPeerIndex[_myUserId] = -1;
return 1;
} else {
_vm->displayMessage(0, "Error Adding User \"%s\" to Session \"%s\"", userName, sessionName);
_vm->displayMessage("Error Adding User \"%s\" to Session \"%s\"", userName, sessionName);
endSession();
closeProvider();
}
} else {
_vm->displayMessage(0, "Error creating session \"%s\"", userName );
_vm->displayMessage("Error creating session \"%s\"", userName );
closeProvider();
}
@@ -453,7 +453,7 @@ int Net::doJoinSession(Session session) {
return true;
}
}
_vm->displayMessage(0, "Unable to join game session with address \"%s:%d\"", session.host.c_str(), session.port);
_vm->displayMessage("Unable to join game session with address \"%s:%d\"", session.host.c_str(), session.port);
return false;
}
@@ -768,7 +768,7 @@ bool Net::initProvider() {
return true;
_enet = new Networking::ENet::ENet();
if (!_enet->initialize()) {
_vm->displayMessage(0, "Unable to initialize ENet library.");
_vm->displayMessage("Unable to initialize ENet library.");
Net::closeProvider();
return false;
}
@@ -1243,7 +1243,7 @@ void Net::remoteReceiveData() {
if (_gameName == "moonbase") {
// TODO: Host migration
if (!_isHost && _vm->_currentRoom == 2) {
_vm->displayMessage(0, "You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end.");
_vm->displayMessage("You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end.");
_vm->VAR(253) = 26; // gGameMode = GAME-OVER
_vm->runScript(2104, 1, 0, 0); // leave-game
}
@@ -1404,7 +1404,7 @@ void Net::handleGameData(Common::JSONValue *json, int peerIndex) {
if (paramsArray[0]->asIntegerNumber() == 145 && _fromUserId == 1) {
if (!_isHost && _vm->_currentRoom == 2) {
// TODO: Host migration
_vm->displayMessage(0, "You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end.");
_vm->displayMessage("You have been disconnected from the game host.\nNormally, host migration would take place, but ScummVM doesn't do that yet, so this game session will now end.");
_vm->VAR(253) = 26; // GAME-OVER
_vm->runScript(2104, 1, 0, 0); // leave-game
return;
+2 -2
View File
@@ -231,7 +231,7 @@ void ScummEngine::askForDisk(const Common::Path &filename, int disknum) {
ConfMan.getPath("path").toString(Common::Path::kNativeSeparator).c_str());
#endif
result = displayMessage("Quit", "%s", buf);
result = displayMessageOKQuit("%s", buf);
if (!result) {
error("Cannot find file: '%s'", filename.toString(Common::Path::kNativeSeparator).c_str());
}
@@ -293,7 +293,7 @@ void ScummEngine::readIndexFile() {
}
if (checkTryMedia(_fileHandle)) {
displayMessage(nullptr, "You're trying to run game encrypted by ActiveMark. This is not supported.");
displayMessage("You're trying to run game encrypted by ActiveMark. This is not supported.");
quitGame();
return;
+18 -9
View File
@@ -1356,7 +1356,7 @@ Common::Error ScummEngine::init() {
GUI::MessageDialog dialog(Common::U32String::format(
_("Could not find the '%s' Macintosh executable to read resources from. %s will be disabled."),
gameName, (_game.id == GID_MONKEY2 || _game.version > 6) ? _s("The Mac GUI") : _s("The music and the Mac GUI")), _("OK"));
gameName, (_game.id == GID_MONKEY2 || _game.version > 6) ? _s("The Mac GUI") : _s("The music and the Mac GUI")));
dialog.runModal();
} else if (isUsingOriginalGUI() || _game.id == GID_INDY3 || _game.id == GID_LOOM) {
// FIXME: THIS IS A TEMPORARY WORKAROUND!
@@ -1810,8 +1810,7 @@ void ScummEngine_v7::setupScumm(const Common::Path &macResourceFile) {
GUI::MessageDialog dialog(_(
"Audio files compressed with ScummVM Tools were detected; *.BUN/*.SOU\n"
"compression is not supported anymore for this game, audio will be disabled.\n"
"Please copy the game from the original media without compression."),
_("OK"));
"Please copy the game from the original media without compression."));
dialog.runModal();
_imuseDigital->disableEngine();
}
@@ -2300,8 +2299,7 @@ void ScummEngine::setupMusic(int midi) {
GUI::MessageDialog dialog(
Common::U32String::format(
_("Native MIDI support requires the Roland Upgrade from LucasArts,\n"
"but %s is missing. Using AdLib instead."), fileName.toString(Common::Path::kNativeSeparator).c_str()),
_("OK"));
"but %s is missing. Using AdLib instead."), fileName.toString(Common::Path::kNativeSeparator).c_str()));
dialog.runModal();
_sound->_musicType = MDT_ADLIB;
}
@@ -2316,8 +2314,7 @@ void ScummEngine::setupMusic(int midi) {
memcmp(_gameMD5, "\xa0\x1f\xab\x4a\x64\xd4\x7b\x96\xe2\xe5\x8e\x6b\x0f\x82\x5c\xc7", 16) == 0) {
GUI::MessageDialog dialog(
_("This particular version of Monkey Island 1 is known to miss some\n"
"required resources for MT-32. Using AdLib instead."),
_("OK"));
"required resources for MT-32. Using AdLib instead."));
dialog.runModal();
_sound->_musicType = MDT_ADLIB;
}
@@ -4301,7 +4298,7 @@ void ScummEngine::confirmRestartDialog() {
}
}
char ScummEngine::displayMessage(const char *altButton, const char *message, ...) {
char ScummEngine::displayMessage(const char *message, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -4309,7 +4306,7 @@ char ScummEngine::displayMessage(const char *altButton, const char *message, ...
vsnprintf(buf, STRINGBUFLEN, message, va);
va_end(va);
GUI::MessageDialog dialog(buf, "OK", altButton);
GUI::MessageDialog dialog(buf);
return runDialog(dialog);
}
@@ -4325,6 +4322,18 @@ bool ScummEngine::displayMessageYesNo(const char *message, ...) {
return runDialog(dialog) == GUI::kMessageOK;
}
bool ScummEngine::displayMessageYesNo(const char *message, ...) {
char buf[STRINGBUFLEN];
va_list va;
va_start(va, message);
vsnprintf(buf, STRINGBUFLEN, message, va);
va_end(va);
GUI::MessageDialog dialog(buf, _("OK"), _("Quit"));
return runDialog(dialog) == GUI::kMessageOK;
}
#if defined(ENABLE_HE) && defined(USE_ENET)
int ScummEngine_v90he::networkSessionDialog() {
GUI::MessageDialog dialog(_("Would you like to host or join a network play session?"), _("Host"), _("Join"));
+2 -1
View File
@@ -803,8 +803,9 @@ protected:
void drawDraftsInventory();
public:
char displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4);
char displayMessage(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3);
bool displayMessageYesNo(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3);
bool displayMessageOKQuit(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3);
protected:
byte _fastMode = 0;
+1 -1
View File
@@ -137,7 +137,7 @@ SkyCompact::SkyCompact() {
error("unknown \"sky.cpt\" version");
if (SKY_CPT_SIZE != _cptFile->size()) {
GUI::MessageDialog dialog(_("The \"sky.cpt\" engine data file has an incorrect size."), _("OK"));
GUI::MessageDialog dialog(_("The \"sky.cpt\" engine data file has an incorrect size."));
dialog.runModal();
error("Incorrect sky.cpt size (%d, expected: %d)", (int)_cptFile->size(), SKY_CPT_SIZE);
}
+9 -9
View File
@@ -954,7 +954,7 @@ uint16 Control::saveRestorePanel(bool allowSave) {
saveGameTexts[_selectedGame] = dirtyBufStr;
saveDescriptions(saveGameTexts);
} else if (clickRes == NO_DISK_SPACE)
displayMessage(0, "Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str());
displayMessage("Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str());
quitPanel = true;
}
_mouseClicked = false;
@@ -1002,7 +1002,7 @@ uint16 Control::saveRestorePanel(bool allowSave) {
refreshNames = true;
}
if (clickRes == NO_DISK_SPACE) {
displayMessage(0, "Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str());
displayMessage("Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str());
quitPanel = true;
}
if ((clickRes == CANCEL_PRESSED) || (clickRes == GAME_RESTORED))
@@ -1153,7 +1153,7 @@ bool Control::isControlPanelOpen() {
return _controlPanel;
}
int Control::displayMessage(const char *altButton, const char *message, ...) {
int Control::displayMessage(const char *message, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -1161,7 +1161,7 @@ int Control::displayMessage(const char *altButton, const char *message, ...) {
vsnprintf(buf, STRINGBUFLEN, message, va);
va_end(va);
GUI::MessageDialog dialog(buf, "OK", altButton);
GUI::MessageDialog dialog(buf);
int result = dialog.runModal();
_skyMouse->spriteMouse(MOUSE_NORMAL, 0, 0);
return result;
@@ -1182,7 +1182,7 @@ void Control::saveDescriptions(const Common::StringArray &list) {
delete outf;
}
if (ioFailed)
displayMessage(NULL, "Unable to store Savegame names to file SKY-VM.SAV. (%s)", _saveFileMan->popErrorDesc().c_str());
displayMessage("Unable to store Savegame names to file SKY-VM.SAV. (%s)", _saveFileMan->popErrorDesc().c_str());
}
uint16 Control::saveGameToFile(bool fromControlPanel, const char *filename, bool isAutosave) {
@@ -1385,16 +1385,16 @@ uint16 Control::parseSaveData(uint8 *srcBuf) {
LODSD(srcPos, size);
LODSD(srcPos, saveRev);
if (saveRev > SAVE_FILE_REVISION) {
displayMessage(0, "Unknown save file revision (%d)", saveRev);
displayMessage("Unknown save file revision (%d)", saveRev);
return RESTORE_FAILED;
} else if (saveRev < OLD_SAVEGAME_TYPE) {
displayMessage(0, "This saved game version is unsupported.");
displayMessage("This saved game version is unsupported.");
return RESTORE_FAILED;
}
LODSD(srcPos, gameVersion);
if (gameVersion != SkyEngine::_systemVars->gameVersion) {
if ((!SkyEngine::isCDVersion()) || (gameVersion < 365)) { // cd versions are compatible
displayMessage(NULL, "This saved game was created by\n"
displayMessage("This saved game was created by\n"
"Beneath a Steel Sky v0.0%03d\n"
"It cannot be loaded by this version (v0.0%3d)",
gameVersion, SkyEngine::_systemVars->gameVersion);
@@ -1482,7 +1482,7 @@ uint16 Control::restoreGameFromFile(bool autoSave) {
*(uint32 *)saveData = TO_LE_32(infSize);
if (inf->read(saveData+4, infSize-4) != infSize-4) {
displayMessage(NULL, "Can't read from file '%s'", filename.c_str());
displayMessage("Can't read from file '%s'", filename.c_str());
free(saveData);
delete inf;
return RESTORE_FAILED;
+1 -1
View File
@@ -198,7 +198,7 @@ public:
void saveDescriptions(const Common::StringArray &list);
private:
int displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4);
int displayMessage(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3);
void initPanel();
void removePanel();
+2 -2
View File
@@ -563,7 +563,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *
Video::VideoDecoder *aviDecoder = new Video::AVIDecoder(12);
return new MoviePlayer(vm, textMan, resMan, sound, system, aviDecoder, kVideoDecoderMP2);
#else
GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support"), _("OK"));
GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support"));
dialog.runModal();
return 0;
#endif
@@ -571,7 +571,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *
if (!vm->isPsx() || scumm_stricmp(sequenceList[id], "enddemo") != 0) {
Common::U32String buf = Common::U32String::format(_("Cutscene '%s' not found"), sequenceList[id]);
GUI::MessageDialog dialog(buf, _("OK"));
GUI::MessageDialog dialog(buf);
dialog.runModal();
}
+7 -7
View File
@@ -2790,7 +2790,7 @@ void Control::drawPsxComponent(int componentType, uint8 *src, uint8 *dst, FrameH
free(initialPtr);
}
int Control::displayMessage(const char *altButton, const char *message, ...) {
int Control::displayMessage(const char *message, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -2798,7 +2798,7 @@ int Control::displayMessage(const char *altButton, const char *message, ...) {
vsnprintf(buf, STRINGBUFLEN, message, va);
va_end(va);
GUI::MessageDialog dialog(buf, "OK", altButton);
GUI::MessageDialog dialog(buf);
int result = dialog.runModal();
_mouse->setPointer(MSE_POINTER, 0);
return result;
@@ -2860,7 +2860,7 @@ void Control::saveGameToFile(uint8 slot) {
outf = _saveFileMan->openForSaving(fName);
if (!outf) {
// Display an error message and do nothing
displayMessage(0, "Unable to create file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
displayMessage("Unable to create file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
return;
}
@@ -2908,7 +2908,7 @@ void Control::saveGameToFile(uint8 slot) {
outf->writeUint32LE(playerRaw[cnt2]);
outf->finalize();
if (outf->err())
displayMessage(0, "Couldn't write to file '%s'. Device full? (%s)", fName, _saveFileMan->popErrorDesc().c_str());
displayMessage("Couldn't write to file '%s'. Device full? (%s)", fName, _saveFileMan->popErrorDesc().c_str());
delete outf;
}
@@ -2920,14 +2920,14 @@ bool Control::restoreGameFromFile(uint8 slot) {
inf = _saveFileMan->openForLoading(fName);
if (!inf) {
// Display an error message, and do nothing
displayMessage(0, "Can't open file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
displayMessage("Can't open file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
return false;
}
uint saveHeader = inf->readUint32LE();
if (saveHeader != SAVEGAME_HEADER) {
// Display an error message, and do nothing
displayMessage(0, "Saved game '%s' is corrupt", fName);
displayMessage("Saved game '%s' is corrupt", fName);
return false;
}
@@ -2973,7 +2973,7 @@ bool Control::restoreGameFromFile(uint8 slot) {
playerBuf[cnt2] = inf->readUint32LE();
if (inf->err() || inf->eos()) {
displayMessage(0, "Can't read from file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
displayMessage("Can't read from file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str());
delete inf;
free(_restoreBuf);
_restoreBuf = nullptr;
+1 -1
View File
@@ -202,7 +202,7 @@ private:
bool gameVersionIsMediaHouse();
bool loadCustomStrings(const char *filename);
int displayMessage(const char *altButton, MSVC_PRINTF const char *message, ...) GCC_PRINTF(3, 4);
int displayMessage(MSVC_PRINTF const char *message, ...) GCC_PRINTF(2, 3);
// PSX Credits functions
int32 getCreditsFontHeight(uint8 *font);
+1 -1
View File
@@ -1735,7 +1735,7 @@ int Logic::fnRestartGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32
int Logic::fnQuitGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
if (SwordEngine::_systemVars.isDemo) {
GUI::MessageDialog dialog(_("This is the end of the Broken Sword 1 Demo"), _("OK"));
GUI::MessageDialog dialog(_("This is the end of the Broken Sword 1 Demo"));
dialog.runModal();
Engine::quitGame();
} else
+2 -2
View File
@@ -456,7 +456,7 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system
Video::AVIDecoder *aviDecoder = new Video::AVIDecoder(12);
return new MoviePlayer(vm, system, aviDecoder, kVideoDecoderMP2);
#else
GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support"), _("OK"));
GUI::MessageDialog dialog(_("MPEG-2 cutscenes found but ScummVM has been built without MPEG-2 support"));
dialog.runModal();
return nullptr;
#endif
@@ -466,7 +466,7 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system
// In addition, some of the later re-releases of the game don't have the "eye" Virgin logo movie.
if (!vm->_logic->readVar(DEMO) && strcmp(name, "eye") != 0) {
Common::U32String buf = Common::U32String::format(_("Cutscene '%s' not found"), name);
GUI::MessageDialog dialog(buf, _("OK"));
GUI::MessageDialog dialog(buf);
dialog.runModal();
} else
warning("Cutscene '%s' not found", name);
+1 -1
View File
@@ -486,7 +486,7 @@ void SoundManager::setSFXVolumes(uint8 volume) {
void SoundManager::showSoundError(const char *errorMsg, const char *soundFile) {
Common::String msg;
msg = Common::String::format(errorMsg, soundFile);
GUI::MessageDialog dialog(msg.c_str(), "OK");
GUI::MessageDialog dialog(msg.c_str());
dialog.runModal();
error("%s", msg.c_str());
+1 -1
View File
@@ -98,7 +98,7 @@ void ChangeLanguage(LANGUAGE newLang) {
if ((newLang == TXT_ENGLISH) || !f.open(_vm->getTextFile(TXT_ENGLISH))) {
char buf[50];
Common::sprintf_s(buf, CANNOT_FIND_FILE, _vm->getTextFile(newLang));
GUI::MessageDialog dialog(buf, "OK");
GUI::MessageDialog dialog(buf);
dialog.runModal();
error(CANNOT_FIND_FILE, _vm->getTextFile(newLang));
+2 -4
View File
@@ -92,8 +92,7 @@ Common::Error VCruiseEngine::run() {
if (_gameDescription->desc.flags & VCRUISE_GF_WANT_OGG_VORBIS) {
GUI::MessageDialog dialog(
_("Music for this game requires Ogg Vorbis support, which was not compiled in.\n"
"The game will still play, but will not have any music."),
_("OK"));
"The game will still play, but will not have any music."));
dialog.runModal();
}
#endif
@@ -102,8 +101,7 @@ Common::Error VCruiseEngine::run() {
if (_gameDescription->desc.flags & VCRUISE_GF_WANT_MP3) {
GUI::MessageDialog dialog(
_("Music for this game requires MP3 support, which was not compiled in.\n"
"The game will still play, but will not have any music."),
_("OK"));
"The game will still play, but will not have any music."));
dialog.runModal();
}
#endif
+1 -2
View File
@@ -207,8 +207,7 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea
_("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."), tempVersion, SAVE_VERSION
),
_("OK"));
));
dialog.runModal();
}
+1 -1
View File
@@ -143,7 +143,7 @@ bool DownloadDialog::selectDirectories() {
if (file.getName().equalsIgnoreCase(remoteDirectory.name())) {
// If there is, ask user whether it's OK
if (!file.isDirectory()) {
GUI::MessageDialog alert(_("Cannot create a directory to download - the specified directory has a file with the same name."), _("OK"));
GUI::MessageDialog alert(_("Cannot create a directory to download - the specified directory has a file with the same name."));
alert.runModal();
return false;
}
+2 -2
View File
@@ -563,11 +563,11 @@ void LauncherDialog::loadGame(int item) {
}
} else {
MessageDialog dialog
(_("This game does not support loading games from the launcher."), _("OK"));
(_("This game does not support loading games from the launcher."));
dialog.runModal();
}
} else {
MessageDialog dialog(_("ScummVM could not find any engine capable of running the selected game!"), _("OK"));
MessageDialog dialog(_("ScummVM could not find any engine capable of running the selected game!"));
dialog.runModal();
}
+21
View File
@@ -152,6 +152,14 @@ void MessageDialog::reflowLayout() {
}
}
MessageDialog::MessageDialog(const Common::U32String &message)
: MessageDialog(message, _("OK")) {
}
MessageDialog::MessageDialog(const Common::String &message)
: MessageDialog(Common::U32String(message), _("OK")) {
}
MessageDialog::MessageDialog(const Common::U32String &message,
const Common::U32String &defaultButton,
const Common::U32String &altButton,
@@ -218,6 +226,11 @@ void TimedMessageDialog::handleTickle() {
close();
}
CountdownMessageDialog::CountdownMessageDialog(const Common::U32String &message,
uint32 duration)
: CountdownMessageDialog(message, duration, _("OK")) {
}
CountdownMessageDialog::CountdownMessageDialog(const Common::U32String &message,
uint32 duration,
const Common::U32String &defaultButton,
@@ -253,6 +266,14 @@ void CountdownMessageDialog::updateCountdown() {
}
}
MessageDialogWithURL::MessageDialogWithURL(const Common::U32String &message, const char *url)
: MessageDialogWithURL(message, url, _("OK")) {
}
MessageDialogWithURL::MessageDialogWithURL(const Common::String &message, const char *url)
: MessageDialogWithURL(Common::U32String(message), url, _("OK")) {
}
MessageDialogWithURL::MessageDialogWithURL(const Common::U32String &message, const char *url, const Common::U32String &defaultButton, Graphics::TextAlign alignment)
: MessageDialog(message, defaultButton, _("Open URL"), alignment, url) {
}
+11 -5
View File
@@ -43,14 +43,16 @@ enum {
*/
class MessageDialog : public Dialog {
public:
MessageDialog(const Common::U32String &message);
MessageDialog(const Common::String &message);
MessageDialog(const Common::U32String &message,
const Common::U32String &defaultButton = Common::U32String("OK"),
const Common::U32String &defaultButton,
const Common::U32String &altButton = Common::U32String(),
Graphics::TextAlign alignment = Graphics::kTextAlignCenter,
const char *url = nullptr,
const Common::U32String &extraMessage = Common::U32String());
MessageDialog(const Common::String &message,
const Common::String &defaultButton = "OK",
const Common::String &defaultButton,
const Common::String &altButton = Common::String(),
Graphics::TextAlign alignment = Graphics::kTextAlignCenter,
const char *url = nullptr);
@@ -97,9 +99,11 @@ protected:
*/
class CountdownMessageDialog : public MessageDialog {
public:
CountdownMessageDialog(const Common::U32String &message,
uint32 duration);
CountdownMessageDialog(const Common::U32String &message,
uint32 duration,
const Common::U32String &defaultButton = Common::U32String("OK"),
const Common::U32String &defaultButton,
const Common::U32String &altButton = Common::U32String(),
Graphics::TextAlign alignment = Graphics::kTextAlignCenter,
const Common::U32String &countdownMessage = Common::U32String(""));
@@ -119,8 +123,10 @@ protected:
*/
class MessageDialogWithURL : public MessageDialog {
public:
MessageDialogWithURL(const Common::U32String &message, const char *url, const Common::U32String &defaultButton = Common::U32String("OK"), Graphics::TextAlign alignment = Graphics::kTextAlignCenter);
MessageDialogWithURL(const Common::String &message, const char *url, const char *defaultButton = "OK", Graphics::TextAlign alignment = Graphics::kTextAlignCenter);
MessageDialogWithURL(const Common::U32String &message, const char *url);
MessageDialogWithURL(const Common::String &message, const char *url);
MessageDialogWithURL(const Common::U32String &message, const char *url, const Common::U32String &defaultButton, Graphics::TextAlign alignment = Graphics::kTextAlignCenter);
MessageDialogWithURL(const Common::String &message, const char *url, const char *defaultButton, Graphics::TextAlign alignment = Graphics::kTextAlignCenter);
};