This commit is contained in:
parent
44ab5caedf
commit
04603af8ff
7 changed files with 53 additions and 9 deletions
|
@ -93,6 +93,7 @@ set(GTA5VIEW_SOURCES
|
||||||
|
|
||||||
set(GTA5VIEW_HEADERS
|
set(GTA5VIEW_HEADERS
|
||||||
config.h
|
config.h
|
||||||
|
wrapper.h
|
||||||
AboutDialog.h
|
AboutDialog.h
|
||||||
AppEnv.h
|
AppEnv.h
|
||||||
CrewDatabase.h
|
CrewDatabase.h
|
||||||
|
|
|
@ -240,8 +240,19 @@ void MapLocationDialog::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
|
|
||||||
void MapLocationDialog::wheelEvent(QWheelEvent *ev)
|
void MapLocationDialog::wheelEvent(QWheelEvent *ev)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
const QPoint numPixels = ev->pixelDelta();
|
const QPoint numPixels = ev->pixelDelta();
|
||||||
const QPoint numDegrees = ev->angleDelta();
|
const QPoint numDegrees = ev->angleDelta();
|
||||||
|
#else
|
||||||
|
QPoint numDegrees;
|
||||||
|
if (ev->orientation() == Qt::Horizontal) {
|
||||||
|
numDegrees.setX(ev->delta());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
numDegrees.setY(ev->delta());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
if (!numPixels.isNull()) {
|
if (!numPixels.isNull()) {
|
||||||
if (numPixels.y() < 0 && zoomPercent != 100) {
|
if (numPixels.y() < 0 && zoomPercent != 100) {
|
||||||
zoomPercent = zoomPercent - 10;
|
zoomPercent = zoomPercent - 10;
|
||||||
|
@ -251,8 +262,10 @@ void MapLocationDialog::wheelEvent(QWheelEvent *ev)
|
||||||
zoomPercent = zoomPercent + 10;
|
zoomPercent = zoomPercent + 10;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (!numDegrees.isNull()) {
|
#endif
|
||||||
|
if (!numDegrees.isNull()) {
|
||||||
if (numDegrees.y() < 0 && zoomPercent != 100) {
|
if (numDegrees.y() < 0 && zoomPercent != 100) {
|
||||||
zoomPercent = zoomPercent - 10;
|
zoomPercent = zoomPercent - 10;
|
||||||
repaint();
|
repaint();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
|
#include "wrapper.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
|
@ -837,8 +837,7 @@ void RagePhoto::uInt32ToCharLE(quint32 x, char *y)
|
||||||
const QByteArray RagePhoto::stringToUtf16LE(const QString &string)
|
const QByteArray RagePhoto::stringToUtf16LE(const QString &string)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
#if QT_VERSION >= 0x060000
|
||||||
QStringEncoder stringEncoder = QStringEncoder(QStringEncoder::Utf16LE);
|
return QStringEncoder(QStringEncoder::Utf16LE)(string);
|
||||||
return stringEncoder(string);
|
|
||||||
#else
|
#else
|
||||||
return QTextCodec::codecForName("UTF-16LE")->fromUnicode(string);
|
return QTextCodec::codecForName("UTF-16LE")->fromUnicode(string);
|
||||||
#endif
|
#endif
|
||||||
|
@ -847,8 +846,7 @@ const QByteArray RagePhoto::stringToUtf16LE(const QString &string)
|
||||||
const QString RagePhoto::utf16LEToString(const QByteArray &data)
|
const QString RagePhoto::utf16LEToString(const QByteArray &data)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
#if QT_VERSION >= 0x060000
|
||||||
QStringDecoder stringDecoder = QStringDecoder(QStringDecoder::Utf16LE);
|
return QStringDecoder(QStringDecoder::Utf16LE)(data);
|
||||||
return stringDecoder(data);
|
|
||||||
#else
|
#else
|
||||||
return QTextCodec::codecForName("UTF-16LE")->toUnicode(data);
|
return QTextCodec::codecForName("UTF-16LE")->toUnicode(data);
|
||||||
#endif
|
#endif
|
||||||
|
@ -857,8 +855,7 @@ const QString RagePhoto::utf16LEToString(const QByteArray &data)
|
||||||
const QString RagePhoto::utf16LEToString(const char *data, int size)
|
const QString RagePhoto::utf16LEToString(const char *data, int size)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
#if QT_VERSION >= 0x060000
|
||||||
QStringDecoder stringDecoder = QStringDecoder(QStringDecoder::Utf16LE);
|
return QStringDecoder(QStringDecoder::Utf16LE)(QByteArray::fromRawData(data, size));
|
||||||
return stringDecoder(QByteArray::fromRawData(data, size));
|
|
||||||
#else
|
#else
|
||||||
return QTextCodec::codecForName("UTF-16LE")->toUnicode(data, size);
|
return QTextCodec::codecForName("UTF-16LE")->toUnicode(data, size);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "PlayerListDialog.h"
|
#include "PlayerListDialog.h"
|
||||||
#include "StringParser.h"
|
#include "StringParser.h"
|
||||||
|
#include "wrapper.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
@ -405,7 +406,7 @@ void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
|
||||||
newCrew = newCrew.split(" ").at(0);
|
newCrew = newCrew.split(" ").at(0);
|
||||||
if (newCrew.length() > 10)
|
if (newCrew.length() > 10)
|
||||||
return;
|
return;
|
||||||
for (const QChar &crewChar : newCrew) {
|
for (const QChar &crewChar : qAsConst(newCrew)) {
|
||||||
if (!crewChar.isNumber()) {
|
if (!crewChar.isNumber()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ DEPLOYMENT.display_name = gta5view
|
||||||
TARGET = gta5view
|
TARGET = gta5view
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
HEADERS += config.h
|
HEADERS += config.h \
|
||||||
|
wrapper.h
|
||||||
PRECOMPILED_HEADER += config.h
|
PRECOMPILED_HEADER += config.h
|
||||||
|
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
|
|
30
wrapper.h
Normal file
30
wrapper.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* Copyright (C) 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef WRAPPER_H
|
||||||
|
#define WRAPPER_H
|
||||||
|
|
||||||
|
#if QT_VERSION < 0x050700
|
||||||
|
#if __cplusplus > 201703L
|
||||||
|
#define qAsConst(x) std::as_const(x)
|
||||||
|
#else
|
||||||
|
#define qAsConst
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // WRAPPER_H
|
Loading…
Reference in a new issue