This commit is contained in:
parent
f9129f8364
commit
678425a7c5
17 changed files with 172 additions and 37 deletions
|
@ -22,13 +22,17 @@
|
||||||
#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;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,9 @@ 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");
|
||||||
|
@ -135,7 +137,9 @@ 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");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2018 Syping
|
* Copyright (C) 2016-2020 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
|
||||||
|
@ -35,9 +35,11 @@ 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 (QString globalStr : globalFile.childKeys())
|
for (const QString &globalStr : globalFile.childKeys())
|
||||||
{
|
{
|
||||||
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
|
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
|
||||||
}
|
}
|
||||||
|
@ -49,7 +51,9 @@ 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))
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
#include <QtWinExtras/QtWin>
|
#include <QtWinExtras/QtWin>
|
||||||
|
@ -41,7 +45,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
@ -81,7 +84,11 @@
|
||||||
#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),
|
||||||
|
@ -745,7 +752,11 @@ 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
|
||||||
|
|
|
@ -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,7 +19,6 @@
|
||||||
#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>
|
||||||
|
@ -27,6 +26,10 @@
|
||||||
#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);
|
||||||
|
@ -98,12 +101,21 @@ 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);
|
||||||
this->move(desktopRect.x(), desktopRect.y());
|
move(desktopRect.x(), desktopRect.y());
|
||||||
this->resize(desktopRect.width(), desktopRect.height());
|
resize(desktopRect.width(), desktopRect.height());
|
||||||
this->showFullScreen();
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
#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>
|
||||||
|
@ -272,10 +271,10 @@ void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
|
||||||
#else
|
#else
|
||||||
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
||||||
#endif
|
#endif
|
||||||
int picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
int picIndex = pictureKeyList.indexOf(widgetKey);
|
||||||
ui->vlSnapmatic->insertWidget(picIndex, proWidget);
|
ui->vlSnapmatic->insertWidget(picIndex, proWidget);
|
||||||
|
|
||||||
qApp->processEvents();
|
QApplication::processEvents();
|
||||||
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,10 +292,10 @@ void ProfileInterface::insertSavegameIPI(QWidget *widget)
|
||||||
#else
|
#else
|
||||||
qSort(savegameKeyList.begin(), savegameKeyList.end());
|
qSort(savegameKeyList.begin(), savegameKeyList.end());
|
||||||
#endif
|
#endif
|
||||||
int sgdIndex = savegameKeyList.indexOf(QRegExp(widgetKey));
|
int sgdIndex = savegameKeyList.indexOf(widgetKey);
|
||||||
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
|
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
|
||||||
|
|
||||||
qApp->processEvents();
|
QApplication::processEvents();
|
||||||
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,7 +325,7 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
picIndex = pictureKeyList.indexOf(widgetKey);
|
||||||
}
|
}
|
||||||
picIndex++;
|
picIndex++;
|
||||||
if (pictureKeyList.length() > picIndex)
|
if (pictureKeyList.length() > picIndex)
|
||||||
|
@ -365,7 +364,7 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
picIndex = pictureKeyList.indexOf(widgetKey);
|
||||||
}
|
}
|
||||||
if (picIndex > 0)
|
if (picIndex > 0)
|
||||||
{
|
{
|
||||||
|
@ -408,7 +407,7 @@ void ProfileInterface::sortingProfileInterface()
|
||||||
ui->vlSavegame->setEnabled(true);
|
ui->vlSavegame->setEnabled(true);
|
||||||
ui->vlSnapmatic->setEnabled(true);
|
ui->vlSnapmatic->setEnabled(true);
|
||||||
|
|
||||||
qApp->processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::profileLoaded_p()
|
void ProfileInterface::profileLoaded_p()
|
||||||
|
@ -772,7 +771,11 @@ 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("PGTA5%1").arg(QString::number(spJson.uid)));
|
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
|
||||||
picture->setPictureTitle(customImageTitle);
|
picture->setPictureTitle(customImageTitle);
|
||||||
|
@ -826,7 +829,11 @@ 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("PGTA5%1").arg(QString::number(spJson.uid)));
|
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
|
||||||
picture->setPictureTitle(importDialog->getImageTitle());
|
picture->setPictureTitle(importDialog->getImageTitle());
|
||||||
|
@ -1071,7 +1078,11 @@ 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("PGTA5%1").arg(QString::number(spJson.uid)));
|
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
|
||||||
picture->setPictureTitle(importDialog->getImageTitle());
|
picture->setPictureTitle(importDialog->getImageTitle());
|
||||||
|
@ -1115,7 +1126,11 @@ 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 % "/PGTA5" % QString::number(snapmaticProperties.uid));
|
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid));
|
||||||
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
|
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
|
||||||
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
|
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
|
||||||
|
@ -1152,7 +1167,11 @@ 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 % "/PGTA5" % QString::number(snapmaticProperties.uid));
|
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid));
|
||||||
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
|
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
|
||||||
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
|
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
|
||||||
|
@ -2046,7 +2065,7 @@ void ProfileInterface::massTool(MassTool tool)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
qApp->processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
@ -2145,7 +2164,7 @@ void ProfileInterface::massTool(MassTool tool)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
qApp->processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
@ -2198,7 +2217,7 @@ preSelectionCrewID:
|
||||||
}
|
}
|
||||||
if (crewList.contains(QString::number(crewID)))
|
if (crewList.contains(QString::number(crewID)))
|
||||||
{
|
{
|
||||||
indexNum = crewList.indexOf(QRegExp(QString::number(crewID)));
|
indexNum = crewList.indexOf(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())
|
||||||
|
@ -2276,7 +2295,7 @@ preSelectionCrewID:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
qApp->processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
@ -2379,7 +2398,7 @@ preSelectionTitle:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
picture->emitUpdate();
|
picture->emitUpdate();
|
||||||
qApp->processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbDialog.close();
|
pbDialog.close();
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#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,7 +23,6 @@
|
||||||
#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>
|
||||||
|
@ -438,7 +437,7 @@ void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
|
||||||
}
|
}
|
||||||
if (crewList.contains(QString::number(crewID)))
|
if (crewList.contains(QString::number(crewID)))
|
||||||
{
|
{
|
||||||
indexNum = crewList.indexOf(QRegExp(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());
|
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,7 +22,6 @@
|
||||||
#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>
|
||||||
|
@ -33,6 +32,10 @@
|
||||||
#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
|
||||||
|
@ -994,7 +997,11 @@ 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; }
|
||||||
}
|
}
|
||||||
|
@ -1418,7 +1425,12 @@ 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);
|
||||||
|
#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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#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>
|
||||||
|
|
|
@ -63,7 +63,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +151,11 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +184,11 @@ 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
|
||||||
|
@ -195,7 +207,11 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +235,11 @@ 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)
|
||||||
|
@ -236,7 +256,11 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,10 @@ isEqual(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_INSTALL_BINS]/rcc
|
||||||
# QT5 ONLY STUFF
|
# QT5 ONLY STUFF
|
||||||
|
|
||||||
isEqual(QT_MAJOR_VERSION, 5): RESOURCES += res/tr_qt5.qrc
|
isEqual(QT_MAJOR_VERSION, 5): RESOURCES += res/tr_qt5.qrc
|
||||||
isEqual(QT_MAJOR_VERSION, 5): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc
|
|
||||||
|
# QT5+ ONLY STUFF
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc
|
||||||
|
|
||||||
# RESOURCE COMPILATION
|
# RESOURCE COMPILATION
|
||||||
|
|
||||||
|
|
7
main.cpp
7
main.cpp
|
@ -31,7 +31,6 @@
|
||||||
#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>
|
||||||
|
@ -54,6 +53,10 @@
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x060000
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -70,8 +73,10 @@
|
||||||
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);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2017 Syping
|
* Copyright (C) 2017-2020 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,7 +17,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "JSHighlighter.h"
|
#include "JSHighlighter.h"
|
||||||
#include <QRegExp>
|
|
||||||
|
|
||||||
JSHighlighter::JSHighlighter(QTextDocument *parent) :
|
JSHighlighter::JSHighlighter(QTextDocument *parent) :
|
||||||
QSyntaxHighlighter(parent)
|
QSyntaxHighlighter(parent)
|
||||||
|
@ -31,34 +30,61 @@ 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)
|
||||||
{
|
{
|
||||||
for (HighlightingRule rule : highlightingRules)
|
#if QT_VERSION >= 0x050000
|
||||||
|
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)
|
||||||
|
@ -67,6 +93,7 @@ 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 Syping
|
* Copyright (C) 2017-2020 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,10 +24,15 @@
|
||||||
#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
|
||||||
|
@ -37,7 +42,11 @@ 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,7 +80,11 @@ 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