first code modification

This commit is contained in:
Rafael 2016-02-27 01:06:24 +01:00
parent d1f4723c4d
commit 38a8065016
6 changed files with 306 additions and 13 deletions

View file

@ -15,6 +15,10 @@
* limitations under the License. * limitations under the License.
*****************************************************************************/ *****************************************************************************/
#include <QDesktopServices>
#include <QSettings>
#include <QDebug>
#include <QDir>
#include "frmGTA5Sync.h" #include "frmGTA5Sync.h"
#include "ui_frmGTA5Sync.h" #include "ui_frmGTA5Sync.h"
@ -23,6 +27,49 @@ frmGTA5Sync::frmGTA5Sync(QWidget *parent) :
ui(new Ui::frmGTA5Sync) ui(new Ui::frmGTA5Sync)
{ {
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
QString GTAV_defaultFolder = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation) + "\\Rockstar Games\\GTA V";
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
{
qDebug() << "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(".");
foreach(QString GTAV_Profile, GTAV_Profiles)
{
ui->cbProfile->addItem(GTAV_Profile);
}
} }
frmGTA5Sync::~frmGTA5Sync() frmGTA5Sync::~frmGTA5Sync()

View file

@ -33,6 +33,8 @@ public:
~frmGTA5Sync(); ~frmGTA5Sync();
private: private:
QString GTAV_Folder;
QString GTAV_ProfilesFolder;
Ui::frmGTA5Sync *ui; Ui::frmGTA5Sync *ui;
}; };

View file

@ -1,24 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>frmGTA5Sync</class> <class>frmGTA5Sync</class>
<widget class="QMainWindow" name="frmGTA5Sync" > <widget class="QMainWindow" name="frmGTA5Sync">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>1211</width>
<height>300</height> <height>650</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string>frmGTA5Sync</string> <string>gta5sync</string>
</property>
<widget class="QWidget" name="cwSync">
<layout class="QVBoxLayout" name="vlSync">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" name="hlProfile">
<item>
<widget class="QLabel" name="labProfile">
<property name="text">
<string>Profile:</string>
</property> </property>
<widget class="QMenuBar" name="menuBar" />
<widget class="QToolBar" name="mainToolBar" />
<widget class="QWidget" name="centralWidget" />
<widget class="QStatusBar" name="statusBar" />
</widget> </widget>
<layoutDefault spacing="6" margin="11" /> </item>
<pixmapfunction></pixmapfunction> <item>
<resources/> <widget class="QComboBox" name="cbProfile"/>
</item>
<item>
<spacer name="hsProfile">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="swLists">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="pageSavegames">
<layout class="QVBoxLayout" name="vlSavegames">
<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>
<widget class="QLabel" name="labSavegames">
<property name="text">
<string>Savegames</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="lvSavegames"/>
</item>
<item>
<widget class="QPushButton" name="cmdViewSnapmatic">
<property name="text">
<string>View Snapmatic pictures</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageSnapmatic">
<layout class="QVBoxLayout" name="vlSnapmatic">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labSnapmatic">
<property name="text">
<string>Snapmatic</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlSnapmatic">
<item>
<layout class="QVBoxLayout" name="vlPictureList">
<item>
<widget class="QListView" name="lvPicutres">
<property name="minimumSize">
<size>
<width>225</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>275</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlBackToSG">
<item>
<widget class="QPushButton" name="cmdBackToSG">
<property name="text">
<string>&lt;- Back to Savegames</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="vlPicture">
<item>
<layout class="QHBoxLayout" name="hlPicRender">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labPicture">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="res.qrc">:/img/gta5sync.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labEmptyRender">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labPicInfo">
<property name="text">
<string>Filename: %1
Title: %2
Date: %3</string>
</property>
</widget>
</item>
<item>
<spacer name="vsPicture">
<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>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1211</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuSync">
<property name="title">
<string>Sync</string>
</property>
<addaction name="actionSetup_sync"/>
<addaction name="actionSync_log"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout_gta5sync"/>
</widget>
<addaction name="menuSync"/>
<addaction name="menuHelp"/>
</widget>
<action name="actionAbout_gta5sync">
<property name="text">
<string>About gta5sync</string>
</property>
</action>
<action name="actionSetup_sync">
<property name="text">
<string>Setup sync</string>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
</action>
<action name="actionSync_log">
<property name="text">
<string>Sync log</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="res.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

BIN
gta5sync.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

View file

@ -29,3 +29,6 @@ SOURCES += main.cpp\
HEADERS += frmGTA5Sync.h HEADERS += frmGTA5Sync.h
FORMS += frmGTA5Sync.ui FORMS += frmGTA5Sync.ui
RESOURCES += \
res.qrc

5
res.qrc Executable file
View file

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/img">
<file>gta5sync.jpg</file>
</qresource>
</RCC>