Skip to content

Commit

Permalink
Resolve issue #4876: No confirmation dialogue box when exporting comb…
Browse files Browse the repository at this point in the history
…ined models.

Update German localization.
  • Loading branch information
codereader committed Sep 20, 2018
1 parent bf034c7 commit c261458
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 67 deletions.
52 changes: 31 additions & 21 deletions install/i18n/darkradiant.pot
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: greebo@angua.at\n"
"POT-Creation-Date: 2018-05-02 09:31+0200\n"
"POT-Creation-Date: 2018-09-20 13:24+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -422,17 +422,17 @@ msgstr ""
msgid "Export region"
msgstr ""

#: ..\..\radiant\model\ModelExporter.cpp:323
#: ..\..\radiant\model\ModelExporter.cpp:324
#: ..\..\plugins\particles\ParticlesManager.cpp:323
#: ..\..\plugins\particles\ParticlesManager.cpp:351
msgid "Cannot open file for writing: {0}"
msgstr ""

#: ..\..\radiant\model\ModelExporter.cpp:345
#: ..\..\radiant\model\ModelExporter.cpp:346
msgid "Could not rename the existing file to .bak: {0}"
msgstr ""

#: ..\..\radiant\model\ModelExporter.cpp:359
#: ..\..\radiant\model\ModelExporter.cpp:360
msgid "Could not rename the temporary file: {0}"
msgstr ""

Expand Down Expand Up @@ -779,7 +779,7 @@ msgid "ShaderClipboard is empty."
msgstr ""

#: ..\..\radiant\settings\GameManager.cpp:119
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:182
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:183
msgid "Game"
msgstr ""

Expand Down Expand Up @@ -2345,23 +2345,33 @@ msgstr ""
msgid "Model Export"
msgstr ""

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:176
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:180
msgid "Empty Filename"
msgstr ""

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:176
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:180
msgid "No filename specified, cannot run exporter"
msgstr ""

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:191
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:186
msgid "Confirm Replacement"
msgstr ""

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:187
msgid ""
"The file {0} already exists.\n"
"Replace this file?"
msgstr ""

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:204
msgid "Export failed"
msgstr ""

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:283
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:296
msgid "Empty Selection"
msgstr ""

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:283
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:296
msgid "Nothing selected, cannot run exporter"
msgstr ""

Expand Down Expand Up @@ -2720,11 +2730,11 @@ msgstr ""
msgid "The mission path \"{0}\" does not exist.\n"
msgstr ""

#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:23
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:24
msgid "DarkRadiant Preferences"
msgstr ""

#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:117
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:118
msgid "Settings/"
msgstr ""

Expand Down Expand Up @@ -2917,11 +2927,11 @@ msgstr ""
msgid "Remove from Layer..."
msgstr ""

#: ..\..\radiant\undo\UndoSystem.cpp:331
#: ..\..\radiant\undo\UndoSystem.cpp:340
msgid "Settings/Undo System"
msgstr ""

#: ..\..\radiant\undo\UndoSystem.cpp:332
#: ..\..\radiant\undo\UndoSystem.cpp:341
msgid "Undo Queue Size"
msgstr ""

Expand Down Expand Up @@ -3022,19 +3032,19 @@ msgstr ""
msgid "Zoom View"
msgstr ""

#: ..\..\radiant\xyview\XYWnd.cpp:229
#: ..\..\radiant\xyview\XYWnd.cpp:235
msgid "XY Top"
msgstr ""

#: ..\..\radiant\xyview\XYWnd.cpp:232
#: ..\..\radiant\xyview\XYWnd.cpp:238
msgid "XZ Front"
msgstr ""

#: ..\..\radiant\xyview\XYWnd.cpp:235
#: ..\..\radiant\xyview\XYWnd.cpp:241
msgid "YZ Side"
msgstr ""

#: ..\..\radiant\xyview\XYWnd.cpp:498
#: ..\..\radiant\xyview\XYWnd.cpp:504
msgid "x: {0:6.1f} y: {1:6.1f} z: {2:6.1f}"
msgstr ""

Expand Down Expand Up @@ -4652,11 +4662,11 @@ msgstr ""
msgid "Shift"
msgstr ""

#: ..\..\libs\wxutil\PathEntry.cpp:97
#: ..\..\libs\wxutil\PathEntry.cpp:103
msgid "Choose File"
msgstr ""

#: ..\..\libs\wxutil\PathEntry.cpp:118
#: ..\..\libs\wxutil\PathEntry.cpp:126
msgid "Choose Directory"
msgstr ""

Expand Down Expand Up @@ -5791,7 +5801,7 @@ msgstr ""

#: xml_file_content.cpp:3
msgid ""
"http://www.darkradiant.net/\n"
"https://www.darkradiant.net/\n"
"\n"
"This product contains software technology\n"
"from id Software, Inc. ('id Technology').\n"
Expand Down
Binary file modified install/i18n/de/LC_MESSAGES/darkradiant.mo
Binary file not shown.
60 changes: 36 additions & 24 deletions install/i18n/de/LC_MESSAGES/darkradiant.po
Expand Up @@ -2,9 +2,9 @@ msgid ""
msgstr ""
"Project-Id-Version: DarkRadiant\n"
"Report-Msgid-Bugs-To: greebo@angua.at\n"
"POT-Creation-Date: 2018-05-02 09:31+0200\n"
"PO-Revision-Date: 2018-05-02 09:33+0100\n"
"Last-Translator: codereader <greebo@thedarkmod.com>\n"
"POT-Creation-Date: 2018-09-20 13:24+0200\n"
"PO-Revision-Date: 2018-09-20 13:25+0100\n"
"Last-Translator: codereader <greebo@angua.at>\n"
"Language-Team: The Dark Mod\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -457,17 +457,17 @@ msgstr "Kann keine Region festlegen: keine Elemente ausgewählt."
msgid "Export region"
msgstr "Exportiere Region"

#: ..\..\radiant\model\ModelExporter.cpp:323
#: ..\..\radiant\model\ModelExporter.cpp:324
#: ..\..\plugins\particles\ParticlesManager.cpp:323
#: ..\..\plugins\particles\ParticlesManager.cpp:351
msgid "Cannot open file for writing: {0}"
msgstr "Kann die Datei nicht im Schreibmodus öffnen: {0}"

#: ..\..\radiant\model\ModelExporter.cpp:345
#: ..\..\radiant\model\ModelExporter.cpp:346
msgid "Could not rename the existing file to .bak: {0}"
msgstr "Konnte die bestehende Datei nicht auf .bak umbenennen: {0}"

#: ..\..\radiant\model\ModelExporter.cpp:359
#: ..\..\radiant\model\ModelExporter.cpp:360
msgid "Could not rename the temporary file: {0}"
msgstr "Konnte die temporäre Datei nicht umbenennen: {0}"

Expand Down Expand Up @@ -821,7 +821,7 @@ msgid "ShaderClipboard is empty."
msgstr "Shader-Zwischenablage ist leer."

#: ..\..\radiant\settings\GameManager.cpp:119
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:182
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:183
msgid "Game"
msgstr "Spiel"

Expand Down Expand Up @@ -2416,23 +2416,35 @@ msgstr "Filter bearbeiten..."
msgid "Model Export"
msgstr "Model-Export"

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:176
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:180
msgid "Empty Filename"
msgstr "Leerer Dateiname"

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:176
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:180
msgid "No filename specified, cannot run exporter"
msgstr "Kein Zieldateipfad angegeben, exportieren nicht möglich."

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:191
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:186
msgid "Confirm Replacement"
msgstr "Ersetzen bestätigen"

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:187
msgid ""
"The file {0} already exists.\n"
"Replace this file?"
msgstr ""
"Die Datei {0} existiert bereits.\n"
"Soll sie überschrieben werden?"

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:204
msgid "Export failed"
msgstr "Export fehlgeschlagen"

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:283
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:296
msgid "Empty Selection"
msgstr "Keine Auswahl"

#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:283
#: ..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp:296
msgid "Nothing selected, cannot run exporter"
msgstr "Nichts ausgewählt, exportieren nicht möglich"

Expand Down Expand Up @@ -2800,11 +2812,11 @@ msgstr "Die EXE-Datei \"{0}\" konnte in dem angegebenen Ordner nicht gefunden we
msgid "The mission path \"{0}\" does not exist.\n"
msgstr "Der Missions-Pfad \"{0}\" existiert nicht.\n"

#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:23
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:24
msgid "DarkRadiant Preferences"
msgstr "DarkRadiant Einstellungen"

#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:117
#: ..\..\radiant\ui\prefdialog\PrefDialog.cpp:118
msgid "Settings/"
msgstr "Einstellungen/"

Expand Down Expand Up @@ -2997,11 +3009,11 @@ msgstr "Nach Layer verschieben..."
msgid "Remove from Layer..."
msgstr "Von Layer entfernen..."

#: ..\..\radiant\undo\UndoSystem.cpp:331
#: ..\..\radiant\undo\UndoSystem.cpp:340
msgid "Settings/Undo System"
msgstr "Einstellungen/Undo"

#: ..\..\radiant\undo\UndoSystem.cpp:332
#: ..\..\radiant\undo\UndoSystem.cpp:341
msgid "Undo Queue Size"
msgstr "Größe des Undo-Stapels"

Expand Down Expand Up @@ -3108,19 +3120,19 @@ msgstr "Ansicht verschieben"
msgid "Zoom View"
msgstr "Ansicht zoomen"

#: ..\..\radiant\xyview\XYWnd.cpp:229
#: ..\..\radiant\xyview\XYWnd.cpp:235
msgid "XY Top"
msgstr "XY Oben"

#: ..\..\radiant\xyview\XYWnd.cpp:232
#: ..\..\radiant\xyview\XYWnd.cpp:238
msgid "XZ Front"
msgstr "XZ Vorne"

#: ..\..\radiant\xyview\XYWnd.cpp:235
#: ..\..\radiant\xyview\XYWnd.cpp:241
msgid "YZ Side"
msgstr "YZ Seite"

#: ..\..\radiant\xyview\XYWnd.cpp:498
#: ..\..\radiant\xyview\XYWnd.cpp:504
msgid "x: {0:6.1f} y: {1:6.1f} z: {2:6.1f}"
msgstr "x: {0:6.1f} y: {1:6.1f} z: {2:6.1f}"

Expand Down Expand Up @@ -4779,11 +4791,11 @@ msgstr "Strg"
msgid "Shift"
msgstr "Umschalt"

#: ..\..\libs\wxutil\PathEntry.cpp:97
#: ..\..\libs\wxutil\PathEntry.cpp:103
msgid "Choose File"
msgstr "Datei auswählen"

#: ..\..\libs\wxutil\PathEntry.cpp:118
#: ..\..\libs\wxutil\PathEntry.cpp:126
msgid "Choose Directory"
msgstr "Verzeichnis auswählen"

Expand Down Expand Up @@ -5925,7 +5937,7 @@ msgstr "Kompilierungsdatum: %s"

#: xml_file_content.cpp:3
msgid ""
"http://www.darkradiant.net/\n"
"https://www.darkradiant.net/\n"
"\n"
"This product contains software technology\n"
"from id Software, Inc. ('id Technology').\n"
Expand All @@ -5935,7 +5947,7 @@ msgid ""
"\n"
"The Dark Mod (www.thedarkmod.com)"
msgstr ""
"http://www.darkradiant.net/\n"
"https://www.darkradiant.net/\n"
"\n"
"Dieses Produkt enthält teilweise Software \n"
"der Firma id Software, Inc. ('id Technology').\n"
Expand Down
10 changes: 9 additions & 1 deletion libs/wxutil/PathEntry.cpp
Expand Up @@ -36,7 +36,8 @@ PathEntry::PathEntry(wxWindow* parent, bool foldersOnly, bool open,
wxPanel(parent, wxID_ANY),
_fileType(fileType),
_defaultExt(defaultExt),
_open(open)
_open(open),
_askForOverwrite(true)
{
SetSizer(new wxBoxSizer(wxHORIZONTAL));

Expand Down Expand Up @@ -90,12 +91,19 @@ void PathEntry::setDefaultExtension(const std::string& defaultExt)
_defaultExt = defaultExt;
}

void PathEntry::setAskForOverwrite(bool ask)
{
_askForOverwrite = ask;
}

void PathEntry::onBrowseFiles(wxCommandEvent& ev)
{
wxWindow* topLevel = wxGetTopLevelParent(this);

FileChooser fileChooser(topLevel, _("Choose File"), _open, _fileType, _defaultExt);

// Propagate the setting of this picker
fileChooser.askForOverwrite(_askForOverwrite);
fileChooser.setCurrentPath(getValue());

std::string filename = fileChooser.display();
Expand Down
7 changes: 7 additions & 0 deletions libs/wxutil/PathEntry.h
Expand Up @@ -33,6 +33,9 @@ class PathEntry :
// Whether we're opening the FileChooser in open or save mode
bool _open;

// Whether save-dialogs are asking the user if they want to overwrite the selected file
bool _askForOverwrite;

private:
// Private shared constructor
PathEntry(wxWindow* parent, bool foldersOnly, bool open,
Expand Down Expand Up @@ -82,6 +85,10 @@ class PathEntry :
// Set the default extension to use in the FileChooser variant
void setDefaultExtension(const std::string& defaultExt);

// For save-style PathEntry fields it's possible to skip the "Replace this file?" question
// This flag will be forwarded to the underlying FileChooser class.
void setAskForOverwrite(bool ask);

private:
// callbacks
void onBrowseFiles(wxCommandEvent& ev);
Expand Down
13 changes: 13 additions & 0 deletions radiant/ui/modelexport/ExportAsModelDialog.cpp
Expand Up @@ -120,6 +120,10 @@ void ExportAsModelDialog::populateWindow()
pathEntry->setValue(recentPath);
pathEntry->SetName("ExportDialogFilePicker");

// We don't want the FileChooser to ask for permission overwriting an existing file,
// we do this ourselves in this class when the user hits OK
pathEntry->setAskForOverwrite(false);

existing->GetContainingSizer()->Replace(existing, pathEntry);
existing->Destroy();

Expand Down Expand Up @@ -177,6 +181,15 @@ void ExportAsModelDialog::onExport(wxCommandEvent& ev)
return;
}

// Check if the target file already exists
if (os::fileOrDirExists(options.outputFilename) &&
wxutil::Messagebox::Show(_("Confirm Replacement"),
fmt::format(_("The file {0} already exists.\nReplace this file?"), options.outputFilename),
IDialog::MessageType::MESSAGE_ASK) != IDialog::RESULT_YES)
{
return; // abort
}

saveOptionsToRegistry();

try
Expand Down

0 comments on commit c261458

Please sign in to comment.