added snapmatic + savegame widget

This commit is contained in:
Rafael 2016-03-25 07:07:58 +01:00
parent 9057b783e5
commit a608702e69
13 changed files with 428 additions and 66 deletions

View file

@ -18,6 +18,9 @@
#include "ProfileInterface.h" #include "ProfileInterface.h"
#include "ui_ProfileInterface.h" #include "ui_ProfileInterface.h"
#include "SnapmaticWidget.h"
#include "SavegameWidget.h"
#include <QDir>
ProfileInterface::ProfileInterface(QWidget *parent) : ProfileInterface::ProfileInterface(QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -31,3 +34,9 @@ ProfileInterface::~ProfileInterface()
{ {
delete ui; delete ui;
} }
void ProfileInterface::setProfileFolder(QString folder)
{
profileFolder = folder;
}

View file

@ -13,67 +13,71 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Profile Interface</string> <string>Profile Interface</string>
</property> </property>
<widget class="QWidget" name="horizontalLayoutWidget"> <layout class="QVBoxLayout" name="vlProfileInterface">
<property name="geometry"> <property name="leftMargin">
<rect> <number>0</number>
<x>10</x>
<y>110</y>
<width>400</width>
<height>300</height>
</rect>
</property> </property>
<layout class="QHBoxLayout" name="hlInformation"> <property name="topMargin">
<property name="spacing"> <number>0</number>
<number>6</number> </property>
</property> <property name="rightMargin">
<property name="leftMargin"> <number>0</number>
<number>9</number> </property>
</property> <property name="bottomMargin">
<property name="topMargin"> <number>0</number>
<number>9</number> </property>
</property> <item>
<property name="rightMargin"> <widget class="QScrollArea" name="saSnapmatic">
<number>9</number> <property name="frameShape">
</property> <enum>QFrame::NoFrame</enum>
<property name="bottomMargin"> </property>
<number>9</number> <property name="frameShadow">
</property> <enum>QFrame::Plain</enum>
<item> </property>
<widget class="QLabel" name="labInformation"> <property name="lineWidth">
<property name="text"> <number>0</number>
<string>&lt;span style=&quot; font-weight:600;&quot;&gt;GTA V Snapmatic Picture:&lt;/span&gt; PHOTO - 01/01/01 - 22:04:11</string> </property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="saSnapmaticContent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="labProfileContent">
<property name="text">
<string>Content of Profile %1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="vsContent">
<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> </widget>
<item> </item>
<spacer name="hsInformation"> </layout>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdView">
<property name="text">
<string>View</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClose">
<property name="text">
<string>Close Profile</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

32
SavegameWidget.cpp Executable file
View file

@ -0,0 +1,32 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping Gaming Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "SavegameWidget.h"
#include "ui_SavegameWidget.h"
SavegameWidget::SavegameWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SavegameWidget)
{
ui->setupUi(this);
}
SavegameWidget::~SavegameWidget()
{
delete ui;
}

40
SavegameWidget.h Executable file
View file

@ -0,0 +1,40 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping Gaming Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef SAVEGAMEWIDGET_H
#define SAVEGAMEWIDGET_H
#include <QWidget>
namespace Ui {
class SavegameWidget;
}
class SavegameWidget : public QWidget
{
Q_OBJECT
public:
explicit SavegameWidget(QWidget *parent = 0);
~SavegameWidget();
private:
Ui::SavegameWidget *ui;
};
#endif // SAVEGAMEWIDGET_H

58
SavegameWidget.ui Executable file
View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SavegameWidget</class>
<widget class="QWidget" name="SavegameWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>45</height>
</rect>
</property>
<property name="windowTitle">
<string>Savegame Widget</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labSavegameStr">
<property name="text">
<string>The Third Way (100%) - 00/00/00 00:00:00</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="hsSavegameWidget">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdCopy">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdDelete">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

32
SnapmaticWidget.cpp Executable file
View file

@ -0,0 +1,32 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping Gaming Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "SnapmaticWidget.h"
#include "ui_SnapmaticWidget.h"
SnapmaticWidget::SnapmaticWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SnapmaticWidget)
{
ui->setupUi(this);
}
SnapmaticWidget::~SnapmaticWidget()
{
delete ui;
}

42
SnapmaticWidget.h Executable file
View file

@ -0,0 +1,42 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016 Syping Gaming Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef SNAPMATICWIDGET_H
#define SNAPMATICWIDGET_H
#include <QWidget>
#include "SnapmaticPicture.h"
namespace Ui {
class SnapmaticWidget;
}
class SnapmaticWidget : public QWidget
{
Q_OBJECT
public:
explicit SnapmaticWidget(QWidget *parent = 0);
void setSnapmaticPicture(SnapmaticPicture *picutre, QString picturePath);
~SnapmaticWidget();
private:
Ui::SnapmaticWidget *ui;
};
#endif // SNAPMATICWIDGET_H

83
SnapmaticWidget.ui Executable file
View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SnapmaticWidget</class>
<widget class="QWidget" name="SnapmaticWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>385</width>
<height>45</height>
</rect>
</property>
<property name="windowTitle">
<string>Snapmatic Widget</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labPicture">
<property name="minimumSize">
<size>
<width>48</width>
<height>27</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>27</height>
</size>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labPicStr">
<property name="text">
<string>PHOTO - 00/00/00 00:00:00</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="hsView">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdView">
<property name="text">
<string>View</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdDelete">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -19,12 +19,64 @@
#include "UserInterface.h" #include "UserInterface.h"
#include "ui_UserInterface.h" #include "ui_UserInterface.h"
#include "ProfileInterface.h" #include "ProfileInterface.h"
#include <QMessageBox>
#include <QSettings>
#include <QFileInfo>
#include <QFile>
#include <QDir>
#include <QMap>
#ifdef QT5_MODE
#include <QStandardPaths>
#else
#include <QDesktopServices>
#endif
UserInterface::UserInterface(QWidget *parent) : UserInterface::UserInterface(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::UserInterface) ui(new Ui::UserInterface)
{ {
ui->setupUi(this); ui->setupUi(this);
// init settings
QSettings SyncSettings("Syping Gaming Team", "gta5sync");
SyncSettings.beginGroup("dir");
bool forceDir = SyncSettings.value("force", false).toBool();
// init folder
#ifdef QT5_MODE
QString GTAV_defaultFolder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "\\Rockstar Games\\GTA V";
#else
QString GTAV_defaultFolder = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation) + "\\Rockstar Games\\GTA V";
#endif
QDir GTAV_Dir;
if (forceDir)
{
GTAV_Folder = SyncSettings.value("dir", GTAV_defaultFolder).toString();
}
else
{
GTAV_Folder = GTAV_defaultFolder;
}
GTAV_Dir.setPath(GTAV_Folder);
if (GTAV_Dir.exists())
{
QDir::setCurrent(GTAV_Folder);
}
else
{
QMessageBox::warning(this, tr("GTA V Sync"), tr("GTA V Folder not found!"));
}
// profiles init
QDir GTAV_ProfilesDir;
GTAV_ProfilesFolder = GTAV_Folder + "\\Profiles";
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
QStringList GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::NoFilter, QDir::NoSort);
GTAV_Profiles.removeAll("..");
GTAV_Profiles.removeAll(".");
ProfileInterface *profile1 = new ProfileInterface(); ProfileInterface *profile1 = new ProfileInterface();
ui->swProfile->addWidget(profile1); ui->swProfile->addWidget(profile1);
ui->swProfile->setCurrentWidget(profile1); ui->swProfile->setCurrentWidget(profile1);

View file

@ -20,6 +20,8 @@
#define USERINTERFACE_H #define USERINTERFACE_H
#include <QMainWindow> #include <QMainWindow>
#include <QString>
#include <QMap>
namespace Ui { namespace Ui {
class UserInterface; class UserInterface;
@ -37,6 +39,9 @@ private slots:
private: private:
Ui::UserInterface *ui; Ui::UserInterface *ui;
QString GTAV_Folder;
QString GTAV_ProfilesFolder;
QMap<QString, QString> GTAV_ProfileMap;
}; };
#endif // USERINTERFACE_H #endif // USERINTERFACE_H

View file

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Grand Theft Auto V Sync</string> <string>GTA V Sync</string>
</property> </property>
<widget class="QWidget" name="cwUI"> <widget class="QWidget" name="cwUI">
<layout class="QVBoxLayout" name="vlUI"> <layout class="QVBoxLayout" name="vlUI">

View file

@ -35,7 +35,9 @@ SOURCES += main.cpp \
SavegameDialog.cpp \ SavegameDialog.cpp \
SyncFramework.cpp \ SyncFramework.cpp \
UserInterface.cpp \ UserInterface.cpp \
ProfileInterface.cpp ProfileInterface.cpp \
SnapmaticWidget.cpp \
SavegameWidget.cpp
HEADERS += \ HEADERS += \
SnapmaticPicture.h \ SnapmaticPicture.h \
@ -47,13 +49,17 @@ HEADERS += \
SavegameDialog.h \ SavegameDialog.h \
SyncFramework.h \ SyncFramework.h \
UserInterface.h \ UserInterface.h \
ProfileInterface.h ProfileInterface.h \
SnapmaticWidget.h \
SavegameWidget.h
FORMS += \ FORMS += \
PictureDialog.ui \ PictureDialog.ui \
SavegameDialog.ui \ SavegameDialog.ui \
UserInterface.ui \ UserInterface.ui \
ProfileInterface.ui ProfileInterface.ui \
SnapmaticWidget.ui \
SavegameWidget.ui
TRANSLATIONS += \ TRANSLATIONS += \
gta5sync_de.ts gta5sync_de.ts

View file

@ -39,12 +39,11 @@ int main(int argc, char *argv[])
a.setApplicationName("gta5sync"); a.setApplicationName("gta5sync");
a.setApplicationVersion("1.0.0"); a.setApplicationVersion("1.0.0");
// Loading translation settings
QSettings settings("Syping Gaming Team", "gta5sync"); QSettings settings("Syping Gaming Team", "gta5sync");
settings.beginGroup("Interface"); settings.beginGroup("Interface");
QString language = settings.value("Language","System").toString(); QString language = settings.value("Language","System").toString();
settings.endGroup(); settings.endGroup();
// Translate pre values
bool trsf = false; bool trsf = false;
bool svlp = false; bool svlp = false;
@ -62,7 +61,7 @@ int main(int argc, char *argv[])
{ {
if (langList.at(0) != "en") if (langList.at(0) != "en")
{ {
if (svlp) {trsf = true;} if (svlp) { trsf = true; }
} }
} }
} }
@ -70,7 +69,7 @@ int main(int argc, char *argv[])
{ {
if (langList.at(0) != "en") if (langList.at(0) != "en")
{ {
if (svlp) {trsf = true;} if (svlp) { trsf = true; }
} }
} }
} }