threading issues fixed
This commit is contained in:
parent
a8501be581
commit
7591d805c9
13 changed files with 251 additions and 93 deletions
|
@ -42,6 +42,9 @@ void DatabaseThread::run()
|
||||||
QEventLoop threadLoop;
|
QEventLoop threadLoop;
|
||||||
QStringList crewList;
|
QStringList crewList;
|
||||||
|
|
||||||
|
// Register thread loop end signal
|
||||||
|
QObject::connect(this, SIGNAL(threadEndCommited()), &threadLoop, SLOT(quit()));
|
||||||
|
|
||||||
// Quick time scan
|
// Quick time scan
|
||||||
if (crewList.length() <= 3)
|
if (crewList.length() <= 3)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +61,7 @@ void DatabaseThread::run()
|
||||||
|
|
||||||
QEventLoop *waitingLoop = new QEventLoop();
|
QEventLoop *waitingLoop = new QEventLoop();
|
||||||
QTimer::singleShot(10000, waitingLoop, SLOT(quit()));
|
QTimer::singleShot(10000, waitingLoop, SLOT(quit()));
|
||||||
|
QObject::connect(this, SIGNAL(threadEndCommited()), waitingLoop, SLOT(quit()));
|
||||||
waitingLoop->exec();
|
waitingLoop->exec();
|
||||||
delete waitingLoop;
|
delete waitingLoop;
|
||||||
|
|
||||||
|
@ -70,16 +74,19 @@ void DatabaseThread::run()
|
||||||
scanCrewMembersList(crewList, crewMaxPages, 10000);
|
scanCrewMembersList(crewList, crewMaxPages, 10000);
|
||||||
emit playerNameUpdated();
|
emit playerNameUpdated();
|
||||||
|
|
||||||
|
if (threadRunning)
|
||||||
|
{
|
||||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||||
threadLoop.exec();
|
threadLoop.exec();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseThread::scanCrewReference(QStringList crewList, int requestDelay)
|
void DatabaseThread::scanCrewReference(QStringList crewList, int requestDelay)
|
||||||
{
|
{
|
||||||
foreach (const QString &crewID, crewList)
|
foreach (const QString &crewID, crewList)
|
||||||
{
|
{
|
||||||
if (crewID != "0")
|
if (threadRunning && crewID != "0")
|
||||||
{
|
{
|
||||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||||
|
|
||||||
|
@ -93,6 +100,7 @@ void DatabaseThread::scanCrewReference(QStringList crewList, int requestDelay)
|
||||||
|
|
||||||
QEventLoop *downloadLoop = new QEventLoop();
|
QEventLoop *downloadLoop = new QEventLoop();
|
||||||
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
||||||
|
QObject::connect(this, SIGNAL(threadEndCommited()), downloadLoop, SLOT(quit()));
|
||||||
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
||||||
downloadLoop->exec();
|
downloadLoop->exec();
|
||||||
delete downloadLoop;
|
delete downloadLoop;
|
||||||
|
@ -138,6 +146,7 @@ void DatabaseThread::scanCrewReference(QStringList crewList, int requestDelay)
|
||||||
|
|
||||||
QEventLoop *waitingLoop = new QEventLoop();
|
QEventLoop *waitingLoop = new QEventLoop();
|
||||||
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
||||||
|
QObject::connect(this, SIGNAL(threadEndCommited()), waitingLoop, SLOT(quit()));
|
||||||
waitingLoop->exec();
|
waitingLoop->exec();
|
||||||
delete waitingLoop;
|
delete waitingLoop;
|
||||||
|
|
||||||
|
@ -153,7 +162,7 @@ void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int
|
||||||
{
|
{
|
||||||
foreach (const QString &crewID, crewList)
|
foreach (const QString &crewID, crewList)
|
||||||
{
|
{
|
||||||
if (crewID != "0")
|
if (threadRunning && crewID != "0")
|
||||||
{
|
{
|
||||||
int currentPage = 0;
|
int currentPage = 0;
|
||||||
int foundPlayers = 0;
|
int foundPlayers = 0;
|
||||||
|
@ -173,6 +182,7 @@ void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int
|
||||||
|
|
||||||
QEventLoop *downloadLoop = new QEventLoop();
|
QEventLoop *downloadLoop = new QEventLoop();
|
||||||
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
||||||
|
QObject::connect(this, SIGNAL(threadEndCommited()), downloadLoop, SLOT(quit()));
|
||||||
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
||||||
downloadLoop->exec();
|
downloadLoop->exec();
|
||||||
delete downloadLoop;
|
delete downloadLoop;
|
||||||
|
@ -207,6 +217,7 @@ void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int
|
||||||
|
|
||||||
QEventLoop *waitingLoop = new QEventLoop();
|
QEventLoop *waitingLoop = new QEventLoop();
|
||||||
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
||||||
|
QObject::connect(this, SIGNAL(threadEndCommited()), waitingLoop, SLOT(quit()));
|
||||||
waitingLoop->exec();
|
waitingLoop->exec();
|
||||||
delete waitingLoop;
|
delete waitingLoop;
|
||||||
|
|
||||||
|
@ -221,3 +232,9 @@ void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseThread::doEndThread()
|
||||||
|
{
|
||||||
|
threadRunning = false;
|
||||||
|
emit threadEndCommited();
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@ class DatabaseThread : public QThread
|
||||||
public:
|
public:
|
||||||
explicit DatabaseThread(CrewDatabase *crewDB, QObject *parent = 0);
|
explicit DatabaseThread(CrewDatabase *crewDB, QObject *parent = 0);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void doEndThread();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CrewDatabase *crewDB;
|
CrewDatabase *crewDB;
|
||||||
void scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay);
|
void scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay);
|
||||||
|
@ -43,7 +46,7 @@ protected:
|
||||||
signals:
|
signals:
|
||||||
void playerNameFound(int playerID, QString playerName);
|
void playerNameFound(int playerID, QString playerName);
|
||||||
void playerNameUpdated();
|
void playerNameUpdated();
|
||||||
|
void threadEndCommited();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATABASETHREAD_H
|
#endif // DATABASETHREAD_H
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include <QPicture>
|
#include <QPicture>
|
||||||
#include <QBitmap>
|
#include <QBitmap>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
#include <QImage>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
|
@ -59,6 +60,34 @@
|
||||||
PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
|
PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
|
||||||
QDialog(parent), profileDB(profileDB), crewDB(crewDB),
|
QDialog(parent), profileDB(profileDB), crewDB(crewDB),
|
||||||
ui(new Ui::PictureDialog)
|
ui(new Ui::PictureDialog)
|
||||||
|
{
|
||||||
|
primaryWindow = false;
|
||||||
|
setupPictureDialog(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
PictureDialog::PictureDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::PictureDialog)
|
||||||
|
{
|
||||||
|
primaryWindow = false;
|
||||||
|
setupPictureDialog(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
PictureDialog::PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
|
||||||
|
QDialog(parent), primaryWindow(primaryWindow), profileDB(profileDB), crewDB(crewDB),
|
||||||
|
ui(new Ui::PictureDialog)
|
||||||
|
{
|
||||||
|
setupPictureDialog(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
PictureDialog::PictureDialog(bool primaryWindow, QWidget *parent) :
|
||||||
|
QDialog(parent), primaryWindow(primaryWindow),
|
||||||
|
ui(new Ui::PictureDialog)
|
||||||
|
{
|
||||||
|
setupPictureDialog(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PictureDialog::setupPictureDialog(bool withDatabase_)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
windowTitleStr = this->windowTitle();
|
windowTitleStr = this->windowTitle();
|
||||||
|
@ -66,9 +95,9 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
|
||||||
ui->cmdExport->setEnabled(0);
|
ui->cmdExport->setEnabled(0);
|
||||||
plyrsList = QStringList();
|
plyrsList = QStringList();
|
||||||
fullscreenWidget = 0;
|
fullscreenWidget = 0;
|
||||||
rqfullscreen = 0;
|
rqFullscreen = 0;
|
||||||
previewmode = 0;
|
previewMode = 0;
|
||||||
navienabled = 0;
|
naviEnabled = 0;
|
||||||
indexed = 0;
|
indexed = 0;
|
||||||
picArea = "";
|
picArea = "";
|
||||||
picTitl = "";
|
picTitl = "";
|
||||||
|
@ -80,6 +109,9 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
|
||||||
locZ = "";
|
locZ = "";
|
||||||
smpic = 0;
|
smpic = 0;
|
||||||
|
|
||||||
|
// With datebase
|
||||||
|
withDatabase = withDatabase_;
|
||||||
|
|
||||||
// Avatar area
|
// Avatar area
|
||||||
avatarAreaPicture = QImage(":/img/avatararea.png");
|
avatarAreaPicture = QImage(":/img/avatararea.png");
|
||||||
avatarLocX = 145;
|
avatarLocX = 145;
|
||||||
|
@ -88,7 +120,7 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
|
||||||
|
|
||||||
// Overlay area
|
// Overlay area
|
||||||
renderOverlayPicture();
|
renderOverlayPicture();
|
||||||
overlayenabled = 1;
|
overlayEnabled = 1;
|
||||||
|
|
||||||
// Export menu
|
// Export menu
|
||||||
exportMenu = new QMenu(this);
|
exportMenu = new QMenu(this);
|
||||||
|
@ -121,6 +153,15 @@ PictureDialog::~PictureDialog()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PictureDialog::closeEvent(QCloseEvent *ev)
|
||||||
|
{
|
||||||
|
Q_UNUSED(ev)
|
||||||
|
if (primaryWindow && withDatabase)
|
||||||
|
{
|
||||||
|
emit endDatabaseThread();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PictureDialog::addPreviousNextButtons()
|
void PictureDialog::addPreviousNextButtons()
|
||||||
{
|
{
|
||||||
// Windows Vista additions
|
// Windows Vista additions
|
||||||
|
@ -132,7 +173,7 @@ void PictureDialog::addPreviousNextButtons()
|
||||||
uiToolbar->addAction(QIcon(":/img/back.png"), "", this, SLOT(previousPictureRequestedSlot()));
|
uiToolbar->addAction(QIcon(":/img/back.png"), "", this, SLOT(previousPictureRequestedSlot()));
|
||||||
uiToolbar->addAction(QIcon(":/img/next.png"), "", this, SLOT(nextPictureRequestedSlot()));
|
uiToolbar->addAction(QIcon(":/img/next.png"), "", this, SLOT(nextPictureRequestedSlot()));
|
||||||
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
|
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
|
||||||
navienabled = true;
|
naviEnabled = true;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -142,7 +183,7 @@ void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
||||||
Q_UNUSED(newLabelSize)
|
Q_UNUSED(newLabelSize)
|
||||||
int newDialogHeight = ui->labPicture->pixmap()->height();
|
int newDialogHeight = ui->labPicture->pixmap()->height();
|
||||||
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
||||||
if (navienabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
||||||
setMinimumSize(width(), newDialogHeight);
|
setMinimumSize(width(), newDialogHeight);
|
||||||
setMaximumSize(width(), newDialogHeight);
|
setMaximumSize(width(), newDialogHeight);
|
||||||
setFixedHeight(newDialogHeight);
|
setFixedHeight(newDialogHeight);
|
||||||
|
@ -176,7 +217,7 @@ bool PictureDialog::event(QEvent *event)
|
||||||
{
|
{
|
||||||
#ifdef GTA5SYNC_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
if (navienabled)
|
if (naviEnabled)
|
||||||
{
|
{
|
||||||
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange)
|
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange)
|
||||||
{
|
{
|
||||||
|
@ -220,27 +261,27 @@ bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||||
returnValue = true;
|
returnValue = true;
|
||||||
break;
|
break;
|
||||||
case Qt::Key_1:
|
case Qt::Key_1:
|
||||||
if (previewmode)
|
if (previewMode)
|
||||||
{
|
{
|
||||||
previewmode = false;
|
previewMode = false;
|
||||||
renderPicture();
|
renderPicture();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
previewmode = true;
|
previewMode = true;
|
||||||
renderPicture();
|
renderPicture();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Qt::Key_2:
|
case Qt::Key_2:
|
||||||
if (overlayenabled)
|
if (overlayEnabled)
|
||||||
{
|
{
|
||||||
overlayenabled = false;
|
overlayEnabled = false;
|
||||||
if (!previewmode) renderPicture();
|
if (!previewMode) renderPicture();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
overlayenabled = true;
|
overlayEnabled = true;
|
||||||
if (!previewmode) renderPicture();
|
if (!previewMode) renderPicture();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if QT_VERSION >= 0x050300
|
#if QT_VERSION >= 0x050300
|
||||||
|
@ -253,6 +294,10 @@ bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||||
on_labPicture_mouseDoubleClicked(Qt::LeftButton);
|
on_labPicture_mouseDoubleClicked(Qt::LeftButton);
|
||||||
returnValue = true;
|
returnValue = true;
|
||||||
break;
|
break;
|
||||||
|
case Qt::Key_Escape:
|
||||||
|
ui->cmdClose->click();
|
||||||
|
returnValue = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +311,7 @@ void PictureDialog::triggerFullscreenDoubeClick()
|
||||||
|
|
||||||
void PictureDialog::exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen)
|
void PictureDialog::exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen)
|
||||||
{
|
{
|
||||||
rqfullscreen = fullscreen;
|
rqFullscreen = fullscreen;
|
||||||
exportMenu->popup(pos);
|
exportMenu->popup(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,10 +340,10 @@ void PictureDialog::renderOverlayPicture()
|
||||||
// Generating Overlay Preview
|
// Generating Overlay Preview
|
||||||
QRect preferedRect = QRect(0, 0, 200, 160);
|
QRect preferedRect = QRect(0, 0, 200, 160);
|
||||||
QString overlayText = tr("Key 1 - Avatar Preview Mode\nKey 2 - Toggle Overlay\nArrow Keys - Navigate");
|
QString overlayText = tr("Key 1 - Avatar Preview Mode\nKey 2 - Toggle Overlay\nArrow Keys - Navigate");
|
||||||
QPixmap overlayPixmap(1, 1);
|
QImage overlayImage(1, 1, QImage::Format_ARGB32_Premultiplied);
|
||||||
overlayPixmap.fill(Qt::transparent);
|
overlayImage.fill(Qt::transparent);
|
||||||
|
|
||||||
QPainter overlayPainter(&overlayPixmap);
|
QPainter overlayPainter(&overlayImage);
|
||||||
QFont overlayPainterFont;
|
QFont overlayPainterFont;
|
||||||
overlayPainterFont.setPixelSize(12);
|
overlayPainterFont.setPixelSize(12);
|
||||||
overlayPainter.setFont(overlayPainterFont);
|
overlayPainter.setFont(overlayPainterFont);
|
||||||
|
@ -317,8 +362,8 @@ void PictureDialog::renderOverlayPicture()
|
||||||
overlaySpace.setHeight(overlaySpace.height() + 6);
|
overlaySpace.setHeight(overlaySpace.height() + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
overlayPixmap = overlayPixmap.scaled(overlaySpace.size());
|
overlayImage = overlayImage.scaled(overlaySpace.size());
|
||||||
overlayPainter.begin(&overlayPixmap);
|
overlayPainter.begin(&overlayImage);
|
||||||
overlayPainter.setPen(QColor::fromRgb(255, 255, 255, 255));
|
overlayPainter.setPen(QColor::fromRgb(255, 255, 255, 255));
|
||||||
overlayPainter.setFont(overlayPainterFont);
|
overlayPainter.setFont(overlayPainterFont);
|
||||||
overlayPainter.drawText(preferedRect, Qt::AlignLeft | hOverlay | Qt::TextDontClip | Qt::TextWordWrap, overlayText);
|
overlayPainter.drawText(preferedRect, Qt::AlignLeft | hOverlay | Qt::TextDontClip | Qt::TextWordWrap, overlayText);
|
||||||
|
@ -333,16 +378,15 @@ void PictureDialog::renderOverlayPicture()
|
||||||
overlaySpace.setWidth(overlaySpace.width() + 6);
|
overlaySpace.setWidth(overlaySpace.width() + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap overlayBorderImage(overlaySpace.width(), overlaySpace.height());
|
QImage overlayBorderImage(overlaySpace.width(), overlaySpace.height(), QImage::Format_ARGB6666_Premultiplied);
|
||||||
overlayBorderImage.fill(QColor(15, 15, 15, 162));
|
overlayBorderImage.fill(QColor(15, 15, 15, 162));
|
||||||
|
|
||||||
QPixmap overlayTempPixmap(overlaySpace.size());
|
overlayTempImage = QImage(overlaySpace.width(), overlaySpace.height(), QImage::Format_ARGB6666_Premultiplied);
|
||||||
overlayTempPixmap.fill(Qt::transparent);
|
overlayTempImage.fill(Qt::transparent);
|
||||||
QPainter overlayTempPainter(&overlayTempPixmap);
|
QPainter overlayTempPainter(&overlayTempImage);
|
||||||
overlayTempPainter.drawPixmap(0, 0, overlayBorderImage);
|
overlayTempPainter.drawImage(0, 0, overlayBorderImage);
|
||||||
overlayTempPainter.drawPixmap(3, 3, overlayPixmap);
|
overlayTempPainter.drawImage(3, 3, overlayImage);
|
||||||
overlayTempPainter.end();
|
overlayTempPainter.end();
|
||||||
overlayTempImage = overlayTempPixmap.toImage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool _indexed, int _index)
|
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool _indexed, int _index)
|
||||||
|
@ -368,7 +412,14 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk,
|
||||||
locX = QString::number(picture->getSnapmaticProperties().location.x);
|
locX = QString::number(picture->getSnapmaticProperties().location.x);
|
||||||
locY = QString::number(picture->getSnapmaticProperties().location.y);
|
locY = QString::number(picture->getSnapmaticProperties().location.y);
|
||||||
locZ = QString::number(picture->getSnapmaticProperties().location.z);
|
locZ = QString::number(picture->getSnapmaticProperties().location.z);
|
||||||
|
if (withDatabase)
|
||||||
|
{
|
||||||
crewID = crewDB->getCrewName(picture->getSnapmaticProperties().crewID);
|
crewID = crewDB->getCrewName(picture->getSnapmaticProperties().crewID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
crewID = QString::number(picture->getSnapmaticProperties().crewID);
|
||||||
|
}
|
||||||
created = picture->getSnapmaticProperties().createdDateTime.toString(Qt::DefaultLocaleShortDate);
|
created = picture->getSnapmaticProperties().createdDateTime.toString(Qt::DefaultLocaleShortDate);
|
||||||
plyrsList = picture->getSnapmaticProperties().playersList;
|
plyrsList = picture->getSnapmaticProperties().playersList;
|
||||||
picTitl = picture->getPictureTitl();
|
picTitl = picture->getPictureTitl();
|
||||||
|
@ -387,7 +438,15 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk,
|
||||||
{
|
{
|
||||||
foreach (const QString &player, plyrsList)
|
foreach (const QString &player, plyrsList)
|
||||||
{
|
{
|
||||||
QString playerName = profileDB->getPlayerName(player.toInt());
|
QString playerName;
|
||||||
|
if (withDatabase)
|
||||||
|
{
|
||||||
|
playerName = profileDB->getPlayerName(player.toInt());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playerName = player;
|
||||||
|
}
|
||||||
plyrsStr.append(", <a href=\"https://socialclub.rockstargames.com/member/");
|
plyrsStr.append(", <a href=\"https://socialclub.rockstargames.com/member/");
|
||||||
plyrsStr.append(playerName);
|
plyrsStr.append(playerName);
|
||||||
plyrsStr.append("/");
|
plyrsStr.append("/");
|
||||||
|
@ -438,9 +497,9 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
|
|
||||||
void PictureDialog::renderPicture()
|
void PictureDialog::renderPicture()
|
||||||
{
|
{
|
||||||
if (!previewmode)
|
if (!previewMode)
|
||||||
{
|
{
|
||||||
if (overlayenabled)
|
if (overlayEnabled)
|
||||||
{
|
{
|
||||||
QPixmap overlayAreaPixmap(960, 536);
|
QPixmap overlayAreaPixmap(960, 536);
|
||||||
overlayAreaPixmap.fill(Qt::transparent);
|
overlayAreaPixmap.fill(Qt::transparent);
|
||||||
|
@ -479,7 +538,15 @@ void PictureDialog::playerNameUpdated()
|
||||||
QString plyrsStr;
|
QString plyrsStr;
|
||||||
foreach (const QString &player, plyrsList)
|
foreach (const QString &player, plyrsList)
|
||||||
{
|
{
|
||||||
QString playerName = profileDB->getPlayerName(player.toInt());
|
QString playerName;
|
||||||
|
if (withDatabase)
|
||||||
|
{
|
||||||
|
playerName = profileDB->getPlayerName(player.toInt());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playerName = player;
|
||||||
|
}
|
||||||
plyrsStr.append(", <a href=\"https://socialclub.rockstargames.com/member/");
|
plyrsStr.append(", <a href=\"https://socialclub.rockstargames.com/member/");
|
||||||
if (playerName != player)
|
if (playerName != player)
|
||||||
{
|
{
|
||||||
|
@ -502,7 +569,7 @@ void PictureDialog::playerNameUpdated()
|
||||||
|
|
||||||
void PictureDialog::exportSnapmaticPicture()
|
void PictureDialog::exportSnapmaticPicture()
|
||||||
{
|
{
|
||||||
if (rqfullscreen && fullscreenWidget)
|
if (rqFullscreen && fullscreenWidget)
|
||||||
{
|
{
|
||||||
PictureExport::exportAsPicture(fullscreenWidget, smpic);
|
PictureExport::exportAsPicture(fullscreenWidget, smpic);
|
||||||
}
|
}
|
||||||
|
@ -514,7 +581,7 @@ void PictureDialog::exportSnapmaticPicture()
|
||||||
|
|
||||||
void PictureDialog::copySnapmaticPicture()
|
void PictureDialog::copySnapmaticPicture()
|
||||||
{
|
{
|
||||||
if (rqfullscreen && fullscreenWidget)
|
if (rqFullscreen && fullscreenWidget)
|
||||||
{
|
{
|
||||||
PictureExport::exportAsSnapmatic(fullscreenWidget, smpic);
|
PictureExport::exportAsSnapmatic(fullscreenWidget, smpic);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,10 @@ class PictureDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
||||||
|
explicit PictureDialog(QWidget *parent = 0);
|
||||||
|
explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
||||||
|
explicit PictureDialog(bool primaryWindow, QWidget *parent = 0);
|
||||||
|
void setupPictureDialog(bool withDatabase);
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool indexed, int index);
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool indexed, int index);
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index);
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index);
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
||||||
|
@ -70,8 +74,10 @@ signals:
|
||||||
void nextPictureRequested();
|
void nextPictureRequested();
|
||||||
void previousPictureRequested();
|
void previousPictureRequested();
|
||||||
void newPictureCommited(QImage picture);
|
void newPictureCommited(QImage picture);
|
||||||
|
void endDatabaseThread();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void closeEvent(QCloseEvent *ev);
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
void mousePressEvent(QMouseEvent *ev);
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
bool event(QEvent *event);
|
bool event(QEvent *event);
|
||||||
|
@ -100,10 +106,12 @@ private:
|
||||||
QString locX;
|
QString locX;
|
||||||
QString locY;
|
QString locY;
|
||||||
QString locZ;
|
QString locZ;
|
||||||
bool overlayenabled;
|
bool overlayEnabled;
|
||||||
bool rqfullscreen;
|
bool primaryWindow;
|
||||||
bool navienabled;
|
bool withDatabase;
|
||||||
bool previewmode;
|
bool rqFullscreen;
|
||||||
|
bool naviEnabled;
|
||||||
|
bool previewMode;
|
||||||
bool indexed;
|
bool indexed;
|
||||||
int index;
|
int index;
|
||||||
int avatarLocX;
|
int avatarLocX;
|
||||||
|
|
|
@ -73,7 +73,7 @@ void ProfileLoader::run()
|
||||||
emit loadingProgress(curFile, maximumV);
|
emit loadingProgress(curFile, maximumV);
|
||||||
QString picturePath = profileFolder + QDir::separator() + SnapmaticPic;
|
QString picturePath = profileFolder + QDir::separator() + SnapmaticPic;
|
||||||
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
|
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
|
||||||
if (picture->readingPicture())
|
if (picture->readingPicture(true, true, true))
|
||||||
{
|
{
|
||||||
emit pictureLoaded(picture);
|
emit pictureLoaded(picture);
|
||||||
int crewNumber = picture->getSnapmaticProperties().crewID;
|
int crewNumber = picture->getSnapmaticProperties().crewID;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QPainter>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -51,6 +52,9 @@ SnapmaticPicture::SnapmaticPicture(const QString &fileName, QObject *parent) : Q
|
||||||
titlStreamCharacterMax = 39;
|
titlStreamCharacterMax = 39;
|
||||||
rawPicContent = "";
|
rawPicContent = "";
|
||||||
|
|
||||||
|
// PREDEFINED PROPERTIES
|
||||||
|
snapmaticResolution = QSize(960, 536);
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +68,7 @@ void SnapmaticPicture::reset()
|
||||||
rawPicContent = "";
|
rawPicContent = "";
|
||||||
|
|
||||||
// INIT PIC
|
// INIT PIC
|
||||||
cachePicture = QImage(0, 0, QImage::Format_RGB32);
|
cachePicture = QImage(0, 0, QImage::Format_RGB888);
|
||||||
jpegRawContentSize = 0;
|
jpegRawContentSize = 0;
|
||||||
picExportFileName = "";
|
picExportFileName = "";
|
||||||
isCustomFormat = 0;
|
isCustomFormat = 0;
|
||||||
|
@ -79,9 +83,12 @@ void SnapmaticPicture::reset()
|
||||||
// INIT JSON
|
// INIT JSON
|
||||||
jsonOk = 0;
|
jsonOk = 0;
|
||||||
jsonStr = "";
|
jsonStr = "";
|
||||||
|
|
||||||
|
// SNAPMATIC PROPERTIES
|
||||||
|
localSpJson = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapmaticPicture::readingPicture(bool writeEnabled_, bool cacheEnabled_)
|
bool SnapmaticPicture::readingPicture(bool writeEnabled_, bool cacheEnabled_, bool fastLoad)
|
||||||
{
|
{
|
||||||
// Start opening file
|
// Start opening file
|
||||||
// lastStep is like currentStep
|
// lastStep is like currentStep
|
||||||
|
@ -239,6 +246,21 @@ bool SnapmaticPicture::readingPicture(bool writeEnabled_, bool cacheEnabled_)
|
||||||
QImage tempPicture;
|
QImage tempPicture;
|
||||||
picOk = tempPicture.loadFromData(jpegRawContent, "JPEG");
|
picOk = tempPicture.loadFromData(jpegRawContent, "JPEG");
|
||||||
}
|
}
|
||||||
|
else if (!fastLoad)
|
||||||
|
{
|
||||||
|
QImage tempPicture = QImage(snapmaticResolution, QImage::Format_RGB888);
|
||||||
|
QPainter tempPainter(&tempPicture);
|
||||||
|
if (cachePicture.size() == snapmaticResolution)
|
||||||
|
{
|
||||||
|
tempPainter.drawImage(0, 0, cachePicture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempPainter.drawImage(0, 0, cachePicture.scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
|
}
|
||||||
|
tempPainter.end();
|
||||||
|
cachePicture = tempPicture;
|
||||||
|
}
|
||||||
|
|
||||||
// Read JSON Stream
|
// Read JSON Stream
|
||||||
if (!picStream->isReadable())
|
if (!picStream->isReadable())
|
||||||
|
@ -351,12 +373,12 @@ void SnapmaticPicture::updateStrings()
|
||||||
picExportFileName = sortStr + "_" + cmpPicTitl;
|
picExportFileName = sortStr + "_" + cmpPicTitl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapmaticPicture::readingPictureFromFile(const QString &fileName, bool writeEnabled_, bool cacheEnabled_)
|
bool SnapmaticPicture::readingPictureFromFile(const QString &fileName, bool writeEnabled_, bool cacheEnabled_, bool fastLoad)
|
||||||
{
|
{
|
||||||
if (fileName != "")
|
if (fileName != "")
|
||||||
{
|
{
|
||||||
picFilePath = fileName;
|
picFilePath = fileName;
|
||||||
return readingPicture(writeEnabled_, cacheEnabled_);
|
return readingPicture(writeEnabled_, cacheEnabled_, fastLoad);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -561,19 +583,30 @@ QImage SnapmaticPicture::getImage()
|
||||||
else if (writeEnabled)
|
else if (writeEnabled)
|
||||||
{
|
{
|
||||||
bool returnOk = 0;
|
bool returnOk = 0;
|
||||||
QImage returnPicture;
|
QImage tempPicture;
|
||||||
|
QImage returnPicture(snapmaticResolution, QImage::Format_RGB888);
|
||||||
|
|
||||||
QBuffer snapmaticStream(&rawPicContent);
|
QBuffer snapmaticStream(&rawPicContent);
|
||||||
snapmaticStream.open(QIODevice::ReadOnly);
|
snapmaticStream.open(QIODevice::ReadOnly);
|
||||||
if (snapmaticStream.seek(jpegStreamEditorBegin))
|
if (snapmaticStream.seek(jpegStreamEditorBegin))
|
||||||
{
|
{
|
||||||
QByteArray jpegRawContent = snapmaticStream.read(jpegPicStreamLength);
|
QByteArray jpegRawContent = snapmaticStream.read(jpegPicStreamLength);
|
||||||
returnOk = returnPicture.loadFromData(jpegRawContent, "JPEG");
|
returnOk = tempPicture.loadFromData(jpegRawContent, "JPEG");
|
||||||
}
|
}
|
||||||
snapmaticStream.close();
|
snapmaticStream.close();
|
||||||
|
|
||||||
if (returnOk)
|
if (returnOk)
|
||||||
{
|
{
|
||||||
|
QPainter returnPainter(&returnPicture);
|
||||||
|
if (tempPicture.size() == snapmaticResolution)
|
||||||
|
{
|
||||||
|
returnPainter.drawImage(0, 0, tempPicture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnPainter.drawImage(0, 0, tempPicture.scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
|
}
|
||||||
|
returnPainter.end();
|
||||||
return returnPicture;
|
return returnPicture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,7 +622,7 @@ QImage SnapmaticPicture::getImage()
|
||||||
lastStep = "1;/1,OpenFile," + StringParser::convertDrawStringForLog(picFilePath);
|
lastStep = "1;/1,OpenFile," + StringParser::convertDrawStringForLog(picFilePath);
|
||||||
picFile->deleteLater();
|
picFile->deleteLater();
|
||||||
delete picFile;
|
delete picFile;
|
||||||
return QImage(0, 0, QImage::Format_RGB32);
|
return QImage(0, 0, QImage::Format_RGB888);
|
||||||
}
|
}
|
||||||
rawPicContent = picFile->read(snapmaticFileMaxSize);
|
rawPicContent = picFile->read(snapmaticFileMaxSize);
|
||||||
picFile->close();
|
picFile->close();
|
||||||
|
@ -610,7 +643,7 @@ QImage SnapmaticPicture::getImage()
|
||||||
return returnPicture;
|
return returnPicture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QImage(0, 0, QImage::Format_RGB32);
|
return QImage(0, 0, QImage::Format_RGB888);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SnapmaticPicture::getContentMaxLength()
|
int SnapmaticPicture::getContentMaxLength()
|
||||||
|
@ -636,7 +669,7 @@ void SnapmaticPicture::setPicFilePath(QString picFilePath_)
|
||||||
void SnapmaticPicture::clearCache()
|
void SnapmaticPicture::clearCache()
|
||||||
{
|
{
|
||||||
cacheEnabled = false;
|
cacheEnabled = false;
|
||||||
cachePicture = QImage(0, 0, QImage::Format_RGB32);
|
cachePicture = QImage(0, 0, QImage::Format_RGB888);
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON part
|
// JSON part
|
||||||
|
@ -827,3 +860,10 @@ bool SnapmaticPicture::setPictureVisible()
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PREDEFINED PROPERTIES
|
||||||
|
|
||||||
|
QSize SnapmaticPicture::getSnapmaticResolution()
|
||||||
|
{
|
||||||
|
return snapmaticResolution;
|
||||||
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ public:
|
||||||
explicit SnapmaticPicture(const QString &fileName = "", QObject *parent = 0);
|
explicit SnapmaticPicture(const QString &fileName = "", QObject *parent = 0);
|
||||||
~SnapmaticPicture();
|
~SnapmaticPicture();
|
||||||
void reset();
|
void reset();
|
||||||
bool readingPictureFromFile(const QString &fileName, bool writeEnabled = true, bool cacheEnabled = false);
|
bool readingPictureFromFile(const QString &fileName, bool writeEnabled = true, bool cacheEnabled = false, bool fastLoad = false);
|
||||||
bool readingPicture(bool writeEnabled = true, bool cacheEnabled = true);
|
bool readingPicture(bool writeEnabled = true, bool cacheEnabled = true, bool fastLoad = false);
|
||||||
bool isPicOk();
|
bool isPicOk();
|
||||||
void clearCache();
|
void clearCache();
|
||||||
QImage getImage();
|
QImage getImage();
|
||||||
|
@ -93,6 +93,9 @@ public:
|
||||||
bool setPictureHidden();
|
bool setPictureHidden();
|
||||||
bool setPictureVisible();
|
bool setPictureVisible();
|
||||||
|
|
||||||
|
// PREDEFINED PROPERTIES
|
||||||
|
QSize getSnapmaticResolution();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getSnapmaticHeaderString(const QByteArray &snapmaticHeader);
|
QString getSnapmaticHeaderString(const QByteArray &snapmaticHeader);
|
||||||
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
||||||
|
@ -132,6 +135,9 @@ private:
|
||||||
int titlStreamCharacterMax;
|
int titlStreamCharacterMax;
|
||||||
QByteArray rawPicContent;
|
QByteArray rawPicContent;
|
||||||
|
|
||||||
|
// PREDEFINED PROPERTIES
|
||||||
|
QSize snapmaticResolution;
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
void parseJsonContent();
|
void parseJsonContent();
|
||||||
bool jsonOk;
|
bool jsonOk;
|
||||||
|
|
|
@ -85,7 +85,7 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
picTitl = picture->getPictureTitl();
|
picTitl = picture->getPictureTitl();
|
||||||
picStr = picture->getPictureStr();
|
picStr = picture->getPictureStr();
|
||||||
|
|
||||||
QPixmap SnapmaticPixmap = QPixmap::fromImage(picture->getImage().scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
QPixmap SnapmaticPixmap = QPixmap::fromImage(picture->getImage().scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
||||||
ui->labPicStr->setText(picStr + "\n" + picTitl + "");
|
ui->labPicStr->setText(picStr + "\n" + picTitl + "");
|
||||||
ui->labPicture->setPixmap(SnapmaticPixmap);
|
ui->labPicture->setPixmap(SnapmaticPixmap);
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,12 @@ void UserInterface::closeProfile()
|
||||||
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserInterface::closeEvent(QCloseEvent *ev)
|
||||||
|
{
|
||||||
|
Q_UNUSED(ev)
|
||||||
|
threadDB->doEndThread();
|
||||||
|
}
|
||||||
|
|
||||||
UserInterface::~UserInterface()
|
UserInterface::~UserInterface()
|
||||||
{
|
{
|
||||||
foreach (QPushButton *profileBtn, profileBtns)
|
foreach (QPushButton *profileBtn, profileBtns)
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QCloseEvent>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
|
@ -62,6 +63,9 @@ private slots:
|
||||||
void on_action_Disable_In_game_triggered();
|
void on_action_Disable_In_game_triggered();
|
||||||
void settingsApplied(int contentMode, QString language);
|
void settingsApplied(int contentMode, QString language);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent *ev);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProfileDatabase *profileDB;
|
ProfileDatabase *profileDB;
|
||||||
CrewDatabase *crewDB;
|
CrewDatabase *crewDB;
|
||||||
|
|
2
config.h
2
config.h
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
#ifndef GTA5SYNC_APPVER
|
#ifndef GTA5SYNC_APPVER
|
||||||
#ifndef GTA5SYNC_DAILYB
|
#ifndef GTA5SYNC_DAILYB
|
||||||
#define GTA5SYNC_APPVER "1.3.1"
|
#define GTA5SYNC_APPVER "1.3.2"
|
||||||
#else
|
#else
|
||||||
#define GTA5SYNC_APPVER QString("%1").arg(GTA5SYNC_DAILYB)
|
#define GTA5SYNC_APPVER QString("%1").arg(GTA5SYNC_DAILYB)
|
||||||
#endif
|
#endif
|
||||||
|
|
67
main.cpp
67
main.cpp
|
@ -425,60 +425,67 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (selectedAction == "showpic")
|
if (selectedAction == "showpic")
|
||||||
{
|
{
|
||||||
CrewDatabase *crewDB = new CrewDatabase();
|
CrewDatabase crewDB;
|
||||||
ProfileDatabase *profileDB = new ProfileDatabase();
|
ProfileDatabase profileDB;
|
||||||
DatabaseThread *threadDB = new DatabaseThread(crewDB);
|
DatabaseThread threadDB(&crewDB);
|
||||||
PictureDialog *picDialog = new PictureDialog(profileDB, crewDB);
|
PictureDialog picDialog(true, &profileDB, &crewDB);
|
||||||
SnapmaticPicture picture;
|
SnapmaticPicture picture;
|
||||||
|
|
||||||
bool readOk = picture.readingPictureFromFile(arg1);
|
bool readOk = picture.readingPictureFromFile(arg1);
|
||||||
picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
picDialog->setWindowIcon(IconLoader::loadingAppIcon());
|
picDialog.setWindowIcon(IconLoader::loadingAppIcon());
|
||||||
picDialog->setSnapmaticPicture(&picture, readOk);
|
picDialog.setSnapmaticPicture(&picture, readOk);
|
||||||
|
|
||||||
int crewID = picture.getSnapmaticProperties().crewID;
|
int crewID = picture.getSnapmaticProperties().crewID;
|
||||||
if (crewID != 0) { crewDB->addCrew(crewID); }
|
if (crewID != 0) { crewDB.addCrew(crewID); }
|
||||||
if (!readOk) { return 1; }
|
if (!readOk) { return 1; }
|
||||||
|
|
||||||
QObject::connect(threadDB, SIGNAL(playerNameFound(int, QString)), profileDB, SLOT(setPlayerName(int, QString)));
|
QEventLoop threadLoop;
|
||||||
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), picDialog, SLOT(playerNameUpdated()));
|
QObject::connect(&threadDB, SIGNAL(playerNameFound(int, QString)), &profileDB, SLOT(setPlayerName(int, QString)));
|
||||||
threadDB->start();
|
QObject::connect(&threadDB, SIGNAL(playerNameUpdated()), &picDialog, SLOT(playerNameUpdated()));
|
||||||
|
QObject::connect(&threadDB, SIGNAL(finished()), &threadLoop, SLOT(quit()));
|
||||||
|
QObject::connect(&picDialog, SIGNAL(endDatabaseThread()), &threadDB, SLOT(doEndThread()));
|
||||||
|
threadDB.start();
|
||||||
|
|
||||||
picDialog->show();
|
picDialog.show();
|
||||||
picDialog->setMinimumSize(picDialog->size());
|
|
||||||
picDialog->setMaximumSize(picDialog->size());
|
|
||||||
|
|
||||||
return a.exec();
|
threadLoop.exec();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else if (selectedAction == "showsgd")
|
else if (selectedAction == "showsgd")
|
||||||
{
|
{
|
||||||
SavegameDialog *savegameDialog = new SavegameDialog();
|
SavegameDialog savegameDialog;
|
||||||
SavegameData savegame;
|
SavegameData savegame;
|
||||||
|
|
||||||
bool readOk = savegame.readingSavegameFromFile(arg1);
|
bool readOk = savegame.readingSavegameFromFile(arg1);
|
||||||
savegameDialog->setWindowFlags(savegameDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
savegameDialog.setWindowFlags(savegameDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
savegameDialog->setWindowIcon(IconLoader::loadingAppIcon());
|
savegameDialog.setWindowIcon(IconLoader::loadingAppIcon());
|
||||||
savegameDialog->setSavegameData(&savegame, arg1, readOk);
|
savegameDialog.setSavegameData(&savegame, arg1, readOk);
|
||||||
|
|
||||||
if (!readOk) { return 1; }
|
if (!readOk) { return 1; }
|
||||||
|
|
||||||
savegameDialog->show();
|
savegameDialog.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
CrewDatabase *crewDB = new CrewDatabase();
|
CrewDatabase crewDB;
|
||||||
ProfileDatabase *profileDB = new ProfileDatabase();
|
ProfileDatabase profileDB;
|
||||||
DatabaseThread *threadDB = new DatabaseThread(crewDB);
|
DatabaseThread threadDB(&crewDB);
|
||||||
|
|
||||||
QObject::connect(threadDB, SIGNAL(playerNameFound(int, QString)), profileDB, SLOT(setPlayerName(int, QString)));
|
QEventLoop threadLoop;
|
||||||
threadDB->start();
|
QObject::connect(&threadDB, SIGNAL(playerNameFound(int, QString)), &profileDB, SLOT(setPlayerName(int, QString)));
|
||||||
|
QObject::connect(&threadDB, SIGNAL(finished()), &threadLoop, SLOT(quit()));
|
||||||
|
threadDB.start();
|
||||||
|
|
||||||
UserInterface *uiWindow = new UserInterface(profileDB, crewDB, threadDB);
|
UserInterface uiWindow(&profileDB, &crewDB, &threadDB);
|
||||||
uiWindow->setWindowIcon(IconLoader::loadingAppIcon());
|
uiWindow.setWindowIcon(IconLoader::loadingAppIcon());
|
||||||
uiWindow->setupDirEnv();
|
uiWindow.setupDirEnv();
|
||||||
uiWindow->show();
|
uiWindow.show();
|
||||||
|
|
||||||
return a.exec();
|
threadLoop.exec();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1, 3, 0, 0
|
FILEVERSION 1, 3, 2, 0
|
||||||
PRODUCTVERSION 1, 3, 0, 0
|
PRODUCTVERSION 1, 3, 2, 0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
FILEFLAGS 0
|
FILEFLAGS 0
|
||||||
FILEOS VOS_NT_WINDOWS32
|
FILEOS VOS_NT_WINDOWS32
|
||||||
|
@ -25,12 +25,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Syping"
|
VALUE "CompanyName", "Syping"
|
||||||
VALUE "FileDescription", "gta5view\0"
|
VALUE "FileDescription", "gta5view\0"
|
||||||
VALUE "FileVersion", "1.3.0\0"
|
VALUE "FileVersion", "1.3.2\0"
|
||||||
VALUE "InternalName", "gta5view\0"
|
VALUE "InternalName", "gta5view\0"
|
||||||
VALUE "LegalCopyright", "Copyright © 2016-2017 Syping\0"
|
VALUE "LegalCopyright", "Copyright © 2016-2017 Syping\0"
|
||||||
VALUE "OriginalFilename", "gta5view.exe\0"
|
VALUE "OriginalFilename", "gta5view.exe\0"
|
||||||
VALUE "ProductName", "gta5view\0"
|
VALUE "ProductName", "gta5view\0"
|
||||||
VALUE "ProductVersion", "1.3.0\0"
|
VALUE "ProductVersion", "1.3.2\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
Loading…
Reference in a new issue