filedialogs improved, german translation updated

This commit is contained in:
Rafael 2016-03-28 20:00:04 +02:00
parent d04d3aca55
commit de79678187
5 changed files with 126 additions and 12 deletions

View file

@ -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<QUrl> sidebarUrls = fileDialog.sidebarUrls();
QDir dir;

View file

@ -18,9 +18,13 @@
#include "SavegameWidget.h"
#include "ui_SavegameWidget.h"
#include "StandardPaths.h"
#include "SavegameData.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QFileInfo>
#include <QFile>
#include <QUrl>
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<QUrl> 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;
}
}
}

View file

@ -37,6 +37,7 @@ public:
private slots:
void on_cmdDelete_clicked();
void on_cmdCopy_clicked();
private:
Ui::SavegameWidget *ui;

Binary file not shown.

View file

@ -8,7 +8,7 @@
<source>About gta5sync</source>
<translation>Über gta5sync</translation>
</message>
<message utf8="true">
<message>
<location filename="AboutDialog.ui" line="59"/>
<source>&lt;span style=&quot; font-weight:600;&quot;&gt;gta5sync&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;A project for viewing and sync Grand Theft Auto 5 Snapmatic Pictures and Savegames&lt;br/&gt;&lt;br/&gt;Project version: %1&lt;br/&gt;Compiled with Qt %2&lt;br/&gt;Running with Qt %3&lt;br/&gt;&lt;br/&gt;Copyright © &lt;a href=&quot;https://github.com/Syping/&quot;&gt;Syping&lt;/a&gt; 2016&lt;br/&gt;gta5sync is licensed under &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html#content&quot;&gt;GNU GPLv3&lt;/a&gt;</source>
<translation type="unfinished"></translation>
@ -66,14 +66,23 @@
<translation>Keine Crew</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="154"/>
<location filename="PictureDialog.cpp" line="159"/>
<source>JPEG picture (*.jpg)</source>
<translation>JPEG Bild (*.jpg)</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="160"/>
<source>Portable Network Graphics (*.png)</source>
<translation>Portable Network Graphics (*.png)</translation>
</message>
<message>
<source>JPEG picture (*.jpg);;Portable Network Graphics (*.png)</source>
<translation>JPEG Bild (*.jpg);;Portable Network Graphics (*.png)</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="155"/>
<location filename="PictureDialog.cpp" line="226"/>
<location filename="PictureDialog.cpp" line="232"/>
<location filename="PictureDialog.cpp" line="231"/>
<location filename="PictureDialog.cpp" line="237"/>
<source>Export picture</source>
<translation>Bild exportieren</translation>
</message>
@ -82,12 +91,12 @@
<translation type="obsolete">Snapmatic Bild Exporter</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="226"/>
<location filename="PictureDialog.cpp" line="231"/>
<source>Failed to save the picture</source>
<translation>Fehlgeschlagen beim Speichern des Bildes</translation>
<translation>Beim Speichern des Bildes ist ein Fehler aufgetreten</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="232"/>
<location filename="PictureDialog.cpp" line="237"/>
<source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation>
</message>
@ -171,21 +180,48 @@
<translation>Löschen</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="50"/>
<location filename="SavegameWidget.cpp" line="63"/>
<location filename="SavegameWidget.cpp" line="54"/>
<location filename="SavegameWidget.cpp" line="67"/>
<source>Delete savegame</source>
<translation>Savegame löschen</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="50"/>
<location filename="SavegameWidget.cpp" line="54"/>
<source>Are you sure to delete %1 from your savegames?</source>
<translation>Bist du sicher %1 von deinen Spielständen zu löschen?</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="63"/>
<location filename="SavegameWidget.cpp" line="67"/>
<source>Failed at deleting %1 from your savegames</source>
<translation>Fehlgeschlagen beim Löschen %1 von deinen Spielständen</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="82"/>
<location filename="SavegameWidget.cpp" line="128"/>
<location filename="SavegameWidget.cpp" line="134"/>
<source>Copy savegame</source>
<translation>Spielstand kopieren</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="85"/>
<source>Savegame files (SGTA*)</source>
<translation>Spielstanddateien (SGTA*)</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="86"/>
<source>All files (**)</source>
<translation>Alle Dateien (**)</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="128"/>
<source>Failed to copy the savegame</source>
<translation>Beim Kopieren vom Spielstand ist ein Fehler aufgetreten</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="134"/>
<source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation>
</message>
<message>
<source>Are you sure to delete %1 from your Savegames?</source>
<translation type="obsolete">Bist du sicher %1 von deinen Spielständen zu löschen?</translation>