clean RAM after use profile, button focus fixed
This commit is contained in:
parent
6e165de9e2
commit
fc37a5963c
7 changed files with 72 additions and 10 deletions
|
@ -40,6 +40,14 @@ ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *cre
|
||||||
|
|
||||||
ProfileInterface::~ProfileInterface()
|
ProfileInterface::~ProfileInterface()
|
||||||
{
|
{
|
||||||
|
foreach(SavegameData *savegame, savegames)
|
||||||
|
{
|
||||||
|
delete savegame;
|
||||||
|
}
|
||||||
|
foreach(SnapmaticPicture *picture, pictures)
|
||||||
|
{
|
||||||
|
delete picture;
|
||||||
|
}
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +72,7 @@ void ProfileInterface::on_savegameLoaded(SavegameData *savegame, QString savegam
|
||||||
SavegameWidget *sgdWidget = new SavegameWidget();
|
SavegameWidget *sgdWidget = new SavegameWidget();
|
||||||
sgdWidget->setSavegameData(savegame, savegamePath);
|
sgdWidget->setSavegameData(savegame, savegamePath);
|
||||||
ui->vlSavegame->addWidget(sgdWidget);
|
ui->vlSavegame->addWidget(sgdWidget);
|
||||||
|
savegames.append(savegame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::on_pictureLoaded(SnapmaticPicture *picture, QString picturePath)
|
void ProfileInterface::on_pictureLoaded(SnapmaticPicture *picture, QString picturePath)
|
||||||
|
@ -71,6 +80,7 @@ void ProfileInterface::on_pictureLoaded(SnapmaticPicture *picture, QString pictu
|
||||||
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB);
|
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB);
|
||||||
picWidget->setSnapmaticPicture(picture, picturePath);
|
picWidget->setSnapmaticPicture(picture, picturePath);
|
||||||
ui->vlSnapmatic->addWidget(picWidget);
|
ui->vlSnapmatic->addWidget(picWidget);
|
||||||
|
pictures.append(picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::on_loadingProgress(int value, int maximum)
|
void ProfileInterface::on_loadingProgress(int value, int maximum)
|
||||||
|
@ -90,5 +100,5 @@ void ProfileInterface::on_profileLoaded()
|
||||||
|
|
||||||
void ProfileInterface::on_cmdCloseProfile_clicked()
|
void ProfileInterface::on_cmdCloseProfile_clicked()
|
||||||
{
|
{
|
||||||
this->close();
|
emit profileClosed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ProfileInterface;
|
class ProfileInterface;
|
||||||
|
@ -52,6 +53,11 @@ private:
|
||||||
QString profileFolder;
|
QString profileFolder;
|
||||||
QString profileName;
|
QString profileName;
|
||||||
QString loadingStr;
|
QString loadingStr;
|
||||||
|
QList<SavegameData*> savegames;
|
||||||
|
QList<SnapmaticPicture*> pictures;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void profileClosed();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROFILEINTERFACE_H
|
#endif // PROFILEINTERFACE_H
|
||||||
|
|
|
@ -172,6 +172,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Close Profile</string>
|
<string>Close Profile</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Copy</string>
|
<string>Copy</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -52,6 +55,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete</string>
|
<string>Delete</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -60,6 +60,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>View</string>
|
<string>View</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -67,6 +70,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete</string>
|
<string>Delete</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -38,6 +38,8 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
|
||||||
ui(new Ui::UserInterface)
|
ui(new Ui::UserInterface)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
profileOpen = 0;
|
||||||
|
profileUI = 0;
|
||||||
|
|
||||||
// init settings
|
// init settings
|
||||||
QSettings SyncSettings("Syping", "gta5sync");
|
QSettings SyncSettings("Syping", "gta5sync");
|
||||||
|
@ -66,24 +68,49 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("GTA V Sync"), tr("GTA V Folder not found!"));
|
QMessageBox::warning(this, tr("gta5sync"), tr("GTA V Folder not found!"));
|
||||||
}
|
}
|
||||||
|
SyncSettings.endGroup();
|
||||||
|
|
||||||
// profiles init
|
// profiles init
|
||||||
|
SyncSettings.beginGroup("Profile");
|
||||||
|
QString defaultProfile = SyncSettings.value("Default", "").toString();
|
||||||
QDir GTAV_ProfilesDir;
|
QDir GTAV_ProfilesDir;
|
||||||
GTAV_ProfilesFolder = GTAV_Folder + "/Profiles";
|
GTAV_ProfilesFolder = GTAV_Folder + "/Profiles";
|
||||||
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
|
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
|
||||||
|
|
||||||
QStringList GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
QStringList GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
||||||
|
|
||||||
if (GTAV_Profiles.length() >= 1)
|
if (GTAV_Profiles.length() == 1)
|
||||||
{
|
{
|
||||||
QString profileName = GTAV_Profiles.at(0);
|
openProfile(GTAV_Profiles.at(0));
|
||||||
ProfileInterface *profile1 = new ProfileInterface(profileDB, crewDB);
|
}
|
||||||
ui->swProfile->addWidget(profile1);
|
else if(GTAV_Profiles.contains(defaultProfile))
|
||||||
ui->swProfile->setCurrentWidget(profile1);
|
{
|
||||||
profile1->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName);
|
openProfile(defaultProfile);
|
||||||
profile1->setupProfileInterface();
|
}
|
||||||
|
SyncSettings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterface::openProfile(QString profileName)
|
||||||
|
{
|
||||||
|
profileOpen = true;
|
||||||
|
profileUI = new ProfileInterface(profileDB, crewDB);
|
||||||
|
ui->swProfile->addWidget(profileUI);
|
||||||
|
ui->swProfile->setCurrentWidget(profileUI);
|
||||||
|
profileUI->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName);
|
||||||
|
profileUI->setupProfileInterface();
|
||||||
|
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserInterface::closeProfile()
|
||||||
|
{
|
||||||
|
if (profileOpen)
|
||||||
|
{
|
||||||
|
profileOpen = false;
|
||||||
|
ui->swProfile->removeWidget(profileUI);
|
||||||
|
profileUI->deleteLater();
|
||||||
|
delete profileUI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#ifndef USERINTERFACE_H
|
#ifndef USERINTERFACE_H
|
||||||
#define USERINTERFACE_H
|
#define USERINTERFACE_H
|
||||||
|
|
||||||
|
#include "ProfileInterface.h"
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
@ -38,14 +39,17 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_actionExit_triggered();
|
void on_actionExit_triggered();
|
||||||
|
void closeProfile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProfileDatabase *profileDB;
|
ProfileDatabase *profileDB;
|
||||||
CrewDatabase *crewDB;
|
CrewDatabase *crewDB;
|
||||||
Ui::UserInterface *ui;
|
Ui::UserInterface *ui;
|
||||||
|
ProfileInterface *profileUI;
|
||||||
|
bool profileOpen;
|
||||||
QString GTAV_Folder;
|
QString GTAV_Folder;
|
||||||
QString GTAV_ProfilesFolder;
|
QString GTAV_ProfilesFolder;
|
||||||
QMap<QString, QString> GTAV_ProfileMap;
|
void openProfile(QString profileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // USERINTERFACE_H
|
#endif // USERINTERFACE_H
|
||||||
|
|
Loading…
Reference in a new issue