now can load more profiles, translation updated
This commit is contained in:
parent
fc37a5963c
commit
6c55773dbc
12 changed files with 175 additions and 33 deletions
|
@ -110,6 +110,9 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
|
|||
ui->labJSON->setText(jsonDrawString.arg("0.0", "0.0", "0.0", tr("No player"), tr("No crew")));
|
||||
QMessageBox::warning(this,tr("Snapmatic Picture Viewer"),tr("Failed at %1").arg(picture->getLastStep()));
|
||||
}
|
||||
|
||||
this->setMinimumSize(this->geometry().size());
|
||||
this->setMaximumSize(this->geometry().size());
|
||||
}
|
||||
|
||||
void PictureDialog::on_playerNameUpdated()
|
||||
|
|
|
@ -19,35 +19,53 @@
|
|||
#include "ProfileInterface.h"
|
||||
#include "ui_ProfileInterface.h"
|
||||
#include "SnapmaticWidget.h"
|
||||
#include "DatabaseThread.h"
|
||||
#include "SavegameWidget.h"
|
||||
#include "ProfileLoader.h"
|
||||
#include <QSpacerItem>
|
||||
#include <QFileInfo>
|
||||
#include <QPalette>
|
||||
#include <QRegExp>
|
||||
#include <QDebug>
|
||||
#include <QColor>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
|
||||
QWidget(parent), profileDB(profileDB), crewDB(crewDB),
|
||||
ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
|
||||
QWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
|
||||
ui(new Ui::ProfileInterface)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->saProfile->setVisible(false);
|
||||
ui->cmdCloseProfile->setEnabled(false);
|
||||
loadingStr = ui->labProfileLoading->text();
|
||||
profileFolder = "";
|
||||
profileLoader = 0;
|
||||
|
||||
QPalette palette;
|
||||
QColor baseColor = palette.base().color();
|
||||
ui->saProfile->setStyleSheet("QWidget#saProfileContent{background-color: rgb(" + QString::number(baseColor.red()) + "," + QString::number(baseColor.green()) + "," + QString::number(baseColor.blue()) + ")}");
|
||||
}
|
||||
|
||||
ProfileInterface::~ProfileInterface()
|
||||
{
|
||||
foreach(SavegameData *savegame, savegames)
|
||||
{
|
||||
savegame->deleteLater();
|
||||
delete savegame;
|
||||
}
|
||||
foreach(SnapmaticPicture *picture, pictures)
|
||||
{
|
||||
picture->deleteLater();
|
||||
delete picture;
|
||||
}
|
||||
foreach(QWidget *widget, widgets)
|
||||
{
|
||||
widget->deleteLater();
|
||||
delete widget;
|
||||
}
|
||||
profileLoader->deleteLater();
|
||||
delete profileLoader;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -59,7 +77,8 @@ void ProfileInterface::setProfileFolder(QString folder, QString profile)
|
|||
|
||||
void ProfileInterface::setupProfileInterface()
|
||||
{
|
||||
ProfileLoader *profileLoader = new ProfileLoader(profileFolder, crewDB);
|
||||
ui->labProfileLoading->setText(tr("Loading..."));
|
||||
profileLoader = new ProfileLoader(profileFolder, crewDB);
|
||||
QObject::connect(profileLoader, SIGNAL(savegameLoaded(SavegameData*, QString)), this, SLOT(on_savegameLoaded(SavegameData*, QString)));
|
||||
QObject::connect(profileLoader, SIGNAL(pictureLoaded(SnapmaticPicture*, QString)), this, SLOT(on_pictureLoaded(SnapmaticPicture*, QString)));
|
||||
QObject::connect(profileLoader, SIGNAL(loadingProgress(int,int)), this, SLOT(on_loadingProgress(int,int)));
|
||||
|
@ -72,14 +91,16 @@ void ProfileInterface::on_savegameLoaded(SavegameData *savegame, QString savegam
|
|||
SavegameWidget *sgdWidget = new SavegameWidget();
|
||||
sgdWidget->setSavegameData(savegame, savegamePath);
|
||||
ui->vlSavegame->addWidget(sgdWidget);
|
||||
widgets.append(sgdWidget);
|
||||
savegames.append(savegame);
|
||||
}
|
||||
|
||||
void ProfileInterface::on_pictureLoaded(SnapmaticPicture *picture, QString picturePath)
|
||||
{
|
||||
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB);
|
||||
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, threadDB);
|
||||
picWidget->setSnapmaticPicture(picture, picturePath);
|
||||
ui->vlSnapmatic->addWidget(picWidget);
|
||||
widgets.append(picWidget);
|
||||
pictures.append(picture);
|
||||
}
|
||||
|
||||
|
@ -96,6 +117,7 @@ void ProfileInterface::on_profileLoaded()
|
|||
ui->saProfileContent->layout()->addItem(saSpacerItem);
|
||||
ui->saProfile->setVisible(true);
|
||||
ui->frmLoading->setVisible(false);
|
||||
ui->cmdCloseProfile->setEnabled(true);
|
||||
}
|
||||
|
||||
void ProfileInterface::on_cmdCloseProfile_clicked()
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "SnapmaticPicture.h"
|
||||
#include "ProfileDatabase.h"
|
||||
#include "DatabaseThread.h"
|
||||
#include "ProfileLoader.h"
|
||||
#include "SavegameData.h"
|
||||
#include "CrewDatabase.h"
|
||||
#include <QWidget>
|
||||
|
@ -34,7 +36,7 @@ class ProfileInterface : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
||||
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||
void setProfileFolder(QString folder, QString profile);
|
||||
void setupProfileInterface();
|
||||
~ProfileInterface();
|
||||
|
@ -49,12 +51,16 @@ private slots:
|
|||
private:
|
||||
ProfileDatabase *profileDB;
|
||||
CrewDatabase *crewDB;
|
||||
DatabaseThread *threadDB;
|
||||
Ui::ProfileInterface *ui;
|
||||
|
||||
ProfileLoader *profileLoader;
|
||||
QList<SavegameData*> savegames;
|
||||
QList<SnapmaticPicture*> pictures;
|
||||
QList<QWidget*> widgets;
|
||||
QString profileFolder;
|
||||
QString profileName;
|
||||
QString loadingStr;
|
||||
QList<SavegameData*> savegames;
|
||||
QList<SnapmaticPicture*> pictures;
|
||||
|
||||
signals:
|
||||
void profileClosed();
|
||||
|
|
|
@ -37,6 +37,7 @@ protected:
|
|||
private:
|
||||
QString profileFolder;
|
||||
CrewDatabase *crewDB;
|
||||
ProfileLoader *profileLoader;
|
||||
|
||||
signals:
|
||||
void pictureLoaded(SnapmaticPicture *picture, QString picturePath);
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
#include "SnapmaticWidget.h"
|
||||
#include "ui_SnapmaticWidget.h"
|
||||
#include "SnapmaticPicture.h"
|
||||
#include "DatabaseThread.h"
|
||||
#include "PictureDialog.h"
|
||||
#include <QPixmap>
|
||||
|
||||
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, QWidget *parent) :
|
||||
QWidget(parent), profileDB(profileDB),
|
||||
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, DatabaseThread *threadDB, QWidget *parent) :
|
||||
QWidget(parent), profileDB(profileDB), threadDB(threadDB),
|
||||
ui(new Ui::SnapmaticWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -52,7 +53,13 @@ void SnapmaticWidget::on_cmdView_clicked()
|
|||
picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
picDialog->setSnapmaticPicture(smpic, true);
|
||||
picDialog->setModal(true);
|
||||
|
||||
// be ready for playerName updated
|
||||
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), picDialog, SLOT(on_playerNameUpdated()));
|
||||
|
||||
// show picture dialog
|
||||
picDialog->show();
|
||||
picDialog->exec();
|
||||
picDialog->deleteLater();
|
||||
delete picDialog;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "SnapmaticPicture.h"
|
||||
#include "ProfileDatabase.h"
|
||||
#include "DatabaseThread.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
|
@ -32,7 +33,7 @@ class SnapmaticWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SnapmaticWidget(ProfileDatabase *profileDB, QWidget *parent = 0);
|
||||
explicit SnapmaticWidget(ProfileDatabase *profileDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||
void setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath);
|
||||
~SnapmaticWidget();
|
||||
|
||||
|
@ -41,6 +42,7 @@ private slots:
|
|||
|
||||
private:
|
||||
ProfileDatabase *profileDB;
|
||||
DatabaseThread *threadDB;
|
||||
Ui::SnapmaticWidget *ui;
|
||||
SnapmaticPicture *smpic;
|
||||
QString picPath;
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include "UserInterface.h"
|
||||
#include "ui_UserInterface.h"
|
||||
#include "ProfileInterface.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <QFileInfo>
|
||||
|
@ -33,8 +36,8 @@
|
|||
#include <QDesktopServices>
|
||||
#endif
|
||||
|
||||
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
|
||||
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB),
|
||||
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
|
||||
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
|
||||
ui(new Ui::UserInterface)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -80,6 +83,7 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
|
|||
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
|
||||
|
||||
QStringList GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
||||
setupProfileUi(GTAV_Profiles);
|
||||
|
||||
if (GTAV_Profiles.length() == 1)
|
||||
{
|
||||
|
@ -92,10 +96,46 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
|
|||
SyncSettings.endGroup();
|
||||
}
|
||||
|
||||
void UserInterface::setupProfileUi(QStringList GTAV_Profiles)
|
||||
{
|
||||
foreach(const QString >AV_Profile, GTAV_Profiles)
|
||||
{
|
||||
QPushButton *profileBtn = new QPushButton(GTAV_Profile, ui->swSelection);
|
||||
profileBtn->setObjectName(GTAV_Profile);
|
||||
profileBtn->setMinimumSize(0, 40);
|
||||
profileBtn->setAutoDefault(true);
|
||||
ui->swSelection->layout()->addWidget(profileBtn);
|
||||
|
||||
QObject::connect(profileBtn, SIGNAL(clicked(bool)), this, SLOT(on_profileButton_clicked()));
|
||||
}
|
||||
QSpacerItem *buttomSpacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
ui->swSelection->layout()->addItem(buttomSpacerItem);
|
||||
|
||||
QHBoxLayout *footerLayout = new QHBoxLayout();
|
||||
footerLayout->setObjectName("footerLayout");
|
||||
ui->swSelection->layout()->addItem(footerLayout);
|
||||
|
||||
QSpacerItem *closeButtonSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
footerLayout->addSpacerItem(closeButtonSpacer);
|
||||
|
||||
QPushButton *cmdClose = new QPushButton(tr("Close"), ui->swSelection);
|
||||
cmdClose->setObjectName("cmdClose");
|
||||
cmdClose->setAutoDefault(true);
|
||||
footerLayout->addWidget(cmdClose);
|
||||
|
||||
QObject::connect(cmdClose, SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||
}
|
||||
|
||||
void UserInterface::on_profileButton_clicked()
|
||||
{
|
||||
QPushButton *profileBtn = (QPushButton*)sender();
|
||||
openProfile(profileBtn->objectName());
|
||||
}
|
||||
|
||||
void UserInterface::openProfile(QString profileName)
|
||||
{
|
||||
profileOpen = true;
|
||||
profileUI = new ProfileInterface(profileDB, crewDB);
|
||||
profileUI = new ProfileInterface(profileDB, crewDB, threadDB);
|
||||
ui->swProfile->addWidget(profileUI);
|
||||
ui->swProfile->setCurrentWidget(profileUI);
|
||||
profileUI->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName);
|
||||
|
@ -123,3 +163,14 @@ void UserInterface::on_actionExit_triggered()
|
|||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
void UserInterface::on_actionSelect_profile_triggered()
|
||||
{
|
||||
closeProfile();
|
||||
openSelectProfile();
|
||||
}
|
||||
|
||||
void UserInterface::openSelectProfile()
|
||||
{
|
||||
// not needed right now
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "ProfileInterface.h"
|
||||
#include "ProfileDatabase.h"
|
||||
#include "DatabaseThread.h"
|
||||
#include "CrewDatabase.h"
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
|
@ -34,22 +35,27 @@ class UserInterface : public QMainWindow
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||
~UserInterface();
|
||||
|
||||
private slots:
|
||||
void on_actionExit_triggered();
|
||||
void closeProfile();
|
||||
void on_actionExit_triggered();
|
||||
void on_actionSelect_profile_triggered();
|
||||
void on_profileButton_clicked();
|
||||
|
||||
private:
|
||||
ProfileDatabase *profileDB;
|
||||
CrewDatabase *crewDB;
|
||||
DatabaseThread *threadDB;
|
||||
Ui::UserInterface *ui;
|
||||
ProfileInterface *profileUI;
|
||||
bool profileOpen;
|
||||
QString GTAV_Folder;
|
||||
QString GTAV_ProfilesFolder;
|
||||
void setupProfileUi(QStringList GTAV_Profiles);
|
||||
void openProfile(QString profileName);
|
||||
void openSelectProfile();
|
||||
};
|
||||
|
||||
#endif // USERINTERFACE_H
|
||||
|
|
|
@ -38,7 +38,36 @@
|
|||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="profileSelection"/>
|
||||
<widget class="QWidget" name="swSelection">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="vsUpper">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labSelectProfile">
|
||||
<property name="text">
|
||||
<string>Select profile</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -78,7 +107,7 @@
|
|||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Q</string>
|
||||
|
|
BIN
gta5sync_de.qm
BIN
gta5sync_de.qm
Binary file not shown.
|
@ -89,7 +89,7 @@
|
|||
</message>
|
||||
<message>
|
||||
<source>Content of Profile %1</source>
|
||||
<translation>Inhalt vom Profil %1</translation>
|
||||
<translation type="obsolete">Inhalt vom Profil %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>View</source>
|
||||
|
@ -100,6 +100,11 @@
|
|||
<source>Close Profile</source>
|
||||
<translation>Profil schließen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="ProfileInterface.cpp" line="80"/>
|
||||
<source>Loading...</source>
|
||||
<translation>Lade...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SavegameDialog</name>
|
||||
|
@ -143,7 +148,7 @@
|
|||
<translation>Kopieren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="SavegameWidget.ui" line="53"/>
|
||||
<location filename="SavegameWidget.ui" line="56"/>
|
||||
<source>Delete</source>
|
||||
<translation>Löschen</translation>
|
||||
</message>
|
||||
|
@ -166,7 +171,7 @@
|
|||
<translation>Ansehen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="SnapmaticWidget.ui" line="68"/>
|
||||
<location filename="SnapmaticWidget.ui" line="71"/>
|
||||
<source>Delete</source>
|
||||
<translation>Löschen</translation>
|
||||
</message>
|
||||
|
@ -178,9 +183,8 @@
|
|||
<translation type="obsolete">Grand Theft Auto V Sync</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.cpp" line="69"/>
|
||||
<source>GTA V Sync</source>
|
||||
<translation>GTA V Sync</translation>
|
||||
<translation type="obsolete">GTA V Sync</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="20"/>
|
||||
|
@ -188,49 +192,60 @@
|
|||
<translation>gta5sync - %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="57"/>
|
||||
<location filename="UserInterface.ui" line="86"/>
|
||||
<source>File</source>
|
||||
<translation>Datei</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="64"/>
|
||||
<location filename="UserInterface.ui" line="93"/>
|
||||
<source>Help</source>
|
||||
<translation>Hilfe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="73"/>
|
||||
<location filename="UserInterface.ui" line="102"/>
|
||||
<source>About gta5sync</source>
|
||||
<translation>Über gta5sync</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="76"/>
|
||||
<location filename="UserInterface.ui" line="105"/>
|
||||
<source>Ctrl+A</source>
|
||||
<translation>Strg+A</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="81"/>
|
||||
<source>Exit</source>
|
||||
<location filename="UserInterface.ui" line="110"/>
|
||||
<location filename="UserInterface.cpp" line="121"/>
|
||||
<source>Close</source>
|
||||
<translation>Schließen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="84"/>
|
||||
<source>Exit</source>
|
||||
<translation type="obsolete">Schließen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="113"/>
|
||||
<source>Ctrl+Q</source>
|
||||
<translation>Strg+Q</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="89"/>
|
||||
<location filename="UserInterface.ui" line="59"/>
|
||||
<location filename="UserInterface.ui" line="118"/>
|
||||
<source>Select profile</source>
|
||||
<translation>Profil auswählen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.ui" line="92"/>
|
||||
<location filename="UserInterface.ui" line="121"/>
|
||||
<source>Ctrl+P</source>
|
||||
<translation>Strg+P</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.cpp" line="69"/>
|
||||
<location filename="UserInterface.cpp" line="74"/>
|
||||
<source>GTA V Folder not found!</source>
|
||||
<translation>GTA V Ordner nicht gefunden!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="UserInterface.cpp" line="74"/>
|
||||
<source>gta5sync</source>
|
||||
<translation>gta5sync</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -275,7 +275,7 @@ int main(int argc, char *argv[])
|
|||
QObject::connect(threadDB, SIGNAL(playerNameFound(int, QString)), profileDB, SLOT(setPlayerName(int, QString)));
|
||||
threadDB->start();
|
||||
|
||||
UserInterface *uiWindow = new UserInterface(profileDB, crewDB);
|
||||
UserInterface *uiWindow = new UserInterface(profileDB, crewDB, threadDB);
|
||||
uiWindow->show();
|
||||
|
||||
return a.exec();
|
||||
|
|
Loading…
Reference in a new issue