add copying of snapmatic pictures, german translation updated

This commit is contained in:
Rafael 2016-04-01 01:54:21 +02:00
parent 217d973d94
commit c3b6c9d16e
10 changed files with 185 additions and 75 deletions

View file

@ -43,6 +43,7 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, QWidget *parent) :
ui->cmdExport->setEnabled(0);
plyrsList = QStringList();
picTitl = "";
picPath = "";
crewID = "";
locX = "";
locY = "";
@ -55,9 +56,10 @@ PictureDialog::~PictureDialog()
delete ui;
}
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath, bool readOk)
{
// Showing error if reading error
picPath = picturePath;
smpic = picture;
if (!readOk)
{
@ -262,7 +264,7 @@ fileDialogPreSave:
if (!isSaved)
{
QMessageBox::warning(this, tr("Export picture"), tr("Failed to save current picture"));
QMessageBox::warning(this, tr("Export picture"), tr("Failed to export current Snapmatic picture"));
goto fileDialogPreSave;
}
}
@ -276,3 +278,72 @@ fileDialogPreSave:
settings.setValue("ExportPicture", fileDialog.saveState());
settings.endGroup();
}
void PictureDialog::on_cmdCopy_clicked()
{
QSettings settings("Syping", "gta5sync");
settings.beginGroup("FileDialogs");
fileDialogPreSave:
QFileInfo sgdFileInfo(picPath);
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 picture"));
QStringList filters;
filters << tr("Snapmatic pictures (PGTA*)");
filters << tr("All files (**)");
fileDialog.setNameFilters(filters);
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.restoreState(settings.value("CopyPicture","").toByteArray());
fileDialog.selectFile(sgdFileInfo.fileName());
if (fileDialog.exec())
{
QStringList selectedFiles = fileDialog.selectedFiles();
if (selectedFiles.length() == 1)
{
QString selectedFile = selectedFiles.at(0);
if (QFile::exists(selectedFile))
{
if (QMessageBox::Yes == QMessageBox::warning(this, tr("Copy picture"), tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
{
if (!QFile::remove(selectedFile))
{
QMessageBox::warning(this, tr("Copy picture"), tr("Failed to overwrite %1 with current Snapmatic picture").arg("\""+selectedFile+"\""));
goto fileDialogPreSave;
}
}
else
{
goto fileDialogPreSave;
}
}
bool isCopied = QFile::copy(picPath, selectedFile);
if (!isCopied)
{
QMessageBox::warning(this, tr("Copy picture"), tr("Failed to copy current Snapmatic picture"));
goto fileDialogPreSave;
}
}
else
{
QMessageBox::warning(this, tr("Copy picture"), tr("No valid file is selected"));
goto fileDialogPreSave;
}
}
settings.setValue("CopyPicture", fileDialog.saveState());
settings.endGroup();
}

View file

@ -32,7 +32,7 @@ class PictureDialog : public QDialog
Q_OBJECT
public:
explicit PictureDialog(ProfileDatabase *profileDB, QWidget *parent = 0);
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
void setSnapmaticPicture(SnapmaticPicture *picture, QString picPath, bool readOk);
~PictureDialog();
public slots:
@ -41,6 +41,7 @@ public slots:
private slots:
void on_cmdClose_clicked();
void on_cmdExport_clicked();
void on_cmdCopy_clicked();
private:
ProfileDatabase *profileDB;
@ -50,6 +51,7 @@ private:
QString windowTitleStr;
QStringList plyrsList;
QString picTitl;
QString picPath;
QString crewID;
QString locX;
QString locY;

View file

@ -89,6 +89,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdCopy">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClose">
<property name="toolTip">

View file

@ -20,7 +20,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="app.qrc">:/img/savegame.png</pixmap>
<pixmap resource="res/app.qrc">:/img/savegame.png</pixmap>
</property>
</widget>
</item>
@ -63,7 +63,7 @@
</layout>
</widget>
<resources>
<include location="app.qrc"/>
<include location="res/app.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -57,7 +57,7 @@ void SnapmaticWidget::on_cmdView_clicked()
{
PictureDialog *picDialog = new PictureDialog(profileDB, this);
picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
picDialog->setSnapmaticPicture(smpic, true);
picDialog->setSnapmaticPicture(smpic, picPath, true);
picDialog->setModal(true);
// be ready for playerName updated

View file

@ -65,13 +65,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdCopy">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdDelete">
<property name="text">

View file

@ -71,7 +71,8 @@ FORMS += \
UserInterface.ui
TRANSLATIONS += \
res/gta5sync_de.ts
res/gta5sync_de.ts \
res/gta5sync_ru.ts
RESOURCES += \
res/app.qrc

View file

@ -245,7 +245,7 @@ int main(int argc, char *argv[])
bool readOk = picture.readingPictureFromFile(arg1);
picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
picDialog->setWindowIcon(IconLoader::loadingAppIcon());
picDialog->setSnapmaticPicture(&picture, readOk);
picDialog->setSnapmaticPicture(&picture, arg1, readOk);
int crewID = picture.getCrewNumber();
if (crewID != 0) { crewDB->addCrew(crewID); }

Binary file not shown.

View file

@ -11,7 +11,7 @@
<message utf8="true">
<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>
<translation>&lt;span style=&quot; font-weight:600;&quot;&gt;gta5sync&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Ein Projekt zum ansehen und synchronisieren von Grand Theft Auto 5 Snapmatic Bilder und Spielständen&lt;br/&gt;&lt;br/&gt;Projektversion: %1&lt;br/&gt;Gebaut mit Qt %2&lt;br/&gt;Läuft auf 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 lizenziert unter &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html#content&quot;&gt;GNU GPLv3&lt;/a&gt;</translation>
</message>
<message>
<location filename="../AboutDialog.ui" line="104"/>
@ -58,58 +58,93 @@
</message>
<message>
<location filename="../PictureDialog.ui" line="95"/>
<location filename="../PictureDialog.ui" line="98"/>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<location filename="../PictureDialog.ui" line="102"/>
<location filename="../PictureDialog.ui" line="105"/>
<source>Close</source>
<translation>Schließen</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="63"/>
<location filename="../PictureDialog.cpp" line="110"/>
<location filename="../PictureDialog.cpp" line="66"/>
<location filename="../PictureDialog.cpp" line="113"/>
<source>Snapmatic Picture Viewer</source>
<translation>Snapmatic Bildansicht</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="63"/>
<location filename="../PictureDialog.cpp" line="110"/>
<location filename="../PictureDialog.cpp" line="66"/>
<location filename="../PictureDialog.cpp" line="113"/>
<source>Failed at %1</source>
<translation>Fehlgeschlagen bei %1</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="99"/>
<location filename="../PictureDialog.cpp" line="109"/>
<location filename="../PictureDialog.cpp" line="102"/>
<location filename="../PictureDialog.cpp" line="112"/>
<source>No player</source>
<translation>Keine Spieler</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="102"/>
<location filename="../PictureDialog.cpp" line="109"/>
<location filename="../PictureDialog.cpp" line="105"/>
<location filename="../PictureDialog.cpp" line="112"/>
<source>No crew</source>
<translation>Keine Crew</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="167"/>
<location filename="../PictureDialog.cpp" line="170"/>
<source>JPEG picture (*.jpg)</source>
<translation>JPEG Bild (*.jpg)</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="168"/>
<location filename="../PictureDialog.cpp" line="171"/>
<source>Portable Network Graphics (*.png)</source>
<translation>Portable Network Graphics (*.png)</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="267"/>
<location filename="../PictureDialog.cpp" line="249"/>
<location filename="../PictureDialog.cpp" line="319"/>
<source>Overwrite %1 with current Snapmatic picture?</source>
<translation>Überschreibe %1 mit aktuellen Snapmatic Bild?</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="271"/>
<location filename="../PictureDialog.cpp" line="253"/>
<location filename="../PictureDialog.cpp" line="323"/>
<source>Failed to overwrite %1 with current Snapmatic picture</source>
<translation>Fehlgeschlagen beim Überschreiben von %1 mit aktuellen Snapmatic Bild</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="285"/>
<location filename="../PictureDialog.cpp" line="267"/>
<source>Failed to export current Snapmatic picture</source>
<translation>Fehlgeschlagen beim Exportieren vom aktuellen Snapmatic Bild</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="297"/>
<location filename="../PictureDialog.cpp" line="319"/>
<location filename="../PictureDialog.cpp" line="323"/>
<location filename="../PictureDialog.cpp" line="336"/>
<location filename="../PictureDialog.cpp" line="342"/>
<source>Copy picture</source>
<translation>Bild kopieren</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="300"/>
<source>Snapmatic pictures (PGTA*)</source>
<translation>Snapmatic Bilder (PGTA*)</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="301"/>
<source>All files (**)</source>
<translation>Alle Dateien (**)</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="336"/>
<source>Failed to copy current Snapmatic picture</source>
<translation>Fehlgeschlagen beim Kopieren vom Snapmatic Bild</translation>
</message>
<message>
<source>Failed to save current picture</source>
<translation>Fehlgeschlagen beim Speichern vom aktuellen Bild</translation>
<translation type="obsolete">Fehlgeschlagen beim Speichern vom aktuellen Bild</translation>
</message>
<message>
<source>JPEG picture (*.jpg);;Portable Network Graphics (*.png)</source>
@ -117,11 +152,11 @@
</message>
<message>
<location filename="../PictureDialog.ui" line="85"/>
<location filename="../PictureDialog.cpp" line="163"/>
<location filename="../PictureDialog.cpp" line="166"/>
<location filename="../PictureDialog.cpp" line="249"/>
<location filename="../PictureDialog.cpp" line="253"/>
<location filename="../PictureDialog.cpp" line="267"/>
<location filename="../PictureDialog.cpp" line="271"/>
<location filename="../PictureDialog.cpp" line="285"/>
<location filename="../PictureDialog.cpp" line="291"/>
<location filename="../PictureDialog.cpp" line="273"/>
<source>Export picture</source>
<translation>Bild exportieren</translation>
</message>
@ -134,7 +169,8 @@
<translation type="obsolete">Beim Speichern des Bildes ist ein Fehler aufgetreten</translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="291"/>
<location filename="../PictureDialog.cpp" line="273"/>
<location filename="../PictureDialog.cpp" line="342"/>
<source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation>
</message>
@ -154,16 +190,16 @@
</message>
<message>
<location filename="../ProfileInterface.ui" line="179"/>
<location filename="../ProfileInterface.cpp" line="164"/>
<location filename="../ProfileInterface.cpp" line="221"/>
<location filename="../ProfileInterface.cpp" line="236"/>
<location filename="../ProfileInterface.cpp" line="264"/>
<location filename="../ProfileInterface.cpp" line="271"/>
<location filename="../ProfileInterface.cpp" line="277"/>
<location filename="../ProfileInterface.cpp" line="292"/>
<location filename="../ProfileInterface.cpp" line="302"/>
<location filename="../ProfileInterface.cpp" line="338"/>
<location filename="../ProfileInterface.cpp" line="344"/>
<location filename="../ProfileInterface.cpp" line="165"/>
<location filename="../ProfileInterface.cpp" line="199"/>
<location filename="../ProfileInterface.cpp" line="214"/>
<location filename="../ProfileInterface.cpp" line="242"/>
<location filename="../ProfileInterface.cpp" line="249"/>
<location filename="../ProfileInterface.cpp" line="255"/>
<location filename="../ProfileInterface.cpp" line="270"/>
<location filename="../ProfileInterface.cpp" line="280"/>
<location filename="../ProfileInterface.cpp" line="316"/>
<location filename="../ProfileInterface.cpp" line="322"/>
<source>Import copy</source>
<translation>Kopie importieren</translation>
</message>
@ -181,68 +217,68 @@
<translation>Profil schließen</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="87"/>
<location filename="../ProfileInterface.cpp" line="88"/>
<source>Loading...</source>
<translation>Lade...</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="168"/>
<location filename="../ProfileInterface.cpp" line="169"/>
<source>All profile files (SGTA* PGTA*)</source>
<translation>Alle Profildateien (SGTA* PGTA*)</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="169"/>
<location filename="../ProfileInterface.cpp" line="170"/>
<source>Savegames files (SGTA*)</source>
<translation>Spielstanddateien (SGTA*)</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="170"/>
<location filename="../ProfileInterface.cpp" line="171"/>
<source>Snapmatic pictures (PGTA*)</source>
<translation>Snapmatic Bilder (PGTA*)</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="171"/>
<location filename="../ProfileInterface.cpp" line="172"/>
<source>All files (**)</source>
<translation>Alle Dateien (**)</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="221"/>
<location filename="../ProfileInterface.cpp" line="199"/>
<source>Failed to read Snapmatic picture</source>
<translation>Fehler beim Lesen vom Snapmatic Bild</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="236"/>
<location filename="../ProfileInterface.cpp" line="214"/>
<source>Failed to read Savegame file</source>
<translation>Fehler beim Lesen von Spielstanddatei</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="264"/>
<location filename="../ProfileInterface.cpp" line="242"/>
<source>Can&apos;t import %1 because of not valid file format</source>
<translation>Kann %1 nicht importieren weil das Dateiformat nicht gültig ist</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="271"/>
<location filename="../ProfileInterface.cpp" line="277"/>
<location filename="../ProfileInterface.cpp" line="249"/>
<location filename="../ProfileInterface.cpp" line="255"/>
<source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="292"/>
<location filename="../ProfileInterface.cpp" line="270"/>
<source>Failed to import copy of Snapmatic picture because the file not begin with PGTA</source>
<translation>Fehlgeschlagenen beim Import vom Snapmatic Bild weil die Datei nicht mit PGTA begint </translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="302"/>
<location filename="../ProfileInterface.cpp" line="280"/>
<source>Failed to import copy of Snapmatic picture because the copy failed</source>
<translation>Fehlgeschlagenen beim Import vom Snapmatic Bild weil kopieren fehlgeschlagen ist</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="338"/>
<location filename="../ProfileInterface.cpp" line="316"/>
<source>Failed to import copy of Savegame file because the copy failed</source>
<translation>Fehlgeschlagenen beim Import vom Spielstand weil kopieren fehlgeschlagen ist</translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="344"/>
<location filename="../ProfileInterface.cpp" line="322"/>
<source>Failed to import copy of Savegame file because no free Savegame slot left</source>
<translation>Fehlgeschlagenen beim Import vom Spielstand weil kein Spielstandslot mehr übrig ist</translation>
</message>
@ -294,52 +330,52 @@
<translation>Löschen</translation>
</message>
<message>
<location filename="../SavegameWidget.cpp" line="55"/>
<location filename="../SavegameWidget.cpp" line="68"/>
<location filename="../SavegameWidget.cpp" line="56"/>
<location filename="../SavegameWidget.cpp" line="69"/>
<source>Delete savegame</source>
<translation>Savegame löschen</translation>
</message>
<message>
<location filename="../SavegameWidget.cpp" line="55"/>
<location filename="../SavegameWidget.cpp" line="56"/>
<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="68"/>
<location filename="../SavegameWidget.cpp" line="69"/>
<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="88"/>
<location filename="../SavegameWidget.cpp" line="133"/>
<location filename="../SavegameWidget.cpp" line="137"/>
<location filename="../SavegameWidget.cpp" line="150"/>
<location filename="../SavegameWidget.cpp" line="156"/>
<location filename="../SavegameWidget.cpp" line="89"/>
<location filename="../SavegameWidget.cpp" line="111"/>
<location filename="../SavegameWidget.cpp" line="115"/>
<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="91"/>
<location filename="../SavegameWidget.cpp" line="92"/>
<source>Savegame files (SGTA*)</source>
<translation>Spielstanddateien (SGTA*)</translation>
</message>
<message>
<location filename="../SavegameWidget.cpp" line="92"/>
<location filename="../SavegameWidget.cpp" line="93"/>
<source>All files (**)</source>
<translation>Alle Dateien (**)</translation>
</message>
<message>
<location filename="../SavegameWidget.cpp" line="133"/>
<location filename="../SavegameWidget.cpp" line="111"/>
<source>Overwrite %1 with current savegame?</source>
<translation>Überschreibe %1 mit aktuellen Spielstand?</translation>
</message>
<message>
<location filename="../SavegameWidget.cpp" line="137"/>
<location filename="../SavegameWidget.cpp" line="115"/>
<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="150"/>
<location filename="../SavegameWidget.cpp" line="128"/>
<source>Failed to copy current savegame</source>
<translation>Fehlgeschlagen beim Kopieren vom Spielstand</translation>
</message>
@ -348,7 +384,7 @@
<translation type="obsolete">Beim Kopieren vom Spielstand ist ein Fehler aufgetreten</translation>
</message>
<message>
<location filename="../SavegameWidget.cpp" line="156"/>
<location filename="../SavegameWidget.cpp" line="134"/>
<source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation>
</message>