merged with gta5view 1.8

This commit is contained in:
Syping 2020-08-25 20:47:50 +02:00
parent 181e18503c
commit 4e83cb165a
22 changed files with 2274 additions and 2145 deletions

View file

@ -70,9 +70,18 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
#if QT_VERSION >= 0x050200
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
QFontMetrics fontMetrics(ui->txtJSON->font());
#if QT_VERSION >= 0x050B00
ui->txtJSON->setTabStopDistance(fontMetrics.horizontalAdvance(" "));
#else
ui->txtJSON->setTabStopWidth(fontMetrics.width(" "));
#endif
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonCode.toUtf8());
ui->txtJSON->setStyleSheet("QPlainTextEdit{background-color: rgb(46, 47, 48); color: rgb(238, 231, 172);}");

View file

@ -60,40 +60,10 @@ MapLocationDialog::~MapLocationDialog()
void MapLocationDialog::drawPointOnMap(double xpos_d, double 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);
ui->labPos->setText(tr("X: %1\nY: %2", "X and Y position").arg(QString::number(xpos_d), QString::number(ypos_d)));
xpos_new = xpos_d;
ypos_new = ypos_d;
ui->labPos->setText(tr("X: %1\nY: %2", "X and Y position").arg(QString::number(xpos_d), QString::number(ypos_d)));
repaint();
}
void MapLocationDialog::on_cmdChange_clicked()
@ -139,6 +109,48 @@ void MapLocationDialog::updatePosFromEvent(int x, int y)
drawPointOnMap(xpos_fp, ypos_fp);
}
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 GTA5SYNC_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)
{
if (!changeMode) { ev->ignore(); }

View file

@ -39,6 +39,7 @@ public:
~MapLocationDialog();
protected:
void paintEvent(QPaintEvent *ev);
void mouseMoveEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev);

View file

@ -25,6 +25,11 @@
<property name="windowTitle">
<string>Snapmatic Map Viewer</string>
</property>
<property name="styleSheet">
<string notr="true">QDialog#MapLocationDialog {
background-color: transparent;
}</string>
</property>
<layout class="QVBoxLayout" name="vlMapPreview">
<property name="spacing">
<number>0</number>

View file

@ -136,25 +136,34 @@ OptionsDialog::~OptionsDialog()
void OptionsDialog::setupTreeWidget()
{
for (QString playerIDStr : profileDB->getPlayers())
const QStringList players = profileDB->getPlayers();
if (players.length() != 0) {
QStringList::const_iterator it = players.constBegin();
QStringList::const_iterator end = players.constEnd();
while (it != end)
{
bool ok;
int playerID = playerIDStr.toInt(&ok);
int playerID = it->toInt(&ok);
if (ok)
{
QString playerName = profileDB->getPlayerName(playerID);
QStringList playerTreeViewList;
playerTreeViewList += playerIDStr;
playerTreeViewList += *it;
playerTreeViewList += playerName;
QTreeWidgetItem *playerItem = new QTreeWidgetItem(playerTreeViewList);
ui->twPlayers->addTopLevelItem(playerItem);
playerItems += playerItem;
}
it++;
}
ui->twPlayers->sortItems(1, Qt::AscendingOrder);
}
else {
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabPlayers));
}
}
void OptionsDialog::setupLanguageBox()
{
@ -362,6 +371,8 @@ void OptionsDialog::applySettings()
#if QT_VERSION >= 0x050200
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
#endif
#else
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
#endif
settings->endGroup();
@ -722,8 +733,9 @@ void OptionsDialog::setupSnapmaticPictureViewer()
ui->gbSnapmaticPictureViewer->setVisible(false);
#endif
#else
ui->cbSnapmaticNavigationBar->setVisible(false);
ui->gbSnapmaticPictureViewer->setVisible(false);
settings->beginGroup("Interface");
ui->cbSnapmaticNavigationBar->setChecked(settings->value("NavigationBar", true).toBool());
settings->endGroup();
#endif
}

View file

@ -135,12 +135,15 @@ void PictureDialog::setupPictureDialog()
smpic = nullptr;
crewStr = "";
// Get Snapmatic Resolution
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
// Avatar area
qreal screenRatio = AppEnv::screenRatio();
qreal screenRatioPR = AppEnv::screenRatioPR();
if (screenRatio != 1 || screenRatioPR != 1)
{
avatarAreaPicture = QImage(":/img/avatararea.png").scaledToHeight(536 * screenRatio * screenRatioPR, Qt::FastTransformation);
avatarAreaPicture = QImage(":/img/avatararea.png").scaledToHeight(snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::FastTransformation);
}
else
{
@ -151,7 +154,7 @@ void PictureDialog::setupPictureDialog()
avatarSize = 470;
// DPI calculation (picture)
ui->labPicture->setFixedSize(960 * screenRatio, 536 * screenRatio);
ui->labPicture->setFixedSize(snapmaticResolution.width() * screenRatio, snapmaticResolution.height() * screenRatio);
ui->labPicture->setFocusPolicy(Qt::StrongFocus);
ui->labPicture->setScaledContents(true);
@ -199,8 +202,8 @@ void PictureDialog::setupPictureDialog()
ui->jsonLayout->setContentsMargins(4 * screenRatio, 10 * screenRatio, 4 * screenRatio, 4 * screenRatio);
// Pre-adapt window for DPI
setFixedWidth(960 * screenRatio);
setFixedHeight(536 * screenRatio);
setFixedWidth(snapmaticResolution.width() * screenRatio);
setFixedHeight(snapmaticResolution.height() * screenRatio);
}
PictureDialog::~PictureDialog()
@ -216,6 +219,15 @@ PictureDialog::~PictureDialog()
delete layout()->menuBar();
}
#endif
#else
if (naviEnabled)
{
for (QObject *obj : layout()->menuBar()->children())
{
delete obj;
}
delete layout()->menuBar();
}
#endif
for (QObject *obj : manageMenu->children())
{
@ -236,18 +248,31 @@ void PictureDialog::closeEvent(QCloseEvent *ev)
void PictureDialog::addPreviousNextButtons()
{
// Windows Vista additions
#ifdef GTA5SYNC_WIN
#if QT_VERSION >= 0x050200
QToolBar *uiToolbar = new QToolBar("Picture Toolbar", this);
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/next.svgz"), "", this, SLOT(nextPictureRequestedSlot()));
layout()->setMenuBar(uiToolbar);
naviEnabled = true;
#endif
#else
QToolBar *uiToolbar = new QToolBar("Picture Toolbar", this);
#if QT_VERSION < 0x050600
qreal screenRatio = AppEnv::screenRatio();
if (screenRatio != 1) {
QSize iconSize = uiToolbar->iconSize();
uiToolbar->setIconSize(QSize(iconSize.width() * screenRatio, iconSize.height() * screenRatio));
}
#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
}
@ -368,7 +393,11 @@ void PictureDialog::resizeEvent(QResizeEvent *event)
void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
{
Q_UNUSED(newLabelSize)
#if QT_VERSION >= 0x050F00
int newDialogHeight = SnapmaticPicture::getSnapmaticResolution().height();
#else
int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
#endif
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
setMaximumSize(width(), newDialogHeight);
@ -686,10 +715,11 @@ void PictureDialog::renderPicture()
{
if (overlayEnabled)
{
QPixmap shownImagePixmap(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR);
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap shownImagePixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
shownImagePixmap.fill(Qt::transparent);
QPainter shownImagePainter(&shownImagePixmap);
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.drawImage(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage);
shownImagePainter.end();
#if QT_VERSION >= 0x050600
@ -699,10 +729,11 @@ void PictureDialog::renderPicture()
}
else
{
QPixmap shownImagePixmap(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR);
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap shownImagePixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
shownImagePixmap.fill(Qt::transparent);
QPainter shownImagePainter(&shownImagePixmap);
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.end();
#if QT_VERSION >= 0x050600
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
@ -713,15 +744,16 @@ void PictureDialog::renderPicture()
else
{
// Generating Avatar Preview
QPixmap avatarPixmap(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR);
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap avatarPixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
QPainter snapPainter(&avatarPixmap);
QFont snapPainterFont;
snapPainterFont.setPixelSize(12 * screenRatio * screenRatioPR);
snapPainter.drawImage(0, 0, snapmaticPicture.scaled(960 * screenRatio * screenRatioPR, 536 * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
snapPainter.drawImage(0, 0, snapmaticPicture.scaled(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
snapPainter.drawImage(0, 0, avatarAreaPicture);
snapPainter.setPen(QColor::fromRgb(255, 255, 255, 255));
snapPainter.setFont(snapPainterFont);
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.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.end();
#if QT_VERSION >= 0x050600
avatarPixmap.setDevicePixelRatio(screenRatioPR);

View file

@ -73,12 +73,32 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
// Set Icon for Manage Buttons
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->cmdMakeSe->setIcon(QIcon::fromTheme("go-next"));
ui->cmdMakeAd->setIcon(QIcon::fromTheme("list-add"));
}
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->cmdMakeSe->setIcon(QIcon(":/img/next.svgz"));
ui->cmdMakeAd->setIcon(QIcon(":/img/add.svgz"));

View file

@ -264,7 +264,11 @@ void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
QStringList widgetsKeyList = widgets.values();
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
#if QT_VERSION >= 0x050600
#if QT_VERSION >= 0x050F00
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
#else
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
#endif
#else
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
#endif
@ -284,7 +288,11 @@ void ProfileInterface::insertSavegameIPI(QWidget *widget)
QString widgetKey = widgets[proWidget];
QStringList widgetsKeyList = widgets.values();
QStringList savegameKeyList = widgetsKeyList.filter("SGD", Qt::CaseSensitive);
#if QT_VERSION >= 0x050F00
std::sort(savegameKeyList.begin(), savegameKeyList.end());
#else
qSort(savegameKeyList.begin(), savegameKeyList.end());
#endif
int sgdIndex = savegameKeyList.indexOf(QRegExp(widgetKey));
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
@ -303,7 +311,11 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
QStringList widgetsKeyList = widgets.values();
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
#if QT_VERSION >= 0x050600
#if QT_VERSION >= 0x050F00
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
#else
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
#endif
#else
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
#endif
@ -338,7 +350,11 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
QStringList widgetsKeyList = widgets.values();
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
#if QT_VERSION >= 0x050600
#if QT_VERSION >= 0x050F00
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
#else
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
#endif
#else
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
#endif
@ -369,7 +385,12 @@ void ProfileInterface::sortingProfileInterface()
ui->vlSnapmatic->setEnabled(false);
QStringList widgetsKeyList = widgets.values();
#if QT_VERSION >= 0x050F00
std::sort(widgetsKeyList.begin(), widgetsKeyList.end());
#else
qSort(widgetsKeyList.begin(), widgetsKeyList.end());
#endif
for (QString widgetKey : widgetsKeyList)
{
@ -1627,7 +1648,7 @@ void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
contextMenuOpened = true;
contextMenu.exec(ev->globalPos());
contextMenuOpened = false;
hoverProfileWidgetCheck();
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
}
void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
@ -1660,7 +1681,7 @@ void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
contextMenuOpened = true;
contextMenu.exec(ev->globalPos());
contextMenuOpened = false;
hoverProfileWidgetCheck();
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
}
void ProfileInterface::on_saProfileContent_dropped(const QMimeData *mimeData)
@ -1781,19 +1802,23 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
return true;
}
}
else if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::WindowActivate)
else if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
{
if ((watched->objectName() == "SavegameWidget" || watched->objectName() == "SnapmaticWidget") && isProfileLoaded)
{
ProfileWidget *pWidget = nullptr;
for (ProfileWidget *widget : widgets.keys())
QMap<ProfileWidget*, QString>::const_iterator it = widgets.constBegin();
QMap<ProfileWidget*, QString>::const_iterator end = widgets.constEnd();
while (it != end)
{
ProfileWidget *widget = it.key();
QPoint mousePos = widget->mapFromGlobal(QCursor::pos());
if (widget->rect().contains(mousePos))
{
pWidget = widget;
break;
}
it++;
}
if (pWidget != nullptr)
{
@ -1827,7 +1852,7 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
}
else if (event->type() == QEvent::WindowDeactivate && isProfileLoaded)
{
if (previousWidget != nullptr)
if (previousWidget != nullptr && watched == previousWidget)
{
previousWidget->setStyleSheet(QLatin1String(""));
previousWidget = nullptr;
@ -1863,13 +1888,17 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
void ProfileInterface::hoverProfileWidgetCheck()
{
ProfileWidget *pWidget = nullptr;
for (ProfileWidget *widget : widgets.keys())
QMap<ProfileWidget*, QString>::const_iterator it = widgets.constBegin();
QMap<ProfileWidget*, QString>::const_iterator end = widgets.constEnd();
while (it != end)
{
ProfileWidget *widget = it.key();
if (widget->underMouse())
{
pWidget = widget;
break;
}
it++;
}
if (pWidget != nullptr)
{

View file

@ -433,8 +433,8 @@ QString SnapmaticPicture::getSnapmaticHeaderString(const QByteArray &snapmaticHe
QString SnapmaticPicture::getSnapmaticJSONString(const QByteArray &jsonBytes)
{
QByteArray jsonUsefulBytes = jsonBytes;
jsonUsefulBytes.replace('\x00', QString());
jsonUsefulBytes.replace('\x0c', QString());
jsonUsefulBytes.replace('\x00', "");
jsonUsefulBytes.replace('\x0c', "");
return QString::fromUtf8(jsonUsefulBytes.trimmed());
}
@ -1339,7 +1339,8 @@ bool SnapmaticPicture::setPictureVisible()
QSize SnapmaticPicture::getSnapmaticResolution()
{
return snapmaticResolution;
// keep old UI size for now
return QSize(960, 536);
}
// SNAPMATIC DEFAULTS

View file

@ -120,7 +120,7 @@ public:
bool setVisible() { return setPictureVisible(); } // Please use setPictureVisible instead
// PREDEFINED PROPERTIES
QSize getSnapmaticResolution();
static QSize getSnapmaticResolution();
// SNAPMATIC DEFAULTS
bool isSnapmaticDefaultsEnforced();

View file

@ -20,6 +20,7 @@
#include "imagecropper.h"
#include "AppEnv.h"
#include <QPainterPath>
#include <QMouseEvent>
#include <QPainter>

View file

@ -44,7 +44,7 @@
#endif
#ifndef GTA5SYNC_APPVER
#define GTA5SYNC_APPVER "0.2.0"
#define GTA5SYNC_APPVER "0.3.0"
#endif
#if __cplusplus

View file

@ -199,10 +199,11 @@ QString QJsonDocument::escapeString(const QString &s) const {
//------------------------------------------------------------------------------
// Name: toJson
//------------------------------------------------------------------------------
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format) const {
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int indent) const {
QString b;
QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text);
bool compact = (format == JsonFormat::Compact);
switch(v.type()) {
case QJsonValue::Null:
@ -228,37 +229,43 @@ QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format) const {
case QJsonValue::Array:
{
const QJsonArray a = v.toArray();
ss << "[";
ss << (compact ? "[" : "[\n");
if(!a.empty()) {
QJsonArray::const_iterator it = a.begin();
QJsonArray::const_iterator e = a.end();
ss << toJson(*it++, format);
if (!compact) ss << QByteArray(4*indent, ' ');
ss << toJson(*it++, format, indent+1);
for(;it != e; ++it) {
ss << ',';
ss << toJson(*it, format);
ss << (compact ? "," : ",\n");
if (!compact) ss << QByteArray(4*indent, ' ');
ss << toJson(*it, format, indent+1);
}
}
ss << "]";
indent--;
ss << (compact ? "]" : QString("\n%1]").arg(QString(4*indent, ' ')));
}
break;
case QJsonValue::Object:
{
const QJsonObject o = v.toObject();
ss << "{";
ss << (compact ? "{" : "{\n");
if(!o.empty()) {
QJsonObject::const_iterator it = o.begin();
QJsonObject::const_iterator e = o.end();
ss << '"' << escapeString(it.key()) << "\": " << toJson(it.value(), format);
if (!compact) ss << QByteArray(4*indent, ' ');
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
++it;
for(;it != e; ++it) {
ss << ',';
ss << '"' << escapeString(it.key()) << "\": " << toJson(it.value(), format);
ss << (compact ? "," : ",\n");
if (!compact) ss << QByteArray(4*indent, ' ');
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
}
}
ss << "}";
indent--;
ss << (compact ? "}" : QString("\n%1}").arg(QString(4*indent, ' ')));
}
break;
case QJsonValue::Undefined:

View file

@ -88,7 +88,7 @@ public:
private:
void setRoot(const QJsonRoot &root);
QString toJson(const QJsonValue &v, JsonFormat format) const;
QString toJson(const QJsonValue &v, JsonFormat format, int indent = 1) const;
QString escapeString(const QString &s) const;
private:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff