diff --git a/PictureDialog.cpp b/PictureDialog.cpp index a00edad..a75aa78 100755 --- a/PictureDialog.cpp +++ b/PictureDialog.cpp @@ -150,11 +150,16 @@ void PictureDialog::on_cmdExport_clicked() fileDialog.setFileMode(QFileDialog::AnyFile); fileDialog.setViewMode(QFileDialog::Detail); fileDialog.setAcceptMode(QFileDialog::AcceptSave); + fileDialog.setOption(QFileDialog::DontUseNativeDialog, true); fileDialog.setDefaultSuffix("suffix"); - fileDialog.setNameFilter(tr("JPEG picture (*.jpg);;Portable Network Graphics (*.png)")); fileDialog.setWindowTitle(tr("Export picture")); fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint); + QStringList filters; + filters << tr("JPEG picture (*.jpg)"); + filters << tr("Portable Network Graphics (*.png)"); + fileDialog.setNameFilters(filters); + QList sidebarUrls = fileDialog.sidebarUrls(); QDir dir; diff --git a/SavegameWidget.cpp b/SavegameWidget.cpp index 27edc09..ff42ed6 100755 --- a/SavegameWidget.cpp +++ b/SavegameWidget.cpp @@ -18,9 +18,13 @@ #include "SavegameWidget.h" #include "ui_SavegameWidget.h" +#include "StandardPaths.h" #include "SavegameData.h" +#include #include +#include #include +#include SavegameWidget::SavegameWidget(QWidget *parent) : QWidget(parent), @@ -64,3 +68,71 @@ void SavegameWidget::on_cmdDelete_clicked() } } } + +void SavegameWidget::on_cmdCopy_clicked() +{ + QFileInfo fileInfo(sgdPath); + QFileDialog fileDialog(this); + fileDialog.setFileMode(QFileDialog::AnyFile); + fileDialog.setViewMode(QFileDialog::Detail); + fileDialog.setAcceptMode(QFileDialog::AcceptSave); + fileDialog.setOption(QFileDialog::DontUseNativeDialog, true); + fileDialog.setDefaultSuffix(""); + fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint); + fileDialog.setWindowTitle(tr("Copy savegame")); + + QStringList filters; + filters << tr("Savegame files (SGTA*)"); + filters << tr("All files (**)"); + fileDialog.setNameFilters(filters); + + QList sidebarUrls = fileDialog.sidebarUrls(); + QDir dir; + + // Get Documents + Desktop Location + QString documentsLocation = StandardPaths::documentsLocation(); + QString desktopLocation = StandardPaths::desktopLocation(); + + // Add Desktop Location to Sidebar + dir.setPath(desktopLocation); + if (dir.exists()) + { + sidebarUrls.append(QUrl::fromLocalFile(dir.absolutePath())); + } + + // Add Documents + GTA V Location to Sidebar + dir.setPath(documentsLocation); + if (dir.exists()) + { + sidebarUrls.append(QUrl::fromLocalFile(dir.absolutePath())); + if (dir.cd("Rockstar Games/GTA V")) + { + sidebarUrls.append(QUrl::fromLocalFile(dir.absolutePath())); + } + } + + fileDialog.setSidebarUrls(sidebarUrls); + +fileDialogPreSave: + if (fileDialog.exec()) + { + QStringList selectedFiles = fileDialog.selectedFiles(); + if (selectedFiles.length() == 1) + { + QString selectedFile = selectedFiles.at(0); + + bool isCopied = QFile::copy(sgdPath, selectedFile); + + if (!isCopied) + { + QMessageBox::warning(this, tr("Copy savegame"), tr("Failed to copy the savegame")); + goto fileDialogPreSave; + } + } + else + { + QMessageBox::warning(this, tr("Copy savegame"), tr("No valid file is selected")); + goto fileDialogPreSave; + } + } +} diff --git a/SavegameWidget.h b/SavegameWidget.h index d1a537d..2a232e0 100755 --- a/SavegameWidget.h +++ b/SavegameWidget.h @@ -37,6 +37,7 @@ public: private slots: void on_cmdDelete_clicked(); + void on_cmdCopy_clicked(); private: Ui::SavegameWidget *ui; diff --git a/gta5sync_de.qm b/gta5sync_de.qm index 382bf06..e83ad13 100755 Binary files a/gta5sync_de.qm and b/gta5sync_de.qm differ diff --git a/gta5sync_de.ts b/gta5sync_de.ts index 2d02afb..b8012c3 100755 --- a/gta5sync_de.ts +++ b/gta5sync_de.ts @@ -8,7 +8,7 @@ About gta5sync Über gta5sync - + <span style=" font-weight:600;">gta5sync</span><br/><br/>A project for viewing and sync Grand Theft Auto 5 Snapmatic Pictures and Savegames<br/><br/>Project version: %1<br/>Compiled with Qt %2<br/>Running with Qt %3<br/><br/>Copyright © <a href="https://github.com/Syping/">Syping</a> 2016<br/>gta5sync is licensed under <a href="https://www.gnu.org/licenses/gpl-3.0.html#content">GNU GPLv3</a> @@ -66,14 +66,23 @@ 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) - - + + Export picture Bild exportieren @@ -82,12 +91,12 @@ Snapmatic Bild Exporter - + Failed to save the picture - Fehlgeschlagen beim Speichern des Bildes + Beim Speichern des Bildes ist ein Fehler aufgetreten - + No valid file is selected Keine gültige Datei wurde ausgewählt @@ -171,21 +180,48 @@ 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 + + + + No valid file is selected + Keine gültige Datei wurde ausgewählt + Are you sure to delete %1 from your Savegames? Bist du sicher %1 von deinen Spielständen zu löschen?