added savegame delete function, german translation updated

This commit is contained in:
Rafael 2016-03-28 17:46:42 +02:00
parent 4922ce7173
commit 24f51f3af8
7 changed files with 103 additions and 24 deletions

View File

@ -94,6 +94,7 @@ void ProfileInterface::on_savegameLoaded(SavegameData *savegame, QString savegam
ui->vlSavegame->addWidget(sgdWidget);
widgets.append(sgdWidget);
savegames.append(savegame);
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(on_savegameDeleted()));
}
void ProfileInterface::on_pictureLoaded(SnapmaticPicture *picture, QString picturePath)
@ -121,6 +122,14 @@ void ProfileInterface::on_profileLoaded()
ui->cmdCloseProfile->setEnabled(true);
}
void ProfileInterface::on_savegameDeleted()
{
SavegameWidget *sgdWidget = (SavegameWidget*)sender();
widgets.removeAll(sgdWidget);
sgdWidget->deleteLater();
delete sgdWidget;
}
void ProfileInterface::on_pictureDeleted()
{
SnapmaticWidget *picWidget = (SnapmaticWidget*)sender();

View File

@ -47,6 +47,7 @@ private slots:
void on_pictureLoaded(SnapmaticPicture *picture, QString picturePath);
void on_savegameLoaded(SavegameData *savegame, QString savegamePath);
void on_loadingProgress(int value, int maximum);
void on_savegameDeleted();
void on_pictureDeleted();
void on_profileLoaded();

View File

@ -19,6 +19,8 @@
#include "SavegameWidget.h"
#include "ui_SavegameWidget.h"
#include "SavegameData.h"
#include <QMessageBox>
#include <QFile>
SavegameWidget::SavegameWidget(QWidget *parent) :
QWidget(parent),
@ -26,6 +28,7 @@ SavegameWidget::SavegameWidget(QWidget *parent) :
{
ui->setupUi(this);
sgdPath = "";
sgdStr = "";
sgdata = 0;
}
@ -37,6 +40,27 @@ SavegameWidget::~SavegameWidget()
void SavegameWidget::setSavegameData(SavegameData *savegame, QString savegamePath)
{
ui->labSavegameStr->setText(savegame->getSavegameStr());
sgdStr = savegame->getSavegameStr();
sgdPath = savegamePath;
sgdata = savegame;
}
void SavegameWidget::on_cmdDelete_clicked()
{
int uchoice = QMessageBox::question(this, tr("Delete savegame"), tr("Are you sure to delete %1 from your Savegames?").arg("\""+sgdStr+"\""), QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
if (uchoice == QMessageBox::Yes)
{
if (!QFile::exists(sgdPath))
{
emit savegameDeleted();
}
else if(QFile::remove(sgdPath))
{
emit savegameDeleted();
}
else
{
QMessageBox::warning(this, tr("Delete savegame"), tr("Failed at deleting %1 from your Savegames").arg("\""+sgdStr+"\""));
}
}
}

View File

@ -35,10 +35,17 @@ public:
void setSavegameData(SavegameData *savegame, QString savegamePath);
~SavegameWidget();
private slots:
void on_cmdDelete_clicked();
private:
Ui::SavegameWidget *ui;
SavegameData *sgdata;
QString sgdPath;
QString sgdStr;
signals:
void savegameDeleted();
};
#endif // SAVEGAMEWIDGET_H

View File

@ -72,7 +72,7 @@ void SnapmaticWidget::on_cmdView_clicked()
void SnapmaticWidget::on_cmdDelete_clicked()
{
int uchoice = QMessageBox::question(this, tr("Delete picture"), tr("You're 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::No | QMessageBox::Yes, QMessageBox::No);
if (uchoice == QMessageBox::Yes)
{
if (!QFile::exists(picPath))
@ -85,7 +85,7 @@ void SnapmaticWidget::on_cmdDelete_clicked()
}
else
{
QMessageBox::warning(this, tr("Delete picture"), tr("Failed at deleting %1 from your Snapmatic pictures").arg(picStr));
QMessageBox::warning(this, tr("Delete picture"), tr("Failed at deleting %1 from your Snapmatic pictures").arg("\""+picStr+"\""));
}
}
}

Binary file not shown.

View File

@ -14,7 +14,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="AboutDialog.ui" line="101"/>
<location filename="AboutDialog.ui" line="104"/>
<source>Close</source>
<translation>Schließen</translation>
</message>
@ -42,52 +42,52 @@
<translation>Schließen</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="65"/>
<location filename="PictureDialog.cpp" line="111"/>
<location filename="PictureDialog.cpp" line="61"/>
<location filename="PictureDialog.cpp" line="107"/>
<source>Snapmatic Picture Viewer</source>
<translation>Snapmatic Bildansicht</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="65"/>
<location filename="PictureDialog.cpp" line="111"/>
<location filename="PictureDialog.cpp" line="61"/>
<location filename="PictureDialog.cpp" line="107"/>
<source>Failed at %1</source>
<translation>Fehlgeschlagen bei %1</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="100"/>
<location filename="PictureDialog.cpp" line="110"/>
<location filename="PictureDialog.cpp" line="96"/>
<location filename="PictureDialog.cpp" line="106"/>
<source>No player</source>
<translation>Keine Spieler</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="103"/>
<location filename="PictureDialog.cpp" line="110"/>
<location filename="PictureDialog.cpp" line="99"/>
<location filename="PictureDialog.cpp" line="106"/>
<source>No crew</source>
<translation>Keine Crew</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="158"/>
<location filename="PictureDialog.cpp" line="154"/>
<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="159"/>
<location filename="PictureDialog.cpp" line="155"/>
<location filename="PictureDialog.cpp" line="226"/>
<location filename="PictureDialog.cpp" line="232"/>
<source>Export picture</source>
<translation>Bild exportieren</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="235"/>
<location filename="PictureDialog.cpp" line="241"/>
<source>Snapmatic Picture Exporter</source>
<translation>Snapmatic Bild Exporter</translation>
<translation type="obsolete">Snapmatic Bild Exporter</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="235"/>
<location filename="PictureDialog.cpp" line="226"/>
<source>Failed to save the picture</source>
<translation>Fehlgeschlagen beim Speichern des Bildes</translation>
</message>
<message>
<location filename="PictureDialog.cpp" line="241"/>
<location filename="PictureDialog.cpp" line="232"/>
<source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation>
</message>
@ -100,7 +100,7 @@
<translation>Profil Interface</translation>
</message>
<message>
<location filename="ProfileInterface.ui" line="63"/>
<location filename="ProfileInterface.ui" line="52"/>
<source>Loading file %1 of %2 files</source>
<oldsource>Loading %1 files of %2 files</oldsource>
<translation>Lade Datei %1 von %2 Dateien</translation>
@ -114,12 +114,12 @@
<translation type="obsolete">Ansehen</translation>
</message>
<message>
<location filename="ProfileInterface.ui" line="173"/>
<location filename="ProfileInterface.ui" line="179"/>
<source>Close Profile</source>
<translation>Profil schließen</translation>
</message>
<message>
<location filename="ProfileInterface.cpp" line="80"/>
<location filename="ProfileInterface.cpp" line="81"/>
<source>Loading...</source>
<translation>Lade...</translation>
</message>
@ -170,6 +170,22 @@
<source>Delete</source>
<translation>Löschen</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="50"/>
<location filename="SavegameWidget.cpp" line="63"/>
<source>Delete savegame</source>
<translation>Savegame löschen</translation>
</message>
<message>
<location filename="SavegameWidget.cpp" line="50"/>
<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"/>
<source>Failed at deleting %1 from your Savegames</source>
<translation>Fehlgeschlagen beim Löschen %1 von deinen Spielständen</translation>
</message>
</context>
<context>
<name>SnapmaticWidget</name>
@ -193,6 +209,26 @@
<source>Delete</source>
<translation>Löschen</translation>
</message>
<message>
<location filename="SnapmaticWidget.cpp" line="75"/>
<location filename="SnapmaticWidget.cpp" line="88"/>
<source>Delete picture</source>
<translation>Bild löschen</translation>
</message>
<message>
<location filename="SnapmaticWidget.cpp" line="75"/>
<source>Are you sure to delete %1 from your Snapmatic pictures?</source>
<translation>Bist du sicher %1 von deinen Snapmatic Bilder zu löschen?</translation>
</message>
<message>
<source>You&apos;re sure to delete %1 from your Snapmatic pictures?</source>
<translation type="obsolete">Bist du sicher %1 von deinen Snapmatic Bilder zu löschen?</translation>
</message>
<message>
<location filename="SnapmaticWidget.cpp" line="88"/>
<source>Failed at deleting %1 from your Snapmatic pictures</source>
<translation>Fehlgeschlagen beim Löschen %1 von deinen Snapmatic Bildern</translation>
</message>
</context>
<context>
<name>UserInterface</name>
@ -231,7 +267,7 @@
</message>
<message>
<location filename="UserInterface.ui" line="110"/>
<location filename="UserInterface.cpp" line="122"/>
<location filename="UserInterface.cpp" line="117"/>
<source>Close</source>
<translation>Schließen</translation>
</message>
@ -247,6 +283,8 @@
<message>
<location filename="UserInterface.ui" line="59"/>
<location filename="UserInterface.ui" line="118"/>
<location filename="UserInterface.cpp" line="45"/>
<location filename="UserInterface.cpp" line="152"/>
<source>Select profile</source>
<translation>Profil auswählen</translation>
</message>
@ -256,12 +294,12 @@
<translation>Strg+P</translation>
</message>
<message>
<location filename="UserInterface.cpp" line="75"/>
<location filename="UserInterface.cpp" line="70"/>
<source>GTA V Folder not found!</source>
<translation>GTA V Ordner nicht gefunden!</translation>
</message>
<message>
<location filename="UserInterface.cpp" line="75"/>
<location filename="UserInterface.cpp" line="70"/>
<source>gta5sync</source>
<translation>gta5sync</translation>
</message>