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

View file

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

View file

@ -19,6 +19,8 @@
#include "SavegameWidget.h" #include "SavegameWidget.h"
#include "ui_SavegameWidget.h" #include "ui_SavegameWidget.h"
#include "SavegameData.h" #include "SavegameData.h"
#include <QMessageBox>
#include <QFile>
SavegameWidget::SavegameWidget(QWidget *parent) : SavegameWidget::SavegameWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -26,6 +28,7 @@ SavegameWidget::SavegameWidget(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
sgdPath = ""; sgdPath = "";
sgdStr = "";
sgdata = 0; sgdata = 0;
} }
@ -37,6 +40,27 @@ SavegameWidget::~SavegameWidget()
void SavegameWidget::setSavegameData(SavegameData *savegame, QString savegamePath) void SavegameWidget::setSavegameData(SavegameData *savegame, QString savegamePath)
{ {
ui->labSavegameStr->setText(savegame->getSavegameStr()); ui->labSavegameStr->setText(savegame->getSavegameStr());
sgdStr = savegame->getSavegameStr();
sgdPath = savegamePath; sgdPath = savegamePath;
sgdata = savegame; 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); void setSavegameData(SavegameData *savegame, QString savegamePath);
~SavegameWidget(); ~SavegameWidget();
private slots:
void on_cmdDelete_clicked();
private: private:
Ui::SavegameWidget *ui; Ui::SavegameWidget *ui;
SavegameData *sgdata; SavegameData *sgdata;
QString sgdPath; QString sgdPath;
QString sgdStr;
signals:
void savegameDeleted();
}; };
#endif // SAVEGAMEWIDGET_H #endif // SAVEGAMEWIDGET_H

View file

@ -72,7 +72,7 @@ void SnapmaticWidget::on_cmdView_clicked()
void SnapmaticWidget::on_cmdDelete_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 (uchoice == QMessageBox::Yes)
{ {
if (!QFile::exists(picPath)) if (!QFile::exists(picPath))
@ -85,7 +85,7 @@ void SnapmaticWidget::on_cmdDelete_clicked()
} }
else 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> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="AboutDialog.ui" line="101"/> <location filename="AboutDialog.ui" line="104"/>
<source>Close</source> <source>Close</source>
<translation>Schließen</translation> <translation>Schließen</translation>
</message> </message>
@ -42,52 +42,52 @@
<translation>Schließen</translation> <translation>Schließen</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="65"/> <location filename="PictureDialog.cpp" line="61"/>
<location filename="PictureDialog.cpp" line="111"/> <location filename="PictureDialog.cpp" line="107"/>
<source>Snapmatic Picture Viewer</source> <source>Snapmatic Picture Viewer</source>
<translation>Snapmatic Bildansicht</translation> <translation>Snapmatic Bildansicht</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="65"/> <location filename="PictureDialog.cpp" line="61"/>
<location filename="PictureDialog.cpp" line="111"/> <location filename="PictureDialog.cpp" line="107"/>
<source>Failed at %1</source> <source>Failed at %1</source>
<translation>Fehlgeschlagen bei %1</translation> <translation>Fehlgeschlagen bei %1</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="100"/> <location filename="PictureDialog.cpp" line="96"/>
<location filename="PictureDialog.cpp" line="110"/> <location filename="PictureDialog.cpp" line="106"/>
<source>No player</source> <source>No player</source>
<translation>Keine Spieler</translation> <translation>Keine Spieler</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="103"/> <location filename="PictureDialog.cpp" line="99"/>
<location filename="PictureDialog.cpp" line="110"/> <location filename="PictureDialog.cpp" line="106"/>
<source>No crew</source> <source>No crew</source>
<translation>Keine Crew</translation> <translation>Keine Crew</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="158"/> <location filename="PictureDialog.cpp" line="154"/>
<source>JPEG picture (*.jpg);;Portable Network Graphics (*.png)</source> <source>JPEG picture (*.jpg);;Portable Network Graphics (*.png)</source>
<translation>JPEG Bild (*.jpg);;Portable Network Graphics (*.png)</translation> <translation>JPEG Bild (*.jpg);;Portable Network Graphics (*.png)</translation>
</message> </message>
<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> <source>Export picture</source>
<translation>Bild exportieren</translation> <translation>Bild exportieren</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="235"/>
<location filename="PictureDialog.cpp" line="241"/>
<source>Snapmatic Picture Exporter</source> <source>Snapmatic Picture Exporter</source>
<translation>Snapmatic Bild Exporter</translation> <translation type="obsolete">Snapmatic Bild Exporter</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="235"/> <location filename="PictureDialog.cpp" line="226"/>
<source>Failed to save the picture</source> <source>Failed to save the picture</source>
<translation>Fehlgeschlagen beim Speichern des Bildes</translation> <translation>Fehlgeschlagen beim Speichern des Bildes</translation>
</message> </message>
<message> <message>
<location filename="PictureDialog.cpp" line="241"/> <location filename="PictureDialog.cpp" line="232"/>
<source>No valid file is selected</source> <source>No valid file is selected</source>
<translation>Keine gültige Datei wurde ausgewählt</translation> <translation>Keine gültige Datei wurde ausgewählt</translation>
</message> </message>
@ -100,7 +100,7 @@
<translation>Profil Interface</translation> <translation>Profil Interface</translation>
</message> </message>
<message> <message>
<location filename="ProfileInterface.ui" line="63"/> <location filename="ProfileInterface.ui" line="52"/>
<source>Loading file %1 of %2 files</source> <source>Loading file %1 of %2 files</source>
<oldsource>Loading %1 files of %2 files</oldsource> <oldsource>Loading %1 files of %2 files</oldsource>
<translation>Lade Datei %1 von %2 Dateien</translation> <translation>Lade Datei %1 von %2 Dateien</translation>
@ -114,12 +114,12 @@
<translation type="obsolete">Ansehen</translation> <translation type="obsolete">Ansehen</translation>
</message> </message>
<message> <message>
<location filename="ProfileInterface.ui" line="173"/> <location filename="ProfileInterface.ui" line="179"/>
<source>Close Profile</source> <source>Close Profile</source>
<translation>Profil schließen</translation> <translation>Profil schließen</translation>
</message> </message>
<message> <message>
<location filename="ProfileInterface.cpp" line="80"/> <location filename="ProfileInterface.cpp" line="81"/>
<source>Loading...</source> <source>Loading...</source>
<translation>Lade...</translation> <translation>Lade...</translation>
</message> </message>
@ -170,6 +170,22 @@
<source>Delete</source> <source>Delete</source>
<translation>Löschen</translation> <translation>Löschen</translation>
</message> </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>
<context> <context>
<name>SnapmaticWidget</name> <name>SnapmaticWidget</name>
@ -193,6 +209,26 @@
<source>Delete</source> <source>Delete</source>
<translation>Löschen</translation> <translation>Löschen</translation>
</message> </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>
<context> <context>
<name>UserInterface</name> <name>UserInterface</name>
@ -231,7 +267,7 @@
</message> </message>
<message> <message>
<location filename="UserInterface.ui" line="110"/> <location filename="UserInterface.ui" line="110"/>
<location filename="UserInterface.cpp" line="122"/> <location filename="UserInterface.cpp" line="117"/>
<source>Close</source> <source>Close</source>
<translation>Schließen</translation> <translation>Schließen</translation>
</message> </message>
@ -247,6 +283,8 @@
<message> <message>
<location filename="UserInterface.ui" line="59"/> <location filename="UserInterface.ui" line="59"/>
<location filename="UserInterface.ui" line="118"/> <location filename="UserInterface.ui" line="118"/>
<location filename="UserInterface.cpp" line="45"/>
<location filename="UserInterface.cpp" line="152"/>
<source>Select profile</source> <source>Select profile</source>
<translation>Profil auswählen</translation> <translation>Profil auswählen</translation>
</message> </message>
@ -256,12 +294,12 @@
<translation>Strg+P</translation> <translation>Strg+P</translation>
</message> </message>
<message> <message>
<location filename="UserInterface.cpp" line="75"/> <location filename="UserInterface.cpp" line="70"/>
<source>GTA V Folder not found!</source> <source>GTA V Folder not found!</source>
<translation>GTA V Ordner nicht gefunden!</translation> <translation>GTA V Ordner nicht gefunden!</translation>
</message> </message>
<message> <message>
<location filename="UserInterface.cpp" line="75"/> <location filename="UserInterface.cpp" line="70"/>
<source>gta5sync</source> <source>gta5sync</source>
<translation>gta5sync</translation> <translation>gta5sync</translation>
</message> </message>