overwriting changes, german translation updated

This commit is contained in:
Rafael 2016-03-28 21:37:42 +02:00
parent de79678187
commit e8c3d82db2
5 changed files with 108 additions and 28 deletions

View file

@ -146,11 +146,15 @@ void PictureDialog::on_cmdClose_clicked()
void PictureDialog::on_cmdExport_clicked() void PictureDialog::on_cmdExport_clicked()
{ {
QSettings settings("Syping", "gta5sync");
settings.beginGroup("FileDialogs");
QFileDialog fileDialog(this); QFileDialog fileDialog(this);
fileDialog.setFileMode(QFileDialog::AnyFile); fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setViewMode(QFileDialog::Detail); fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setAcceptMode(QFileDialog::AcceptSave); fileDialog.setAcceptMode(QFileDialog::AcceptSave);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, true); fileDialog.setOption(QFileDialog::DontUseNativeDialog, true);
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
fileDialog.setDefaultSuffix("suffix"); fileDialog.setDefaultSuffix("suffix");
fileDialog.setWindowTitle(tr("Export picture")); fileDialog.setWindowTitle(tr("Export picture"));
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint); fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
@ -186,6 +190,7 @@ void PictureDialog::on_cmdExport_clicked()
} }
fileDialog.setSidebarUrls(sidebarUrls); fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.restoreState(settings.value("ExportPicture","").toByteArray());
fileDialogPreSave: fileDialogPreSave:
if (fileDialog.exec()) if (fileDialog.exec())
@ -224,11 +229,27 @@ fileDialogPreSave:
} }
} }
if (QFile::exists(selectedFile))
{
if (QMessageBox::Yes == QMessageBox::warning(this, tr("Export picture"), tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
{
if (!QFile::remove(selectedFile))
{
QMessageBox::warning(this, tr("Export picture"), tr("Failed to overwrite %1 with current Snapmatic picture").arg("\""+selectedFile+"\""));
goto fileDialogPreSave;
}
}
else
{
goto fileDialogPreSave;
}
}
bool isSaved = ui->labPicture->pixmap()->save(selectedFile, saveFileFormat.toStdString().c_str(), 100); bool isSaved = ui->labPicture->pixmap()->save(selectedFile, saveFileFormat.toStdString().c_str(), 100);
if (!isSaved) if (!isSaved)
{ {
QMessageBox::warning(this, tr("Export picture"), tr("Failed to save the picture")); QMessageBox::warning(this, tr("Export picture"), tr("Failed to save current picture"));
goto fileDialogPreSave; goto fileDialogPreSave;
} }
} }
@ -238,4 +259,7 @@ fileDialogPreSave:
goto fileDialogPreSave; goto fileDialogPreSave;
} }
} }
settings.setValue("ExportPicture", fileDialog.saveState());
settings.endGroup();
} }

View file

@ -22,6 +22,7 @@
#include "SavegameData.h" #include "SavegameData.h"
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QSettings>
#include <QFileInfo> #include <QFileInfo>
#include <QFile> #include <QFile>
#include <QUrl> #include <QUrl>
@ -71,12 +72,16 @@ void SavegameWidget::on_cmdDelete_clicked()
void SavegameWidget::on_cmdCopy_clicked() void SavegameWidget::on_cmdCopy_clicked()
{ {
QSettings settings("Syping", "gta5sync");
settings.beginGroup("FileDialogs");
QFileInfo fileInfo(sgdPath); QFileInfo fileInfo(sgdPath);
QFileDialog fileDialog(this); QFileDialog fileDialog(this);
fileDialog.setFileMode(QFileDialog::AnyFile); fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setViewMode(QFileDialog::Detail); fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setAcceptMode(QFileDialog::AcceptSave); fileDialog.setAcceptMode(QFileDialog::AcceptSave);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, true); fileDialog.setOption(QFileDialog::DontUseNativeDialog, true);
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
fileDialog.setDefaultSuffix(""); fileDialog.setDefaultSuffix("");
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint); fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
fileDialog.setWindowTitle(tr("Copy savegame")); fileDialog.setWindowTitle(tr("Copy savegame"));
@ -112,6 +117,7 @@ void SavegameWidget::on_cmdCopy_clicked()
} }
fileDialog.setSidebarUrls(sidebarUrls); fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.restoreState(settings.value("CopySavegame","").toByteArray());
fileDialogPreSave: fileDialogPreSave:
if (fileDialog.exec()) if (fileDialog.exec())
@ -121,11 +127,26 @@ fileDialogPreSave:
{ {
QString selectedFile = selectedFiles.at(0); QString selectedFile = selectedFiles.at(0);
bool isCopied = QFile::copy(sgdPath, selectedFile); if (QFile::exists(selectedFile))
{
if (QMessageBox::Yes == QMessageBox::warning(this, tr("Copy savegame"), tr("Overwrite %1 with current savegame?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
{
if (!QFile::remove(selectedFile))
{
QMessageBox::warning(this, tr("Copy savegame"), tr("Failed to overwrite %1 with current savegame").arg("\""+selectedFile+"\""));
goto fileDialogPreSave;
}
}
else
{
goto fileDialogPreSave;
}
}
bool isCopied = QFile::copy(sgdPath, selectedFile);
if (!isCopied) if (!isCopied)
{ {
QMessageBox::warning(this, tr("Copy savegame"), tr("Failed to copy the savegame")); QMessageBox::warning(this, tr("Copy savegame"), tr("Failed to copy current savegame"));
goto fileDialogPreSave; goto fileDialogPreSave;
} }
} }
@ -135,4 +156,7 @@ fileDialogPreSave:
goto fileDialogPreSave; goto fileDialogPreSave;
} }
} }
settings.setValue("CopySavegame", fileDialog.saveState());
settings.endGroup();
} }

View file

@ -72,7 +72,7 @@ void SnapmaticWidget::on_cmdView_clicked()
void SnapmaticWidget::on_cmdDelete_clicked() void SnapmaticWidget::on_cmdDelete_clicked()
{ {
int uchoice = QMessageBox::question(this, tr("Delete picture"), tr("Are you sure to delete %1 from your Snapmatic pictures?").arg("\""+picStr+"\""), QMessageBox::No | QMessageBox::Yes, QMessageBox::No); int uchoice = QMessageBox::question(this, tr("Delete picture"), tr("Are you sure to delete %1 from your Snapmatic pictures?").arg("\""+picStr+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (uchoice == QMessageBox::Yes) if (uchoice == QMessageBox::Yes)
{ {
if (!QFile::exists(picPath)) if (!QFile::exists(picPath))

Binary file not shown.

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.0" language="de_DE"> <TS version="2.1" language="de_DE">
<context> <context>
<name>AboutDialog</name> <name>AboutDialog</name>
<message> <message>
@ -66,23 +66,40 @@
<translation>Keine Crew</translation> <translation>Keine Crew</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="159"/> <location filename="PictureDialog.cpp" line="163"/>
<source>JPEG picture (*.jpg)</source> <source>JPEG picture (*.jpg)</source>
<translation>JPEG Bild (*.jpg)</translation> <translation>JPEG Bild (*.jpg)</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="160"/> <location filename="PictureDialog.cpp" line="164"/>
<source>Portable Network Graphics (*.png)</source> <source>Portable Network Graphics (*.png)</source>
<translation>Portable Network Graphics (*.png)</translation> <translation>Portable Network Graphics (*.png)</translation>
</message> </message>
<message> <message>
<source>JPEG picture (*.jpg);;Portable Network Graphics (*.png)</source> <location filename="PictureDialog.cpp" line="234"/>
<translation>JPEG Bild (*.jpg);;Portable Network Graphics (*.png)</translation> <source>Overwrite %1 with current Snapmatic picture?</source>
<translation>Überschreibe %1 mit aktuellen Snapmatic Bild?</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="155"/> <location filename="PictureDialog.cpp" line="238"/>
<location filename="PictureDialog.cpp" line="231"/> <source>Failed to overwrite %1 with current Snapmatic picture</source>
<location filename="PictureDialog.cpp" line="237"/> <translation>Fehlgeschlagen beim Überschreiben von %1 mit aktuellen Snapmatic Bild</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="252"/>
<source>Failed to save current picture</source>
<translation>Fehlgeschlagen beim Speichern vom aktuellen Bild</translation>
</message>
<message>
<source>JPEG picture (*.jpg);;Portable Network Graphics (*.png)</source>
<translation type="vanished">JPEG Bild (*.jpg);;Portable Network Graphics (*.png)</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="159"/>
<location filename="PictureDialog.cpp" line="234"/>
<location filename="PictureDialog.cpp" line="238"/>
<location filename="PictureDialog.cpp" line="252"/>
<location filename="PictureDialog.cpp" line="258"/>
<source>Export picture</source> <source>Export picture</source>
<translation>Bild exportieren</translation> <translation>Bild exportieren</translation>
</message> </message>
@ -91,12 +108,11 @@
<translation type="obsolete">Snapmatic Bild Exporter</translation> <translation type="obsolete">Snapmatic Bild Exporter</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="231"/>
<source>Failed to save the picture</source> <source>Failed to save the picture</source>
<translation>Beim Speichern des Bildes ist ein Fehler aufgetreten</translation> <translation type="vanished">Beim Speichern des Bildes ist ein Fehler aufgetreten</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="237"/> <location filename="PictureDialog.cpp" line="258"/>
<source>No valid file is selected</source> <source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation> <translation>Keine gültige Datei wurde ausgewählt</translation>
</message> </message>
@ -180,45 +196,61 @@
<translation>Löschen</translation> <translation>Löschen</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="54"/> <location filename="SavegameWidget.cpp" line="55"/>
<location filename="SavegameWidget.cpp" line="67"/> <location filename="SavegameWidget.cpp" line="68"/>
<source>Delete savegame</source> <source>Delete savegame</source>
<translation>Savegame löschen</translation> <translation>Savegame löschen</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="54"/> <location filename="SavegameWidget.cpp" line="55"/>
<source>Are you sure to delete %1 from your savegames?</source> <source>Are you sure to delete %1 from your savegames?</source>
<translation>Bist du sicher %1 von deinen Spielständen zu löschen?</translation> <translation>Bist du sicher %1 von deinen Spielständen zu löschen?</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="67"/> <location filename="SavegameWidget.cpp" line="68"/>
<source>Failed at deleting %1 from your savegames</source> <source>Failed at deleting %1 from your savegames</source>
<translation>Fehlgeschlagen beim Löschen %1 von deinen Spielständen</translation> <translation>Fehlgeschlagen beim Löschen %1 von deinen Spielständen</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="82"/> <location filename="SavegameWidget.cpp" line="87"/>
<location filename="SavegameWidget.cpp" line="128"/> <location filename="SavegameWidget.cpp" line="132"/>
<location filename="SavegameWidget.cpp" line="134"/> <location filename="SavegameWidget.cpp" line="136"/>
<location filename="SavegameWidget.cpp" line="149"/>
<location filename="SavegameWidget.cpp" line="155"/>
<source>Copy savegame</source> <source>Copy savegame</source>
<translation>Spielstand kopieren</translation> <translation>Spielstand kopieren</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="85"/> <location filename="SavegameWidget.cpp" line="90"/>
<source>Savegame files (SGTA*)</source> <source>Savegame files (SGTA*)</source>
<translation>Spielstanddateien (SGTA*)</translation> <translation>Spielstanddateien (SGTA*)</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="86"/> <location filename="SavegameWidget.cpp" line="91"/>
<source>All files (**)</source> <source>All files (**)</source>
<translation>Alle Dateien (**)</translation> <translation>Alle Dateien (**)</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="128"/> <location filename="SavegameWidget.cpp" line="132"/>
<source>Failed to copy the savegame</source> <source>Overwrite %1 with current savegame?</source>
<translation>Beim Kopieren vom Spielstand ist ein Fehler aufgetreten</translation> <translation>Überschreibe %1 mit aktuellen Spielstand?</translation>
</message> </message>
<message> <message>
<location filename="SavegameWidget.cpp" line="134"/> <location filename="SavegameWidget.cpp" line="136"/>
<source>Failed to overwrite %1 with current savegame</source>
<translation>Fehlgeschlagen beim Überschreiben von %1 mit aktuellen Spielstand </translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="149"/>
<source>Failed to copy current savegame</source>
<translation>Fehlgeschlagen beim Kopieren vom Spielstand</translation>
</message>
<message>
<source>Failed to copy the savegame</source>
<translation type="vanished">Beim Kopieren vom Spielstand ist ein Fehler aufgetreten</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="155"/>
<source>No valid file is selected</source> <source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation> <translation>Keine gültige Datei wurde ausgewählt</translation>
</message> </message>