first ui dev, open profiles in PictureDialog

This commit is contained in:
Rafael 2016-03-23 06:29:49 +01:00
parent d78ede95da
commit d28bf999ae
12 changed files with 517 additions and 8 deletions

View file

@ -87,8 +87,14 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk)
{ {
foreach (const QString &player, plyrsList) foreach (const QString &player, plyrsList)
{ {
plyrsStr.append(", "); QString playerName = profileDB->getPlayerName(player.toInt());
plyrsStr.append(profileDB->getPlayerName(player.toInt())); plyrsStr.append(", <a href=\"http://socialclub.rockstargames.com/member/");
plyrsStr.append(playerName);
plyrsStr.append("/");
plyrsStr.append(player);
plyrsStr.append("\">");
plyrsStr.append(playerName);
plyrsStr.append("</a>");
} }
plyrsStr.remove(0,2); plyrsStr.remove(0,2);
} }
@ -116,8 +122,21 @@ void PictureDialog::on_playerNameUpdated()
QString plyrsStr; QString plyrsStr;
foreach (const QString &player, plyrsList) foreach (const QString &player, plyrsList)
{ {
plyrsStr.append(", "); QString playerName = profileDB->getPlayerName(player.toInt());
plyrsStr.append(profileDB->getPlayerName(player.toInt())); plyrsStr.append(", <a href=\"http://socialclub.rockstargames.com/member/");
if (playerName != player)
{
plyrsStr.append(playerName);
}
else
{
plyrsStr.append("id");
}
plyrsStr.append("/");
plyrsStr.append(player);
plyrsStr.append("\">");
plyrsStr.append(playerName);
plyrsStr.append("</a>");
} }
plyrsStr.remove(0,2); plyrsStr.remove(0,2);
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID)); ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID));
@ -180,6 +199,7 @@ fileDialogPreSave:
{ {
QString saveFileFormat; QString saveFileFormat;
QString selectedFile = selectedFiles.at(0); QString selectedFile = selectedFiles.at(0);
if (selectedFile.right(4) == ".jpg") if (selectedFile.right(4) == ".jpg")
{ {
saveFileFormat = "JPEG"; saveFileFormat = "JPEG";

View file

@ -65,6 +65,9 @@
<property name="text"> <property name="text">
<string>&lt;span style=&quot; font-weight:600;&quot;&gt;Location: &lt;/span&gt;%1, %2, %3 &lt;br&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Players: &lt;/span&gt;%4&lt;br&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crew ID: &lt;/span&gt;%5</string> <string>&lt;span style=&quot; font-weight:600;&quot;&gt;Location: &lt;/span&gt;%1, %2, %3 &lt;br&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Players: &lt;/span&gt;%4&lt;br&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crew ID: &lt;/span&gt;%5</string>
</property> </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>

33
ProfileInterface.cpp Executable file
View file

@ -0,0 +1,33 @@
/*****************************************************************************
* 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 "ProfileInterface.h"
#include "ui_ProfileInterface.h"
ProfileInterface::ProfileInterface(QWidget *parent) :
QWidget(parent),
ui(new Ui::ProfileInterface)
{
ui->setupUi(this);
profileFolder = "";
}
ProfileInterface::~ProfileInterface()
{
delete ui;
}

41
ProfileInterface.h Executable file
View file

@ -0,0 +1,41 @@
/*****************************************************************************
* 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 PROFILEINTERFACE_H
#define PROFILEINTERFACE_H
#include <QWidget>
namespace Ui {
class ProfileInterface;
}
class ProfileInterface : public QWidget
{
Q_OBJECT
public:
explicit ProfileInterface(QWidget *parent = 0);
void setProfileFolder(QString folder);
~ProfileInterface();
private:
Ui::ProfileInterface *ui;
QString profileFolder;
};
#endif // PROFILEINTERFACE_H

80
ProfileInterface.ui Executable file
View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProfileInterface</class>
<widget class="QWidget" name="ProfileInterface">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Profile Interface</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QHBoxLayout" name="hlInformation">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="labInformation">
<property name="text">
<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>
</widget>
</item>
<item>
<spacer name="hsInformation">
<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>
<resources/>
<connections/>
</ui>

90
SyncFramework.cpp Executable file
View file

@ -0,0 +1,90 @@
/*****************************************************************************
* 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/>.
*****************************************************************************/
// DONT USE THE SYNC FRAMEWORK NOW
#ifndef QT5_MODE
#include "SyncFramework.h"
#include <QEventLoop>
#include <QFtp>
SyncFramework::SyncFramework(QObject *parent) : QObject(parent)
{
// INIT DEFAULT
serverPort = 21;
serverHostname = "";
serverUsername = "";
serverPassword = "";
serverSyncFolder = "gta5sync";
}
void SyncFramework::testServer()
{
QEventLoop ftpLoop;
QFtp *ftpConnection = new QFtp();
connect(ftpConnection, SIGNAL(done(bool)), &ftpLoop, SLOT(quit()));
ftpConnection->connectToHost(serverHostname, serverPort);
if (serverUsername != "")
{
ftpConnection->login(serverHostname, serverPassword);
}
else
{
ftpConnection->login();
}
ftpConnection->close();
ftpLoop.exec();
}
void SyncFramework::setPort(int port)
{
serverPort = port;
}
void SyncFramework::setHost(QString hostname)
{
serverHostname = hostname;
}
void SyncFramework::setUsername(QString username)
{
serverUsername = username;
}
void SyncFramework::setPassword(QString password)
{
serverPassword = password;
}
void SyncFramework::setSyncFolder(QString folder)
{
serverSyncFolder = folder;
}
void SyncFramework::fileDownloaded(bool isDone)
{
Q_UNUSED(isDone)
}
void SyncFramework::fileUploaded(bool isDone)
{
Q_UNUSED(isDone)
}
#endif

55
SyncFramework.h Executable file
View file

@ -0,0 +1,55 @@
/*****************************************************************************
* 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/>.
*****************************************************************************/
// DONT USE THE SYNC FRAMEWORK NOW
#ifndef QT5_MODE
#ifndef SYNCFRAMEWORK_H
#define SYNCFRAMEWORK_H
#include <QObject>
#include <QString>
class SyncFramework : public QObject
{
Q_OBJECT
public:
explicit SyncFramework(QObject *parent = 0);
void setPort(int port);
void setHost(QString hostname);
void setUsername(QString username);
void setPassword(QString password);
void setSyncFolder(QString folder);
void testServer();
private:
int serverPort;
QString serverHostname;
QString serverUsername;
QString serverPassword;
QString serverSyncFolder;
private slots:
void fileDownloaded(bool isDone);
void fileUploaded(bool isDone);
};
#endif
#endif // SYNCFRAMEWORK_H

41
UserInterface.cpp Executable file
View file

@ -0,0 +1,41 @@
/*****************************************************************************
* 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 "UserInterface.h"
#include "ui_UserInterface.h"
#include "ProfileInterface.h"
UserInterface::UserInterface(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::UserInterface)
{
ui->setupUi(this);
ProfileInterface *profile1 = new ProfileInterface();
ui->swProfile->addWidget(profile1);
ui->swProfile->setCurrentWidget(profile1);
}
UserInterface::~UserInterface()
{
delete ui;
}
void UserInterface::on_actionExit_triggered()
{
this->close();
}

42
UserInterface.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 USERINTERFACE_H
#define USERINTERFACE_H
#include <QMainWindow>
namespace Ui {
class UserInterface;
}
class UserInterface : public QMainWindow
{
Q_OBJECT
public:
explicit UserInterface(QWidget *parent = 0);
~UserInterface();
private slots:
void on_actionExit_triggered();
private:
Ui::UserInterface *ui;
};
#endif // USERINTERFACE_H

92
UserInterface.ui Executable file
View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UserInterface</class>
<widget class="QMainWindow" name="UserInterface">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Grand Theft Auto V Sync</string>
</property>
<widget class="QWidget" name="cwUI">
<layout class="QVBoxLayout" name="vlUI">
<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="QStackedWidget" name="swProfile">
<property name="lineWidth">
<number>0</number>
</property>
<widget class="QWidget" name="profileSelection"/>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionSelect_profile"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout_gta5sync"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuHelp"/>
</widget>
<action name="actionAbout_gta5sync">
<property name="text">
<string>About gta5sync</string>
</property>
<property name="shortcut">
<string>Ctrl+A</string>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionSelect_profile">
<property name="text">
<string>Select profile</string>
</property>
<property name="shortcut">
<string>Ctrl+P</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -32,7 +32,10 @@ SOURCES += main.cpp\
DatabaseThread.cpp \ DatabaseThread.cpp \
CrewDatabase.cpp \ CrewDatabase.cpp \
SavegameData.cpp \ SavegameData.cpp \
SavegameDialog.cpp SavegameDialog.cpp \
SyncFramework.cpp \
UserInterface.cpp \
ProfileInterface.cpp
HEADERS += \ HEADERS += \
SnapmaticPicture.h \ SnapmaticPicture.h \
@ -41,11 +44,16 @@ HEADERS += \
DatabaseThread.h \ DatabaseThread.h \
CrewDatabase.h \ CrewDatabase.h \
SavegameData.h \ SavegameData.h \
SavegameDialog.h SavegameDialog.h \
SyncFramework.h \
UserInterface.h \
ProfileInterface.h
FORMS += \ FORMS += \
PictureDialog.ui \ PictureDialog.ui \
SavegameDialog.ui SavegameDialog.ui \
UserInterface.ui \
ProfileInterface.ui
RESOURCES += RESOURCES +=

View file

@ -21,6 +21,7 @@
#include "DatabaseThread.h" #include "DatabaseThread.h"
#include "SavegameDialog.h" #include "SavegameDialog.h"
#include "PictureDialog.h" #include "PictureDialog.h"
#include "UserInterface.h"
#include "CrewDatabase.h" #include "CrewDatabase.h"
#include "SavegameData.h" #include "SavegameData.h"
#include <QApplication> #include <QApplication>
@ -125,5 +126,8 @@ int main(int argc, char *argv[])
return a.exec(); return a.exec();
} }
return 0; UserInterface *uiWindow = new UserInterface();
uiWindow->show();
return a.exec();
} }