Add Cayo Perico Map, optimisations
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
3ed26d4f9d
commit
0686b9a65d
|
@ -29,7 +29,11 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
|||
ui(new Ui::AboutDialog)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
#endif
|
||||
|
||||
// Build Strings
|
||||
QString appVersion = QApplication::applicationVersion();
|
||||
|
|
|
@ -47,7 +47,6 @@ endif()
|
|||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_CMAKE
|
||||
-DGTA5SYNC_PROJECT
|
||||
-DSNAPMATIC_NODEFAULT
|
||||
)
|
||||
|
||||
set(GTA5VIEW_SOURCES
|
||||
|
|
|
@ -49,7 +49,11 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
|
|||
ui(new Ui::ImportDialog)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
#endif
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->cmdOK->setDefault(true);
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
#if QT_VERSION >= 0x050200
|
||||
#include <QFontDatabase>
|
||||
#include <QDebug>
|
||||
#endif
|
||||
|
||||
#ifdef GTA5SYNC_TELEMETRY
|
||||
|
@ -40,29 +39,30 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
|
|||
ui(new Ui::JsonEditorDialog)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
setWindowFlag(Qt::WindowMinMaxButtonsHint, true);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowMinMaxButtonsHint);
|
||||
#endif
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->cmdClose->setDefault(true);
|
||||
ui->cmdClose->setFocus();
|
||||
|
||||
// Set Icon for Close Button
|
||||
if (QIcon::hasThemeIcon("dialog-close"))
|
||||
{
|
||||
if (QIcon::hasThemeIcon("dialog-close")) {
|
||||
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-close"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-close")) {
|
||||
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
|
||||
}
|
||||
|
||||
// Set Icon for Save Button
|
||||
if (QIcon::hasThemeIcon("document-save"))
|
||||
{
|
||||
if (QIcon::hasThemeIcon("document-save")) {
|
||||
ui->cmdSave->setIcon(QIcon::fromTheme("document-save"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-save"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-save")) {
|
||||
ui->cmdSave->setIcon(QIcon::fromTheme("gtk-save"));
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,7 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
|
|||
ui->hlButtons->setContentsMargins(9 * screenRatio, 0, 9 * screenRatio, 0);
|
||||
ui->vlInterface->setContentsMargins(0, 0, 0, 9 * screenRatio);
|
||||
#endif
|
||||
if (screenRatio > 1)
|
||||
{
|
||||
if (screenRatio > 1) {
|
||||
ui->lineJSON->setMinimumHeight(qRound(1 * screenRatio));
|
||||
ui->lineJSON->setMaximumHeight(qRound(1 * screenRatio));
|
||||
ui->lineJSON->setLineWidth(qRound(1 * screenRatio));
|
||||
|
@ -121,28 +120,22 @@ void JsonEditorDialog::closeEvent(QCloseEvent *ev)
|
|||
QJsonDocument jsonOriginal = QJsonDocument::fromJson(jsonCode.toUtf8());
|
||||
QString originalCode = QString::fromUtf8(jsonOriginal.toJson(QJsonDocument::Compact));
|
||||
QString newCode = QString::fromUtf8(jsonNew.toJson(QJsonDocument::Compact));
|
||||
if (newCode != originalCode)
|
||||
{
|
||||
if (newCode != originalCode) {
|
||||
QMessageBox::StandardButton button = QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("<h4>Unsaved changes detected</h4>You want to save the JSON content before you quit?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
if (button == QMessageBox::Yes)
|
||||
{
|
||||
if (saveJsonContent())
|
||||
{
|
||||
if (button == QMessageBox::Yes) {
|
||||
if (saveJsonContent()) {
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ev->ignore();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (button == QMessageBox::No)
|
||||
{
|
||||
else if (button == QMessageBox::No) {
|
||||
ev->accept();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ev->ignore();
|
||||
return;
|
||||
}
|
||||
|
@ -153,47 +146,38 @@ bool JsonEditorDialog::saveJsonContent()
|
|||
{
|
||||
QString jsonPatched = QString(ui->txtJSON->toPlainText()).replace("\t", " ");
|
||||
QJsonDocument jsonNew = QJsonDocument::fromJson(jsonPatched.toUtf8());
|
||||
if (!jsonNew.isEmpty())
|
||||
{
|
||||
if (!jsonNew.isEmpty()) {
|
||||
QJsonDocument jsonOriginal = QJsonDocument::fromJson(jsonCode.toUtf8());
|
||||
QString originalCode = QString::fromUtf8(jsonOriginal.toJson(QJsonDocument::Compact));
|
||||
QString newCode = QString::fromUtf8(jsonNew.toJson(QJsonDocument::Compact));
|
||||
if (newCode != originalCode)
|
||||
{
|
||||
if (newCode != originalCode) {
|
||||
QString currentFilePath = smpic->getPictureFilePath();
|
||||
QString originalFilePath = smpic->getOriginalPictureFilePath();
|
||||
QString backupFileName = originalFilePath % ".bak";
|
||||
if (!QFile::exists(backupFileName))
|
||||
{
|
||||
if (!QFile::exists(backupFileName)) {
|
||||
QFile::copy(currentFilePath, backupFileName);
|
||||
}
|
||||
smpic->setJsonStr(newCode, true);
|
||||
if (!smpic->isJsonOk())
|
||||
{
|
||||
if (!smpic->isJsonOk()) {
|
||||
QString lastStep = smpic->getLastStep(false);
|
||||
QString readableError;
|
||||
if (lastStep.contains("JSONINCOMPLETE") && lastStep.contains("JSONERROR"))
|
||||
{
|
||||
if (lastStep.contains("JSONINCOMPLETE") && lastStep.contains("JSONERROR")) {
|
||||
readableError = SnapmaticPicture::tr("JSON is incomplete and malformed");
|
||||
}
|
||||
else if (lastStep.contains("JSONINCOMPLETE"))
|
||||
{
|
||||
else if (lastStep.contains("JSONINCOMPLETE")) {
|
||||
readableError = SnapmaticPicture::tr("JSON is incomplete");
|
||||
}
|
||||
else if (lastStep.contains("JSONERROR"))
|
||||
{
|
||||
else if (lastStep.contains("JSONERROR")) {
|
||||
readableError = SnapmaticPicture::tr("JSON is malformed");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
readableError = tr("JSON Error");
|
||||
}
|
||||
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of %1").arg(readableError));
|
||||
smpic->setJsonStr(originalCode, true);
|
||||
return false;
|
||||
}
|
||||
if (!smpic->exportPicture(currentFilePath))
|
||||
{
|
||||
if (!smpic->exportPicture(currentFilePath)) {
|
||||
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of I/O Error"));
|
||||
smpic->setJsonStr(originalCode, true);
|
||||
return false;
|
||||
|
@ -206,8 +190,7 @@ bool JsonEditorDialog::saveJsonContent()
|
|||
telemetrySettings.beginGroup("Telemetry");
|
||||
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||
telemetrySettings.endGroup();
|
||||
if (pushUsageData && Telemetry->canPush())
|
||||
{
|
||||
if (pushUsageData && Telemetry->canPush()) {
|
||||
QJsonDocument jsonDocument;
|
||||
QJsonObject jsonObject;
|
||||
jsonObject["Type"] = "JSONEdited";
|
||||
|
@ -225,8 +208,7 @@ bool JsonEditorDialog::saveJsonContent()
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of JSON Error"));
|
||||
return false;
|
||||
}
|
||||
|
@ -240,7 +222,5 @@ void JsonEditorDialog::on_cmdClose_clicked()
|
|||
void JsonEditorDialog::on_cmdSave_clicked()
|
||||
{
|
||||
if (saveJsonContent())
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,11 @@ MapLocationDialog::MapLocationDialog(double x, double y, QWidget *parent) :
|
|||
ui(new Ui::MapLocationDialog)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
#endif
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->cmdDone->setVisible(false);
|
||||
|
@ -45,12 +49,10 @@ MapLocationDialog::MapLocationDialog(double x, double y, QWidget *parent) :
|
|||
ui->vlMapDialog->setSpacing(widgetMargin);
|
||||
setMinimumSize(500 * screenRatio, 600 * screenRatio);
|
||||
setMaximumSize(500 * screenRatio, 600 * screenRatio);
|
||||
setFixedSize(500 * screenRatio, 600 * screenRatio);
|
||||
setMouseTracking(true);
|
||||
|
||||
changeMode = false;
|
||||
propUpdate = false;
|
||||
drawPointOnMap(xpos_old, ypos_old);
|
||||
}
|
||||
|
||||
MapLocationDialog::~MapLocationDialog()
|
||||
|
@ -66,6 +68,22 @@ void MapLocationDialog::drawPointOnMap(double xpos_d, double ypos_d)
|
|||
repaint();
|
||||
}
|
||||
|
||||
void MapLocationDialog::setCayoPerico(bool isCayoPerico)
|
||||
{
|
||||
qreal screenRatio = AppEnv::screenRatio();
|
||||
p_isCayoPerico = isCayoPerico;
|
||||
if (isCayoPerico) {
|
||||
setMinimumSize(500 * screenRatio, 500 * screenRatio);
|
||||
setMaximumSize(500 * screenRatio, 500 * screenRatio);
|
||||
ui->hlMapDialog->removeItem(ui->vlMapDialog);
|
||||
ui->hlMapDialog->insertLayout(0, ui->vlMapDialog);
|
||||
ui->hlMapDialog->removeItem(ui->vlPosLayout);
|
||||
ui->hlMapDialog->addLayout(ui->vlPosLayout);
|
||||
ui->labPos->setAlignment(Qt::AlignRight);
|
||||
}
|
||||
drawPointOnMap(xpos_old, ypos_old);
|
||||
}
|
||||
|
||||
void MapLocationDialog::on_cmdChange_clicked()
|
||||
{
|
||||
qreal screenRatio = AppEnv::screenRatio();
|
||||
|
@ -85,45 +103,34 @@ void MapLocationDialog::on_cmdDone_clicked()
|
|||
{
|
||||
ui->cmdDone->setVisible(false);
|
||||
ui->cmdChange->setVisible(true);
|
||||
if (xpos_new != xpos_old || ypos_new != ypos_old)
|
||||
{
|
||||
if (xpos_new != xpos_old || ypos_new != ypos_old) {
|
||||
ui->cmdApply->setVisible(true);
|
||||
ui->cmdRevert->setVisible(true);
|
||||
}
|
||||
|
||||
setCursor(Qt::ArrowCursor);
|
||||
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);
|
||||
double x_per = x / mapPixelSize.width(); // get X %
|
||||
double y_per = y / mapPixelSize.height(); // get Y %
|
||||
double x_pos, y_pos;
|
||||
if (p_isCayoPerico) {
|
||||
x_pos = x_per * 2340; // 2340 is 100% for X (Cayo Perico)
|
||||
y_pos = y_per * -2340; // -2340 is 100% for Y (Cayo Perico)
|
||||
x_pos = x_pos + 3560; // +3560 gets corrected for X (Cayo Perico)
|
||||
y_pos = y_pos - 3980; // -4000 gets corrected for Y (Cayo Perico)
|
||||
}
|
||||
else {
|
||||
x_pos = x_per * 10000; // 10000 is 100% for X (Los Santos)
|
||||
y_pos = y_per * -12000; // -12000 is 100% for Y (Los Santos)
|
||||
x_pos = x_pos - 4000; // -4000 gets corrected for X (Los Santos)
|
||||
y_pos = y_pos + 8000; // +8000 gets corrected for Y (Los Santos)
|
||||
}
|
||||
drawPointOnMap(x_pos, y_pos);
|
||||
}
|
||||
#else
|
||||
void MapLocationDialog::updatePosFromEvent(int x, int y)
|
||||
{
|
||||
QSize mapPixelSize = size();
|
||||
int xpos_ad = x;
|
||||
int 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
void MapLocationDialog::paintEvent(QPaintEvent *ev)
|
||||
{
|
||||
|
@ -132,73 +139,110 @@ void MapLocationDialog::paintEvent(QPaintEvent *ev)
|
|||
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));
|
||||
QImage mapImage;
|
||||
if (p_isCayoPerico) {
|
||||
mapImage = QImage(":/img/mapcayoperico.jpg");
|
||||
}
|
||||
else {
|
||||
mapImage = QImage(":/img/mappreview.jpg");
|
||||
}
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
||||
painter.drawImage(QRect(QPoint(0, 0), size()), mapImage);
|
||||
|
||||
// Paint Marker
|
||||
QSize mapPixelSize = size();
|
||||
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;
|
||||
double xpos_mp, ypos_mp;
|
||||
if (p_isCayoPerico) {
|
||||
double xpos_per = xpos_new - 3560; // correct X in reserve
|
||||
double ypos_per = ypos_new + 3980; // correct y in reserve
|
||||
xpos_per = xpos_per / 2340; // divide 100% for X
|
||||
ypos_per = ypos_per / -2340; // divide 100% for Y
|
||||
xpos_mp = xpos_per * mapPixelSize.width(); // locate window width pos
|
||||
ypos_mp = ypos_per * mapPixelSize.height(); // locate window height pos
|
||||
}
|
||||
else {
|
||||
double xpos_per = xpos_new + 4000; // correct X in reserve
|
||||
double ypos_per = ypos_new - 8000; // correct y in reserve
|
||||
xpos_per = xpos_per / 10000; // divide 100% for X
|
||||
ypos_per = ypos_per / -12000; // divide 100% for Y
|
||||
xpos_mp = xpos_per * mapPixelSize.width(); // locate window width pos
|
||||
ypos_mp = ypos_per * mapPixelSize.height(); // locate window height pos
|
||||
}
|
||||
long xpos_pr, 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
|
||||
ypos_pr = ypos_mp - pointMarkerHalfSize + screenRatioPR;
|
||||
}
|
||||
else {
|
||||
xpos_pr = xpos_mp - pointMarkerHalfSize;
|
||||
ypos_pr = ypos_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);
|
||||
painter.drawPixmap(xpos_pr, ypos_pr, pointMarkerSize, pointMarkerSize, mapMarkerPixmap);
|
||||
|
||||
QDialog::paintEvent(ev);
|
||||
}
|
||||
|
||||
void MapLocationDialog::mouseMoveEvent(QMouseEvent *ev)
|
||||
{
|
||||
if (!changeMode) { ev->ignore(); }
|
||||
else if (ev->buttons() & Qt::LeftButton)
|
||||
{
|
||||
if (!changeMode) {
|
||||
ev->ignore();
|
||||
}
|
||||
else if (ev->buttons() & Qt::LeftButton) {
|
||||
#if QT_VERSION >= 0x060000
|
||||
updatePosFromEvent(ev->position().x(), ev->position().y());
|
||||
const QPointF localPos = ev->position();
|
||||
#elif QT_VERSION >= 0x050000
|
||||
const QPointF localPos = ev->localPos();
|
||||
#else
|
||||
updatePosFromEvent(ev->x(), ev->y());
|
||||
const QPoint localPos = ev->pos();
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
if (screenRatioPR != 1) {
|
||||
updatePosFromEvent(localPos.x() - screenRatioPR, localPos.y() - screenRatioPR);
|
||||
}
|
||||
else {
|
||||
updatePosFromEvent(localPos.x(), localPos.y());
|
||||
}
|
||||
#else
|
||||
updatePosFromEvent(localPos.x(), localPos.y());
|
||||
#endif
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ev->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void MapLocationDialog::mouseReleaseEvent(QMouseEvent *ev)
|
||||
{
|
||||
if (!changeMode) { ev->ignore(); }
|
||||
else if (ev->button() == Qt::LeftButton)
|
||||
{
|
||||
if (!changeMode) {
|
||||
ev->ignore();
|
||||
}
|
||||
else if (ev->button() == Qt::LeftButton) {
|
||||
#if QT_VERSION >= 0x060000
|
||||
updatePosFromEvent(ev->position().x(), ev->position().y());
|
||||
const QPointF localPos = ev->position();
|
||||
#elif QT_VERSION >= 0x050000
|
||||
const QPointF localPos = ev->localPos();
|
||||
#else
|
||||
updatePosFromEvent(ev->x(), ev->y());
|
||||
const QPointF localPos = ev->posF();
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
if (screenRatioPR != 1) {
|
||||
updatePosFromEvent(localPos.x() - screenRatioPR, localPos.y() - screenRatioPR);
|
||||
}
|
||||
else {
|
||||
updatePosFromEvent(localPos.x(), localPos.y());
|
||||
}
|
||||
#else
|
||||
updatePosFromEvent(localPos.x(), localPos.y());
|
||||
#endif
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ev->ignore();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2017 Syping
|
||||
* Copyright (C) 2017-2021 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
|
||||
|
@ -33,6 +33,7 @@ class MapLocationDialog : public QDialog
|
|||
public:
|
||||
explicit MapLocationDialog(double x, double y, QWidget *parent = 0);
|
||||
void drawPointOnMap(double x, double y);
|
||||
void setCayoPerico(bool isCayoPerico);
|
||||
bool propUpdated();
|
||||
double getXpos();
|
||||
double getYpos();
|
||||
|
@ -48,11 +49,7 @@ private slots:
|
|||
void on_cmdApply_clicked();
|
||||
void on_cmdChange_clicked();
|
||||
void on_cmdRevert_clicked();
|
||||
#if QT_VERSION >= 0x060000
|
||||
void updatePosFromEvent(double x, double y);
|
||||
#else
|
||||
void updatePosFromEvent(int x, int y);
|
||||
#endif
|
||||
void on_cmdClose_clicked();
|
||||
|
||||
private:
|
||||
|
@ -62,6 +59,7 @@ private:
|
|||
double ypos_new;
|
||||
bool propUpdate;
|
||||
bool changeMode;
|
||||
bool p_isCayoPerico;
|
||||
Ui::MapLocationDialog *ui;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,11 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
|||
ui(new Ui::OptionsDialog)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
#endif
|
||||
|
||||
// Setup User Interface
|
||||
ui->setupUi(this);
|
||||
|
|
|
@ -127,10 +127,20 @@ PictureDialog::PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, Cre
|
|||
void PictureDialog::setupPictureDialog()
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
setWindowFlag(Qt::CustomizeWindowHint, true);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint^Qt::CustomizeWindowHint);
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
// for stupid Window Manager (GNOME 3 should feel triggered)
|
||||
// for stupid Window Manager like GNOME
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::Dialog, false);
|
||||
setWindowFlag(Qt::Window, true);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Setup User Interface
|
||||
|
@ -684,7 +694,10 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
|||
#endif
|
||||
PictureWidget *pictureWidget = new PictureWidget(this); // Work!
|
||||
pictureWidget->setObjectName("PictureWidget");
|
||||
#if QT_VERSION >= 0x050600
|
||||
#if QT_VERSION >= 0x050900
|
||||
pictureWidget->setWindowFlag(Qt::FramelessWindowHint, true);
|
||||
pictureWidget->setWindowFlag(Qt::MaximizeUsingFullscreenGeometryHint, true);
|
||||
#elif QT_VERSION >= 0x050600
|
||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::MaximizeUsingFullscreenGeometryHint);
|
||||
#else
|
||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint);
|
||||
|
@ -729,13 +742,15 @@ int PictureDialog::getIndex()
|
|||
void PictureDialog::openPreviewMap()
|
||||
{
|
||||
SnapmaticPicture *picture = smpic;
|
||||
SnapmaticProperties currentProperties = picture->getSnapmaticProperties();
|
||||
MapLocationDialog *mapLocDialog;
|
||||
if (rqFullscreen && fullscreenWidget != nullptr) {
|
||||
mapLocDialog = new MapLocationDialog(picture->getSnapmaticProperties().location.x, picture->getSnapmaticProperties().location.y, fullscreenWidget);
|
||||
mapLocDialog = new MapLocationDialog(currentProperties.location.x, currentProperties.location.y, fullscreenWidget);
|
||||
}
|
||||
else {
|
||||
mapLocDialog = new MapLocationDialog(picture->getSnapmaticProperties().location.x, picture->getSnapmaticProperties().location.y, this);
|
||||
mapLocDialog = new MapLocationDialog(currentProperties.location.x, currentProperties.location.y, this);
|
||||
}
|
||||
mapLocDialog->setCayoPerico(currentProperties.location.isCayoPerico);
|
||||
mapLocDialog->setWindowIcon(windowIcon());
|
||||
mapLocDialog->setModal(true);
|
||||
#ifndef Q_OS_ANDROID
|
||||
|
@ -746,10 +761,9 @@ void PictureDialog::openPreviewMap()
|
|||
mapLocDialog->exec();
|
||||
if (mapLocDialog->propUpdated()) {
|
||||
// Update Snapmatic Properties
|
||||
SnapmaticProperties localSpJson = picture->getSnapmaticProperties();
|
||||
localSpJson.location.x = mapLocDialog->getXpos();
|
||||
localSpJson.location.y = mapLocDialog->getYpos();
|
||||
localSpJson.location.z = 0;
|
||||
currentProperties.location.x = mapLocDialog->getXpos();
|
||||
currentProperties.location.y = mapLocDialog->getYpos();
|
||||
currentProperties.location.z = 0;
|
||||
|
||||
// Update Snapmatic Picture
|
||||
QString currentFilePath = picture->getPictureFilePath();
|
||||
|
@ -759,7 +773,7 @@ void PictureDialog::openPreviewMap()
|
|||
QFile::copy(currentFilePath, backupFileName);
|
||||
}
|
||||
SnapmaticProperties fallbackProperties = picture->getSnapmaticProperties();
|
||||
picture->setSnapmaticProperties(localSpJson);
|
||||
picture->setSnapmaticProperties(currentProperties);
|
||||
if (!picture->exportPicture(currentFilePath)) {
|
||||
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of I/O Error"));
|
||||
picture->setSnapmaticProperties(fallbackProperties);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-2021 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
|
||||
|
@ -31,7 +31,11 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
|
|||
ui(new Ui::PlayerListDialog)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
#endif
|
||||
|
||||
listUpdated = false;
|
||||
ui->setupUi(this);
|
||||
|
@ -39,40 +43,32 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
|
|||
ui->cmdCancel->setFocus();
|
||||
|
||||
// Set Icon for Apply Button
|
||||
if (QIcon::hasThemeIcon("dialog-ok-apply"))
|
||||
{
|
||||
if (QIcon::hasThemeIcon("dialog-ok-apply")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("dialog-apply"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("dialog-apply")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-apply"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-apply")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("gtk-apply"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("dialog-ok"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("dialog-ok")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-ok"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-ok")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||
}
|
||||
|
||||
// Set Icon for Cancel Button
|
||||
if (QIcon::hasThemeIcon("dialog-cancel"))
|
||||
{
|
||||
if (QIcon::hasThemeIcon("dialog-cancel")) {
|
||||
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-cancel"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-cancel")) {
|
||||
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
@ -87,8 +83,7 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
|
|||
ui->cmdMakeSe->setIcon(QIcon::fromTheme("go-next"));
|
||||
ui->cmdMakeAd->setIcon(QIcon::fromTheme("list-add"));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
#if QT_VERSION < 0x050600
|
||||
qreal screenRatio = AppEnv::screenRatio();
|
||||
if (screenRatio != 1) {
|
||||
|
@ -112,12 +107,10 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
|
|||
|
||||
PlayerListDialog::~PlayerListDialog()
|
||||
{
|
||||
for (QObject *object : ui->listAvPlayers->children())
|
||||
{
|
||||
for (QObject *object : ui->listAvPlayers->children()) {
|
||||
delete object;
|
||||
}
|
||||
for (QObject *object : ui->listSePlayers->children())
|
||||
{
|
||||
for (QObject *object : ui->listSePlayers->children()) {
|
||||
delete object;
|
||||
}
|
||||
delete ui;
|
||||
|
@ -131,16 +124,13 @@ void PlayerListDialog::on_cmdCancel_clicked()
|
|||
void PlayerListDialog::buildInterface()
|
||||
{
|
||||
const QStringList dbPlayers = profileDB->getPlayers();
|
||||
for (QString sePlayer : players)
|
||||
{
|
||||
for (const QString &sePlayer : players) {
|
||||
QListWidgetItem *playerItem = new QListWidgetItem(profileDB->getPlayerName(sePlayer));
|
||||
playerItem->setData(Qt::UserRole, sePlayer);
|
||||
ui->listSePlayers->addItem(playerItem);
|
||||
}
|
||||
for (QString dbPlayer : dbPlayers)
|
||||
{
|
||||
if (!players.contains(dbPlayer))
|
||||
{
|
||||
for (const QString &dbPlayer : dbPlayers) {
|
||||
if (!players.contains(dbPlayer)) {
|
||||
QListWidgetItem *playerItem = new QListWidgetItem(profileDB->getPlayerName(dbPlayer));
|
||||
playerItem->setData(Qt::UserRole, dbPlayer);
|
||||
ui->listAvPlayers->addItem(playerItem);
|
||||
|
@ -151,8 +141,7 @@ void PlayerListDialog::buildInterface()
|
|||
|
||||
void PlayerListDialog::on_cmdMakeAv_clicked()
|
||||
{
|
||||
for (QListWidgetItem *item : ui->listSePlayers->selectedItems())
|
||||
{
|
||||
for (QListWidgetItem *item : ui->listSePlayers->selectedItems()) {
|
||||
QString playerName = item->text();
|
||||
int playerID = item->data(Qt::UserRole).toInt();
|
||||
delete item;
|
||||
|
@ -166,13 +155,11 @@ void PlayerListDialog::on_cmdMakeAv_clicked()
|
|||
void PlayerListDialog::on_cmdMakeSe_clicked()
|
||||
{
|
||||
int maxPlayers = 30;
|
||||
if (maxPlayers < ui->listSePlayers->count() + ui->listAvPlayers->selectedItems().count())
|
||||
{
|
||||
if (maxPlayers < ui->listSePlayers->count() + ui->listAvPlayers->selectedItems().count()) {
|
||||
QMessageBox::warning(this, tr("Add Players..."), tr("Failed to add more Players because the limit of Players are %1!").arg(QString::number(maxPlayers)));
|
||||
return;
|
||||
}
|
||||
for (QListWidgetItem *item : ui->listAvPlayers->selectedItems())
|
||||
{
|
||||
for (QListWidgetItem *item : ui->listAvPlayers->selectedItems()) {
|
||||
QString playerName = item->text();
|
||||
int playerID = item->data(Qt::UserRole).toInt();
|
||||
delete item;
|
||||
|
@ -186,15 +173,12 @@ void PlayerListDialog::on_cmdMakeAd_clicked()
|
|||
{
|
||||
bool playerOk;
|
||||
int playerID = QInputDialog::getInt(this, tr("Add Player..."), tr("Enter Social Club Player ID"), 1, 1, 214783647, 1, &playerOk, windowFlags());
|
||||
if (playerOk)
|
||||
{
|
||||
for (int i = 0; i < ui->listAvPlayers->count(); ++i)
|
||||
{
|
||||
if (playerOk) {
|
||||
for (int i = 0; i < ui->listAvPlayers->count(); ++i) {
|
||||
QListWidgetItem *item = ui->listAvPlayers->item(i);
|
||||
QString itemPlayerName = item->text();
|
||||
int itemPlayerID = item->data(Qt::UserRole).toInt();
|
||||
if (itemPlayerID == playerID)
|
||||
{
|
||||
if (itemPlayerID == playerID) {
|
||||
delete item;
|
||||
QListWidgetItem *playerItem = new QListWidgetItem(itemPlayerName);
|
||||
playerItem->setData(Qt::UserRole, playerID);
|
||||
|
@ -202,8 +186,7 @@ void PlayerListDialog::on_cmdMakeAd_clicked()
|
|||
return;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ui->listSePlayers->count(); ++i)
|
||||
{
|
||||
for (int i = 0; i < ui->listSePlayers->count(); ++i) {
|
||||
QListWidgetItem *item = ui->listSePlayers->item(i);
|
||||
int itemPlayerID = item->data(Qt::UserRole).toInt();
|
||||
if (itemPlayerID == playerID)
|
||||
|
@ -221,8 +204,7 @@ void PlayerListDialog::on_cmdMakeAd_clicked()
|
|||
void PlayerListDialog::on_cmdApply_clicked()
|
||||
{
|
||||
players.clear();
|
||||
for (int i = 0; i < ui->listSePlayers->count(); ++i)
|
||||
{
|
||||
for (int i = 0; i < ui->listSePlayers->count(); ++i) {
|
||||
players += ui->listSePlayers->item(i)->data(Qt::UserRole).toString();
|
||||
}
|
||||
emit playerListUpdated(players);
|
||||
|
|
|
@ -28,7 +28,11 @@ SavegameDialog::SavegameDialog(QWidget *parent) :
|
|||
ui(new Ui::SavegameDialog)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
#endif
|
||||
|
||||
// Setup User Interface
|
||||
ui->setupUi(this);
|
||||
|
|
|
@ -41,41 +41,38 @@ SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileD
|
|||
ui(new Ui::SnapmaticEditor)
|
||||
{
|
||||
// Set Window Flags
|
||||
#if QT_VERSION >= 0x050900
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
#else
|
||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
#endif
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->cmdCancel->setDefault(true);
|
||||
ui->cmdCancel->setFocus();
|
||||
|
||||
// Set Icon for Apply Button
|
||||
if (QIcon::hasThemeIcon("dialog-ok-apply"))
|
||||
{
|
||||
if (QIcon::hasThemeIcon("dialog-ok-apply")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("dialog-apply"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("dialog-apply")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-apply"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-apply")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("gtk-apply"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("dialog-ok"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("dialog-ok")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-ok"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-ok")) {
|
||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||
}
|
||||
|
||||
// Set Icon for Cancel Button
|
||||
if (QIcon::hasThemeIcon("dialog-cancel"))
|
||||
{
|
||||
if (QIcon::hasThemeIcon("dialog-cancel")) {
|
||||
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-cancel"))
|
||||
{
|
||||
else if (QIcon::hasThemeIcon("gtk-cancel")) {
|
||||
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
|
||||
}
|
||||
|
||||
|
@ -96,27 +93,18 @@ SnapmaticEditor::~SnapmaticEditor()
|
|||
|
||||
void SnapmaticEditor::selfie_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
isSelfie = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isSelfie = false;
|
||||
}
|
||||
isSelfie = checked;
|
||||
}
|
||||
|
||||
|
||||
void SnapmaticEditor::mugshot_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
isMugshot = true;
|
||||
ui->cbDirector->setEnabled(false);
|
||||
ui->cbDirector->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
isMugshot = false;
|
||||
ui->cbDirector->setEnabled(true);
|
||||
}
|
||||
|
@ -124,14 +112,12 @@ void SnapmaticEditor::mugshot_toggled(bool checked)
|
|||
|
||||
void SnapmaticEditor::editor_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
isEditor = true;
|
||||
ui->cbDirector->setEnabled(false);
|
||||
ui->cbDirector->setChecked(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
isEditor = false;
|
||||
ui->cbDirector->setEnabled(true);
|
||||
}
|
||||
|
@ -139,8 +125,7 @@ void SnapmaticEditor::editor_toggled(bool checked)
|
|||
|
||||
void SnapmaticEditor::on_rbSelfie_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
mugshot_toggled(false);
|
||||
editor_toggled(false);
|
||||
selfie_toggled(true);
|
||||
|
@ -149,8 +134,7 @@ void SnapmaticEditor::on_rbSelfie_toggled(bool checked)
|
|||
|
||||
void SnapmaticEditor::on_rbMugshot_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
selfie_toggled(false);
|
||||
editor_toggled(false);
|
||||
mugshot_toggled(true);
|
||||
|
@ -159,8 +143,7 @@ void SnapmaticEditor::on_rbMugshot_toggled(bool checked)
|
|||
|
||||
void SnapmaticEditor::on_rbEditor_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
selfie_toggled(false);
|
||||
mugshot_toggled(false);
|
||||
editor_toggled(true);
|
||||
|
@ -169,8 +152,7 @@ void SnapmaticEditor::on_rbEditor_toggled(bool checked)
|
|||
|
||||
void SnapmaticEditor::on_rbCustom_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
selfie_toggled(false);
|
||||
mugshot_toggled(false);
|
||||
editor_toggled(false);
|
||||
|
@ -189,20 +171,16 @@ void SnapmaticEditor::setSnapmaticPicture(SnapmaticPicture *picture)
|
|||
playersList = snapmaticProperties.playersList;
|
||||
ui->cbDirector->setChecked(snapmaticProperties.isFromDirector);
|
||||
ui->cbMeme->setChecked(snapmaticProperties.isMeme);
|
||||
if (isSelfie)
|
||||
{
|
||||
if (isSelfie) {
|
||||
ui->rbSelfie->setChecked(true);
|
||||
}
|
||||
else if (isMugshot)
|
||||
{
|
||||
else if (isMugshot) {
|
||||
ui->rbMugshot->setChecked(true);
|
||||
}
|
||||
else if (isEditor)
|
||||
{
|
||||
else if (isEditor) {
|
||||
ui->rbEditor->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ui->rbCustom->setChecked(true);
|
||||
}
|
||||
setSnapmaticCrew(returnCrewName(crewID));
|
||||
|
@ -212,8 +190,7 @@ void SnapmaticEditor::setSnapmaticPicture(SnapmaticPicture *picture)
|
|||
|
||||
void SnapmaticEditor::insertPlayerNames(QStringList *players)
|
||||
{
|
||||
for (int i = 0; i < players->size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < players->size(); ++i) {
|
||||
players->replace(i, profileDB->getPlayerName(players->at(i)));
|
||||
}
|
||||
}
|
||||
|
@ -229,54 +206,48 @@ void SnapmaticEditor::setSnapmaticPlayers(const QStringList &players)
|
|||
{
|
||||
QString editStr = QString("<a href=\"g5e://editplayers\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
|
||||
QString playersStr;
|
||||
if (players.length() != 1)
|
||||
{
|
||||
if (players.length() != 1) {
|
||||
playersStr = tr("Players: %1 (%2)", "Multiple Player are inserted here");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
playersStr = tr("Player: %1 (%2)", "One Player is inserted here");
|
||||
}
|
||||
if (players.length() != 0)
|
||||
{
|
||||
if (players.length() != 0) {
|
||||
ui->labPlayers->setText(playersStr.arg(players.join(", "), editStr));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ui->labPlayers->setText(playersStr.arg(QApplication::translate("PictureDialog", "No Players"), editStr));
|
||||
}
|
||||
#ifndef Q_OS_ANDROID
|
||||
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
|
||||
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
|
||||
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
|
||||
if (heightForWidth(width()) > height())
|
||||
resize(width(), heightForWidth(width()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SnapmaticEditor::setSnapmaticTitle(const QString &title)
|
||||
{
|
||||
if (title.length() > 39)
|
||||
{
|
||||
if (title.length() > 39) {
|
||||
snapmaticTitle = title.left(39);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
snapmaticTitle = title;
|
||||
}
|
||||
QString editStr = QString("<a href=\"g5e://edittitle\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
|
||||
QString titleStr = tr("Title: %1 (%2)").arg(StringParser::escapeString(snapmaticTitle), editStr);
|
||||
ui->labTitle->setText(titleStr);
|
||||
if (SnapmaticPicture::verifyTitle(snapmaticTitle))
|
||||
{
|
||||
if (SnapmaticPicture::verifyTitle(snapmaticTitle)) {
|
||||
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes", "Yes, should work fine"))));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No", "No, could lead to issues"))));
|
||||
}
|
||||
#ifndef Q_OS_ANDROID
|
||||
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
|
||||
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
|
||||
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
|
||||
if (heightForWidth(width()) > height())
|
||||
resize(width(), heightForWidth(width()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -288,7 +259,8 @@ void SnapmaticEditor::setSnapmaticCrew(const QString &crew)
|
|||
#ifndef Q_OS_ANDROID
|
||||
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
|
||||
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
|
||||
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
|
||||
if (heightForWidth(width()) > height())
|
||||
resize(width(), heightForWidth(width()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -304,8 +276,7 @@ void SnapmaticEditor::on_cmdCancel_clicked()
|
|||
|
||||
void SnapmaticEditor::on_cmdApply_clicked()
|
||||
{
|
||||
if (ui->cbQualify->isChecked())
|
||||
{
|
||||
if (ui->cbQualify->isChecked()) {
|
||||
qualifyAvatar();
|
||||
}
|
||||
snapmaticProperties.crewID = crewID;
|
||||
|
@ -315,27 +286,23 @@ void SnapmaticEditor::on_cmdApply_clicked()
|
|||
snapmaticProperties.isFromDirector = ui->cbDirector->isChecked();
|
||||
snapmaticProperties.isMeme = ui->cbMeme->isChecked();
|
||||
snapmaticProperties.playersList = playersList;
|
||||
if (smpic)
|
||||
{
|
||||
if (smpic) {
|
||||
QString currentFilePath = smpic->getPictureFilePath();
|
||||
QString originalFilePath = smpic->getOriginalPictureFilePath();
|
||||
QString backupFileName = originalFilePath % ".bak";
|
||||
if (!QFile::exists(backupFileName))
|
||||
{
|
||||
if (!QFile::exists(backupFileName)) {
|
||||
QFile::copy(currentFilePath, backupFileName);
|
||||
}
|
||||
SnapmaticProperties fallbackProperties = smpic->getSnapmaticProperties();
|
||||
QString fallbackTitle = smpic->getPictureTitle();
|
||||
smpic->setSnapmaticProperties(snapmaticProperties);
|
||||
smpic->setPictureTitle(snapmaticTitle);
|
||||
if (!smpic->exportPicture(currentFilePath))
|
||||
{
|
||||
if (!smpic->exportPicture(currentFilePath)) {
|
||||
QMessageBox::warning(this, tr("Snapmatic Properties"), tr("Patching of Snapmatic Properties failed because of I/O Error"));
|
||||
smpic->setSnapmaticProperties(fallbackProperties);
|
||||
smpic->setPictureTitle(fallbackTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
smpic->updateStrings();
|
||||
smpic->emitUpdate();
|
||||
#ifdef GTA5SYNC_TELEMETRY
|
||||
|
@ -343,8 +310,7 @@ void SnapmaticEditor::on_cmdApply_clicked()
|
|||
telemetrySettings.beginGroup("Telemetry");
|
||||
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||
telemetrySettings.endGroup();
|
||||
if (pushUsageData && Telemetry->canPush())
|
||||
{
|
||||
if (pushUsageData && Telemetry->canPush()) {
|
||||
QJsonDocument jsonDocument;
|
||||
QJsonObject jsonObject;
|
||||
jsonObject["Type"] = "PropertyEdited";
|
||||
|
@ -373,8 +339,7 @@ void SnapmaticEditor::qualifyAvatar()
|
|||
|
||||
void SnapmaticEditor::on_cbQualify_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->cbMeme->setEnabled(false);
|
||||
ui->cbDirector->setEnabled(false);
|
||||
ui->rbCustom->setEnabled(false);
|
||||
|
@ -382,15 +347,13 @@ void SnapmaticEditor::on_cbQualify_toggled(bool checked)
|
|||
ui->rbEditor->setEnabled(false);
|
||||
ui->rbMugshot->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ui->cbMeme->setEnabled(true);
|
||||
ui->rbCustom->setEnabled(true);
|
||||
ui->rbSelfie->setEnabled(true);
|
||||
ui->rbEditor->setEnabled(true);
|
||||
ui->rbMugshot->setEnabled(true);
|
||||
if (ui->rbSelfie->isChecked() || ui->rbCustom->isChecked())
|
||||
{
|
||||
if (ui->rbSelfie->isChecked() || ui->rbCustom->isChecked()) {
|
||||
ui->cbDirector->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
@ -398,8 +361,7 @@ void SnapmaticEditor::on_cbQualify_toggled(bool checked)
|
|||
|
||||
void SnapmaticEditor::on_labPlayers_linkActivated(const QString &link)
|
||||
{
|
||||
if (link == "g5e://editplayers")
|
||||
{
|
||||
if (link == "g5e://editplayers") {
|
||||
PlayerListDialog *playerListDialog = new PlayerListDialog(playersList, profileDB, this);
|
||||
connect(playerListDialog, SIGNAL(playerListUpdated(QStringList)), this, SLOT(playerListUpdated(QStringList)));
|
||||
playerListDialog->setModal(true);
|
||||
|
@ -411,12 +373,10 @@ void SnapmaticEditor::on_labPlayers_linkActivated(const QString &link)
|
|||
|
||||
void SnapmaticEditor::on_labTitle_linkActivated(const QString &link)
|
||||
{
|
||||
if (link == "g5e://edittitle")
|
||||
{
|
||||
if (link == "g5e://edittitle") {
|
||||
bool ok;
|
||||
QString newTitle = QInputDialog::getText(this, tr("Snapmatic Title"), tr("New Snapmatic title:"), QLineEdit::Normal, snapmaticTitle, &ok, windowFlags());
|
||||
if (ok && !newTitle.isEmpty())
|
||||
{
|
||||
if (ok && !newTitle.isEmpty()) {
|
||||
setSnapmaticTitle(newTitle);
|
||||
}
|
||||
}
|
||||
|
@ -424,39 +384,33 @@ void SnapmaticEditor::on_labTitle_linkActivated(const QString &link)
|
|||
|
||||
void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
|
||||
{
|
||||
if (link == "g5e://editcrew")
|
||||
{
|
||||
if (link == "g5e://editcrew") {
|
||||
bool ok;
|
||||
int indexNum = 0;
|
||||
QStringList itemList;
|
||||
QStringList crewList = crewDB->getCrews();
|
||||
if (!crewList.contains(QLatin1String("0")))
|
||||
{
|
||||
if (!crewList.contains(QLatin1String("0"))) {
|
||||
crewList += QLatin1String("0");
|
||||
}
|
||||
crewList.sort();
|
||||
for (QString crew : crewList)
|
||||
{
|
||||
for (const QString &crew : crewList) {
|
||||
itemList += QString("%1 (%2)").arg(crew, returnCrewName(crew.toInt()));
|
||||
}
|
||||
if (crewList.contains(QString::number(crewID)))
|
||||
{
|
||||
if (crewList.contains(QString::number(crewID))) {
|
||||
indexNum = crewList.indexOf(QString::number(crewID));
|
||||
}
|
||||
QString newCrew = QInputDialog::getItem(this, tr("Snapmatic Crew"), tr("New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags());
|
||||
if (ok && !newCrew.isEmpty())
|
||||
{
|
||||
if (newCrew.contains(" ")) newCrew = newCrew.split(" ").at(0);
|
||||
if (newCrew.length() > 10) return;
|
||||
for (QChar crewChar : newCrew)
|
||||
{
|
||||
if (!crewChar.isNumber())
|
||||
{
|
||||
if (ok && !newCrew.isEmpty()) {
|
||||
if (newCrew.contains(" "))
|
||||
newCrew = newCrew.split(" ").at(0);
|
||||
if (newCrew.length() > 10)
|
||||
return;
|
||||
for (const QChar &crewChar : newCrew) {
|
||||
if (!crewChar.isNumber()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!crewList.contains(newCrew))
|
||||
{
|
||||
if (!crewList.contains(newCrew)) {
|
||||
crewDB->addCrew(crewID);
|
||||
}
|
||||
crewID = newCrew.toInt();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5spv Grand Theft Auto Snapmatic Picture Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-2021 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
|
||||
|
@ -84,8 +84,7 @@ bool SnapmaticPicture::preloadFile()
|
|||
|
||||
isFormatSwitch = false;
|
||||
|
||||
if (!picFile->open(QFile::ReadOnly))
|
||||
{
|
||||
if (!picFile->open(QFile::ReadOnly)) {
|
||||
lastStep = "1;/1,OpenFile," % convertDrawStringForLog(picFilePath);
|
||||
delete picFile;
|
||||
return false;
|
||||
|
@ -98,8 +97,7 @@ bool SnapmaticPicture::preloadFile()
|
|||
if (!ok)
|
||||
return false;
|
||||
|
||||
if (picFilePath.right(4) != QLatin1String(".g5e"))
|
||||
{
|
||||
if (picFilePath.right(4) != QLatin1String(".g5e")) {
|
||||
if (p_ragePhoto.photoFormat() == RagePhoto::PhotoFormat::G5EX)
|
||||
isFormatSwitch = true;
|
||||
}
|
||||
|
@ -122,9 +120,9 @@ bool SnapmaticPicture::readingPicture(bool cacheEnabled_)
|
|||
if (!ok)
|
||||
return false;
|
||||
|
||||
if (cacheEnabled) picOk = cachePicture.loadFromData(p_ragePhoto.photoData(), "JPEG");
|
||||
if (!cacheEnabled)
|
||||
{
|
||||
if (cacheEnabled)
|
||||
picOk = cachePicture.loadFromData(p_ragePhoto.photoData(), "JPEG");
|
||||
if (!cacheEnabled) {
|
||||
QImage tempPicture;
|
||||
picOk = tempPicture.loadFromData(p_ragePhoto.photoData(), "JPEG");
|
||||
}
|
||||
|
@ -154,19 +152,18 @@ void SnapmaticPicture::updateStrings()
|
|||
pictureStr = tr("PHOTO - %1").arg(localProperties.createdDateTime.toString("MM/dd/yy HH:mm:ss"));
|
||||
sortStr = localProperties.createdDateTime.toString("yyMMddHHmmss") % QString::number(localProperties.uid);
|
||||
QString exportStr = localProperties.createdDateTime.toString("yyyyMMdd") % "-" % QString::number(localProperties.uid);
|
||||
if (getSnapmaticFormat() == SnapmaticFormat::G5E_Format) picFileName = "PGTA5" % QString::number(localProperties.uid);
|
||||
if (getSnapmaticFormat() == SnapmaticFormat::G5E_Format)
|
||||
picFileName = |