Compare commits
No commits in common. "master" and "0.2.0" have entirely different histories.
53 changed files with 3135 additions and 3643 deletions
18
AppEnv.cpp
18
AppEnv.cpp
|
@ -22,17 +22,13 @@
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -157,7 +153,7 @@ QString AppEnv::getPluginsFolder()
|
||||||
QByteArray AppEnv::getUserAgent()
|
QByteArray AppEnv::getUserAgent()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050400
|
#if QT_VERSION >= 0x050400
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
QString kernelVersion = QSysInfo::kernelVersion();
|
QString kernelVersion = QSysInfo::kernelVersion();
|
||||||
const QStringList &kernelVersionList = kernelVersion.split(".");
|
const QStringList &kernelVersionList = kernelVersion.split(".");
|
||||||
if (kernelVersionList.length() > 2)
|
if (kernelVersionList.length() > 2)
|
||||||
|
@ -214,7 +210,7 @@ QUrl AppEnv::getPlayerFetchingUrl(QString crewID, int pageNumber)
|
||||||
|
|
||||||
GameVersion AppEnv::getGameVersion()
|
GameVersion AppEnv::getGameVersion()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
QString argumentValue;
|
QString argumentValue;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
argumentValue = "\\WOW6432Node";
|
argumentValue = "\\WOW6432Node";
|
||||||
|
@ -272,7 +268,7 @@ GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
|
||||||
{
|
{
|
||||||
if (gameVersion == GameVersion::SocialClubVersion)
|
if (gameVersion == GameVersion::SocialClubVersion)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
QString argumentValue;
|
QString argumentValue;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
argumentValue = "\\WOW6432Node";
|
argumentValue = "\\WOW6432Node";
|
||||||
|
@ -286,7 +282,7 @@ GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
|
||||||
}
|
}
|
||||||
else if (gameVersion == GameVersion::SteamVersion)
|
else if (gameVersion == GameVersion::SteamVersion)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
QString argumentValue;
|
QString argumentValue;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
argumentValue = "\\WOW6432Node";
|
argumentValue = "\\WOW6432Node";
|
||||||
|
@ -447,7 +443,7 @@ bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
|
||||||
}
|
}
|
||||||
if (socialClubVersion)
|
if (socialClubVersion)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
QString argumentValue;
|
QString argumentValue;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
argumentValue = "\\WOW6432Node";
|
argumentValue = "\\WOW6432Node";
|
||||||
|
@ -472,7 +468,7 @@ bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
|
||||||
}
|
}
|
||||||
if (steamVersion)
|
if (steamVersion)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
QString argumentValue;
|
QString argumentValue;
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
argumentValue = "\\WOW6432Node";
|
argumentValue = "\\WOW6432Node";
|
||||||
|
|
|
@ -47,11 +47,14 @@ void DatabaseThread::run()
|
||||||
QObject::connect(this, SIGNAL(threadTerminated()), &threadLoop, SLOT(quit()));
|
QObject::connect(this, SIGNAL(threadTerminated()), &threadLoop, SLOT(quit()));
|
||||||
|
|
||||||
while (threadRunning)
|
while (threadRunning)
|
||||||
|
{
|
||||||
|
if (threadRunning)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||||
threadLoop.exec();
|
threadLoop.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DatabaseThread::scanCrewReference(const QStringList &crewList, const int &requestDelay)
|
void DatabaseThread::scanCrewReference(const QStringList &crewList, const int &requestDelay)
|
||||||
{
|
{
|
||||||
|
@ -62,9 +65,7 @@ void DatabaseThread::scanCrewReference(const QStringList &crewList, const int &r
|
||||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||||
QNetworkRequest netRequest(AppEnv::getCrewFetchingUrl(crewID));
|
QNetworkRequest netRequest(AppEnv::getCrewFetchingUrl(crewID));
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
#if QT_VERSION < 0x060000
|
|
||||||
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||||
netRequest.setRawHeader("Accept", "text/html");
|
netRequest.setRawHeader("Accept", "text/html");
|
||||||
|
@ -137,9 +138,7 @@ void DatabaseThread::scanCrewMembersList(const QStringList &crewList, const int
|
||||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||||
QNetworkRequest netRequest(AppEnv::getPlayerFetchingUrl(crewID, currentPage));
|
QNetworkRequest netRequest(AppEnv::getPlayerFetchingUrl(crewID, currentPage));
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
#if QT_VERSION < 0x060000
|
|
||||||
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||||
netRequest.setRawHeader("Accept", "application/json");
|
netRequest.setRawHeader("Accept", "application/json");
|
||||||
|
|
|
@ -35,11 +35,9 @@ QMap<QString, QString> GlobalString::getGlobalMap()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> globalMap;
|
QMap<QString, QString> globalMap;
|
||||||
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
||||||
#if QT_VERSION < 0x060000
|
|
||||||
globalFile.setIniCodec("UTF-8");
|
globalFile.setIniCodec("UTF-8");
|
||||||
#endif
|
|
||||||
globalFile.beginGroup("Global");
|
globalFile.beginGroup("Global");
|
||||||
for (const QString &globalStr : globalFile.childKeys())
|
for (QString globalStr : globalFile.childKeys())
|
||||||
{
|
{
|
||||||
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
|
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
|
||||||
}
|
}
|
||||||
|
@ -51,9 +49,7 @@ QString GlobalString::getString(QString valueStr, bool *ok)
|
||||||
{
|
{
|
||||||
QString globalString = valueStr;
|
QString globalString = valueStr;
|
||||||
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
||||||
#if QT_VERSION < 0x060000
|
|
||||||
globalFile.setIniCodec("UTF-8");
|
globalFile.setIniCodec("UTF-8");
|
||||||
#endif
|
|
||||||
globalFile.beginGroup("Global");
|
globalFile.beginGroup("Global");
|
||||||
QStringList globalStrList = globalFile.childKeys();
|
QStringList globalStrList = globalFile.childKeys();
|
||||||
if (globalStrList.contains(valueStr))
|
if (globalStrList.contains(valueStr))
|
||||||
|
|
|
@ -16,11 +16,10 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "ImportDialog.h"
|
||||||
#include "ui_ImportDialog.h"
|
#include "ui_ImportDialog.h"
|
||||||
#include "SnapmaticPicture.h"
|
|
||||||
#include "SidebarGenerator.h"
|
#include "SidebarGenerator.h"
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "ImportDialog.h"
|
|
||||||
#include "imagecropper.h"
|
#include "imagecropper.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -40,6 +39,8 @@
|
||||||
#include <QRgb>
|
#include <QRgb>
|
||||||
|
|
||||||
// IMAGES VALUES
|
// IMAGES VALUES
|
||||||
|
#define snapmaticResolutionW 960
|
||||||
|
#define snapmaticResolutionH 536
|
||||||
#define snapmaticAvatarResolution 470
|
#define snapmaticAvatarResolution 470
|
||||||
#define snapmaticAvatarPlacementW 145
|
#define snapmaticAvatarPlacementW 145
|
||||||
#define snapmaticAvatarPlacementH 66
|
#define snapmaticAvatarPlacementH 66
|
||||||
|
@ -138,8 +139,7 @@ void ImportDialog::processImage()
|
||||||
{
|
{
|
||||||
if (workImage.isNull()) return;
|
if (workImage.isNull()) return;
|
||||||
QImage snapmaticImage = workImage;
|
QImage snapmaticImage = workImage;
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
QPixmap snapmaticPixmap(snapmaticResolutionW, snapmaticResolutionH);
|
||||||
QPixmap snapmaticPixmap(snapmaticResolution);
|
|
||||||
snapmaticPixmap.fill(selectedColour);
|
snapmaticPixmap.fill(selectedColour);
|
||||||
QPainter snapmaticPainter(&snapmaticPixmap);
|
QPainter snapmaticPainter(&snapmaticPixmap);
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
|
@ -149,21 +149,21 @@ void ImportDialog::processImage()
|
||||||
{
|
{
|
||||||
int diffWidth = 0;
|
int diffWidth = 0;
|
||||||
int diffHeight = 0;
|
int diffHeight = 0;
|
||||||
if (backImage.width() != snapmaticResolution.width())
|
if (backImage.width() != snapmaticResolutionW)
|
||||||
{
|
{
|
||||||
diffWidth = snapmaticResolution.width() - backImage.width();
|
diffWidth = snapmaticResolutionW - backImage.width();
|
||||||
diffWidth = diffWidth / 2;
|
diffWidth = diffWidth / 2;
|
||||||
}
|
}
|
||||||
else if (backImage.height() != snapmaticResolution.height())
|
else if (backImage.height() != snapmaticResolutionH)
|
||||||
{
|
{
|
||||||
diffHeight = snapmaticResolution.height() - backImage.height();
|
diffHeight = snapmaticResolutionH - backImage.height();
|
||||||
diffHeight = diffHeight / 2;
|
diffHeight = diffHeight / 2;
|
||||||
}
|
}
|
||||||
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, backImage);
|
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, backImage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snapmaticPainter.drawImage(0, 0, QImage(backImage).scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
snapmaticPainter.drawImage(0, 0, QImage(backImage).scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
if (ui->cbAvatar->isChecked() && ui->cbForceAvatarColour->isChecked())
|
if (ui->cbAvatar->isChecked() && ui->cbForceAvatarColour->isChecked())
|
||||||
{
|
{
|
||||||
|
@ -204,21 +204,21 @@ void ImportDialog::processImage()
|
||||||
int diffHeight = 0;
|
int diffHeight = 0;
|
||||||
if (!ui->cbIgnore->isChecked())
|
if (!ui->cbIgnore->isChecked())
|
||||||
{
|
{
|
||||||
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
snapmaticImage = snapmaticImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
if (snapmaticImage.width() != snapmaticResolution.width())
|
if (snapmaticImage.width() != snapmaticResolutionW)
|
||||||
{
|
{
|
||||||
diffWidth = snapmaticResolution.width() - snapmaticImage.width();
|
diffWidth = snapmaticResolutionW - snapmaticImage.width();
|
||||||
diffWidth = diffWidth / 2;
|
diffWidth = diffWidth / 2;
|
||||||
}
|
}
|
||||||
else if (snapmaticImage.height() != snapmaticResolution.height())
|
else if (snapmaticImage.height() != snapmaticResolutionH)
|
||||||
{
|
{
|
||||||
diffHeight = snapmaticResolution.height() - snapmaticImage.height();
|
diffHeight = snapmaticResolutionH - snapmaticImage.height();
|
||||||
diffHeight = diffHeight / 2;
|
diffHeight = diffHeight / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
snapmaticImage = snapmaticImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, snapmaticImage);
|
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, snapmaticImage);
|
||||||
if (ui->cbWatermark->isChecked()) { processWatermark(&snapmaticPainter); }
|
if (ui->cbWatermark->isChecked()) { processWatermark(&snapmaticPainter); }
|
||||||
|
@ -575,16 +575,15 @@ QImage ImportDialog::image()
|
||||||
|
|
||||||
void ImportDialog::setImage(QImage *image_)
|
void ImportDialog::setImage(QImage *image_)
|
||||||
{
|
{
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
|
||||||
origImage = *image_;
|
origImage = *image_;
|
||||||
workImage = QImage();
|
workImage = QImage();
|
||||||
if (image_->width() == image_->height())
|
if (image_->width() == image_->height())
|
||||||
{
|
{
|
||||||
insideAvatarZone = true;
|
insideAvatarZone = true;
|
||||||
ui->cbAvatar->setChecked(true);
|
ui->cbAvatar->setChecked(true);
|
||||||
if (image_->height() > snapmaticResolution.height())
|
if (image_->height() > snapmaticResolutionH)
|
||||||
{
|
{
|
||||||
workImage = image_->scaled(snapmaticResolution.height(), snapmaticResolution.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
workImage = image_->scaled(snapmaticResolutionH, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
delete image_;
|
delete image_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -593,18 +592,18 @@ void ImportDialog::setImage(QImage *image_)
|
||||||
delete image_;
|
delete image_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (image_->width() > snapmaticResolution.width() && image_->width() > image_->height())
|
else if (image_->width() > snapmaticResolutionW && image_->width() > image_->height())
|
||||||
{
|
{
|
||||||
insideAvatarZone = false;
|
insideAvatarZone = false;
|
||||||
ui->cbAvatar->setChecked(false);
|
ui->cbAvatar->setChecked(false);
|
||||||
workImage = image_->scaledToWidth(snapmaticResolution.width(), Qt::SmoothTransformation);
|
workImage = image_->scaledToWidth(snapmaticResolutionW, Qt::SmoothTransformation);
|
||||||
delete image_;
|
delete image_;
|
||||||
}
|
}
|
||||||
else if (image_->height() > snapmaticResolution.height() && image_->height() > image_->width())
|
else if (image_->height() > snapmaticResolutionH && image_->height() > image_->width())
|
||||||
{
|
{
|
||||||
insideAvatarZone = false;
|
insideAvatarZone = false;
|
||||||
ui->cbAvatar->setChecked(false);
|
ui->cbAvatar->setChecked(false);
|
||||||
workImage = image_->scaledToHeight(snapmaticResolution.height(), Qt::SmoothTransformation);
|
workImage = image_->scaledToHeight(snapmaticResolutionH, Qt::SmoothTransformation);
|
||||||
delete image_;
|
delete image_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -789,7 +788,7 @@ fileDialogPreOpen:
|
||||||
QMessageBox::warning(this, QApplication::translate("ProfileInterface", "Import"), QApplication::translate("ProfileInterface", "Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
|
QMessageBox::warning(this, QApplication::translate("ProfileInterface", "Import"), QApplication::translate("ProfileInterface", "Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
|
||||||
goto fileDialogPreOpen;
|
goto fileDialogPreOpen;
|
||||||
}
|
}
|
||||||
backImage = importImage.scaled(SnapmaticPicture::getSnapmaticResolution(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
backImage = importImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
backgroundPath = selectedFile;
|
backgroundPath = selectedFile;
|
||||||
ui->labBackgroundImage->setText(tr("Background Image: %1").arg(tr("File", "Background Image: File")));
|
ui->labBackgroundImage->setText(tr("Background Image: %1").arg(tr("File", "Background Image: File")));
|
||||||
ui->cmdBackgroundWipe->setVisible(true);
|
ui->cmdBackgroundWipe->setVisible(true);
|
||||||
|
|
|
@ -70,18 +70,9 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
ui->txtJSON->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
ui->txtJSON->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
#else
|
|
||||||
QFont jsonFont = ui->txtJSON->font();
|
|
||||||
jsonFont.setStyleHint(QFont::Monospace);
|
|
||||||
jsonFont.setFixedPitch(true);
|
|
||||||
ui->txtJSON->setFont(jsonFont);
|
|
||||||
#endif
|
#endif
|
||||||
QFontMetrics fontMetrics(ui->txtJSON->font());
|
QFontMetrics fontMetrics(ui->txtJSON->font());
|
||||||
#if QT_VERSION >= 0x050B00
|
|
||||||
ui->txtJSON->setTabStopDistance(fontMetrics.horizontalAdvance(" "));
|
|
||||||
#else
|
|
||||||
ui->txtJSON->setTabStopWidth(fontMetrics.width(" "));
|
ui->txtJSON->setTabStopWidth(fontMetrics.width(" "));
|
||||||
#endif
|
|
||||||
|
|
||||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonCode.toUtf8());
|
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonCode.toUtf8());
|
||||||
ui->txtJSON->setStyleSheet("QPlainTextEdit{background-color: rgb(46, 47, 48); color: rgb(238, 231, 172);}");
|
ui->txtJSON->setStyleSheet("QPlainTextEdit{background-color: rgb(46, 47, 48); color: rgb(238, 231, 172);}");
|
||||||
|
|
|
@ -60,10 +60,40 @@ MapLocationDialog::~MapLocationDialog()
|
||||||
|
|
||||||
void MapLocationDialog::drawPointOnMap(double xpos_d, double ypos_d)
|
void MapLocationDialog::drawPointOnMap(double xpos_d, double ypos_d)
|
||||||
{
|
{
|
||||||
ui->labPos->setText(tr("X: %1\nY: %2", "X and Y position").arg(QString::number(xpos_d), QString::number(ypos_d)));
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
|
int pointMakerSize = 8 * screenRatio * screenRatioPR;
|
||||||
|
QPixmap pointMakerPixmap = IconLoader::loadingPointmakerIcon().pixmap(QSize(pointMakerSize, pointMakerSize));
|
||||||
|
QSize mapPixelSize = QSize(width() * screenRatioPR, height() * screenRatioPR);
|
||||||
|
|
||||||
|
int pointMakerHalfSize = pointMakerSize / 2;
|
||||||
|
long xpos_ms = qRound(xpos_d);
|
||||||
|
long ypos_ms = qRound(ypos_d);
|
||||||
|
double xpos_ma = xpos_ms + 4000;
|
||||||
|
double ypos_ma = ypos_ms + 4000;
|
||||||
|
double xrat = (double)mapPixelSize.width() / 10000;
|
||||||
|
double yrat = (double)mapPixelSize.height() / 12000;
|
||||||
|
long xpos_mp = qRound(xpos_ma * xrat);
|
||||||
|
long ypos_mp = qRound(ypos_ma * yrat);
|
||||||
|
long xpos_pr = xpos_mp - pointMakerHalfSize;
|
||||||
|
long ypos_pr = ypos_mp + pointMakerHalfSize;
|
||||||
|
|
||||||
|
QPixmap mapPixmap(mapPixelSize);
|
||||||
|
QPainter mapPainter(&mapPixmap);
|
||||||
|
mapPainter.drawPixmap(0, 0, mapPixelSize.width(), mapPixelSize.height(), QPixmap(":/img/mappreview.jpg").scaled(mapPixelSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
|
mapPainter.drawPixmap(xpos_pr, mapPixelSize.height() - ypos_pr, pointMakerSize, pointMakerSize, pointMakerPixmap);
|
||||||
|
mapPainter.end();
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
|
mapPixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QPalette backgroundPalette;
|
||||||
|
backgroundPalette.setBrush(backgroundRole(), QBrush(mapPixmap));
|
||||||
|
setPalette(backgroundPalette);
|
||||||
|
|
||||||
xpos_new = xpos_d;
|
xpos_new = xpos_d;
|
||||||
ypos_new = ypos_d;
|
ypos_new = ypos_d;
|
||||||
repaint();
|
ui->labPos->setText(tr("X: %1\nY: %2", "X and Y position").arg(QString::number(xpos_d), QString::number(ypos_d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapLocationDialog::on_cmdChange_clicked()
|
void MapLocationDialog::on_cmdChange_clicked()
|
||||||
|
@ -95,21 +125,6 @@ void MapLocationDialog::on_cmdDone_clicked()
|
||||||
changeMode = false;
|
changeMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
void MapLocationDialog::updatePosFromEvent(double x, double y)
|
|
||||||
{
|
|
||||||
QSize mapPixelSize = size();
|
|
||||||
double xpos_ad = x;
|
|
||||||
double ypos_ad = mapPixelSize.height() - y;
|
|
||||||
double xrat = 10000 / (double)mapPixelSize.width();
|
|
||||||
double yrat = 12000 / (double)mapPixelSize.height();
|
|
||||||
double xpos_rv = xrat * xpos_ad;
|
|
||||||
double ypos_rv = yrat * ypos_ad;
|
|
||||||
double xpos_fp = xpos_rv - 4000;
|
|
||||||
double ypos_fp = ypos_rv - 4000;
|
|
||||||
drawPointOnMap(xpos_fp, ypos_fp);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void MapLocationDialog::updatePosFromEvent(int x, int y)
|
void MapLocationDialog::updatePosFromEvent(int x, int y)
|
||||||
{
|
{
|
||||||
QSize mapPixelSize = size();
|
QSize mapPixelSize = size();
|
||||||
|
@ -123,60 +138,13 @@ void MapLocationDialog::updatePosFromEvent(int x, int y)
|
||||||
double ypos_fp = ypos_rv - 4000;
|
double ypos_fp = ypos_rv - 4000;
|
||||||
drawPointOnMap(xpos_fp, ypos_fp);
|
drawPointOnMap(xpos_fp, ypos_fp);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void MapLocationDialog::paintEvent(QPaintEvent *ev)
|
|
||||||
{
|
|
||||||
QPainter painter(this);
|
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
|
||||||
|
|
||||||
// Paint Map
|
|
||||||
QSize mapPixelSize = QSize(width() * screenRatioPR, height() * screenRatioPR);
|
|
||||||
painter.drawPixmap(0, 0, width(), height(), QPixmap(":/img/mappreview.jpg").scaled(mapPixelSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
|
||||||
|
|
||||||
// Paint Marker
|
|
||||||
int pointMarkerSize = 8 * screenRatio;
|
|
||||||
int pointMarkerHalfSize = pointMarkerSize / 2;
|
|
||||||
long xpos_ms = qRound(xpos_new);
|
|
||||||
long ypos_ms = qRound(ypos_new);
|
|
||||||
double xpos_ma = xpos_ms + 4000;
|
|
||||||
double ypos_ma = ypos_ms + 4000;
|
|
||||||
double xrat = (double)width() / 10000;
|
|
||||||
double yrat = (double)height() / 12000;
|
|
||||||
long xpos_mp = qRound(xpos_ma * xrat);
|
|
||||||
long ypos_mp = qRound(ypos_ma * yrat);
|
|
||||||
long xpos_pr;
|
|
||||||
long ypos_pr;
|
|
||||||
if (screenRatioPR != 1) {
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
xpos_pr = xpos_mp - pointMarkerHalfSize;
|
|
||||||
ypos_pr = ypos_mp + pointMarkerHalfSize;
|
|
||||||
#else
|
|
||||||
xpos_pr = xpos_mp - pointMarkerHalfSize + screenRatioPR;
|
|
||||||
ypos_pr = ypos_mp + pointMarkerHalfSize - screenRatioPR;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
xpos_pr = xpos_mp - pointMarkerHalfSize;
|
|
||||||
ypos_pr = ypos_mp + pointMarkerHalfSize;
|
|
||||||
}
|
|
||||||
QPixmap mapMarkerPixmap = IconLoader::loadingPointmakerIcon().pixmap(QSize(pointMarkerSize, pointMarkerSize));
|
|
||||||
painter.drawPixmap(xpos_pr, height() - ypos_pr, pointMarkerSize, pointMarkerSize, mapMarkerPixmap);
|
|
||||||
|
|
||||||
QDialog::paintEvent(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapLocationDialog::mouseMoveEvent(QMouseEvent *ev)
|
void MapLocationDialog::mouseMoveEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
if (!changeMode) { ev->ignore(); }
|
if (!changeMode) { ev->ignore(); }
|
||||||
else if (ev->buttons() & Qt::LeftButton)
|
else if (ev->buttons() & Qt::LeftButton)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
updatePosFromEvent(ev->position().x(), ev->position().y());
|
|
||||||
#else
|
|
||||||
updatePosFromEvent(ev->x(), ev->y());
|
updatePosFromEvent(ev->x(), ev->y());
|
||||||
#endif
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -190,11 +158,7 @@ void MapLocationDialog::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
if (!changeMode) { ev->ignore(); }
|
if (!changeMode) { ev->ignore(); }
|
||||||
else if (ev->button() == Qt::LeftButton)
|
else if (ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
updatePosFromEvent(ev->position().x(), ev->position().y());
|
|
||||||
#else
|
|
||||||
updatePosFromEvent(ev->x(), ev->y());
|
updatePosFromEvent(ev->x(), ev->y());
|
||||||
#endif
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -39,7 +39,6 @@ public:
|
||||||
~MapLocationDialog();
|
~MapLocationDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *ev);
|
|
||||||
void mouseMoveEvent(QMouseEvent *ev);
|
void mouseMoveEvent(QMouseEvent *ev);
|
||||||
void mouseReleaseEvent(QMouseEvent *ev);
|
void mouseReleaseEvent(QMouseEvent *ev);
|
||||||
|
|
||||||
|
@ -48,11 +47,7 @@ private slots:
|
||||||
void on_cmdApply_clicked();
|
void on_cmdApply_clicked();
|
||||||
void on_cmdChange_clicked();
|
void on_cmdChange_clicked();
|
||||||
void on_cmdRevert_clicked();
|
void on_cmdRevert_clicked();
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
void updatePosFromEvent(double x, double y);
|
|
||||||
#else
|
|
||||||
void updatePosFromEvent(int x, int y);
|
void updatePosFromEvent(int x, int y);
|
||||||
#endif
|
|
||||||
void on_cmdClose_clicked();
|
void on_cmdClose_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -25,11 +25,6 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Snapmatic Map Viewer</string>
|
<string>Snapmatic Map Viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QDialog#MapLocationDialog {
|
|
||||||
background-color: transparent;
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="vlMapPreview">
|
<layout class="QVBoxLayout" name="vlMapPreview">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
/*****************************************************************************
|
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
|
||||||
* Copyright (C) 2020 Syping
|
|
||||||
*
|
|
||||||
* 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 "TranslationClass.h"
|
|
||||||
#include "MessageThread.h"
|
|
||||||
#include "AppEnv.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QEventLoop>
|
|
||||||
#include <QUrlQuery>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QUrl>
|
|
||||||
|
|
||||||
MessageThread::MessageThread(uint cacheId, QObject *parent) : QThread(parent), cacheId(cacheId)
|
|
||||||
{
|
|
||||||
threadRunning = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageThread::run()
|
|
||||||
{
|
|
||||||
QEventLoop threadLoop;
|
|
||||||
|
|
||||||
QObject::connect(this, SIGNAL(threadTerminated()), &threadLoop, SLOT(quit()));
|
|
||||||
|
|
||||||
while (threadRunning) {
|
|
||||||
{
|
|
||||||
#ifdef GTA5SYNC_MOTD_WEBURL
|
|
||||||
QUrl motdWebUrl = QUrl(GTA5SYNC_MOTD_WEBURL);
|
|
||||||
#else
|
|
||||||
QUrl motdWebUrl = QUrl("https://motd.syping.de/gta5view-dev/");
|
|
||||||
#endif
|
|
||||||
QUrlQuery urlQuery(motdWebUrl);
|
|
||||||
urlQuery.addQueryItem("code", GTA5SYNC_BUILDCODE);
|
|
||||||
urlQuery.addQueryItem("cacheid", QString::number(cacheId));
|
|
||||||
urlQuery.addQueryItem("lang", Translator->getCurrentLanguage());
|
|
||||||
urlQuery.addQueryItem("version", GTA5SYNC_APPVER);
|
|
||||||
motdWebUrl.setQuery(urlQuery);
|
|
||||||
|
|
||||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
|
||||||
QNetworkRequest netRequest(motdWebUrl);
|
|
||||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
|
||||||
QNetworkReply *netReply = netManager->get(netRequest);
|
|
||||||
|
|
||||||
QEventLoop downloadLoop;
|
|
||||||
QObject::connect(netManager, SIGNAL(finished(QNetworkReply*)), &downloadLoop, SLOT(quit()));
|
|
||||||
QObject::connect(this, SIGNAL(threadTerminated()), &threadLoop, SLOT(quit()));
|
|
||||||
QTimer::singleShot(60000, &downloadLoop, SLOT(quit()));
|
|
||||||
downloadLoop.exec();
|
|
||||||
|
|
||||||
if (netReply->isFinished()) {
|
|
||||||
QByteArray jsonContent = netReply->readAll();
|
|
||||||
QString headerData = QString::fromUtf8(netReply->rawHeader("gta5view"));
|
|
||||||
if (!headerData.isEmpty()) {
|
|
||||||
QMap<QString,QString> headerMap;
|
|
||||||
const QStringList headerVarList = headerData.split(';');
|
|
||||||
for (QString headerVar : headerVarList) {
|
|
||||||
QStringList varValueList = headerVar.split('=');
|
|
||||||
if (varValueList.length() >= 2) {
|
|
||||||
const QString variable = varValueList.at(0).trimmed();
|
|
||||||
varValueList.removeFirst();
|
|
||||||
const QString value = varValueList.join('=');
|
|
||||||
headerMap.insert(variable, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (headerMap.value("update", "false") == "true") {
|
|
||||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonContent);
|
|
||||||
emit messagesArrived(jsonDocument.object());
|
|
||||||
}
|
|
||||||
if (headerMap.contains("cache")) {
|
|
||||||
bool uintOk;
|
|
||||||
uint cacheVal = headerMap.value("cache").toUInt(&uintOk);
|
|
||||||
if (uintOk) {
|
|
||||||
cacheId = cacheVal;
|
|
||||||
emit updateCacheId(cacheId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete netReply;
|
|
||||||
delete netManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
|
||||||
threadLoop.exec();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageThread::terminateThread()
|
|
||||||
{
|
|
||||||
threadRunning = false;
|
|
||||||
emit threadTerminated();
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*****************************************************************************
|
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
|
||||||
* Copyright (C) 2020 Syping
|
|
||||||
*
|
|
||||||
* 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 MESSAGETHREAD_H
|
|
||||||
#define MESSAGETHREAD_H
|
|
||||||
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QThread>
|
|
||||||
|
|
||||||
class MessageThread : public QThread
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit MessageThread(uint cacheId, QObject *parent = 0);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void terminateThread();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool threadRunning;
|
|
||||||
uint cacheId;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void run();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void messagesArrived(const QJsonObject &messageObject);
|
|
||||||
void updateCacheId(uint cacheId);
|
|
||||||
void threadTerminated();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MESSAGETHREAD_H
|
|
|
@ -16,10 +16,9 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "OptionsDialog.h"
|
||||||
#include "ui_OptionsDialog.h"
|
#include "ui_OptionsDialog.h"
|
||||||
#include "TranslationClass.h"
|
#include "TranslationClass.h"
|
||||||
#include "SnapmaticPicture.h"
|
|
||||||
#include "OptionsDialog.h"
|
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "UserInterface.h"
|
#include "UserInterface.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
|
@ -75,7 +74,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
int desktopSizeHeight = desktopResolution.height();
|
int desktopSizeHeight = desktopResolution.height();
|
||||||
#endif
|
#endif
|
||||||
aspectRatio = Qt::KeepAspectRatio;
|
aspectRatio = Qt::KeepAspectRatio;
|
||||||
defExportSize = SnapmaticPicture::getSnapmaticResolution();
|
defExportSize = QSize(960, 536);
|
||||||
cusExportSize = defExportSize;
|
cusExportSize = defExportSize;
|
||||||
defaultQuality = 100;
|
defaultQuality = 100;
|
||||||
customQuality = 100;
|
customQuality = 100;
|
||||||
|
@ -137,34 +136,25 @@ OptionsDialog::~OptionsDialog()
|
||||||
|
|
||||||
void OptionsDialog::setupTreeWidget()
|
void OptionsDialog::setupTreeWidget()
|
||||||
{
|
{
|
||||||
const QStringList players = profileDB->getPlayers();
|
for (QString playerIDStr : profileDB->getPlayers())
|
||||||
if (players.length() != 0) {
|
|
||||||
QStringList::const_iterator it = players.constBegin();
|
|
||||||
QStringList::const_iterator end = players.constEnd();
|
|
||||||
while (it != end)
|
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int playerID = it->toInt(&ok);
|
int playerID = playerIDStr.toInt(&ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
QString playerName = profileDB->getPlayerName(playerID);
|
QString playerName = profileDB->getPlayerName(playerID);
|
||||||
|
|
||||||
QStringList playerTreeViewList;
|
QStringList playerTreeViewList;
|
||||||
playerTreeViewList += *it;
|
playerTreeViewList += playerIDStr;
|
||||||
playerTreeViewList += playerName;
|
playerTreeViewList += playerName;
|
||||||
|
|
||||||
QTreeWidgetItem *playerItem = new QTreeWidgetItem(playerTreeViewList);
|
QTreeWidgetItem *playerItem = new QTreeWidgetItem(playerTreeViewList);
|
||||||
ui->twPlayers->addTopLevelItem(playerItem);
|
ui->twPlayers->addTopLevelItem(playerItem);
|
||||||
playerItems += playerItem;
|
playerItems += playerItem;
|
||||||
}
|
}
|
||||||
it++;
|
|
||||||
}
|
}
|
||||||
ui->twPlayers->sortItems(1, Qt::AscendingOrder);
|
ui->twPlayers->sortItems(1, Qt::AscendingOrder);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabPlayers));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsDialog::setupLanguageBox()
|
void OptionsDialog::setupLanguageBox()
|
||||||
{
|
{
|
||||||
|
@ -175,7 +165,7 @@ void OptionsDialog::setupLanguageBox()
|
||||||
|
|
||||||
QString cbSysStr = tr("%1 (Language priority)", "First language a person can talk with a different person/application. \"Native\" or \"Not Native\".").arg(tr("System",
|
QString cbSysStr = tr("%1 (Language priority)", "First language a person can talk with a different person/application. \"Native\" or \"Not Native\".").arg(tr("System",
|
||||||
"System in context of System default"));
|
"System in context of System default"));
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
QString cbAutoStr;
|
QString cbAutoStr;
|
||||||
if (AppEnv::getGameLanguage(AppEnv::getGameVersion()) != GameLanguage::Undefined)
|
if (AppEnv::getGameLanguage(AppEnv::getGameVersion()) != GameLanguage::Undefined)
|
||||||
{
|
{
|
||||||
|
@ -302,7 +292,7 @@ void OptionsDialog::setupInterfaceSettings()
|
||||||
settings->beginGroup("Startup");
|
settings->beginGroup("Startup");
|
||||||
bool alwaysUseMessageFont = settings->value("AlwaysUseMessageFont", false).toBool();
|
bool alwaysUseMessageFont = settings->value("AlwaysUseMessageFont", false).toBool();
|
||||||
ui->cbAlwaysUseMessageFont->setChecked(alwaysUseMessageFont);
|
ui->cbAlwaysUseMessageFont->setChecked(alwaysUseMessageFont);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
if (QSysInfo::windowsVersion() >= 0x0080)
|
if (QSysInfo::windowsVersion() >= 0x0080)
|
||||||
{
|
{
|
||||||
ui->gbFont->setVisible(false);
|
ui->gbFont->setVisible(false);
|
||||||
|
@ -368,12 +358,10 @@ void OptionsDialog::applySettings()
|
||||||
settings->setValue("Language", ui->cbLanguage->itemData(ui->cbLanguage->currentIndex()));
|
settings->setValue("Language", ui->cbLanguage->itemData(ui->cbLanguage->currentIndex()));
|
||||||
settings->setValue("AreaLanguage", ui->cbAreaLanguage->itemData(ui->cbAreaLanguage->currentIndex()));
|
settings->setValue("AreaLanguage", ui->cbAreaLanguage->itemData(ui->cbAreaLanguage->currentIndex()));
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
|
||||||
#endif
|
#endif
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
|
@ -627,7 +615,7 @@ void OptionsDialog::setupWindowsGameSettings()
|
||||||
{
|
{
|
||||||
#ifdef GTA5SYNC_GAME
|
#ifdef GTA5SYNC_GAME
|
||||||
GameVersion gameVersion = AppEnv::getGameVersion();
|
GameVersion gameVersion = AppEnv::getGameVersion();
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
if (gameVersion != GameVersion::NoVersion)
|
if (gameVersion != GameVersion::NoVersion)
|
||||||
{
|
{
|
||||||
if (gameVersion == GameVersion::SocialClubVersion)
|
if (gameVersion == GameVersion::SocialClubVersion)
|
||||||
|
@ -724,7 +712,7 @@ void OptionsDialog::setupCustomGTAFolder()
|
||||||
|
|
||||||
void OptionsDialog::setupSnapmaticPictureViewer()
|
void OptionsDialog::setupSnapmaticPictureViewer()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
settings->beginGroup("Interface");
|
settings->beginGroup("Interface");
|
||||||
ui->cbSnapmaticNavigationBar->setChecked(settings->value("NavigationBar", true).toBool());
|
ui->cbSnapmaticNavigationBar->setChecked(settings->value("NavigationBar", true).toBool());
|
||||||
|
@ -734,9 +722,8 @@ void OptionsDialog::setupSnapmaticPictureViewer()
|
||||||
ui->gbSnapmaticPictureViewer->setVisible(false);
|
ui->gbSnapmaticPictureViewer->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
settings->beginGroup("Interface");
|
ui->cbSnapmaticNavigationBar->setVisible(false);
|
||||||
ui->cbSnapmaticNavigationBar->setChecked(settings->value("NavigationBar", true).toBool());
|
ui->gbSnapmaticPictureViewer->setVisible(false);
|
||||||
settings->endGroup();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,7 @@
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if QT_VERSION < 0x060000
|
#ifdef GTA5SYNC_WIN
|
||||||
#include <QDesktopWidget>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
#include <QtWinExtras/QtWin>
|
#include <QtWinExtras/QtWin>
|
||||||
#include <QtWinExtras/QWinEvent>
|
#include <QtWinExtras/QWinEvent>
|
||||||
|
@ -45,6 +41,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
@ -83,11 +80,7 @@
|
||||||
#define picPath picture->getPictureFilePath()
|
#define picPath picture->getPictureFilePath()
|
||||||
#define picTitl StringParser::escapeString(picture->getPictureTitle())
|
#define picTitl StringParser::escapeString(picture->getPictureTitle())
|
||||||
#define plyrsList picture->getSnapmaticProperties().playersList
|
#define plyrsList picture->getSnapmaticProperties().playersList
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
#define created QLocale().toString(picture->getSnapmaticProperties().createdDateTime, QLocale::ShortFormat)
|
|
||||||
#else
|
|
||||||
#define created picture->getSnapmaticProperties().createdDateTime.toString(Qt::DefaultLocaleShortDate)
|
#define created picture->getSnapmaticProperties().createdDateTime.toString(Qt::DefaultLocaleShortDate)
|
||||||
#endif
|
|
||||||
|
|
||||||
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),
|
||||||
|
@ -142,16 +135,12 @@ void PictureDialog::setupPictureDialog()
|
||||||
smpic = nullptr;
|
smpic = nullptr;
|
||||||
crewStr = "";
|
crewStr = "";
|
||||||
|
|
||||||
// Get Snapmatic Resolution
|
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
|
||||||
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);
|
|
||||||
|
|
||||||
// Avatar area
|
// Avatar area
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
if (screenRatio != 1 || screenRatioPR != 1)
|
if (screenRatio != 1 || screenRatioPR != 1)
|
||||||
{
|
{
|
||||||
avatarAreaPicture = QImage(":/img/avatararea.png").scaledToHeight(windowResolution.height() * screenRatio * screenRatioPR, Qt::FastTransformation);
|
avatarAreaPicture = QImage(":/img/avatararea.png").scaledToHeight(536 * screenRatio * screenRatioPR, Qt::FastTransformation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -162,7 +151,7 @@ void PictureDialog::setupPictureDialog()
|
||||||
avatarSize = 470;
|
avatarSize = 470;
|
||||||
|
|
||||||
// DPI calculation (picture)
|
// DPI calculation (picture)
|
||||||
ui->labPicture->setFixedSize(windowResolution.width() * screenRatio, windowResolution.height() * screenRatio);
|
ui->labPicture->setFixedSize(960 * screenRatio, 536 * screenRatio);
|
||||||
ui->labPicture->setFocusPolicy(Qt::StrongFocus);
|
ui->labPicture->setFocusPolicy(Qt::StrongFocus);
|
||||||
ui->labPicture->setScaledContents(true);
|
ui->labPicture->setScaledContents(true);
|
||||||
|
|
||||||
|
@ -210,13 +199,13 @@ void PictureDialog::setupPictureDialog()
|
||||||
ui->jsonLayout->setContentsMargins(4 * screenRatio, 10 * screenRatio, 4 * screenRatio, 4 * screenRatio);
|
ui->jsonLayout->setContentsMargins(4 * screenRatio, 10 * screenRatio, 4 * screenRatio, 4 * screenRatio);
|
||||||
|
|
||||||
// Pre-adapt window for DPI
|
// Pre-adapt window for DPI
|
||||||
setFixedWidth(windowResolution.width() * screenRatio);
|
setFixedWidth(960 * screenRatio);
|
||||||
setFixedHeight(windowResolution.height() * screenRatio);
|
setFixedHeight(536 * screenRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
PictureDialog::~PictureDialog()
|
PictureDialog::~PictureDialog()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
if (naviEnabled)
|
if (naviEnabled)
|
||||||
{
|
{
|
||||||
|
@ -227,15 +216,6 @@ PictureDialog::~PictureDialog()
|
||||||
delete layout()->menuBar();
|
delete layout()->menuBar();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
if (naviEnabled)
|
|
||||||
{
|
|
||||||
for (QObject *obj : layout()->menuBar()->children())
|
|
||||||
{
|
|
||||||
delete obj;
|
|
||||||
}
|
|
||||||
delete layout()->menuBar();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
for (QObject *obj : manageMenu->children())
|
for (QObject *obj : manageMenu->children())
|
||||||
{
|
{
|
||||||
|
@ -256,42 +236,139 @@ void PictureDialog::closeEvent(QCloseEvent *ev)
|
||||||
|
|
||||||
void PictureDialog::addPreviousNextButtons()
|
void PictureDialog::addPreviousNextButtons()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
// Windows Vista additions
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
QToolBar *uiToolbar = new QToolBar("Picture Toolbar", this);
|
QToolBar *uiToolbar = new QToolBar("Picture Toolbar", this);
|
||||||
uiToolbar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
uiToolbar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
uiToolbar->setObjectName("UiToolbar");
|
uiToolbar->setObjectName("uiToolbar");
|
||||||
uiToolbar->addAction(QIcon(":/img/back.svgz"), "", this, SLOT(previousPictureRequestedSlot()));
|
uiToolbar->addAction(QIcon(":/img/back.svgz"), "", this, SLOT(previousPictureRequestedSlot()));
|
||||||
uiToolbar->addAction(QIcon(":/img/next.svgz"), "", this, SLOT(nextPictureRequestedSlot()));
|
uiToolbar->addAction(QIcon(":/img/next.svgz"), "", this, SLOT(nextPictureRequestedSlot()));
|
||||||
layout()->setMenuBar(uiToolbar);
|
layout()->setMenuBar(uiToolbar);
|
||||||
|
|
||||||
naviEnabled = true;
|
naviEnabled = true;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
#if QT_VERSION >= 0x050200
|
||||||
|
#ifdef GTA5SYNC_APV
|
||||||
|
bool PictureDialog::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||||
|
{
|
||||||
|
*result = 0;
|
||||||
|
MSG *msg = static_cast<MSG*>(message);
|
||||||
|
LRESULT lRet = 0;
|
||||||
|
|
||||||
|
if (naviEnabled && QtWin::isCompositionEnabled())
|
||||||
|
{
|
||||||
|
if (msg->message == WM_NCCALCSIZE && msg->wParam == TRUE)
|
||||||
|
{
|
||||||
|
NCCALCSIZE_PARAMS *pncsp = reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||||
|
|
||||||
|
int sideBorderSize = ((frameSize().width() - size().width()) / 2);
|
||||||
|
#ifdef GTA5SYNC_APV_SIDE
|
||||||
|
int buttomBorderSize = sideBorderSize;
|
||||||
#else
|
#else
|
||||||
QToolBar *uiToolbar = new QToolBar("Picture Toolbar", this);
|
int buttomBorderSize = (frameSize().height() - size().height());
|
||||||
#if QT_VERSION < 0x050600
|
#endif
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
pncsp->rgrc[0].left += sideBorderSize;
|
||||||
if (screenRatio != 1) {
|
pncsp->rgrc[0].right -= sideBorderSize;
|
||||||
QSize iconSize = uiToolbar->iconSize();
|
pncsp->rgrc[0].bottom -= buttomBorderSize;
|
||||||
uiToolbar->setIconSize(QSize(iconSize.width() * screenRatio, iconSize.height() * screenRatio));
|
}
|
||||||
|
else if (msg->message == WM_NCHITTEST)
|
||||||
|
{
|
||||||
|
int CLOSE_BUTTON_ID = 20;
|
||||||
|
lRet = HitTestNCA(msg->hwnd, msg->lParam);
|
||||||
|
DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lRet);
|
||||||
|
*result = lRet;
|
||||||
|
if (lRet != CLOSE_BUTTON_ID) { return QWidget::nativeEvent(eventType, message, result); }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QWidget::nativeEvent(eventType, message, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QWidget::nativeEvent(eventType, message, result);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT PictureDialog::HitTestNCA(HWND hWnd, LPARAM lParam)
|
||||||
|
{
|
||||||
|
int LEFTEXTENDWIDTH = 0;
|
||||||
|
int RIGHTEXTENDWIDTH = 0;
|
||||||
|
int BOTTOMEXTENDWIDTH = 0;
|
||||||
|
int TOPEXTENDWIDTH = layout()->menuBar()->height();
|
||||||
|
|
||||||
|
POINT ptMouse = {(int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)};
|
||||||
|
|
||||||
|
RECT rcWindow;
|
||||||
|
GetWindowRect(hWnd, &rcWindow);
|
||||||
|
|
||||||
|
RECT rcFrame = {};
|
||||||
|
AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
|
||||||
|
|
||||||
|
USHORT uRow = 1;
|
||||||
|
USHORT uCol = 1;
|
||||||
|
bool fOnResizeBorder = false;
|
||||||
|
|
||||||
|
if (ptMouse.y >= rcWindow.top && ptMouse.y < rcWindow.top + TOPEXTENDWIDTH)
|
||||||
|
{
|
||||||
|
fOnResizeBorder = (ptMouse.y < (rcWindow.top - rcFrame.top));
|
||||||
|
uRow = 0;
|
||||||
|
}
|
||||||
|
else if (ptMouse.y < rcWindow.bottom && ptMouse.y >= rcWindow.bottom - BOTTOMEXTENDWIDTH)
|
||||||
|
{
|
||||||
|
uRow = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ptMouse.x >= rcWindow.left && ptMouse.x < rcWindow.left + LEFTEXTENDWIDTH)
|
||||||
|
{
|
||||||
|
uCol = 0;
|
||||||
|
}
|
||||||
|
else if (ptMouse.x < rcWindow.right && ptMouse.x >= rcWindow.right - RIGHTEXTENDWIDTH)
|
||||||
|
{
|
||||||
|
uCol = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT hitTests[3][3] =
|
||||||
|
{
|
||||||
|
{ HTTOPLEFT, fOnResizeBorder ? HTTOP : HTCAPTION, HTTOPRIGHT },
|
||||||
|
{ HTLEFT, HTNOWHERE, HTRIGHT },
|
||||||
|
{ HTBOTTOMLEFT, HTBOTTOM, HTBOTTOMRIGHT },
|
||||||
|
};
|
||||||
|
|
||||||
|
return hitTests[uRow][uCol];
|
||||||
|
}
|
||||||
|
|
||||||
|
void PictureDialog::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event)
|
||||||
|
// int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
|
||||||
|
// newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
||||||
|
// if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
||||||
|
// int buttomBorderSize = (frameSize().height() - size().height());
|
||||||
|
// int sideBorderSize = ((frameSize().width() - size().width()) / 2);
|
||||||
|
// int brokenDialogHeight = newDialogHeight + (buttomBorderSize - sideBorderSize);
|
||||||
|
// if (event->size().height() == brokenDialogHeight)
|
||||||
|
// {
|
||||||
|
// qDebug() << "BROKEN 1";
|
||||||
|
// setGeometry(geometry().x(), geometry().y(), width(), newDialogHeight);
|
||||||
|
// qDebug() << "BROKEN 2";
|
||||||
|
// event->ignore();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
uiToolbar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
|
||||||
uiToolbar->setObjectName("UiToolbar");
|
|
||||||
uiToolbar->addAction(QIcon(":/img/back.svgz"), "", this, SLOT(previousPictureRequestedSlot()));
|
|
||||||
uiToolbar->addAction(QIcon(":/img/next.svgz"), "", this, SLOT(nextPictureRequestedSlot()));
|
|
||||||
layout()->setMenuBar(uiToolbar);
|
|
||||||
naviEnabled = true;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
#endif
|
||||||
|
|
||||||
void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
||||||
{
|
{
|
||||||
Q_UNUSED(newLabelSize)
|
Q_UNUSED(newLabelSize)
|
||||||
#if QT_VERSION >= 0x050F00
|
|
||||||
int newDialogHeight = SnapmaticPicture::getSnapmaticResolution().height() / 2;
|
|
||||||
#else
|
|
||||||
int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
|
int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
|
||||||
#endif
|
|
||||||
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
||||||
if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
||||||
setMaximumSize(width(), newDialogHeight);
|
setMaximumSize(width(), newDialogHeight);
|
||||||
|
@ -304,7 +381,7 @@ void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
||||||
|
|
||||||
void PictureDialog::styliseDialog()
|
void PictureDialog::styliseDialog()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
if (QtWin::isCompositionEnabled())
|
if (QtWin::isCompositionEnabled())
|
||||||
{
|
{
|
||||||
|
@ -326,7 +403,7 @@ void PictureDialog::styliseDialog()
|
||||||
|
|
||||||
bool PictureDialog::event(QEvent *event)
|
bool PictureDialog::event(QEvent *event)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
if (naviEnabled)
|
if (naviEnabled)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +488,7 @@ bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
if (obj != ui->labPicture && naviEnabled)
|
if (obj != ui->labPicture && naviEnabled)
|
||||||
{
|
{
|
||||||
|
@ -609,12 +686,10 @@ void PictureDialog::renderPicture()
|
||||||
{
|
{
|
||||||
if (overlayEnabled)
|
if (overlayEnabled)
|
||||||
{
|
{
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
QPixmap shownImagePixmap(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR);
|
||||||
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);
|
|
||||||
QPixmap shownImagePixmap(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR);
|
|
||||||
shownImagePixmap.fill(Qt::transparent);
|
shownImagePixmap.fill(Qt::transparent);
|
||||||
QPainter shownImagePainter(&shownImagePixmap);
|
QPainter shownImagePainter(&shownImagePixmap);
|
||||||
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
shownImagePainter.drawImage(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage);
|
shownImagePainter.drawImage(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage);
|
||||||
shownImagePainter.end();
|
shownImagePainter.end();
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
|
@ -624,12 +699,10 @@ void PictureDialog::renderPicture()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
QPixmap shownImagePixmap(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR);
|
||||||
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);
|
|
||||||
QPixmap shownImagePixmap(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR);
|
|
||||||
shownImagePixmap.fill(Qt::transparent);
|
shownImagePixmap.fill(Qt::transparent);
|
||||||
QPainter shownImagePainter(&shownImagePixmap);
|
QPainter shownImagePainter(&shownImagePixmap);
|
||||||
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
shownImagePainter.end();
|
shownImagePainter.end();
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
|
@ -640,17 +713,15 @@ void PictureDialog::renderPicture()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Generating Avatar Preview
|
// Generating Avatar Preview
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
QPixmap avatarPixmap(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR);
|
||||||
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);
|
|
||||||
QPixmap avatarPixmap(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR);
|
|
||||||
QPainter snapPainter(&avatarPixmap);
|
QPainter snapPainter(&avatarPixmap);
|
||||||
QFont snapPainterFont;
|
QFont snapPainterFont;
|
||||||
snapPainterFont.setPixelSize(12 * screenRatio * screenRatioPR);
|
snapPainterFont.setPixelSize(12 * screenRatio * screenRatioPR);
|
||||||
snapPainter.drawImage(0, 0, snapmaticPicture.scaled(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
snapPainter.drawImage(0, 0, snapmaticPicture.scaled(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
snapPainter.drawImage(0, 0, avatarAreaPicture);
|
snapPainter.drawImage(0, 0, avatarAreaPicture);
|
||||||
snapPainter.setPen(QColor::fromRgb(255, 255, 255, 255));
|
snapPainter.setPen(QColor::fromRgb(255, 255, 255, 255));
|
||||||
snapPainter.setFont(snapPainterFont);
|
snapPainter.setFont(snapPainterFont);
|
||||||
snapPainter.drawText(QRect(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, 140 * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR), Qt::AlignLeft | Qt::TextWordWrap, tr("Avatar Preview Mode\nPress 1 for Default View"));
|
snapPainter.drawText(QRect(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, 140 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR), Qt::AlignLeft | Qt::TextWordWrap, tr("Avatar Preview Mode\nPress 1 for Default View"));
|
||||||
snapPainter.end();
|
snapPainter.end();
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
avatarPixmap.setDevicePixelRatio(screenRatioPR);
|
avatarPixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
|
@ -702,7 +773,7 @@ QString PictureDialog::generatePlayersString()
|
||||||
QString plyrsStr;
|
QString plyrsStr;
|
||||||
if (playersList.length() >= 1)
|
if (playersList.length() >= 1)
|
||||||
{
|
{
|
||||||
for (const QString &player : playersList)
|
for (const QString player : playersList)
|
||||||
{
|
{
|
||||||
const QString playerName = profileDB->getPlayerName(player);
|
const QString playerName = profileDB->getPlayerName(player);
|
||||||
if (player != playerName) {
|
if (player != playerName) {
|
||||||
|
@ -749,17 +820,13 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
||||||
{
|
{
|
||||||
if (button == Qt::LeftButton)
|
if (button == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
QRect desktopRect = QApplication::screenAt(pos())->geometry();
|
|
||||||
#else
|
|
||||||
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
||||||
#endif
|
|
||||||
PictureWidget *pictureWidget = new PictureWidget(this); // Work!
|
PictureWidget *pictureWidget = new PictureWidget(this); // Work!
|
||||||
pictureWidget->setObjectName("PictureWidget");
|
pictureWidget->setObjectName("PictureWidget");
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::MaximizeUsingFullscreenGeometryHint);
|
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::WindowStaysOnTopHint^Qt::MaximizeUsingFullscreenGeometryHint);
|
||||||
#else
|
#else
|
||||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint);
|
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::WindowStaysOnTopHint);
|
||||||
#endif
|
#endif
|
||||||
pictureWidget->setWindowTitle(windowTitle());
|
pictureWidget->setWindowTitle(windowTitle());
|
||||||
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color: black;}");
|
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color: black;}");
|
||||||
|
@ -773,7 +840,7 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
||||||
|
|
||||||
pictureWidget->move(desktopRect.x(), desktopRect.y());
|
pictureWidget->move(desktopRect.x(), desktopRect.y());
|
||||||
pictureWidget->resize(desktopRect.width(), desktopRect.height());
|
pictureWidget->resize(desktopRect.width(), desktopRect.height());
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
QtWin::markFullscreenWindow(pictureWidget, true);
|
QtWin::markFullscreenWindow(pictureWidget, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
#if QT_VERSION >= 0x050200
|
||||||
|
#ifdef GTA5SYNC_APV
|
||||||
|
#include <dwmapi.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PictureDialog;
|
class PictureDialog;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +98,15 @@ protected:
|
||||||
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);
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
#if QT_VERSION >= 0x050200
|
||||||
|
#ifdef GTA5SYNC_APV
|
||||||
|
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
|
||||||
|
LRESULT HitTestNCA(HWND hWnd, LPARAM lParam);
|
||||||
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString generateCrewString();
|
QString generateCrewString();
|
||||||
|
@ -119,7 +136,7 @@ private:
|
||||||
int avatarLocY;
|
int avatarLocY;
|
||||||
int avatarSize;
|
int avatarSize;
|
||||||
QMenu *manageMenu;
|
QMenu *manageMenu;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
QPoint dragPosition;
|
QPoint dragPosition;
|
||||||
bool dragStart;
|
bool dragStart;
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "SidebarGenerator.h"
|
#include "SidebarGenerator.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QRegExp>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#if QT_VERSION < 0x050000
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QSaveFile>
|
#include <QSaveFile>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#else
|
||||||
|
#include <QDesktopWidget>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PictureExport::PictureExport()
|
PictureExport::PictureExport()
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "PictureDialog.h"
|
#include "PictureDialog.h"
|
||||||
#include "PictureWidget.h"
|
#include "PictureWidget.h"
|
||||||
#include "UiModLabel.h"
|
#include "UiModLabel.h"
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
@ -26,10 +27,6 @@
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#if QT_VERSION < 0x060000
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PictureWidget::PictureWidget(QWidget *parent) : QDialog(parent)
|
PictureWidget::PictureWidget(QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
installEventFilter(this);
|
installEventFilter(this);
|
||||||
|
@ -101,21 +98,12 @@ void PictureWidget::setImage(QImage image_)
|
||||||
|
|
||||||
void PictureWidget::updateWindowSize(int screenID)
|
void PictureWidget::updateWindowSize(int screenID)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
Q_UNUSED(screenID)
|
|
||||||
QRect desktopRect = QApplication::screenAt(pos())->geometry();
|
|
||||||
move(desktopRect.x(), desktopRect.y());
|
|
||||||
resize(desktopRect.width(), desktopRect.height());
|
|
||||||
showFullScreen();
|
|
||||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(desktopRect.width(), desktopRect.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
|
||||||
#else
|
|
||||||
if (screenID == QApplication::desktop()->screenNumber(this))
|
if (screenID == QApplication::desktop()->screenNumber(this))
|
||||||
{
|
{
|
||||||
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
||||||
move(desktopRect.x(), desktopRect.y());
|
this->move(desktopRect.x(), desktopRect.y());
|
||||||
resize(desktopRect.width(), desktopRect.height());
|
this->resize(desktopRect.width(), desktopRect.height());
|
||||||
showFullScreen();
|
this->showFullScreen();
|
||||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(desktopRect.width(), desktopRect.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(desktopRect.width(), desktopRect.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,32 +73,12 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
|
||||||
// Set Icon for Manage Buttons
|
// Set Icon for Manage Buttons
|
||||||
if (QIcon::hasThemeIcon("go-previous") && QIcon::hasThemeIcon("go-next") && QIcon::hasThemeIcon("list-add"))
|
if (QIcon::hasThemeIcon("go-previous") && QIcon::hasThemeIcon("go-next") && QIcon::hasThemeIcon("list-add"))
|
||||||
{
|
{
|
||||||
#if QT_VERSION < 0x050600
|
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
|
||||||
if (screenRatio != 1) {
|
|
||||||
QSize iconSize = ui->cmdMakeAv->iconSize();
|
|
||||||
iconSize = QSize(iconSize.width() * screenRatio, iconSize.height() * screenRatio);
|
|
||||||
ui->cmdMakeAv->setIconSize(iconSize);
|
|
||||||
ui->cmdMakeSe->setIconSize(iconSize);
|
|
||||||
ui->cmdMakeAd->setIconSize(iconSize);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ui->cmdMakeAv->setIcon(QIcon::fromTheme("go-previous"));
|
ui->cmdMakeAv->setIcon(QIcon::fromTheme("go-previous"));
|
||||||
ui->cmdMakeSe->setIcon(QIcon::fromTheme("go-next"));
|
ui->cmdMakeSe->setIcon(QIcon::fromTheme("go-next"));
|
||||||
ui->cmdMakeAd->setIcon(QIcon::fromTheme("list-add"));
|
ui->cmdMakeAd->setIcon(QIcon::fromTheme("list-add"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if QT_VERSION < 0x050600
|
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
|
||||||
if (screenRatio != 1) {
|
|
||||||
QSize iconSize = ui->cmdMakeAv->iconSize();
|
|
||||||
iconSize = QSize(iconSize.width() * screenRatio, iconSize.height() * screenRatio);
|
|
||||||
ui->cmdMakeAv->setIconSize(iconSize);
|
|
||||||
ui->cmdMakeSe->setIconSize(iconSize);
|
|
||||||
ui->cmdMakeAd->setIconSize(iconSize);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ui->cmdMakeAv->setIcon(QIcon(":/img/back.svgz"));
|
ui->cmdMakeAv->setIcon(QIcon(":/img/back.svgz"));
|
||||||
ui->cmdMakeSe->setIcon(QIcon(":/img/next.svgz"));
|
ui->cmdMakeSe->setIcon(QIcon(":/img/next.svgz"));
|
||||||
ui->cmdMakeAd->setIcon(QIcon(":/img/add.svgz"));
|
ui->cmdMakeAd->setIcon(QIcon(":/img/add.svgz"));
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QRegExp>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
@ -263,14 +264,14 @@ void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||||
#else
|
#else
|
||||||
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
||||||
#endif
|
#endif
|
||||||
int picIndex = pictureKeyList.indexOf(widgetKey);
|
int picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
||||||
ui->vlSnapmatic->insertWidget(picIndex, proWidget);
|
ui->vlSnapmatic->insertWidget(picIndex, proWidget);
|
||||||
|
|
||||||
QApplication::processEvents();
|
qApp->processEvents();
|
||||||
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,15 +284,11 @@ void ProfileInterface::insertSavegameIPI(QWidget *widget)
|
||||||
QString widgetKey = widgets[proWidget];
|
QString widgetKey = widgets[proWidget];
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
QStringList savegameKeyList = widgetsKeyList.filter("SGD", Qt::CaseSensitive);
|
QStringList savegameKeyList = widgetsKeyList.filter("SGD", Qt::CaseSensitive);
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
std::sort(savegameKeyList.begin(), savegameKeyList.end());
|
|
||||||
#else
|
|
||||||
qSort(savegameKeyList.begin(), savegameKeyList.end());
|
qSort(savegameKeyList.begin(), savegameKeyList.end());
|
||||||
#endif
|
int sgdIndex = savegameKeyList.indexOf(QRegExp(widgetKey));
|
||||||
int sgdIndex = savegameKeyList.indexOf(widgetKey);
|
|
||||||
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
|
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
|
||||||
|
|
||||||
QApplication::processEvents();
|
qApp->processEvents();
|
||||||
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +303,7 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||||
#else
|
#else
|
||||||
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
||||||
#endif
|
#endif
|
||||||
|
@ -317,7 +314,7 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picIndex = pictureKeyList.indexOf(widgetKey);
|
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
||||||
}
|
}
|
||||||
picIndex++;
|
picIndex++;
|
||||||
if (pictureKeyList.length() > picIndex)
|
if (pictureKeyList.length() > picIndex)
|
||||||
|
@ -341,7 +338,7 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||||
#else
|
#else
|
||||||
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
||||||
#endif
|
#endif
|
||||||
|
@ -352,7 +349,7 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picIndex = pictureKeyList.indexOf(widgetKey);
|
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
||||||
}
|
}
|
||||||
if (picIndex > 0)
|
if (picIndex > 0)
|
||||||
{
|
{
|
||||||
|
@ -372,12 +369,7 @@ void ProfileInterface::sortingProfileInterface()
|
||||||
ui->vlSnapmatic->setEnabled(false);
|
ui->vlSnapmatic->setEnabled(false);
|
||||||
|
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
std::sort(widgetsKeyList.begin(), widgetsKeyList.end());
|
|
||||||
#else
|
|
||||||
qSort(widgetsKeyList.begin(), widgetsKeyList.end());
|
qSort(widgetsKeyList.begin(), widgetsKeyList.end());
|
||||||
#endif
|
|
||||||
|
|
||||||
for (QString widgetKey : widgetsKeyList)
|
for (QString widgetKey : widgetsKeyList)
|
||||||
{
|
{
|
||||||
|
@ -395,7 +387,7 @@ void ProfileInterface::sortingProfileInterface()
|
||||||
ui->vlSavegame->setEnabled(true);
|
ui->vlSavegame->setEnabled(true);
|
||||||
ui->vlSnapmatic->setEnabled(true);
|
ui->vlSnapmatic->setEnabled(true);
|
||||||
|
|
||||||
QApplication::processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::profileLoaded_p()
|
void ProfileInterface::profileLoaded_p()
|
||||||
|
@ -697,8 +689,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QString customImageTitle;
|
QString customImageTitle;
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
QPixmap snapmaticPixmap(960, 536);
|
||||||
QPixmap snapmaticPixmap(snapmaticResolution);
|
|
||||||
snapmaticPixmap.fill(Qt::black);
|
snapmaticPixmap.fill(Qt::black);
|
||||||
QPainter snapmaticPainter(&snapmaticPixmap);
|
QPainter snapmaticPainter(&snapmaticPixmap);
|
||||||
if (snapmaticImage.height() == snapmaticImage.width())
|
if (snapmaticImage.height() == snapmaticImage.width())
|
||||||
|
@ -725,15 +716,15 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
||||||
// Picture mode
|
// Picture mode
|
||||||
int diffWidth = 0;
|
int diffWidth = 0;
|
||||||
int diffHeight = 0;
|
int diffHeight = 0;
|
||||||
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
snapmaticImage = snapmaticImage.scaled(960, 536, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
if (snapmaticImage.width() != snapmaticResolution.height())
|
if (snapmaticImage.width() != 960)
|
||||||
{
|
{
|
||||||
diffWidth = snapmaticResolution.height() - snapmaticImage.width();
|
diffWidth = 960 - snapmaticImage.width();
|
||||||
diffWidth = diffWidth / 2;
|
diffWidth = diffWidth / 2;
|
||||||
}
|
}
|
||||||
else if (snapmaticImage.height() != snapmaticResolution.width())
|
else if (snapmaticImage.height() != 536)
|
||||||
{
|
{
|
||||||
diffHeight = snapmaticResolution.width() - snapmaticImage.height();
|
diffHeight = 536 - snapmaticImage.height();
|
||||||
diffHeight = diffHeight / 2;
|
diffHeight = diffHeight / 2;
|
||||||
}
|
}
|
||||||
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, snapmaticImage);
|
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, snapmaticImage);
|
||||||
|
@ -760,11 +751,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
||||||
cEnough++;
|
cEnough++;
|
||||||
}
|
}
|
||||||
spJson.createdDateTime = importDateTime;
|
spJson.createdDateTime = importDateTime;
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
spJson.createdTimestamp = QString::number(spJson.createdDateTime.toSecsSinceEpoch()).toUInt();
|
|
||||||
#else
|
|
||||||
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
||||||
#endif
|
|
||||||
picture->setSnapmaticProperties(spJson);
|
picture->setSnapmaticProperties(spJson);
|
||||||
picture->setPicFileName(QString("PRDR3%1").arg(QString::number(spJson.uid)));
|
picture->setPicFileName(QString("PRDR3%1").arg(QString::number(spJson.uid)));
|
||||||
picture->setPictureTitle(customImageTitle);
|
picture->setPictureTitle(customImageTitle);
|
||||||
|
@ -818,11 +805,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
||||||
cEnough++;
|
cEnough++;
|
||||||
}
|
}
|
||||||
spJson.createdDateTime = importDateTime;
|
spJson.createdDateTime = importDateTime;
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
spJson.createdTimestamp = QString::number(spJson.createdDateTime.toSecsSinceEpoch()).toUInt();
|
|
||||||
#else
|
|
||||||
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
||||||
#endif
|
|
||||||
picture->setSnapmaticProperties(spJson);
|
picture->setSnapmaticProperties(spJson);
|
||||||
picture->setPicFileName(QString("PRDR3%1").arg(QString::number(spJson.uid)));
|
picture->setPicFileName(QString("PRDR3%1").arg(QString::number(spJson.uid)));
|
||||||
picture->setPictureTitle(importDialog->getImageTitle());
|
picture->setPictureTitle(importDialog->getImageTitle());
|
||||||
|
@ -1067,11 +1050,7 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
|
||||||
cEnough++;
|
cEnough++;
|
||||||
}
|
}
|
||||||
spJson.createdDateTime = importDateTime;
|
spJson.createdDateTime = importDateTime;
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
spJson.createdTimestamp = QString::number(spJson.createdDateTime.toSecsSinceEpoch()).toUInt();
|
|
||||||
#else
|
|
||||||
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
||||||
#endif
|
|
||||||
picture->setSnapmaticProperties(spJson);
|
picture->setSnapmaticProperties(spJson);
|
||||||
picture->setPicFileName(QString("PRDR3%1").arg(QString::number(spJson.uid)));
|
picture->setPicFileName(QString("PRDR3%1").arg(QString::number(spJson.uid)));
|
||||||
picture->setPictureTitle(importDialog->getImageTitle());
|
picture->setPictureTitle(importDialog->getImageTitle());
|
||||||
|
@ -1115,11 +1094,7 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
|
||||||
// Update Snapmatic uid
|
// Update Snapmatic uid
|
||||||
snapmaticProperties.uid = getRandomUid();
|
snapmaticProperties.uid = getRandomUid();
|
||||||
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
|
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
snapmaticProperties.createdTimestamp = QString::number(snapmaticProperties.createdDateTime.toSecsSinceEpoch()).toUInt();
|
|
||||||
#else
|
|
||||||
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
|
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
|
||||||
#endif
|
|
||||||
bool fExists = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid));
|
bool fExists = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid));
|
||||||
bool fExistsBackup = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".bak");
|
bool fExistsBackup = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".bak");
|
||||||
bool fExistsHidden = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".hidden");
|
bool fExistsHidden = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".hidden");
|
||||||
|
@ -1156,11 +1131,7 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
|
||||||
// Update Snapmatic uid
|
// Update Snapmatic uid
|
||||||
snapmaticProperties.uid = getRandomUid();
|
snapmaticProperties.uid = getRandomUid();
|
||||||
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
|
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
snapmaticProperties.createdTimestamp = QString::number(snapmaticProperties.createdDateTime.toSecsSinceEpoch()).toUInt();
|
|
||||||
#else
|
|
||||||
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
|
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
|
||||||
#endif
|
|
||||||
bool fExists = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid));
|
bool fExists = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid));
|
||||||
bool fExistsBackup = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".bak");
|
bool fExistsBackup = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".bak");
|
||||||
bool fExistsHidden = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".hidden");
|
bool fExistsHidden = QFile::exists(profileFolder % "/PRDR3" % QString::number(snapmaticProperties.uid) % ".hidden");
|
||||||
|
@ -1333,7 +1304,7 @@ void ProfileInterface::exportSelected()
|
||||||
|
|
||||||
QString ExportPreSpan;
|
QString ExportPreSpan;
|
||||||
QString ExportPostSpan;
|
QString ExportPostSpan;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
ExportPreSpan = "<span style=\"color: #003399; font-size: 12pt\">";
|
ExportPreSpan = "<span style=\"color: #003399; font-size: 12pt\">";
|
||||||
ExportPostSpan = "</span>";
|
ExportPostSpan = "</span>";
|
||||||
#else
|
#else
|
||||||
|
@ -1656,7 +1627,7 @@ void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
|
||||||
contextMenuOpened = true;
|
contextMenuOpened = true;
|
||||||
contextMenu.exec(ev->globalPos());
|
contextMenu.exec(ev->globalPos());
|
||||||
contextMenuOpened = false;
|
contextMenuOpened = false;
|
||||||
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
|
hoverProfileWidgetCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
|
void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
|
||||||
|
@ -1689,7 +1660,7 @@ void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
|
||||||
contextMenuOpened = true;
|
contextMenuOpened = true;
|
||||||
contextMenu.exec(ev->globalPos());
|
contextMenu.exec(ev->globalPos());
|
||||||
contextMenuOpened = false;
|
contextMenuOpened = false;
|
||||||
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
|
hoverProfileWidgetCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::on_saProfileContent_dropped(const QMimeData *mimeData)
|
void ProfileInterface::on_saProfileContent_dropped(const QMimeData *mimeData)
|
||||||
|
@ -1810,23 +1781,19 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
|
else if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::WindowActivate)
|
||||||
{
|
{
|
||||||
if ((watched->objectName() == "SavegameWidget" || watched->objectName() == "SnapmaticWidget") && isProfileLoaded)
|
if ((watched->objectName() == "SavegameWidget" || watched->objectName() == "SnapmaticWidget") && isProfileLoaded)
|
||||||
{
|
{
|
||||||
ProfileWidget *pWidget = nullptr;
|
ProfileWidget *pWidget = nullptr;
|
||||||
QMap<ProfileWidget*, QString>::const_iterator it = widgets.constBegin();
|
for (ProfileWidget *widget : widgets.keys())
|
||||||
QMap<ProfileWidget*, QString>::const_iterator end = widgets.constEnd();
|
|
||||||
while (it != end)
|
|
||||||
{
|
{
|
||||||
ProfileWidget *widget = it.key();
|
|
||||||
QPoint mousePos = widget->mapFromGlobal(QCursor::pos());
|
QPoint mousePos = widget->mapFromGlobal(QCursor::pos());
|
||||||
if (widget->rect().contains(mousePos))
|
if (widget->rect().contains(mousePos))
|
||||||
{
|
{
|
||||||
pWidget = widget;
|
pWidget = widget;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
it++;
|
|
||||||
}
|
}
|
||||||
if (pWidget != nullptr)
|
if (pWidget != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -1860,7 +1827,7 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
||||||
}
|
}
|
||||||
else if (event->type() == QEvent::WindowDeactivate && isProfileLoaded)
|
else if (event->type() == QEvent::WindowDeactivate && isProfileLoaded)
|
||||||
{
|
{
|
||||||
if (previousWidget != nullptr && watched == previousWidget)
|
if (previousWidget != nullptr)
|
||||||
{
|
{
|
||||||
previousWidget->setStyleSheet(QLatin1String(""));
|
previousWidget->setStyleSheet(QLatin1String(""));
|
||||||
previousWidget = nullptr;
|
previousWidget = nullptr;
|
||||||
|
@ -1896,17 +1863,13 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
||||||
void ProfileInterface::hoverProfileWidgetCheck()
|
void ProfileInterface::hoverProfileWidgetCheck()
|
||||||
{
|
{
|
||||||
ProfileWidget *pWidget = nullptr;
|
ProfileWidget *pWidget = nullptr;
|
||||||
QMap<ProfileWidget*, QString>::const_iterator it = widgets.constBegin();
|
for (ProfileWidget *widget : widgets.keys())
|
||||||
QMap<ProfileWidget*, QString>::const_iterator end = widgets.constEnd();
|
|
||||||
while (it != end)
|
|
||||||
{
|
{
|
||||||
ProfileWidget *widget = it.key();
|
|
||||||
if (widget->underMouse())
|
if (widget->underMouse())
|
||||||
{
|
{
|
||||||
pWidget = widget;
|
pWidget = widget;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
it++;
|
|
||||||
}
|
}
|
||||||
if (pWidget != nullptr)
|
if (pWidget != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -2055,7 +2018,7 @@ void ProfileInterface::massTool(MassTool tool)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
QApplication::processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
@ -2154,7 +2117,7 @@ void ProfileInterface::massTool(MassTool tool)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
QApplication::processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
@ -2207,7 +2170,7 @@ preSelectionCrewID:
|
||||||
}
|
}
|
||||||
if (crewList.contains(QString::number(crewID)))
|
if (crewList.contains(QString::number(crewID)))
|
||||||
{
|
{
|
||||||
indexNum = crewList.indexOf(QString::number(crewID));
|
indexNum = crewList.indexOf(QRegExp(QString::number(crewID)));
|
||||||
}
|
}
|
||||||
QString newCrew = QInputDialog::getItem(this, QApplication::translate("SnapmaticEditor", "Snapmatic Crew"), QApplication::translate("SnapmaticEditor", "New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags()^Qt::Dialog^Qt::WindowMinMaxButtonsHint);
|
QString newCrew = QInputDialog::getItem(this, QApplication::translate("SnapmaticEditor", "Snapmatic Crew"), QApplication::translate("SnapmaticEditor", "New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags()^Qt::Dialog^Qt::WindowMinMaxButtonsHint);
|
||||||
if (ok && !newCrew.isEmpty())
|
if (ok && !newCrew.isEmpty())
|
||||||
|
@ -2285,7 +2248,7 @@ preSelectionCrewID:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
QApplication::processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
@ -2388,7 +2351,7 @@ preSelectionTitle:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
QApplication::processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
## rdr2view
|
## rdr2view
|
||||||
Red Dead Redemption 2 Savegame and Photo viewer/editor.
|
Red Dead Redemption 2 Savegame and Snapmatic viewer/editor
|
||||||
|
|
||||||
rdr2view is a port from [gta5view](https://gta5view.syping.de/).
|
rdr2view is ported from [gta5view](https://gta5view.syping.de/).
|
||||||
|
|
||||||
**ATTENTION: rdr2view will not be developed anymore!**
|
|
||||||
**gta5view 1.11.0 will get support for RDR 2 as soon it's done.**
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "StringParser.h"
|
#include "StringParser.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
#include <QTextCodec>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "StringParser.h"
|
#include "StringParser.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include <QStringListIterator>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
@ -437,7 +438,7 @@ void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
|
||||||
}
|
}
|
||||||
if (crewList.contains(QString::number(crewID)))
|
if (crewList.contains(QString::number(crewID)))
|
||||||
{
|
{
|
||||||
indexNum = crewList.indexOf(QString::number(crewID));
|
indexNum = crewList.indexOf(QRegExp(QString::number(crewID)));
|
||||||
}
|
}
|
||||||
QString newCrew = QInputDialog::getItem(this, tr("Snapmatic Crew"), tr("New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags());
|
QString newCrew = QInputDialog::getItem(this, tr("Snapmatic Crew"), tr("New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags());
|
||||||
if (ok && !newCrew.isEmpty())
|
if (ok && !newCrew.isEmpty())
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
#include <QTextCodec>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -32,10 +33,6 @@
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
#if QT_VERSION < 0x060000
|
|
||||||
#include <QTextCodec>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QSaveFile>
|
#include <QSaveFile>
|
||||||
#else
|
#else
|
||||||
|
@ -109,7 +106,7 @@ void SnapmaticPicture::reset()
|
||||||
jsonStr = QString();
|
jsonStr = QString();
|
||||||
|
|
||||||
// SNAPMATIC DEFAULTS
|
// SNAPMATIC DEFAULTS
|
||||||
#ifdef SNAPMATIC_NODEFAULT
|
#ifdef GTA5SYNC_NOASSIST
|
||||||
careSnapDefault = false;
|
careSnapDefault = false;
|
||||||
#else
|
#else
|
||||||
careSnapDefault = true;
|
careSnapDefault = true;
|
||||||
|
@ -436,8 +433,8 @@ QString SnapmaticPicture::getSnapmaticHeaderString(const QByteArray &snapmaticHe
|
||||||
QString SnapmaticPicture::getSnapmaticJSONString(const QByteArray &jsonBytes)
|
QString SnapmaticPicture::getSnapmaticJSONString(const QByteArray &jsonBytes)
|
||||||
{
|
{
|
||||||
QByteArray jsonUsefulBytes = jsonBytes;
|
QByteArray jsonUsefulBytes = jsonBytes;
|
||||||
jsonUsefulBytes.replace('\x00', "");
|
jsonUsefulBytes.replace('\x00', QString());
|
||||||
jsonUsefulBytes.replace('\x0c', "");
|
jsonUsefulBytes.replace('\x0c', QString());
|
||||||
return QString::fromUtf8(jsonUsefulBytes.trimmed());
|
return QString::fromUtf8(jsonUsefulBytes.trimmed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +464,7 @@ void SnapmaticPicture::updateStrings()
|
||||||
pictureStr = tr("PHOTO - %1").arg(localProperties.createdDateTime.toString("MM/dd/yy HH:mm:ss"));
|
pictureStr = tr("PHOTO - %1").arg(localProperties.createdDateTime.toString("MM/dd/yy HH:mm:ss"));
|
||||||
sortStr = localProperties.createdDateTime.toString("yyMMddHHmmss") % QString::number(localProperties.uid);
|
sortStr = localProperties.createdDateTime.toString("yyMMddHHmmss") % QString::number(localProperties.uid);
|
||||||
QString exportStr = localProperties.createdDateTime.toString("yyyyMMdd") % "-" % QString::number(localProperties.uid);
|
QString exportStr = localProperties.createdDateTime.toString("yyyyMMdd") % "-" % QString::number(localProperties.uid);
|
||||||
if (isModernFormat) { picFileName = "PRDR3" % QString::number(localProperties.uid); }
|
if (isModernFormat) { picFileName = "PRDR5" % QString::number(localProperties.uid); }
|
||||||
picExportFileName = exportStr % "_" % cmpPicTitl;
|
picExportFileName = exportStr % "_" % cmpPicTitl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,17 +516,7 @@ bool SnapmaticPicture::setImage(const QImage &picture)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (saveSuccess) {
|
if (saveSuccess) { return setPictureStream(picByteArray); }
|
||||||
saveSuccess = setPictureStream(picByteArray);
|
|
||||||
if (saveSuccess) {
|
|
||||||
SnapmaticProperties properties = getSnapmaticProperties();
|
|
||||||
properties.pictureSize = picture.size();
|
|
||||||
if (!setSnapmaticProperties(properties)) {
|
|
||||||
qDebug() << "Failed to refresh Snapmatic properties!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return saveSuccess;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1006,11 +993,7 @@ void SnapmaticPicture::parseJsonContent()
|
||||||
bool timestampOk;
|
bool timestampOk;
|
||||||
QDateTime createdTimestamp;
|
QDateTime createdTimestamp;
|
||||||
localProperties.createdTimestamp = jsonMap["creat"].toUInt(×tampOk);
|
localProperties.createdTimestamp = jsonMap["creat"].toUInt(×tampOk);
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
createdTimestamp.setSecsSinceEpoch(QString::number(localProperties.createdTimestamp).toLongLong());
|
|
||||||
#else
|
|
||||||
createdTimestamp.setTime_t(localProperties.createdTimestamp);
|
createdTimestamp.setTime_t(localProperties.createdTimestamp);
|
||||||
#endif
|
|
||||||
localProperties.createdDateTime = createdTimestamp;
|
localProperties.createdDateTime = createdTimestamp;
|
||||||
if (!timestampOk) { jsonError = true; }
|
if (!timestampOk) { jsonError = true; }
|
||||||
}
|
}
|
||||||
|
@ -1051,12 +1034,6 @@ void SnapmaticPicture::parseJsonContent()
|
||||||
else { jsonError = true; }
|
else { jsonError = true; }
|
||||||
}
|
}
|
||||||
// else { jsonIncomplete = true; } // Game release Snapmatic pictures prior May 2015 left out rsedtr, so don't force exists on that one
|
// else { jsonIncomplete = true; } // Game release Snapmatic pictures prior May 2015 left out rsedtr, so don't force exists on that one
|
||||||
// RDR 2
|
|
||||||
if (jsonObject.contains("width") && jsonObject.contains("height")) {
|
|
||||||
if (jsonObject["width"].isDouble() && jsonObject["height"].isDouble()) { localProperties.pictureSize = QSize(jsonObject["width"].toInt(), jsonObject["height"].toInt()); }
|
|
||||||
else { jsonError = true; }
|
|
||||||
}
|
|
||||||
else { jsonIncomplete = true; }
|
|
||||||
|
|
||||||
if (!jsonIncomplete && !jsonError)
|
if (!jsonIncomplete && !jsonError)
|
||||||
{
|
{
|
||||||
|
@ -1103,10 +1080,6 @@ bool SnapmaticPicture::setSnapmaticProperties(SnapmaticProperties properties)
|
||||||
jsonObject["drctr"] = properties.isFromDirector;
|
jsonObject["drctr"] = properties.isFromDirector;
|
||||||
jsonObject["rsedtr"] = properties.isFromRSEditor;
|
jsonObject["rsedtr"] = properties.isFromRSEditor;
|
||||||
|
|
||||||
// RDR 2
|
|
||||||
jsonObject["width"] = properties.pictureSize.width();
|
|
||||||
jsonObject["height"] = properties.pictureSize.height();
|
|
||||||
|
|
||||||
jsonDocument.setObject(jsonObject);
|
jsonDocument.setObject(jsonObject);
|
||||||
|
|
||||||
if (setJsonStr(QString::fromUtf8(jsonDocument.toJson(QJsonDocument::Compact))))
|
if (setJsonStr(QString::fromUtf8(jsonDocument.toJson(QJsonDocument::Compact))))
|
||||||
|
@ -1444,13 +1417,7 @@ bool SnapmaticPicture::verifyTitleChar(const QChar &titleChar)
|
||||||
QString SnapmaticPicture::parseTitleString(const QByteArray &commitBytes, int maxLength)
|
QString SnapmaticPicture::parseTitleString(const QByteArray &commitBytes, int maxLength)
|
||||||
{
|
{
|
||||||
Q_UNUSED(maxLength)
|
Q_UNUSED(maxLength)
|
||||||
#if QT_VERSION >= 0x060000
|
|
||||||
QStringDecoder strDecoder = QStringDecoder(QStringDecoder::Utf16LE);
|
|
||||||
QString retStr = strDecoder(commitBytes);
|
|
||||||
retStr = retStr.trimmed();
|
|
||||||
#else
|
|
||||||
QString retStr = QTextCodec::codecForName("UTF-16LE")->toUnicode(commitBytes).trimmed();
|
QString retStr = QTextCodec::codecForName("UTF-16LE")->toUnicode(commitBytes).trimmed();
|
||||||
#endif
|
|
||||||
retStr.remove(QChar('\x00'));
|
retStr.remove(QChar('\x00'));
|
||||||
return retStr;
|
return retStr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ struct SnapmaticProperties {
|
||||||
int size;
|
int size;
|
||||||
int crewID;
|
int crewID;
|
||||||
int streetID;
|
int streetID;
|
||||||
QSize pictureSize;
|
|
||||||
QStringList playersList;
|
QStringList playersList;
|
||||||
uint createdTimestamp;
|
uint createdTimestamp;
|
||||||
QDateTime createdDateTime;
|
QDateTime createdDateTime;
|
||||||
|
@ -121,7 +120,7 @@ public:
|
||||||
bool setVisible() { return setPictureVisible(); } // Please use setPictureVisible instead
|
bool setVisible() { return setPictureVisible(); } // Please use setPictureVisible instead
|
||||||
|
|
||||||
// PREDEFINED PROPERTIES
|
// PREDEFINED PROPERTIES
|
||||||
static QSize getSnapmaticResolution();
|
QSize getSnapmaticResolution();
|
||||||
|
|
||||||
// SNAPMATIC DEFAULTS
|
// SNAPMATIC DEFAULTS
|
||||||
bool isSnapmaticDefaultsEnforced();
|
bool isSnapmaticDefaultsEnforced();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "StringParser.h"
|
#include "StringParser.h"
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
|
#include <QTextCodec>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -48,16 +49,12 @@ QString StringParser::escapeString(const QString &toEscape)
|
||||||
QString StringParser::convertBuildedString(const QString &buildedStr)
|
QString StringParser::convertBuildedString(const QString &buildedStr)
|
||||||
{
|
{
|
||||||
QString outputStr = buildedStr;
|
QString outputStr = buildedStr;
|
||||||
outputStr.replace("APPNAME:", QString::fromUtf8(GTA5SYNC_APPSTR));
|
QByteArray sharePath = GTA5SYNC_SHARE;
|
||||||
outputStr.replace("SHAREDDIR:", QString::fromUtf8(GTA5SYNC_SHARE));
|
outputStr.replace("APPNAME:", GTA5SYNC_APPSTR);
|
||||||
outputStr.replace("RUNDIR:", QFileInfo(QApplication::applicationFilePath()).canonicalPath());
|
outputStr.replace("SHAREDDIR:", QString::fromUtf8(sharePath));
|
||||||
#if QT_VERSION >= 0x060000
|
outputStr.replace("RUNDIR:", QFileInfo(qApp->applicationFilePath()).absoluteDir().absolutePath());
|
||||||
outputStr.replace("QCONFLANG:", QLibraryInfo::path(QLibraryInfo::TranslationsPath));
|
|
||||||
outputStr.replace("QCONFPLUG:", QLibraryInfo::path(QLibraryInfo::PluginsPath));
|
|
||||||
#else
|
|
||||||
outputStr.replace("QCONFLANG:", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
outputStr.replace("QCONFLANG:", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
outputStr.replace("QCONFPLUG:", QLibraryInfo::location(QLibraryInfo::PluginsPath));
|
outputStr.replace("QCONFPLUG:", QLibraryInfo::location(QLibraryInfo::PluginsPath));
|
||||||
#endif
|
|
||||||
outputStr.replace("SEPARATOR:", QDir::separator());
|
outputStr.replace("SEPARATOR:", QDir::separator());
|
||||||
return outputStr;
|
return outputStr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#define GTA5SYNC_TELEMETRY_WEBURL ""
|
#define GTA5SYNC_TELEMETRY_WEBURL ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "intrin.h"
|
#include "intrin.h"
|
||||||
#include "d3d9.h"
|
#include "d3d9.h"
|
||||||
|
@ -228,7 +228,7 @@ QJsonDocument TelemetryClass::getSystemHardware()
|
||||||
{
|
{
|
||||||
QJsonDocument jsonDocument;
|
QJsonDocument jsonDocument;
|
||||||
QJsonObject jsonObject;
|
QJsonObject jsonObject;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
{
|
{
|
||||||
int CPUInfo[4] = {-1};
|
int CPUInfo[4] = {-1};
|
||||||
unsigned nExIds, ic = 0;
|
unsigned nExIds, ic = 0;
|
||||||
|
|
|
@ -63,11 +63,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
{
|
{
|
||||||
app->installTranslator(&inQtTranslator);
|
app->installTranslator(&inQtTranslator);
|
||||||
}
|
}
|
||||||
#if QT_VERSION <= 0x060000
|
|
||||||
QLocale::setDefault(QLocale(currentLanguage));
|
|
||||||
#else
|
|
||||||
QLocale::setDefault(currentLanguage);
|
QLocale::setDefault(currentLanguage);
|
||||||
#endif
|
|
||||||
isLangLoaded = true;
|
isLangLoaded = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -151,11 +147,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
{
|
{
|
||||||
app->installTranslator(&inQtTranslator);
|
app->installTranslator(&inQtTranslator);
|
||||||
}
|
}
|
||||||
#if QT_VERSION <= 0x060000
|
|
||||||
QLocale::setDefault(QLocale(currentLanguage));
|
|
||||||
#else
|
|
||||||
QLocale::setDefault(currentLanguage);
|
QLocale::setDefault(currentLanguage);
|
||||||
#endif
|
|
||||||
isLangLoaded = true;
|
isLangLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,11 +176,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
{
|
{
|
||||||
app->installTranslator(&inQtTranslator);
|
app->installTranslator(&inQtTranslator);
|
||||||
}
|
}
|
||||||
#if QT_VERSION <= 0x060000
|
|
||||||
QLocale::setDefault(QLocale(currentLanguage));
|
|
||||||
#else
|
|
||||||
QLocale::setDefault(currentLanguage);
|
QLocale::setDefault(currentLanguage);
|
||||||
#endif
|
|
||||||
isLangLoaded = true;
|
isLangLoaded = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -207,11 +195,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
{
|
{
|
||||||
app->installTranslator(&inQtTranslator);
|
app->installTranslator(&inQtTranslator);
|
||||||
}
|
}
|
||||||
#if QT_VERSION <= 0x060000
|
|
||||||
QLocale::setDefault(QLocale(currentLanguage));
|
|
||||||
#else
|
|
||||||
QLocale::setDefault(currentLanguage);
|
QLocale::setDefault(currentLanguage);
|
||||||
#endif
|
|
||||||
isLangLoaded = true;
|
isLangLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,11 +219,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
{
|
{
|
||||||
app->installTranslator(&inQtTranslator);
|
app->installTranslator(&inQtTranslator);
|
||||||
}
|
}
|
||||||
#if QT_VERSION <= 0x060000
|
|
||||||
QLocale::setDefault(QLocale(currentLanguage));
|
|
||||||
#else
|
|
||||||
QLocale::setDefault(currentLanguage);
|
QLocale::setDefault(currentLanguage);
|
||||||
#endif
|
|
||||||
isLangLoaded = true;
|
isLangLoaded = true;
|
||||||
}
|
}
|
||||||
else if (!trLoadSuccess)
|
else if (!trLoadSuccess)
|
||||||
|
@ -256,11 +236,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
{
|
{
|
||||||
app->installTranslator(&inQtTranslator);
|
app->installTranslator(&inQtTranslator);
|
||||||
}
|
}
|
||||||
#if QT_VERSION <= 0x060000
|
|
||||||
QLocale::setDefault(QLocale(currentLanguage));
|
|
||||||
#else
|
|
||||||
QLocale::setDefault(currentLanguage);
|
QLocale::setDefault(currentLanguage);
|
||||||
#endif
|
|
||||||
isLangLoaded = true;
|
isLangLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,21 +40,14 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QTimer>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, MessageThread *threadMessage, QWidget *parent) :
|
|
||||||
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), threadMessage(threadMessage),
|
|
||||||
ui(new Ui::UserInterface)
|
|
||||||
#else
|
|
||||||
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
|
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
|
||||||
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
|
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
|
||||||
ui(new Ui::UserInterface)
|
ui(new Ui::UserInterface)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
contentMode = 0;
|
contentMode = 0;
|
||||||
|
@ -335,11 +328,7 @@ void UserInterface::closeProfile_p()
|
||||||
void UserInterface::closeEvent(QCloseEvent *ev)
|
void UserInterface::closeEvent(QCloseEvent *ev)
|
||||||
{
|
{
|
||||||
Q_UNUSED(ev)
|
Q_UNUSED(ev)
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
threadMessage->terminateThread();
|
|
||||||
#else
|
|
||||||
threadDB->terminateThread();
|
threadDB->terminateThread();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserInterface::~UserInterface()
|
UserInterface::~UserInterface()
|
||||||
|
@ -614,119 +603,6 @@ void UserInterface::settingsApplied(int _contentMode, bool languageChanged)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
void UserInterface::messagesArrived(const QJsonObject &object)
|
|
||||||
{
|
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
|
||||||
settings.beginGroup("Messages");
|
|
||||||
QJsonObject::const_iterator it = object.constBegin();
|
|
||||||
QJsonObject::const_iterator end = object.constEnd();
|
|
||||||
QStringList messages;
|
|
||||||
while (it != end) {
|
|
||||||
const QString key = it.key();
|
|
||||||
const QJsonValue value = it.value();
|
|
||||||
bool uintOk;
|
|
||||||
uint messageId = key.toUInt(&uintOk);
|
|
||||||
if (uintOk && value.isString()) {
|
|
||||||
const QString valueStr = value.toString();
|
|
||||||
settings.setValue(QString::number(messageId), valueStr);
|
|
||||||
messages << valueStr;
|
|
||||||
}
|
|
||||||
it++;
|
|
||||||
}
|
|
||||||
settings.endGroup();
|
|
||||||
if (!messages.isEmpty())
|
|
||||||
showMessages(messages);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserInterface::showMessages(const QStringList messages)
|
|
||||||
{
|
|
||||||
QDialog *messageDialog = new QDialog(this);
|
|
||||||
messageDialog->setWindowTitle(tr("%1 - Messages").arg(GTA5SYNC_APPSTR));
|
|
||||||
messageDialog->setWindowFlags(messageDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
|
||||||
QVBoxLayout *messageLayout = new QVBoxLayout;
|
|
||||||
messageDialog->setLayout(messageLayout);
|
|
||||||
QStackedWidget *stackWidget = new QStackedWidget(messageDialog);
|
|
||||||
for (const QString message : messages) {
|
|
||||||
QLabel *messageLabel = new QLabel(messageDialog);
|
|
||||||
messageLabel->setText(message);
|
|
||||||
messageLabel->setWordWrap(true);
|
|
||||||
stackWidget->addWidget(messageLabel);
|
|
||||||
}
|
|
||||||
messageLayout->addWidget(stackWidget);
|
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
|
||||||
QPushButton *backButton = new QPushButton(messageDialog);
|
|
||||||
QPushButton *nextButton = new QPushButton(messageDialog);
|
|
||||||
if (QIcon::hasThemeIcon("go-previous") && QIcon::hasThemeIcon("go-next") && QIcon::hasThemeIcon("list-add")) {
|
|
||||||
backButton->setIcon(QIcon::fromTheme("go-previous"));
|
|
||||||
nextButton->setIcon(QIcon::fromTheme("go-next"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
backButton->setIcon(QIcon(":/img/back.svgz"));
|
|
||||||
nextButton->setIcon(QIcon(":/img/next.svgz"));
|
|
||||||
}
|
|
||||||
backButton->setEnabled(false);
|
|
||||||
if (stackWidget->count() <= 1) {
|
|
||||||
nextButton->setEnabled(false);
|
|
||||||
}
|
|
||||||
buttonLayout->addWidget(backButton);
|
|
||||||
buttonLayout->addWidget(nextButton);
|
|
||||||
buttonLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
|
||||||
QPushButton *closeButton = new QPushButton(messageDialog);
|
|
||||||
closeButton->setText(tr("&Close"));
|
|
||||||
if (QIcon::hasThemeIcon("dialog-close")) {
|
|
||||||
closeButton->setIcon(QIcon::fromTheme("dialog-close"));
|
|
||||||
}
|
|
||||||
else if (QIcon::hasThemeIcon("gtk-close")) {
|
|
||||||
closeButton->setIcon(QIcon::fromTheme("gtk-close"));
|
|
||||||
}
|
|
||||||
buttonLayout->addWidget(closeButton);
|
|
||||||
messageLayout->addLayout(buttonLayout);
|
|
||||||
QObject::connect(backButton, &QPushButton::clicked, [stackWidget,backButton,nextButton,closeButton]() {
|
|
||||||
int index = stackWidget->currentIndex();
|
|
||||||
if (index > 0) {
|
|
||||||
index--;
|
|
||||||
stackWidget->setCurrentIndex(index);
|
|
||||||
nextButton->setEnabled(true);
|
|
||||||
if (index > 0) {
|
|
||||||
backButton->setEnabled(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
backButton->setEnabled(false);
|
|
||||||
closeButton->setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
QObject::connect(nextButton, &QPushButton::clicked, [stackWidget,backButton,nextButton,closeButton]() {
|
|
||||||
int index = stackWidget->currentIndex();
|
|
||||||
if (index < stackWidget->count()-1) {
|
|
||||||
index++;
|
|
||||||
stackWidget->setCurrentIndex(index);
|
|
||||||
backButton->setEnabled(true);
|
|
||||||
if (index < stackWidget->count()-1) {
|
|
||||||
nextButton->setEnabled(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nextButton->setEnabled(false);
|
|
||||||
closeButton->setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
QObject::connect(closeButton, &QPushButton::clicked, messageDialog, &QDialog::accept);
|
|
||||||
QObject::connect(messageDialog, &QDialog::finished, messageDialog, &QDialog::deleteLater);
|
|
||||||
QTimer::singleShot(0, closeButton, SLOT(setFocus()));
|
|
||||||
messageDialog->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserInterface::updateCacheId(uint cacheId)
|
|
||||||
{
|
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
|
||||||
settings.beginGroup("Messages");
|
|
||||||
settings.setValue("CacheId", cacheId);
|
|
||||||
settings.endGroup();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
||||||
{
|
{
|
||||||
QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select RDR 2 Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select RDR 2 Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||||
|
|
|
@ -31,10 +31,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
#include "MessageThread.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class UserInterface;
|
class UserInterface;
|
||||||
}
|
}
|
||||||
|
@ -43,11 +39,7 @@ class UserInterface : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, MessageThread *messageThread, QWidget *parent = 0);
|
|
||||||
#else
|
|
||||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||||
#endif
|
|
||||||
void setupDirEnv();
|
void setupDirEnv();
|
||||||
~UserInterface();
|
~UserInterface();
|
||||||
|
|
||||||
|
@ -75,11 +67,6 @@ private slots:
|
||||||
void on_actionSet_Crew_triggered();
|
void on_actionSet_Crew_triggered();
|
||||||
void on_actionSet_Title_triggered();
|
void on_actionSet_Title_triggered();
|
||||||
void settingsApplied(int contentMode, bool languageChanged);
|
void settingsApplied(int contentMode, bool languageChanged);
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
void messagesArrived(const QJsonObject &object);
|
|
||||||
void showMessages(const QStringList messages);
|
|
||||||
void updateCacheId(uint cacheId);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *ev);
|
void closeEvent(QCloseEvent *ev);
|
||||||
|
@ -88,9 +75,6 @@ private:
|
||||||
ProfileDatabase *profileDB;
|
ProfileDatabase *profileDB;
|
||||||
CrewDatabase *crewDB;
|
CrewDatabase *crewDB;
|
||||||
DatabaseThread *threadDB;
|
DatabaseThread *threadDB;
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
MessageThread *threadMessage;
|
|
||||||
#endif
|
|
||||||
Ui::UserInterface *ui;
|
Ui::UserInterface *ui;
|
||||||
ProfileInterface *profileUI;
|
ProfileInterface *profileUI;
|
||||||
QList<QPushButton*> profileBtns;
|
QList<QPushButton*> profileBtns;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "imagecropper.h"
|
#include "imagecropper.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
|
|
||||||
#include <QPainterPath>
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
|
10
config.h
10
config.h
|
@ -44,7 +44,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GTA5SYNC_APPVER
|
#ifndef GTA5SYNC_APPVER
|
||||||
#define GTA5SYNC_APPVER "0.5.0"
|
#define GTA5SYNC_APPVER "0.2.0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
|
@ -107,16 +107,22 @@
|
||||||
#define GTA5SYNC_INLANG ":/tr"
|
#define GTA5SYNC_INLANG ":/tr"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
#ifndef GTA5SYNC_SHARE
|
#ifndef GTA5SYNC_SHARE
|
||||||
#define GTA5SYNC_SHARE "RUNDIR:"
|
#define GTA5SYNC_SHARE "RUNDIR:"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GTA5SYNC_LANG
|
#ifndef GTA5SYNC_LANG
|
||||||
#define GTA5SYNC_LANG "SHAREDDIR:SEPARATOR:lang"
|
#define GTA5SYNC_LANG "SHAREDDIR:SEPARATOR:lang"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GTA5SYNC_PLUG
|
#ifndef GTA5SYNC_PLUG
|
||||||
#define GTA5SYNC_PLUG "RUNDIR:SEPARATOR:plugins"
|
#define GTA5SYNC_PLUG "RUNDIR:SEPARATOR:plugins"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GTA5SYNC_WINRT
|
||||||
|
#undef GTA5SYNC_WIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GTA5SYNC_COMPILER
|
#ifndef GTA5SYNC_COMPILER
|
||||||
|
|
53
main.cpp
53
main.cpp
|
@ -31,6 +31,7 @@
|
||||||
#include "IconLoader.h"
|
#include "IconLoader.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
@ -53,19 +54,11 @@
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
#if QT_VERSION < 0x060000
|
#ifdef GTA5SYNC_WIN
|
||||||
#include <QDesktopWidget>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
#include "MessageThread.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GTA5SYNC_TELEMETRY
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
#include "TelemetryClass.h"
|
#include "TelemetryClass.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,16 +66,16 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
#if QT_VERSION < 0x060000
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setApplicationName(GTA5SYNC_APPSTR);
|
a.setApplicationName(GTA5SYNC_APPSTR);
|
||||||
a.setApplicationVersion(GTA5SYNC_APPVER);
|
a.setApplicationVersion(GTA5SYNC_APPVER);
|
||||||
a.setQuitOnLastWindowClosed(false);
|
a.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
|
QResource::registerResource(":/global/global.rcc");
|
||||||
|
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
settings.beginGroup("Startup");
|
settings.beginGroup("Startup");
|
||||||
|
|
||||||
|
@ -106,12 +99,25 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GTA5SYNC_WIN
|
||||||
#if QT_VERSION >= 0x050400
|
#if QT_VERSION >= 0x050400
|
||||||
bool alwaysUseMessageFont = settings.value("AlwaysUseMessageFont", false).toBool();
|
bool alwaysUseMessageFont = settings.value("AlwaysUseMessageFont", false).toBool();
|
||||||
if (QSysInfo::windowsVersion() >= 0x0080 || alwaysUseMessageFont)
|
if (QSysInfo::windowsVersion() >= 0x0080 || alwaysUseMessageFont)
|
||||||
{
|
{
|
||||||
a.setFont(QApplication::font("QMenu"));
|
// Get Windows Font
|
||||||
|
NONCLIENTMETRICS ncm;
|
||||||
|
ncm.cbSize = sizeof(ncm);
|
||||||
|
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
|
||||||
|
LOGFONTW uiFont = ncm.lfMessageFont;
|
||||||
|
QString uiFontStr(QString::fromStdWString(std::wstring(uiFont.lfFaceName)));
|
||||||
|
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << QApplication::tr("Font") << QApplication::tr("Selected Font: %1").arg(uiFontStr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Set Application Font
|
||||||
|
QFont appFont(uiFontStr, 9);
|
||||||
|
a.setFont(appFont);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -254,7 +260,9 @@ int main(int argc, char *argv[])
|
||||||
bool readOk = picture.readingPictureFromFile(arg1);
|
bool readOk = picture.readingPictureFromFile(arg1);
|
||||||
picDialog.setWindowIcon(IconLoader::loadingAppIcon());
|
picDialog.setWindowIcon(IconLoader::loadingAppIcon());
|
||||||
picDialog.setSnapmaticPicture(&picture, readOk);
|
picDialog.setSnapmaticPicture(&picture, readOk);
|
||||||
|
#ifndef Q_OS_LINUX
|
||||||
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::Dialog^Qt::Window);
|
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::Dialog^Qt::Window);
|
||||||
|
#endif
|
||||||
|
|
||||||
int crewID = picture.getSnapmaticProperties().crewID;
|
int crewID = picture.getSnapmaticProperties().crewID;
|
||||||
if (crewID != 0) { crewDB.addCrew(crewID); }
|
if (crewID != 0) { crewDB.addCrew(crewID); }
|
||||||
|
@ -299,26 +307,7 @@ int main(int argc, char *argv[])
|
||||||
QObject::connect(&threadDB, SIGNAL(finished()), &a, SLOT(quit()));
|
QObject::connect(&threadDB, SIGNAL(finished()), &a, SLOT(quit()));
|
||||||
threadDB.start();
|
threadDB.start();
|
||||||
|
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
uint cacheId;
|
|
||||||
{
|
|
||||||
QSettings messageSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
|
||||||
messageSettings.beginGroup("Messages");
|
|
||||||
cacheId = messageSettings.value("CacheId", 0).toUInt();
|
|
||||||
messageSettings.endGroup();
|
|
||||||
}
|
|
||||||
MessageThread threadMessage(cacheId);
|
|
||||||
QObject::connect(&threadMessage, SIGNAL(finished()), &threadDB, SLOT(terminateThread()));
|
|
||||||
threadMessage.start();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GTA5SYNC_MOTD
|
|
||||||
UserInterface uiWindow(&profileDB, &crewDB, &threadDB, &threadMessage);
|
|
||||||
QObject::connect(&threadMessage, SIGNAL(messagesArrived(QJsonObject)), &uiWindow, SLOT(messagesArrived(QJsonObject)));
|
|
||||||
QObject::connect(&threadMessage, SIGNAL(updateCacheId(uint)), &uiWindow, SLOT(updateCacheId(uint)));
|
|
||||||
#else
|
|
||||||
UserInterface uiWindow(&profileDB, &crewDB, &threadDB);
|
UserInterface uiWindow(&profileDB, &crewDB, &threadDB);
|
||||||
#endif
|
|
||||||
uiWindow.setWindowIcon(IconLoader::loadingAppIcon());
|
uiWindow.setWindowIcon(IconLoader::loadingAppIcon());
|
||||||
uiWindow.setupDirEnv();
|
uiWindow.setupDirEnv();
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
|
|
|
@ -199,11 +199,10 @@ QString QJsonDocument::escapeString(const QString &s) const {
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Name: toJson
|
// Name: toJson
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int indent) const {
|
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format) const {
|
||||||
|
|
||||||
QString b;
|
QString b;
|
||||||
QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text);
|
QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text);
|
||||||
bool compact = (format == JsonFormat::Compact);
|
|
||||||
|
|
||||||
switch(v.type()) {
|
switch(v.type()) {
|
||||||
case QJsonValue::Null:
|
case QJsonValue::Null:
|
||||||
|
@ -229,43 +228,37 @@ QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int indent
|
||||||
case QJsonValue::Array:
|
case QJsonValue::Array:
|
||||||
{
|
{
|
||||||
const QJsonArray a = v.toArray();
|
const QJsonArray a = v.toArray();
|
||||||
ss << (compact ? "[" : "[\n");
|
ss << "[";
|
||||||
if(!a.empty()) {
|
if(!a.empty()) {
|
||||||
QJsonArray::const_iterator it = a.begin();
|
QJsonArray::const_iterator it = a.begin();
|
||||||
QJsonArray::const_iterator e = a.end();
|
QJsonArray::const_iterator e = a.end();
|
||||||
|
|
||||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
ss << toJson(*it++, format);
|
||||||
ss << toJson(*it++, format, indent+1);
|
|
||||||
|
|
||||||
for(;it != e; ++it) {
|
for(;it != e; ++it) {
|
||||||
ss << (compact ? "," : ",\n");
|
ss << ',';
|
||||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
ss << toJson(*it, format);
|
||||||
ss << toJson(*it, format, indent+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
indent--;
|
ss << "]";
|
||||||
ss << (compact ? "]" : QString("\n%1]").arg(QString(4*indent, ' ')));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QJsonValue::Object:
|
case QJsonValue::Object:
|
||||||
{
|
{
|
||||||
const QJsonObject o = v.toObject();
|
const QJsonObject o = v.toObject();
|
||||||
ss << (compact ? "{" : "{\n");
|
ss << "{";
|
||||||
if(!o.empty()) {
|
if(!o.empty()) {
|
||||||
QJsonObject::const_iterator it = o.begin();
|
QJsonObject::const_iterator it = o.begin();
|
||||||
QJsonObject::const_iterator e = o.end();
|
QJsonObject::const_iterator e = o.end();
|
||||||
|
|
||||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
ss << '"' << escapeString(it.key()) << "\": " << toJson(it.value(), format);
|
||||||
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
|
|
||||||
++it;
|
++it;
|
||||||
for(;it != e; ++it) {
|
for(;it != e; ++it) {
|
||||||
ss << (compact ? "," : ",\n");
|
ss << ',';
|
||||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
ss << '"' << escapeString(it.key()) << "\": " << toJson(it.value(), format);
|
||||||
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
indent--;
|
ss << "}";
|
||||||
ss << (compact ? "}" : QString("\n%1}").arg(QString(4*indent, ' ')));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QJsonValue::Undefined:
|
case QJsonValue::Undefined:
|
||||||
|
|
|
@ -88,7 +88,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setRoot(const QJsonRoot &root);
|
void setRoot(const QJsonRoot &root);
|
||||||
QString toJson(const QJsonValue &v, JsonFormat format, int indent = 1) const;
|
QString toJson(const QJsonValue &v, JsonFormat format) const;
|
||||||
QString escapeString(const QString &s) const;
|
QString escapeString(const QString &s) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
19
rdr2view.pro
19
rdr2view.pro
|
@ -40,7 +40,6 @@ SOURCES += main.cpp \
|
||||||
ImportDialog.cpp \
|
ImportDialog.cpp \
|
||||||
JsonEditorDialog.cpp \
|
JsonEditorDialog.cpp \
|
||||||
MapLocationDialog.cpp \
|
MapLocationDialog.cpp \
|
||||||
MessageThread.cpp \
|
|
||||||
OptionsDialog.cpp \
|
OptionsDialog.cpp \
|
||||||
PictureDialog.cpp \
|
PictureDialog.cpp \
|
||||||
PictureExport.cpp \
|
PictureExport.cpp \
|
||||||
|
@ -82,7 +81,6 @@ HEADERS += \
|
||||||
ImportDialog.h \
|
ImportDialog.h \
|
||||||
JsonEditorDialog.h \
|
JsonEditorDialog.h \
|
||||||
MapLocationDialog.h \
|
MapLocationDialog.h \
|
||||||
MessageThread.h \
|
|
||||||
OptionsDialog.h \
|
OptionsDialog.h \
|
||||||
PictureDialog.h \
|
PictureDialog.h \
|
||||||
PictureExport.h \
|
PictureExport.h \
|
||||||
|
@ -162,9 +160,8 @@ INCLUDEPATH += ./anpro ./pcg ./tmext ./uimod
|
||||||
|
|
||||||
# GTA5SYNC/GTA5VIEW/RDR2VIEW ONLY
|
# GTA5SYNC/GTA5VIEW/RDR2VIEW ONLY
|
||||||
|
|
||||||
DEFINES += GTA5SYNC_QMAKE # We using qmake do we?
|
DEFINES += GTA5SYNC_PROJECT # Enable exclusive gta5sync/gta5view/rdr2view functions
|
||||||
DEFINES += GTA5SYNC_PROJECT # Enable exclusive gta5sync/gta5view functions
|
DEFINES += GTA5SYNC_NOASSIST # Not assisting at proper usage of SnapmaticPicture class
|
||||||
DEFINES += SNAPMATIC_NODEFAULT # Not assisting at proper usage of SnapmaticPicture class
|
|
||||||
|
|
||||||
# WINDOWS ONLY
|
# WINDOWS ONLY
|
||||||
|
|
||||||
|
@ -238,15 +235,3 @@ contains(DEFINES, GTA5SYNC_QCONF){
|
||||||
HEADERS -= TelemetryClass.h \
|
HEADERS -= TelemetryClass.h \
|
||||||
tmext/TelemetryClassAuthenticator.h
|
tmext/TelemetryClassAuthenticator.h
|
||||||
}
|
}
|
||||||
|
|
||||||
!contains(DEFINES, GTA5SYNC_MOTD) {
|
|
||||||
SOURCES -= MessageThread.cpp
|
|
||||||
HEADERS -= MessageThread.h
|
|
||||||
} else {
|
|
||||||
lessThan(QT_MAJOR_VERSION, 5) {
|
|
||||||
SOURCES -= MessageThread.cpp
|
|
||||||
HEADERS -= MessageThread.h
|
|
||||||
DEFINES -= GTA5SYNC_MOTD
|
|
||||||
message("Messages require Qt5 or newer!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "rdr2view.exe.manifest"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 0, 5, 0, 0
|
FILEVERSION 0, 2, 0, 0
|
||||||
PRODUCTVERSION 0, 5, 0, 0
|
PRODUCTVERSION 0, 2, 0, 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", "rdr2view"
|
VALUE "FileDescription", "rdr2view"
|
||||||
VALUE "FileVersion", "0.5.0"
|
VALUE "FileVersion", "0.2.0"
|
||||||
VALUE "InternalName", "rdr2view"
|
VALUE "InternalName", "rdr2view"
|
||||||
VALUE "LegalCopyright", "Copyright © 2016-2020 Syping"
|
VALUE "LegalCopyright", "Copyright © 2016-2020 Syping"
|
||||||
VALUE "OriginalFilename", "rdr2view.exe"
|
VALUE "OriginalFilename", "rdr2view.exe"
|
||||||
VALUE "ProductName", "rdr2view"
|
VALUE "ProductName", "rdr2view"
|
||||||
VALUE "ProductVersion", "0.5.0"
|
VALUE "ProductVersion", "0.2.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
648
res/gta5sync.ts
648
res/gta5sync.ts
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
BIN
res/template.r5e
BIN
res/template.r5e
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2017-2020 Syping
|
* Copyright (C) 2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "JSHighlighter.h"
|
#include "JSHighlighter.h"
|
||||||
|
#include <QRegExp>
|
||||||
|
|
||||||
JSHighlighter::JSHighlighter(QTextDocument *parent) :
|
JSHighlighter::JSHighlighter(QTextDocument *parent) :
|
||||||
QSyntaxHighlighter(parent)
|
QSyntaxHighlighter(parent)
|
||||||
|
@ -30,61 +31,34 @@ JSHighlighter::JSHighlighter(QTextDocument *parent) :
|
||||||
keywordPatterns << "\\btrue\\b" << "\\bfalse\\b";
|
keywordPatterns << "\\btrue\\b" << "\\bfalse\\b";
|
||||||
for (QString pattern : keywordPatterns)
|
for (QString pattern : keywordPatterns)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
rule.pattern = QRegularExpression(pattern);
|
|
||||||
#else
|
|
||||||
rule.pattern = QRegExp(pattern);
|
rule.pattern = QRegExp(pattern);
|
||||||
#endif
|
|
||||||
rule.format = keywordFormat;
|
rule.format = keywordFormat;
|
||||||
highlightingRules.append(rule);
|
highlightingRules.append(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
QBrush doubleBrush(QColor::fromRgb(66, 137, 244));
|
QBrush doubleBrush(QColor::fromRgb(66, 137, 244));
|
||||||
doubleFormat.setForeground(doubleBrush);
|
doubleFormat.setForeground(doubleBrush);
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
rule.pattern = QRegularExpression("[+-]?\\d*\\.?\\d+");
|
|
||||||
#else
|
|
||||||
rule.pattern = QRegExp("[+-]?\\d*\\.?\\d+");
|
rule.pattern = QRegExp("[+-]?\\d*\\.?\\d+");
|
||||||
#endif
|
|
||||||
rule.format = doubleFormat;
|
rule.format = doubleFormat;
|
||||||
highlightingRules.append(rule);
|
highlightingRules.append(rule);
|
||||||
|
|
||||||
QBrush quotationBrush(QColor::fromRgb(66, 244, 104));
|
QBrush quotationBrush(QColor::fromRgb(66, 244, 104));
|
||||||
quotationFormat.setForeground(quotationBrush);
|
quotationFormat.setForeground(quotationBrush);
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
rule.pattern = QRegularExpression("\"[^\"]*\"");
|
|
||||||
#else
|
|
||||||
rule.pattern = QRegExp("\"[^\"]*\"");
|
rule.pattern = QRegExp("\"[^\"]*\"");
|
||||||
#endif
|
|
||||||
rule.format = quotationFormat;
|
rule.format = quotationFormat;
|
||||||
highlightingRules.append(rule);
|
highlightingRules.append(rule);
|
||||||
|
|
||||||
QBrush objectBrush(QColor::fromRgb(255, 80, 80));
|
QBrush objectBrush(QColor::fromRgb(255, 80, 80));
|
||||||
objectFormat.setForeground(objectBrush);
|
objectFormat.setForeground(objectBrush);
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
rule.pattern = QRegularExpression("\"[^\"]*\"(?=:)");
|
|
||||||
#else
|
|
||||||
rule.pattern = QRegExp("\"[^\"]*\"(?=:)");
|
rule.pattern = QRegExp("\"[^\"]*\"(?=:)");
|
||||||
#endif
|
|
||||||
rule.format = objectFormat;
|
rule.format = objectFormat;
|
||||||
highlightingRules.append(rule);
|
highlightingRules.append(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JSHighlighter::highlightBlock(const QString &text)
|
void JSHighlighter::highlightBlock(const QString &text)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
for (HighlightingRule rule : highlightingRules)
|
||||||
for (const HighlightingRule &rule : qAsConst(highlightingRules))
|
|
||||||
#else
|
|
||||||
for (const HighlightingRule &rule : highlightingRules)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
|
|
||||||
while (matchIterator.hasNext()) {
|
|
||||||
QRegularExpressionMatch match = matchIterator.next();
|
|
||||||
setFormat(match.capturedStart(), match.capturedLength(), rule.format);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
QRegExp expression(rule.pattern);
|
QRegExp expression(rule.pattern);
|
||||||
int index = expression.indexIn(text);
|
int index = expression.indexIn(text);
|
||||||
while (index >= 0)
|
while (index >= 0)
|
||||||
|
@ -93,7 +67,6 @@ void JSHighlighter::highlightBlock(const QString &text)
|
||||||
setFormat(index, length, rule.format);
|
setFormat(index, length, rule.format);
|
||||||
index = expression.indexIn(text, index + length);
|
index = expression.indexIn(text, index + length);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
setCurrentBlockState(0);
|
setCurrentBlockState(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2017-2020 Syping
|
* Copyright (C) 2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,15 +24,10 @@
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QTextFormat>
|
#include <QTextFormat>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QRegExp>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include <QRegularExpression>
|
|
||||||
#else
|
|
||||||
#include <QRegExp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class QTextDocument;
|
class QTextDocument;
|
||||||
|
|
||||||
class JSHighlighter : public QSyntaxHighlighter
|
class JSHighlighter : public QSyntaxHighlighter
|
||||||
|
@ -42,11 +37,7 @@ class JSHighlighter : public QSyntaxHighlighter
|
||||||
public:
|
public:
|
||||||
struct HighlightingRule
|
struct HighlightingRule
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
QRegularExpression pattern;
|
|
||||||
#else
|
|
||||||
QRegExp pattern;
|
QRegExp pattern;
|
||||||
#endif
|
|
||||||
QTextCharFormat format;
|
QTextCharFormat format;
|
||||||
};
|
};
|
||||||
QVector<HighlightingRule> highlightingRules;
|
QVector<HighlightingRule> highlightingRules;
|
||||||
|
|
|
@ -80,11 +80,7 @@ void UiModWidget::paintEvent(QPaintEvent *paintEvent)
|
||||||
{
|
{
|
||||||
Q_UNUSED(paintEvent)
|
Q_UNUSED(paintEvent)
|
||||||
QStyleOption opt;
|
QStyleOption opt;
|
||||||
#if QT_VERSION <= 0x060000
|
|
||||||
opt.initFrom(this);
|
|
||||||
#else
|
|
||||||
opt.init(this);
|
opt.init(this);
|
||||||
#endif
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue