diff --git a/PictureDialog.cpp b/PictureDialog.cpp index a75aa78..08e42a8 100755 --- a/PictureDialog.cpp +++ b/PictureDialog.cpp @@ -146,11 +146,15 @@ void PictureDialog::on_cmdClose_clicked() void PictureDialog::on_cmdExport_clicked() { + QSettings settings("Syping", "gta5sync"); + settings.beginGroup("FileDialogs"); + QFileDialog fileDialog(this); fileDialog.setFileMode(QFileDialog::AnyFile); fileDialog.setViewMode(QFileDialog::Detail); fileDialog.setAcceptMode(QFileDialog::AcceptSave); fileDialog.setOption(QFileDialog::DontUseNativeDialog, true); + fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true); fileDialog.setDefaultSuffix("suffix"); fileDialog.setWindowTitle(tr("Export picture")); fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint); @@ -186,6 +190,7 @@ void PictureDialog::on_cmdExport_clicked() } fileDialog.setSidebarUrls(sidebarUrls); + fileDialog.restoreState(settings.value("ExportPicture","").toByteArray()); fileDialogPreSave: 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); 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; } } @@ -238,4 +259,7 @@ fileDialogPreSave: goto fileDialogPreSave; } } + + settings.setValue("ExportPicture", fileDialog.saveState()); + settings.endGroup(); } diff --git a/SavegameWidget.cpp b/SavegameWidget.cpp index ff42ed6..58886c6 100755 --- a/SavegameWidget.cpp +++ b/SavegameWidget.cpp @@ -22,6 +22,7 @@ #include "SavegameData.h" #include #include +#include #include #include #include @@ -71,12 +72,16 @@ void SavegameWidget::on_cmdDelete_clicked() void SavegameWidget::on_cmdCopy_clicked() { + QSettings settings("Syping", "gta5sync"); + settings.beginGroup("FileDialogs"); + QFileInfo fileInfo(sgdPath); QFileDialog fileDialog(this); fileDialog.setFileMode(QFileDialog::AnyFile); fileDialog.setViewMode(QFileDialog::Detail); fileDialog.setAcceptMode(QFileDialog::AcceptSave); fileDialog.setOption(QFileDialog::DontUseNativeDialog, true); + fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true); fileDialog.setDefaultSuffix(""); fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint); fileDialog.setWindowTitle(tr("Copy savegame")); @@ -112,6 +117,7 @@ void SavegameWidget::on_cmdCopy_clicked() } fileDialog.setSidebarUrls(sidebarUrls); + fileDialog.restoreState(settings.value("CopySavegame","").toByteArray()); fileDialogPreSave: if (fileDialog.exec()) @@ -121,11 +127,26 @@ fileDialogPreSave: { 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) { - 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; } } @@ -135,4 +156,7 @@ fileDialogPreSave: goto fileDialogPreSave; } } + + settings.setValue("CopySavegame", fileDialog.saveState()); + settings.endGroup(); } diff --git a/SnapmaticWidget.cpp b/SnapmaticWidget.cpp index 9fef30c..9c8d65b 100755 --- a/SnapmaticWidget.cpp +++ b/SnapmaticWidget.cpp @@ -72,7 +72,7 @@ void SnapmaticWidget::on_cmdView_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 (!QFile::exists(picPath)) diff --git a/gta5sync_de.qm b/gta5sync_de.qm index e83ad13..05a11a5 100755 Binary files a/gta5sync_de.qm and b/gta5sync_de.qm differ diff --git a/gta5sync_de.ts b/gta5sync_de.ts index b8012c3..a3e8480 100755 --- a/gta5sync_de.ts +++ b/gta5sync_de.ts @@ -1,6 +1,6 @@ - + AboutDialog @@ -66,23 +66,40 @@ Keine Crew - + JPEG picture (*.jpg) JPEG Bild (*.jpg) - + Portable Network Graphics (*.png) Portable Network Graphics (*.png) - JPEG picture (*.jpg);;Portable Network Graphics (*.png) - JPEG Bild (*.jpg);;Portable Network Graphics (*.png) + + Overwrite %1 with current Snapmatic picture? + Überschreibe %1 mit aktuellen Snapmatic Bild? - - - + + Failed to overwrite %1 with current Snapmatic picture + Fehlgeschlagen beim Überschreiben von %1 mit aktuellen Snapmatic Bild + + + + Failed to save current picture + Fehlgeschlagen beim Speichern vom aktuellen Bild + + + JPEG picture (*.jpg);;Portable Network Graphics (*.png) + JPEG Bild (*.jpg);;Portable Network Graphics (*.png) + + + + + + + Export picture Bild exportieren @@ -91,12 +108,11 @@ Snapmatic Bild Exporter - Failed to save the picture - Beim Speichern des Bildes ist ein Fehler aufgetreten + Beim Speichern des Bildes ist ein Fehler aufgetreten - + No valid file is selected Keine gültige Datei wurde ausgewählt @@ -180,45 +196,61 @@ Löschen - - + + Delete savegame Savegame löschen - + Are you sure to delete %1 from your savegames? Bist du sicher %1 von deinen Spielständen zu löschen? - + Failed at deleting %1 from your savegames Fehlgeschlagen beim Löschen %1 von deinen Spielständen - - - + + + + + Copy savegame Spielstand kopieren - + Savegame files (SGTA*) Spielstanddateien (SGTA*) - + All files (**) Alle Dateien (**) - - Failed to copy the savegame - Beim Kopieren vom Spielstand ist ein Fehler aufgetreten + + Overwrite %1 with current savegame? + Überschreibe %1 mit aktuellen Spielstand? - + + Failed to overwrite %1 with current savegame + Fehlgeschlagen beim Überschreiben von %1 mit aktuellen Spielstand + + + + Failed to copy current savegame + Fehlgeschlagen beim Kopieren vom Spielstand + + + Failed to copy the savegame + Beim Kopieren vom Spielstand ist ein Fehler aufgetreten + + + No valid file is selected Keine gültige Datei wurde ausgewählt