From e8c3d82db2846ea3d15e3c3fdaafb58e2de87974 Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 28 Mar 2016 21:37:42 +0200 Subject: [PATCH] overwriting changes, german translation updated --- PictureDialog.cpp | 26 +++++++++++++- SavegameWidget.cpp | 28 ++++++++++++++-- SnapmaticWidget.cpp | 2 +- gta5sync_de.qm | Bin 6138 -> 7254 bytes gta5sync_de.ts | 80 +++++++++++++++++++++++++++++++------------- 5 files changed, 108 insertions(+), 28 deletions(-) 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 e83ad13bd8b93ab44640d89bfb9e1b05bb4ea4d5..05a11a5b0765be3c1ef8a1bd77cea71c4df40d60 100755 GIT binary patch delta 1157 zcmb`ET}V@57{~uRJNr1txtVTGCGwa|3eB&y2|}8EkfCITLE**bJmhL0Hm72cv(k$` zu<&FCLIu^5^dhsY2>LLhyeLD#AQaN@Lad9lPjBj(D+hrH(ZzZHyzhCR|L^%f?|j;5 z&RMom|p)N?;h`Dmt=&s3gwwEfdf@;aWD|r2Q0kI+c>jk8^|h zJ|O%6FPotN+G*a@R7k$je9?_7b{h3CUp!3*QHS|^D=B%Hl7Cr13Bt)Fyp20THLPw=Lu!Zlooy zOiDN8_9>Xpa@k2~Lc2C^3>6UJK@DuEA{Aj@IB`Kh9oz`02^q9H>5rGxii4!JbkhNc z^f+p@SxsYulD_P1R=Y#26ufT1T_<|#J$A1sm@L&^*cyh2QmmWePh)C=8VRycPVXaEC*7EWVcZU=M_t2)c-KA=IuFIiUi17$^I zfixqK4rE!QvlM7hCxjMMWI10p1*qGV<68Q4@gd{&%iU=Rr56u;}hz#x>*srCctLcztHNz+Xj z82Em17JWBjVBng;+3LK3fq{P~XOEsK(86ZUlMeO3kaOf>e4Pq(&;c&h22Y?xZ@GL{ zEe3|*GA`ejKt8`8*A5v`1_qA1TxXqt9^f?Qx+WhAG(VE-n}wn!P~ih^#%*;#1q- - + 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