From d28bf999ae2cea40eaacd93cdea781fcd1423b7d Mon Sep 17 00:00:00 2001 From: Rafael Date: Wed, 23 Mar 2016 06:29:49 +0100 Subject: [PATCH] first ui dev, open profiles in PictureDialog --- PictureDialog.cpp | 28 ++++++++++++-- PictureDialog.ui | 3 ++ ProfileInterface.cpp | 33 ++++++++++++++++ ProfileInterface.h | 41 ++++++++++++++++++++ ProfileInterface.ui | 80 ++++++++++++++++++++++++++++++++++++++ SyncFramework.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++ SyncFramework.h | 55 ++++++++++++++++++++++++++ UserInterface.cpp | 41 ++++++++++++++++++++ UserInterface.h | 42 ++++++++++++++++++++ UserInterface.ui | 92 ++++++++++++++++++++++++++++++++++++++++++++ gta5sync.pro | 14 +++++-- main.cpp | 6 ++- 12 files changed, 517 insertions(+), 8 deletions(-) create mode 100755 ProfileInterface.cpp create mode 100755 ProfileInterface.h create mode 100755 ProfileInterface.ui create mode 100755 SyncFramework.cpp create mode 100755 SyncFramework.h create mode 100755 UserInterface.cpp create mode 100755 UserInterface.h create mode 100755 UserInterface.ui diff --git a/PictureDialog.cpp b/PictureDialog.cpp index 6afec12..80fcb32 100755 --- a/PictureDialog.cpp +++ b/PictureDialog.cpp @@ -87,8 +87,14 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk) { foreach (const QString &player, plyrsList) { - plyrsStr.append(", "); - plyrsStr.append(profileDB->getPlayerName(player.toInt())); + QString playerName = profileDB->getPlayerName(player.toInt()); + plyrsStr.append(", "); + plyrsStr.append(playerName); + plyrsStr.append(""); } plyrsStr.remove(0,2); } @@ -116,8 +122,21 @@ void PictureDialog::on_playerNameUpdated() QString plyrsStr; foreach (const QString &player, plyrsList) { - plyrsStr.append(", "); - plyrsStr.append(profileDB->getPlayerName(player.toInt())); + QString playerName = profileDB->getPlayerName(player.toInt()); + plyrsStr.append(", "); + plyrsStr.append(playerName); + plyrsStr.append(""); } plyrsStr.remove(0,2); ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, plyrsStr, crewID)); @@ -180,6 +199,7 @@ fileDialogPreSave: { QString saveFileFormat; QString selectedFile = selectedFiles.at(0); + if (selectedFile.right(4) == ".jpg") { saveFileFormat = "JPEG"; diff --git a/PictureDialog.ui b/PictureDialog.ui index 00c96ea..4c80a8d 100755 --- a/PictureDialog.ui +++ b/PictureDialog.ui @@ -65,6 +65,9 @@ <span style=" font-weight:600;">Location: </span>%1, %2, %3 <br><span style=" font-weight:600;">Players: </span>%4<br><span style=" font-weight:600;">Crew ID: </span>%5 + + true + diff --git a/ProfileInterface.cpp b/ProfileInterface.cpp new file mode 100755 index 0000000..dd840df --- /dev/null +++ b/ProfileInterface.cpp @@ -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 . +*****************************************************************************/ + +#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; +} diff --git a/ProfileInterface.h b/ProfileInterface.h new file mode 100755 index 0000000..9bdafbf --- /dev/null +++ b/ProfileInterface.h @@ -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 . +*****************************************************************************/ + +#ifndef PROFILEINTERFACE_H +#define PROFILEINTERFACE_H + +#include + +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 diff --git a/ProfileInterface.ui b/ProfileInterface.ui new file mode 100755 index 0000000..4449ddb --- /dev/null +++ b/ProfileInterface.ui @@ -0,0 +1,80 @@ + + + ProfileInterface + + + + 0 + 0 + 400 + 300 + + + + Profile Interface + + + + + 10 + 110 + 400 + 300 + + + + + 6 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + <span style=" font-weight:600;">GTA V Snapmatic Picture:</span> PHOTO - 01/01/01 - 22:04:11 + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + View + + + + + + + Close Profile + + + + + + + + + diff --git a/SyncFramework.cpp b/SyncFramework.cpp new file mode 100755 index 0000000..2ebc211 --- /dev/null +++ b/SyncFramework.cpp @@ -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 . +*****************************************************************************/ + +// DONT USE THE SYNC FRAMEWORK NOW + +#ifndef QT5_MODE + +#include "SyncFramework.h" +#include +#include + +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 diff --git a/SyncFramework.h b/SyncFramework.h new file mode 100755 index 0000000..8314440 --- /dev/null +++ b/SyncFramework.h @@ -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 . +*****************************************************************************/ + +// DONT USE THE SYNC FRAMEWORK NOW + +#ifndef QT5_MODE + +#ifndef SYNCFRAMEWORK_H +#define SYNCFRAMEWORK_H + +#include +#include + +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 diff --git a/UserInterface.cpp b/UserInterface.cpp new file mode 100755 index 0000000..4b568b5 --- /dev/null +++ b/UserInterface.cpp @@ -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 . +*****************************************************************************/ + +#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(); +} diff --git a/UserInterface.h b/UserInterface.h new file mode 100755 index 0000000..6e7718c --- /dev/null +++ b/UserInterface.h @@ -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 . +*****************************************************************************/ + +#ifndef USERINTERFACE_H +#define USERINTERFACE_H + +#include + +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 diff --git a/UserInterface.ui b/UserInterface.ui new file mode 100755 index 0000000..39b7912 --- /dev/null +++ b/UserInterface.ui @@ -0,0 +1,92 @@ + + + UserInterface + + + + 0 + 0 + 800 + 600 + + + + Grand Theft Auto V Sync + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + + + + + + + 0 + 0 + 800 + 21 + + + + + File + + + + + + + Help + + + + + + + + + About gta5sync + + + Ctrl+A + + + + + Exit + + + Ctrl+Q + + + + + Select profile + + + Ctrl+P + + + + + + diff --git a/gta5sync.pro b/gta5sync.pro index 8c12db5..5af31fc 100755 --- a/gta5sync.pro +++ b/gta5sync.pro @@ -32,7 +32,10 @@ SOURCES += main.cpp\ DatabaseThread.cpp \ CrewDatabase.cpp \ SavegameData.cpp \ - SavegameDialog.cpp + SavegameDialog.cpp \ + SyncFramework.cpp \ + UserInterface.cpp \ + ProfileInterface.cpp HEADERS += \ SnapmaticPicture.h \ @@ -41,11 +44,16 @@ HEADERS += \ DatabaseThread.h \ CrewDatabase.h \ SavegameData.h \ - SavegameDialog.h + SavegameDialog.h \ + SyncFramework.h \ + UserInterface.h \ + ProfileInterface.h FORMS += \ PictureDialog.ui \ - SavegameDialog.ui + SavegameDialog.ui \ + UserInterface.ui \ + ProfileInterface.ui RESOURCES += diff --git a/main.cpp b/main.cpp index e555fd8..3586357 100755 --- a/main.cpp +++ b/main.cpp @@ -21,6 +21,7 @@ #include "DatabaseThread.h" #include "SavegameDialog.h" #include "PictureDialog.h" +#include "UserInterface.h" #include "CrewDatabase.h" #include "SavegameData.h" #include @@ -125,5 +126,8 @@ int main(int argc, char *argv[]) return a.exec(); } - return 0; + UserInterface *uiWindow = new UserInterface(); + uiWindow->show(); + + return a.exec(); }