1.8 bump, fix res regression from 1.7, other fixes.

This commit is contained in:
Syping 2020-04-24 05:36:11 +02:00
parent 8732b9d64d
commit f63645a1fb
36 changed files with 1327 additions and 1880 deletions

View file

@ -3,8 +3,8 @@
!define APP_NAME "gta5view"
!define COMP_NAME "Syping"
!define WEB_SITE "https://gta5view.syping.de/"
!define VERSION "1.7.1.0"
!define COPYRIGHT "Copyright © 2016-2019 Syping"
!define VERSION "1.8.0.0"
!define COPYRIGHT "Copyright © 2016-2020 Syping"
!define DESCRIPTION "Grand Theft Auto V Savegame and Snapmatic Viewer/Editor"
!define INSTALLER_NAME "gta5view_setup.exe"
!define MAIN_APP_EXE "gta5view.exe"
@ -104,11 +104,10 @@ ${INSTALL_TYPE}
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
File "../build/release/gta5view.exe"
File "/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/libgcc_s_seh-1.dll"
File "/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/libstdc++-6.dll"
File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libc++.dll"
File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libunwind.dll"
File "/opt/windev/openssl-latest_qt64d/bin/libcrypto-1_1-x64.dll"
File "/opt/windev/openssl-latest_qt64d/bin/libssl-1_1-x64.dll"
File "/opt/windev/libjpeg-turbo-latest_qt64d/bin/libjpeg-62.dll"
File "/opt/windev/qt64d-latest/bin/Qt5Core.dll"
File "/opt/windev/qt64d-latest/bin/Qt5Gui.dll"
File "/opt/windev/qt64d-latest/bin/Qt5Network.dll"
@ -195,11 +194,10 @@ SectionEnd
Section Uninstall
${INSTALL_TYPE}
Delete "$INSTDIR\gta5view.exe"
Delete "$INSTDIR\libgcc_s_seh-1.dll"
Delete "$INSTDIR\libstdc++-6.dll"
Delete "$INSTDIR\libc++.dll"
Delete "$INSTDIR\libunwind.dll"
Delete "$INSTDIR\libcrypto-1_1-x64.dll"
Delete "$INSTDIR\libssl-1_1-x64.dll"
Delete "$INSTDIR\libjpeg-62.dll"
Delete "$INSTDIR\Qt5Core.dll"
Delete "$INSTDIR\Qt5Gui.dll"
Delete "$INSTDIR\Qt5Network.dll"

View file

@ -1,6 +1,6 @@
#!/bin/bash
DOCKER_IMAGE=sypingauto/gta5view-build:1.7-static
DOCKER_IMAGE=sypingauto/gta5view-build:1.8-static
PROJECT_DIR_DOCKER=/gta5view
cd ${PROJECT_DIR} && \
@ -18,4 +18,8 @@ if [ "${PACKAGE_CODE}" == "gta5-mods" ]; then
${PROJECT_DIR}/.ci/dropbox_uploader.sh mkdir gta5-mods/${PACKAGE_VERSION}
${PROJECT_DIR}/.ci/dropbox_uploader.sh upload ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} gta5-mods/${PACKAGE_VERSION}/${GTA5VIEW_EXECUTABLE} && \
rm -rf ${GTA5VIEW_EXECUTABLE}
elif [ "${PACKAGE_CODE}" == "gtainside" ]; then
${PROJECT_DIR}/.ci/dropbox_uploader.sh mkdir gtainside/${PACKAGE_VERSION}
${PROJECT_DIR}/.ci/dropbox_uploader.sh upload ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} gtainside/${PACKAGE_VERSION}/${GTA5VIEW_EXECUTABLE} && \
rm -rf ${GTA5VIEW_EXECUTABLE}
fi

View file

@ -1,6 +1,6 @@
#!/bin/bash
DOCKER_IMAGE=sypingauto/gta5view-build:1.7-shared
DOCKER_IMAGE=sypingauto/gta5view-build:1.8-shared
PROJECT_DIR_DOCKER=/gta5view
cd ${PROJECT_DIR} && \

View file

@ -2,11 +2,11 @@ stages:
- build
variables:
BUILD_TYPE: "REL"
BUILD_TYPE: "RC"
Windows Installer:
stage: build
image: sypingauto/gta5view-build:1.7-shared
image: sypingauto/gta5view-build:1.8-shared
variables:
BUILD_SCRIPT: "wininstall_build.sh"
QT_SELECT: "qt5-x86_64-w64-mingw32"
@ -19,7 +19,7 @@ Windows Installer:
Windows Portable:
stage: build
image: sypingauto/gta5view-build:1.7-static
image: sypingauto/gta5view-build:1.8-static
variables:
BUILD_SCRIPT: "windows_build.sh"
QT_SELECT: "qt5-x86_64-w64-mingw32"

View file

@ -8,7 +8,7 @@ service:
env:
global:
- BUILD_TYPE=REL
- BUILD_TYPE=RC
matrix:
include:

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2016-2017 Syping
* Copyright (C) 2016-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -499,9 +499,9 @@ bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
qreal AppEnv::screenRatio()
{
#if QT_VERSION >= 0x050000
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
qreal dpi = QApplication::primaryScreen()->logicalDotsPerInch();
#else
qreal dpi = qApp->desktop()->logicalDpiX();
qreal dpi = QApplication::desktop()->logicalDpiX();
#endif
#ifdef Q_OS_MAC
return (dpi / 72);
@ -513,7 +513,7 @@ qreal AppEnv::screenRatio()
qreal AppEnv::screenRatioPR()
{
#if QT_VERSION >= 0x050600
return QGuiApplication::primaryScreen()->devicePixelRatio();
return QApplication::primaryScreen()->devicePixelRatio();
#else
return 1;
#endif

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2016-2017 Syping
* Copyright (C) 2016-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,14 +22,19 @@
#include "ProfileWidget.h"
#include "ExportThread.h"
#include "SavegameData.h"
#include "AppEnv.h"
#include "config.h"
#include <QStringBuilder>
#include <QDesktopWidget>
#include <QApplication>
#include <QFileInfo>
#include <QDebug>
#include <QFile>
#if QT_VERSION >= 0x050000
#include <QScreen>
#else
#include <QDesktopWidget>
#endif
ExportThread::ExportThread(QMap<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent) : QThread(parent),
profileMap(profileMap), exportDirectory(exportDirectory), pictureCopyEnabled(pictureCopyEnabled), pictureExportEnabled(pictureExportEnabled), exportCount(exportCount)
{
@ -101,8 +106,17 @@ void ExportThread::run()
QImage exportPicture = picture->getImage();
if (sizeMode == "Desktop")
{
QRect desktopResolution = qApp->desktop()->screenGeometry();
exportPicture = exportPicture.scaled(desktopResolution.width(), desktopResolution.height(), aspectRatio, Qt::SmoothTransformation);
#if QT_VERSION >= 0x050000
qreal screenRatioPR = AppEnv::screenRatioPR();
QRect desktopResolution = QApplication::primaryScreen()->geometry();
int desktopSizeWidth = qRound((double)desktopResolution.width() * screenRatioPR);
int desktopSizeHeight = qRound((double)desktopResolution.height() * screenRatioPR);
#else
QRect desktopResolution = QApplication::desktop()->screenGeometry();
int desktopSizeWidth = desktopResolution.width();
int desktopSizeHeight = desktopResolution.height();
#endif
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
}
else if (sizeMode == "Custom")
{

View file

@ -1,205 +0,0 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2017-2018 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "ImageEditorDialog.h"
#include "ui_ImageEditorDialog.h"
#include "ProfileInterface.h"
#include "SidebarGenerator.h"
#include "StandardPaths.h"
#include "ImportDialog.h"
#include "AppEnv.h"
#include "config.h"
#include <QStringBuilder>
#include <QImageReader>
#include <QFileDialog>
#include <QMessageBox>
ImageEditorDialog::ImageEditorDialog(SnapmaticPicture *picture, QString profileName, QWidget *parent) :
QDialog(parent), smpic(picture), profileName(profileName),
ui(new Ui::ImageEditorDialog)
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
ui->setupUi(this);
ui->cmdClose->setDefault(true);
ui->cmdClose->setFocus();
// Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
}
else if (QIcon::hasThemeIcon("gtk-close"))
{
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
}
// Set Icon for Import Button
if (QIcon::hasThemeIcon("document-import"))
{
ui->cmdReplace->setIcon(QIcon::fromTheme("document-import"));
}
// Set Icon for Overwrite Button
if (QIcon::hasThemeIcon("document-save"))
{
ui->cmdSave->setIcon(QIcon::fromTheme("document-save"));
}
else if (QIcon::hasThemeIcon("gtk-save"))
{
ui->cmdSave->setIcon(QIcon::fromTheme("gtk-save"));
}
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
snapmaticResolutionLW = 516 * screenRatio; // 430
snapmaticResolutionLH = 288 * screenRatio; // 240
ui->labPicture->setMinimumSize(snapmaticResolutionLW, snapmaticResolutionLH);
imageIsChanged = false;
pictureCache = picture->getImage();
ui->labPicture->setPixmap(QPixmap::fromImage(pictureCache).scaled(snapmaticResolutionLW, snapmaticResolutionLH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
setMaximumSize(sizeHint());
setMinimumSize(sizeHint());
setFixedSize(sizeHint());
}
ImageEditorDialog::~ImageEditorDialog()
{
delete ui;
}
void ImageEditorDialog::on_cmdClose_clicked()
{
close();
}
void ImageEditorDialog::on_cmdReplace_clicked()
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("FileDialogs");
bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
settings.beginGroup("ImportReplace");
fileDialogPreOpen: //Work?
QFileDialog fileDialog(this);
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
fileDialog.setWindowTitle(ProfileInterface::tr("Import..."));
fileDialog.setLabelText(QFileDialog::Accept, ProfileInterface::tr("Import"));
// Getting readable Image formats
QString imageFormatsStr = " ";
for (QByteArray imageFormat : QImageReader::supportedImageFormats())
{
imageFormatsStr += QString("*.") % QString::fromUtf8(imageFormat).toLower() % " ";
}
QStringList filters;
filters << ProfileInterface::tr("All image files (%1)").arg(imageFormatsStr.trimmed());
filters << ProfileInterface::tr("All files (**)");
fileDialog.setNameFilters(filters);
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.setDirectory(settings.value(profileName % "+Directory", StandardPaths::documentsLocation()).toString());
fileDialog.restoreGeometry(settings.value(profileName % "+Geometry", "").toByteArray());
if (fileDialog.exec())
{
QStringList selectedFiles = fileDialog.selectedFiles();
if (selectedFiles.length() == 1)
{
QString selectedFile = selectedFiles.at(0);
QString selectedFileName = QFileInfo(selectedFile).fileName();
QFile snapmaticFile(selectedFile);
if (!snapmaticFile.open(QFile::ReadOnly))
{
QMessageBox::warning(this, ProfileInterface::tr("Import"), ProfileInterface::tr("Can't import %1 because file can't be open").arg("\""+selectedFileName+"\""));
goto fileDialogPreOpen;
}
QImage *importImage = new QImage();
QImageReader snapmaticImageReader;
snapmaticImageReader.setDecideFormatFromContent(true);
snapmaticImageReader.setDevice(&snapmaticFile);
if (!snapmaticImageReader.read(importImage))
{
QMessageBox::warning(this, ProfileInterface::tr("Import"), ProfileInterface::tr("Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
delete importImage;
goto fileDialogPreOpen;
}
ImportDialog *importDialog = new ImportDialog(profileName, this);
importDialog->setImage(importImage);
importDialog->setModal(true);
importDialog->show();
importDialog->exec();
if (importDialog->isImportAgreed())
{
pictureCache = importDialog->image();
ui->labPicture->setPixmap(QPixmap::fromImage(pictureCache).scaled(snapmaticResolutionLW, snapmaticResolutionLH, Qt::KeepAspectRatio, Qt::SmoothTransformation));
imageIsChanged = true;
}
delete importDialog;
}
}
settings.setValue(profileName % "+Geometry", fileDialog.saveGeometry());
settings.setValue(profileName % "+Directory", fileDialog.directory().absolutePath());
settings.endGroup();
settings.endGroup();
}
void ImageEditorDialog::on_cmdSave_clicked()
{
if (imageIsChanged)
{
const QByteArray previousPicture = smpic->getPictureStream();
bool success = smpic->setImage(pictureCache);
if (success)
{
QString currentFilePath = smpic->getPictureFilePath();
QString originalFilePath = smpic->getOriginalPictureFilePath();
QString backupFileName = originalFilePath % ".bak";
if (!QFile::exists(backupFileName))
{
QFile::copy(currentFilePath, backupFileName);
}
if (!smpic->exportPicture(currentFilePath))
{
smpic->setPictureStream(previousPicture);
QMessageBox::warning(this, tr("Snapmatic Image Editor"), tr("Patching of Snapmatic Image failed because of I/O Error"));
return;
}
smpic->emitCustomSignal("PictureUpdated");
}
else
{
QMessageBox::warning(this, tr("Snapmatic Image Editor"), tr("Patching of Snapmatic Image failed because of Image Error"));
return;
}
}
close();
}

View file

@ -1,52 +0,0 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2016-2017 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 IMAGEEDITORDIALOG_H
#define IMAGEEDITORDIALOG_H
#include "SnapmaticPicture.h"
#include <QDialog>
namespace Ui {
class ImageEditorDialog;
}
class ImageEditorDialog : public QDialog
{
Q_OBJECT
public:
explicit ImageEditorDialog(SnapmaticPicture *picture, QString profileName, QWidget *parent = 0);
~ImageEditorDialog();
private slots:
void on_cmdClose_clicked();
void on_cmdReplace_clicked();
void on_cmdSave_clicked();
private:
SnapmaticPicture *smpic;
QString profileName;
Ui::ImageEditorDialog *ui;
int snapmaticResolutionLW;
int snapmaticResolutionLH;
bool imageIsChanged;
QImage pictureCache;
};
#endif // IMAGEEDITORDIALOG_H

View file

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ImageEditorDialog</class>
<widget class="QDialog" name="ImageEditorDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>516</width>
<height>337</height>
</rect>
</property>
<property name="windowTitle">
<string>Overwrite Image...</string>
</property>
<layout class="QVBoxLayout" name="vlInterface">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labPicture">
<property name="minimumSize">
<size>
<width>516</width>
<height>288</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="buttomFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QVBoxLayout" name="vlButtons">
<item>
<layout class="QHBoxLayout" name="hlButtons">
<item>
<widget class="QPushButton" name="cmdReplace">
<property name="toolTip">
<string>Import picture</string>
</property>
<property name="text">
<string>&amp;Import...</string>
</property>
</widget>
</item>
<item>
<spacer name="hsButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdSave">
<property name="toolTip">
<string>Apply changes</string>
</property>
<property name="text">
<string>&amp;Overwrite</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClose">
<property name="toolTip">
<string>Discard changes</string>
</property>
<property name="text">
<string>&amp;Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2017-2019 Syping
* Copyright (C) 2017-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -374,7 +374,7 @@ void ImportDialog::cropPicture()
#endif
imageCropper.setBackgroundColor(Qt::black);
imageCropper.setCroppingRectBorderColor(QColor(255, 255, 255, 127));
imageCropper.setImage(QPixmap::fromImage(workImage, Qt::AutoColor));
imageCropper.setImage(QPixmap::fromImage(origImage, Qt::AutoColor));
imageCropper.setProportion(QSize(1, 1));
imageCropper.setFixedSize(workImage.size());
cropLayout.addWidget(&imageCropper);
@ -575,6 +575,7 @@ QImage ImportDialog::image()
void ImportDialog::setImage(QImage *image_)
{
origImage = *image_;
workImage = QImage();
if (image_->width() == image_->height())
{

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
@ -67,6 +67,7 @@ private:
QString imageTitle;
QImage backImage;
QImage workImage;
QImage origImage;
QImage newImage;
QColor selectedColour;
QMenu *optionsMenu;

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
@ -24,7 +24,6 @@
#include "AppEnv.h"
#include "config.h"
#include <QStringBuilder>
#include <QDesktopWidget>
#include <QJsonDocument>
#include <QStyleFactory>
#include <QApplication>
@ -40,6 +39,12 @@
#include <QList>
#include <QDir>
#if QT_VERSION >= 0x050000
#include <QScreen>
#else
#include <QDesktopWidget>
#endif
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#endif
@ -58,9 +63,16 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
ui->cmdCancel->setDefault(true);
ui->cmdCancel->setFocus();
#if QT_VERSION >= 0x050000
qreal screenRatioPR = AppEnv::screenRatioPR();
QRect desktopResolution = QApplication::primaryScreen()->geometry();
int desktopSizeWidth = qRound((double)desktopResolution.width() * screenRatioPR);
int desktopSizeHeight = qRound((double)desktopResolution.height() * screenRatioPR);
#else
QRect desktopResolution = QApplication::desktop()->screenGeometry(this);
int desktopSizeWidth = desktopResolution.width();
int desktopSizeHeight = desktopResolution.height();
#endif
aspectRatio = Qt::KeepAspectRatio;
defExportSize = QSize(960, 536);
cusExportSize = defExportSize;

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
@ -22,7 +22,6 @@
#include "ui_PictureDialog.h"
#include "SidebarGenerator.h"
#include "MapLocationDialog.h"
#include "ImageEditorDialog.h"
#include "JsonEditorDialog.h"
#include "SnapmaticEditor.h"
#include "StandardPaths.h"

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2016-2017 Syping
* Copyright (C) 2016-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,6 +17,7 @@
*****************************************************************************/
#include "config.h"
#include "AppEnv.h"
#include "PictureExport.h"
#include "PictureDialog.h"
#include "StandardPaths.h"
@ -32,6 +33,9 @@
#if QT_VERSION >= 0x050000
#include <QSaveFile>
#include <QScreen>
#else
#include <QDesktopWidget>
#endif
PictureExport::PictureExport()
@ -157,8 +161,17 @@ fileDialogPreSave: //Work?
QImage exportPicture = picture->getImage();
if (sizeMode == "Desktop")
{
#if QT_VERSION >= 0x050000
qreal screenRatioPR = AppEnv::screenRatioPR();
QRect desktopResolution = QApplication::primaryScreen()->geometry();
int desktopSizeWidth = qRound((double)desktopResolution.width() * screenRatioPR);
int desktopSizeHeight = qRound((double)desktopResolution.height() * screenRatioPR);
#else
QRect desktopResolution = QApplication::desktop()->screenGeometry();
exportPicture = exportPicture.scaled(desktopResolution.width(), desktopResolution.height(), aspectRatio, Qt::SmoothTransformation);
int desktopSizeWidth = desktopResolution.width();
int desktopSizeHeight = desktopResolution.height();
#endif
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
}
else if (sizeMode == "Custom")
{

View file

@ -15,8 +15,8 @@ Grand Theft Auto V Savegame and Snapmatic viewer/editor
# Note: Install Docker Community Edition and Git before continuing
git clone https://gitlab.com/Syping/gta5view && cd gta5view
docker pull syping/qt5-static-mingw
docker run --rm -v ${PWD}:/gta5view -it syping/qt5-static-mingw
docker pull sypingauto/gta5view-build:1.8-static
docker run --rm -v ${PWD}:/gta5view -it sypingauto/gta5view-build:1.8-static
cd /gta5view && mkdir -p build && cd build
qmake-static ../gta5view.pro
make depend
@ -24,7 +24,7 @@ Grand Theft Auto V Savegame and Snapmatic viewer/editor
#### Build gta5view for Debian/Ubuntu
sudo apt-get install git gcc g++ qtbase5-dev qttranslations5-l10n qt5-qmake make
sudo apt-get install git gcc g++ libqt5svg5-dev qtbase5-dev qttranslations5-l10n qt5-qmake make
git clone https://gitlab.com/Syping/gta5view && cd gta5view
mkdir -p build && cd build
../configure --prefix=/opt/gta5view
@ -34,7 +34,7 @@ Grand Theft Auto V Savegame and Snapmatic viewer/editor
#### Build gta5view for Fedora
sudo dnf install git gcc gcc-c++ qt5-qtbase-devel qt5-qttranslations make
sudo dnf install git gcc gcc-c++ qt5-qtbase-devel qt5-qtsvg-devel qt5-qttranslations make
git clone https://gitlab.com/Syping/gta5view && cd gta5view
mkdir -p build && cd build
../configure --prefix=/opt/gta5view

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2016-2019 Syping
* Copyright (C) 2016-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,7 +18,6 @@
#include "SnapmaticWidget.h"
#include "ui_SnapmaticWidget.h"
#include "ImageEditorDialog.h"
#include "MapLocationDialog.h"
#include "JsonEditorDialog.h"
#include "SnapmaticPicture.h"

View file

@ -1,6 +1,7 @@
/*****************************************************************************
* ImageCropper Qt Widget for cropping images
* Copyright (C) 2013 Dimka Novikov, to@dimkanovikov.pro
* Copyright (C) 2020 Syping
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -17,6 +18,7 @@
*****************************************************************************/
#include "imagecropper.h"
#include "AppEnv.h"
#include <QMouseEvent>
#include <QPainter>
@ -112,16 +114,16 @@ const QPixmap ImageCropper::cropImage()
// Получим размер отображаемого изображения
QSize scaledImageSize =
pimpl->imageForCropping.scaled(
this->size(), Qt::KeepAspectRatio, Qt::FastTransformation
size(), Qt::KeepAspectRatio, Qt::SmoothTransformation
).size();
// Определим расстояние от левого и верхнего краёв
float leftDelta = 0;
float topDelta = 0;
const float HALF_COUNT = 2;
if (this->size().height() == scaledImageSize.height()) {
leftDelta = (this->width() - scaledImageSize.width()) / HALF_COUNT;
if (size().height() == scaledImageSize.height()) {
leftDelta = (width() - scaledImageSize.width()) / HALF_COUNT;
} else {
topDelta = (this->height() - scaledImageSize.height()) / HALF_COUNT;
topDelta = (height() - scaledImageSize.height()) / HALF_COUNT;
}
// Определим пропорцию области обрезки по отношению к исходному изображению
float xScale = (float)pimpl->imageForCropping.width() / scaledImageSize.width();
@ -145,39 +147,54 @@ const QPixmap ImageCropper::cropImage()
void ImageCropper::paintEvent(QPaintEvent* _event)
{
QWidget::paintEvent( _event );
QWidget::paintEvent(_event);
//
QPainter widgetPainter(this);
// Рисуем изображение по центру виджета
{
#if QT_VERSION >= 0x050600
qreal screenRatioPR = AppEnv::screenRatioPR();
// ... подгоним изображение для отображения по размеру виджета
QPixmap scaledImage =
pimpl->imageForCropping.scaled(this->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
pimpl->imageForCropping.scaled(qRound((double)width() * screenRatioPR), qRound((double)height() * screenRatioPR), Qt::KeepAspectRatio, Qt::SmoothTransformation);
scaledImage.setDevicePixelRatio(screenRatioPR);
#else
QPixmap scaledImage =
pimpl->imageForCropping.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
#endif
// ... заливаем фон
widgetPainter.fillRect( this->rect(), pimpl->backgroundColor );
widgetPainter.fillRect(rect(), pimpl->backgroundColor);
// ... рисуем изображение по центру виджета
if ( this->size().height() == scaledImage.height() ) {
widgetPainter.drawPixmap( ( this->width() - scaledImage.width() ) / 2, 0, scaledImage );
#if QT_VERSION >= 0x050600
if (qRound((double)height() * screenRatioPR) == scaledImage.height()) {
widgetPainter.drawPixmap( ( qRound((double)width() * screenRatioPR) - scaledImage.width() ) / 2, 0, scaledImage );
} else {
widgetPainter.drawPixmap( 0, ( this->height() - scaledImage.height() ) / 2, scaledImage );
widgetPainter.drawPixmap( 0, ( qRound((double)height() * screenRatioPR) - scaledImage.height() ) / 2, scaledImage );
}
#else
if (height() == scaledImage.height()) {
widgetPainter.drawPixmap( ( width()- scaledImage.width() ) / 2, 0, scaledImage );
} else {
widgetPainter.drawPixmap( 0, ( height() - scaledImage.height() ) / 2, scaledImage );
}
#endif
}
// Рисуем область обрезки
{
// ... если это первое отображение после инициилизации, то центруем областо обрезки
if (pimpl->croppingRect.isNull()) {
const int width = WIDGET_MINIMUM_SIZE.width()/2;
const int height = WIDGET_MINIMUM_SIZE.height()/2;
pimpl->croppingRect.setSize(QSize(width, height));
float x = (this->width() - pimpl->croppingRect.width())/2;
float y = (this->height() - pimpl->croppingRect.height())/2;
const int cwidth = WIDGET_MINIMUM_SIZE.width()/2;
const int cheight = WIDGET_MINIMUM_SIZE.height()/2;
pimpl->croppingRect.setSize(QSize(cwidth, cheight));
float x = (width() - pimpl->croppingRect.width())/2;
float y = (height() - pimpl->croppingRect.height())/2;
pimpl->croppingRect.moveTo(x, y);
}
// ... рисуем затемненную область
QPainterPath p;
p.addRect(pimpl->croppingRect);
p.addRect(this->rect());
p.addRect(rect());
widgetPainter.setBrush(QBrush(QColor(0,0,0,120)));
widgetPainter.setPen(Qt::transparent);
widgetPainter.drawPath(p);

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* 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
* it under the terms of the GNU General Public License as published by
@ -40,11 +40,11 @@
#endif
#ifndef GTA5SYNC_COPYRIGHT
#define GTA5SYNC_COPYRIGHT "2016-2019"
#define GTA5SYNC_COPYRIGHT "2016-2020"
#endif
#ifndef GTA5SYNC_APPVER
#define GTA5SYNC_APPVER "1.7.1"
#define GTA5SYNC_APPVER "1.8.0"
#endif
#if __cplusplus

View file

@ -1,6 +1,6 @@
#/*****************************************************************************
#* gta5view Grand Theft Auto V Profile Viewer
#* Copyright (C) 2015-2019 Syping
#* Copyright (C) 2015-2020 Syping
#*
#* This program is free software: you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
@ -37,7 +37,6 @@ SOURCES += main.cpp \
ExportThread.cpp \
GlobalString.cpp \
IconLoader.cpp \
ImageEditorDialog.cpp \
ImportDialog.cpp \
JsonEditorDialog.cpp \
MapLocationDialog.cpp \
@ -79,7 +78,6 @@ HEADERS += \
ExportThread.h \
GlobalString.h \
IconLoader.h \
ImageEditorDialog.h \
ImportDialog.h \
JsonEditorDialog.h \
MapLocationDialog.h \
@ -117,7 +115,6 @@ HEADERS += \
FORMS += \
AboutDialog.ui \
ExportDialog.ui \
ImageEditorDialog.ui \
ImportDialog.ui \
JsonEditorDialog.ui \
MapLocationDialog.ui \

View file

@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest"
#include <windows.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 7, 1, 0
PRODUCTVERSION 1, 7, 1, 0
FILEVERSION 1, 8, 0, 0
PRODUCTVERSION 1, 8, 0, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
@ -25,12 +25,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Syping"
VALUE "FileDescription", "gta5view"
VALUE "FileVersion", "1.7.1"
VALUE "FileVersion", "1.8.0"
VALUE "InternalName", "gta5view"
VALUE "LegalCopyright", "Copyright © 2016-2019 Syping"
VALUE "LegalCopyright", "Copyright © 2016-2020 Syping"
VALUE "OriginalFilename", "gta5view.exe"
VALUE "ProductName", "gta5view"
VALUE "ProductVersion", "1.7.1"
VALUE "ProductVersion", "1.8.0"
END
END
END

View file

@ -166,66 +166,47 @@ Pictures and Savegames</source>
<context>
<name>ImageEditorDialog</name>
<message>
<location filename="../ImageEditorDialog.ui" line="14"/>
<location filename="../ImportDialog.cpp" line="639"/>
<location filename="../ImportDialog.cpp" line="640"/>
<source>Overwrite Image...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.ui" line="59"/>
<source>Import picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.ui" line="62"/>
<source>&amp;Import...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.ui" line="82"/>
<location filename="../ImportDialog.cpp" line="641"/>
<location filename="../ImportDialog.cpp" line="642"/>
<source>Apply changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.ui" line="85"/>
<location filename="../ImportDialog.cpp" line="640"/>
<location filename="../ImportDialog.cpp" line="641"/>
<source>&amp;Overwrite</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.ui" line="92"/>
<location filename="../ImportDialog.cpp" line="643"/>
<location filename="../ImportDialog.cpp" line="644"/>
<source>Discard changes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.ui" line="95"/>
<location filename="../ImportDialog.cpp" line="642"/>
<location filename="../ImportDialog.cpp" line="643"/>
<source>&amp;Close</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.cpp" line="193"/>
<location filename="../ImageEditorDialog.cpp" line="200"/>
<location filename="../PictureDialog.cpp" line="1006"/>
<location filename="../PictureDialog.cpp" line="1030"/>
<location filename="../SnapmaticWidget.cpp" line="376"/>
<location filename="../SnapmaticWidget.cpp" line="400"/>
<location filename="../PictureDialog.cpp" line="1005"/>
<location filename="../PictureDialog.cpp" line="1029"/>
<location filename="../SnapmaticWidget.cpp" line="375"/>
<location filename="../SnapmaticWidget.cpp" line="399"/>
<source>Snapmatic Image Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.cpp" line="193"/>
<location filename="../PictureDialog.cpp" line="1006"/>
<location filename="../SnapmaticWidget.cpp" line="376"/>
<location filename="../PictureDialog.cpp" line="1005"/>
<location filename="../SnapmaticWidget.cpp" line="375"/>
<source>Patching of Snapmatic Image failed because of I/O Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImageEditorDialog.cpp" line="200"/>
<location filename="../PictureDialog.cpp" line="1030"/>
<location filename="../SnapmaticWidget.cpp" line="400"/>
<location filename="../PictureDialog.cpp" line="1029"/>
<location filename="../SnapmaticWidget.cpp" line="399"/>
<source>Patching of Snapmatic Image failed because of Image Error</source>
<translation type="unfinished"></translation>
</message>
@ -267,7 +248,7 @@ Pictures and Savegames</source>
<location filename="../ImportDialog.ui" line="150"/>
<location filename="../ImportDialog.cpp" line="87"/>
<location filename="../ImportDialog.cpp" line="315"/>
<location filename="../ImportDialog.cpp" line="727"/>
<location filename="../ImportDialog.cpp" line="728"/>
<source>Background Colour: &lt;span style=&quot;color: %1&quot;&gt;%1&lt;/span&gt;</source>
<translation type="unfinished"></translation>
</message>
@ -286,7 +267,7 @@ Pictures and Savegames</source>
<location filename="../ImportDialog.ui" line="203"/>
<location filename="../ImportDialog.cpp" line="88"/>
<location filename="../ImportDialog.cpp" line="323"/>
<location filename="../ImportDialog.cpp" line="807"/>
<location filename="../ImportDialog.cpp" line="808"/>
<source>Background Image:</source>
<translation type="unfinished"></translation>
</message>
@ -446,24 +427,24 @@ Pictures and Savegames</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImportDialog.cpp" line="674"/>
<location filename="../ImportDialog.cpp" line="675"/>
<source>Snapmatic Avatar Zone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImportDialog.cpp" line="674"/>
<location filename="../ImportDialog.cpp" line="675"/>
<source>Are you sure to use a square image outside of the Avatar Zone?
When you want to use it as Avatar the image will be detached!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImportDialog.cpp" line="723"/>
<location filename="../ImportDialog.cpp" line="724"/>
<source>Select Colour...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImportDialog.cpp" line="318"/>
<location filename="../ImportDialog.cpp" line="792"/>
<location filename="../ImportDialog.cpp" line="793"/>
<source>Background Image: %1</source>
<translation type="unfinished"></translation>
</message>
@ -474,7 +455,7 @@ When you want to use it as Avatar the image will be detached!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ImportDialog.cpp" line="792"/>
<location filename="../ImportDialog.cpp" line="793"/>
<source>File</source>
<comment>Background Image: File</comment>
<translation type="unfinished"></translation>
@ -724,26 +705,26 @@ Y: %2</source>
<message>
<location filename="../OptionsDialog.ui" line="399"/>
<location filename="../OptionsDialog.ui" line="422"/>
<location filename="../OptionsDialog.cpp" line="612"/>
<location filename="../OptionsDialog.cpp" line="613"/>
<location filename="../OptionsDialog.cpp" line="627"/>
<location filename="../OptionsDialog.cpp" line="628"/>
<location filename="../OptionsDialog.cpp" line="641"/>
<location filename="../OptionsDialog.cpp" line="642"/>
<location filename="../OptionsDialog.cpp" line="624"/>
<location filename="../OptionsDialog.cpp" line="625"/>
<location filename="../OptionsDialog.cpp" line="639"/>
<location filename="../OptionsDialog.cpp" line="640"/>
<location filename="../OptionsDialog.cpp" line="653"/>
<location filename="../OptionsDialog.cpp" line="654"/>
<source>Found: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.ui" line="406"/>
<location filename="../OptionsDialog.ui" line="429"/>
<location filename="../OptionsDialog.cpp" line="616"/>
<location filename="../OptionsDialog.cpp" line="620"/>
<location filename="../OptionsDialog.cpp" line="628"/>
<location filename="../OptionsDialog.cpp" line="632"/>
<location filename="../OptionsDialog.cpp" line="636"/>
<location filename="../OptionsDialog.cpp" line="645"/>
<location filename="../OptionsDialog.cpp" line="649"/>
<location filename="../OptionsDialog.cpp" line="653"/>
<location filename="../OptionsDialog.cpp" line="644"/>
<location filename="../OptionsDialog.cpp" line="648"/>
<location filename="../OptionsDialog.cpp" line="657"/>
<location filename="../OptionsDialog.cpp" line="661"/>
<location filename="../OptionsDialog.cpp" line="665"/>
<location filename="../OptionsDialog.cpp" line="669"/>
<source>Language: %1</source>
<translation type="unfinished"></translation>
</message>
@ -764,7 +745,7 @@ Y: %2</source>
</message>
<message>
<location filename="../OptionsDialog.ui" line="465"/>
<location filename="../OptionsDialog.cpp" line="574"/>
<location filename="../OptionsDialog.cpp" line="586"/>
<source>Participate in %1 User Statistics</source>
<translation type="unfinished"></translation>
</message>
@ -800,8 +781,8 @@ Y: %2</source>
</message>
<message>
<location filename="../OptionsDialog.ui" line="554"/>
<location filename="../OptionsDialog.cpp" line="590"/>
<location filename="../OptionsDialog.cpp" line="594"/>
<location filename="../OptionsDialog.cpp" line="602"/>
<location filename="../OptionsDialog.cpp" line="606"/>
<source>Participation ID: %1</source>
<translation type="unfinished"></translation>
</message>
@ -823,8 +804,8 @@ Y: %2</source>
<message>
<location filename="../OptionsDialog.ui" line="611"/>
<location filename="../OptionsDialog.ui" line="633"/>
<location filename="../OptionsDialog.cpp" line="202"/>
<location filename="../OptionsDialog.cpp" line="251"/>
<location filename="../OptionsDialog.cpp" line="214"/>
<location filename="../OptionsDialog.cpp" line="263"/>
<source>Current: %1</source>
<translation type="unfinished"></translation>
</message>
@ -881,95 +862,95 @@ Y: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="154"/>
<location filename="../OptionsDialog.cpp" line="166"/>
<source>System</source>
<comment>System in context of System default</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="160"/>
<location filename="../OptionsDialog.cpp" line="172"/>
<source>%1 (Game language)</source>
<comment>Next closest language compared to the Game settings</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="164"/>
<location filename="../OptionsDialog.cpp" line="167"/>
<location filename="../OptionsDialog.cpp" line="176"/>
<location filename="../OptionsDialog.cpp" line="179"/>
<source>%1 (Closest to Interface)</source>
<comment>Next closest language compared to the Interface</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="160"/>
<location filename="../OptionsDialog.cpp" line="164"/>
<location filename="../OptionsDialog.cpp" line="167"/>
<location filename="../OptionsDialog.cpp" line="172"/>
<location filename="../OptionsDialog.cpp" line="176"/>
<location filename="../OptionsDialog.cpp" line="179"/>
<source>Auto</source>
<comment>Automatic language choice.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="154"/>
<location filename="../OptionsDialog.cpp" line="166"/>
<source>%1 (Language priority)</source>
<comment>First language a person can talk with a different person/application. &quot;Native&quot; or &quot;Not Native&quot;.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="462"/>
<location filename="../OptionsDialog.cpp" line="474"/>
<source>%1</source>
<comment>%1</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="462"/>
<location filename="../OptionsDialog.cpp" line="474"/>
<source>The new Custom Folder will initialise after you restart %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="472"/>
<location filename="../OptionsDialog.cpp" line="484"/>
<source>No Profile</source>
<comment>No Profile, as default</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="480"/>
<location filename="../OptionsDialog.cpp" line="484"/>
<location filename="../OptionsDialog.cpp" line="486"/>
<location filename="../OptionsDialog.cpp" line="492"/>
<location filename="../OptionsDialog.cpp" line="496"/>
<location filename="../OptionsDialog.cpp" line="498"/>
<source>Profile: %1</source>
<translation type="unfinished"></translation>
</message>
<message>