Browse Source

added pic open dialog at ui

1.3.x
Rafael 6 years ago
parent
commit
dfa0428cc2
  1. 24
      ProfileInterface.cpp
  2. 9
      ProfileInterface.h
  3. 168
      ProfileInterface.ui
  4. 16
      SnapmaticWidget.cpp
  5. 9
      SnapmaticWidget.h
  6. 6
      UserInterface.cpp
  7. 6
      UserInterface.h
  8. 6
      UserInterface.ui
  9. 9
      main.cpp

24
ProfileInterface.cpp

@ -20,17 +20,19 @@
#include "ui_ProfileInterface.h"
#include "SnapmaticWidget.h"
#include "SavegameWidget.h"
#include <QSpacerItem>
#include <QFileInfo>
#include <QRegExp>
#include <QDebug>
#include <QFile>
#include <QDir>
ProfileInterface::ProfileInterface(QWidget *parent) :
QWidget(parent),
ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
QWidget(parent), profileDB(profileDB), crewDB(crewDB),
ui(new Ui::ProfileInterface)
{
ui->setupUi(this);
ui->labProfileContent->setVisible(false);
contentStr = ui->labProfileContent->text();
profileFolder = "";
}
@ -60,11 +62,14 @@ void ProfileInterface::setupProfileInterface()
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
if (picture->readingPicture())
{
SnapmaticWidget *picWidget = new SnapmaticWidget(ui->saSnapmaticContent);
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB);
picWidget->setSnapmaticPicture(picture, picturePath);
ui->saSnapmaticContent->layout()->addWidget(picWidget);
ui->vlSnapmatic->addWidget(picWidget);
crewDB->addCrew(picture->getCrewNumber());
}
}
QSpacerItem *snapmaticSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->vlSnapmatic->addSpacerItem(snapmaticSpacer);
profileDir.setNameFilters(QStringList("SGTA*"));
QStringList SavegameFiles = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
@ -74,9 +79,16 @@ void ProfileInterface::setupProfileInterface()
SavegameData *savegame = new SavegameData(sgdPath);
if (savegame->readingSavegame())
{
SavegameWidget *sgdWidget = new SavegameWidget(ui->saSavegameContent);
SavegameWidget *sgdWidget = new SavegameWidget();
sgdWidget->setSavegameData(savegame, sgdPath);
ui->saSavegameContent->layout()->addWidget(sgdWidget);
ui->vlSavegame->addWidget(sgdWidget);
}
}
QSpacerItem *savegameSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->vlSavegame->addSpacerItem(savegameSpacer);
}
void ProfileInterface::on_cmdCloseProfile_clicked()
{
this->close();
}

9
ProfileInterface.h

@ -19,6 +19,8 @@
#ifndef PROFILEINTERFACE_H
#define PROFILEINTERFACE_H
#include "ProfileDatabase.h"
#include "CrewDatabase.h"
#include <QWidget>
namespace Ui {
@ -29,12 +31,17 @@ class ProfileInterface : public QWidget
{
Q_OBJECT
public:
explicit ProfileInterface(QWidget *parent = 0);
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
void setProfileFolder(QString folder, QString profile);
void setupProfileInterface();
~ProfileInterface();
private slots:
void on_cmdCloseProfile_clicked();
private:
ProfileDatabase *profileDB;
CrewDatabase *crewDB;
Ui::ProfileInterface *ui;
QString profileFolder;
QString profileName;

168
ProfileInterface.ui

@ -18,13 +18,13 @@
<number>0</number>
</property>
<property name="topMargin">
<number>9</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>9</number>
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labProfileContent">
@ -37,123 +37,81 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlContent">
<widget class="QScrollArea" name="saProfile">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="saProfileContent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>232</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vlProfile">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="hlContent">
<item>
<layout class="QVBoxLayout" name="vlSnapmatic"/>
</item>
<item>
<layout class="QVBoxLayout" name="vlSavegame"/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlButtons">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>9</number>
</property>
<property name="topMargin">
<number>0</number>
<number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>9</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>9</number>
</property>
<item>
<widget class="QScrollArea" name="saSnapmatic">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<spacer name="hsProfile">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
<widget class="QWidget" name="saSnapmaticContent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>196</width>
<height>261</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vlSnapmaticContent">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="vsSnapmatic">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</spacer>
</item>
<item>
<widget class="QScrollArea" name="saSavegame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
<widget class="QPushButton" name="cmdCloseProfile">
<property name="text">
<string>Close Profile</string>
</property>
<widget class="QWidget" name="saSavegameContent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>196</width>
<height>261</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vlSavegameContent">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="vsSavegame">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

16
SnapmaticWidget.cpp

@ -19,10 +19,11 @@
#include "SnapmaticWidget.h"
#include "ui_SnapmaticWidget.h"
#include "SnapmaticPicture.h"
#include "PictureDialog.h"
#include <QPixmap>
SnapmaticWidget::SnapmaticWidget(QWidget *parent) :
QWidget(parent),
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, QWidget *parent) :
QWidget(parent), profileDB(profileDB),
ui(new Ui::SnapmaticWidget)
{
ui->setupUi(this);
@ -44,3 +45,14 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture, QString pic
smpic = picture;
picPath = picturePath;
}
void SnapmaticWidget::on_cmdView_clicked()
{
PictureDialog *picDialog = new PictureDialog(profileDB, this);
picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
picDialog->setSnapmaticPicture(smpic, true);
picDialog->setModal(true);
picDialog->show();
picDialog->exec();
picDialog->deleteLater();
}

9
SnapmaticWidget.h

@ -19,8 +19,9 @@
#ifndef SNAPMATICWIDGET_H
#define SNAPMATICWIDGET_H
#include <QWidget>
#include "SnapmaticPicture.h"
#include "ProfileDatabase.h"
#include <QWidget>
namespace Ui {
class SnapmaticWidget;
@ -31,11 +32,15 @@ class SnapmaticWidget : public QWidget
Q_OBJECT
public:
explicit SnapmaticWidget(QWidget *parent = 0);
explicit SnapmaticWidget(ProfileDatabase *profileDB, QWidget *parent = 0);
void setSnapmaticPicture(SnapmaticPicture *picture, QString picturePath);
~SnapmaticWidget();
private slots:
void on_cmdView_clicked();
private:
ProfileDatabase *profileDB;
Ui::SnapmaticWidget *ui;
SnapmaticPicture *smpic;
QString picPath;

6
UserInterface.cpp

@ -33,8 +33,8 @@
#include <QDesktopServices>
#endif
UserInterface::UserInterface(QWidget *parent) :
QMainWindow(parent),
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB),
ui(new Ui::UserInterface)
{
ui->setupUi(this);
@ -79,7 +79,7 @@ UserInterface::UserInterface(QWidget *parent) :
if (GTAV_Profiles.length() >= 1)
{
QString profileName = GTAV_Profiles.at(0);
ProfileInterface *profile1 = new ProfileInterface();
ProfileInterface *profile1 = new ProfileInterface(profileDB, crewDB);
ui->swProfile->addWidget(profile1);
ui->swProfile->setCurrentWidget(profile1);
profile1->setProfileFolder(GTAV_ProfilesFolder + "/" + profileName, profileName);

6
UserInterface.h

@ -19,6 +19,8 @@
#ifndef USERINTERFACE_H
#define USERINTERFACE_H
#include "ProfileDatabase.h"
#include "CrewDatabase.h"
#include <QMainWindow>
#include <QString>
#include <QMap>
@ -31,13 +33,15 @@ class UserInterface : public QMainWindow
{
Q_OBJECT
public:
explicit UserInterface(QWidget *parent = 0);
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
~UserInterface();
private slots:
void on_actionExit_triggered();
private:
ProfileDatabase *profileDB;
CrewDatabase *crewDB;
Ui::UserInterface *ui;
QString GTAV_Folder;
QString GTAV_ProfilesFolder;

6
UserInterface.ui

@ -10,6 +10,12 @@
<height>600</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>GTA V Sync</string>
</property>

9
main.cpp

@ -268,7 +268,14 @@ int main(int argc, char *argv[])
return a.exec();
}
UserInterface *uiWindow = new UserInterface();
CrewDatabase *crewDB = new CrewDatabase();
ProfileDatabase *profileDB = new ProfileDatabase();
DatabaseThread *threadDB = new DatabaseThread(crewDB);
QObject::connect(threadDB, SIGNAL(playerNameFound(int, QString)), profileDB, SLOT(setPlayerName(int, QString)));
threadDB->start();
UserInterface *uiWindow = new UserInterface(profileDB, crewDB);
uiWindow->show();
return a.exec();

Loading…
Cancel
Save