Compare commits
No commits in common. "1.9.x" and "1.7.x" have entirely different histories.
33
.ci/app.rc
|
@ -1,33 +0,0 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "5sync.ico"
|
||||
#define RT_MANIFEST 24
|
||||
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest"
|
||||
#include <windows.h>
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION MAJOR_VER, MINOR_VER, PATCH_VER, INT_BUILD_VER
|
||||
PRODUCTVERSION MAJOR_VER, MINOR_VER, PATCH_VER, INT_BUILD_VER
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0809, 1200
|
||||
END
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Syping"
|
||||
VALUE "FileDescription", "gta5view"
|
||||
VALUE "FileVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER"
|
||||
VALUE "InternalName", "gta5view"
|
||||
VALUE "LegalCopyright", "Copyright © 2016-2021 Syping"
|
||||
VALUE "OriginalFilename", "gta5view.exe"
|
||||
VALUE "ProductName", "gta5view"
|
||||
VALUE "ProductVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER"
|
||||
END
|
||||
END
|
||||
END
|
30
.ci/ci.sh
|
@ -9,61 +9,33 @@ export PACKAGE_VERSION=$(grep -oE '^[^\-]*' <<< $APPLICATION_VERSION)
|
|||
export PACKAGE_BUILD=$(grep -oP '\-\K.+' <<< $APPLICATION_VERSION)
|
||||
export EXECUTABLE_VERSION=${PACKAGE_VERSION}${PACKAGE_BUILD}${EXECUTABLE_TAG}
|
||||
|
||||
export APPLICATION_MAJOR_VERSION=$(cut -d. -f1 <<< $APPLICATION_VERSION)
|
||||
export APPLICATION_MINOR_VERSION=$(cut -d. -f2 <<< $APPLICATION_VERSION)
|
||||
export APPLICATION_PATCH_VERSION=$(cut -d. -f3 <<< $APPLICATION_VERSION)
|
||||
|
||||
if [ "${PACKAGE_BUILD}" == "" ]; then
|
||||
export PACKAGE_BUILD=1
|
||||
else
|
||||
export APPLICATION_BUILD_INT_VERSION=$(grep -oE "[1-9]*$" <<< $PACKAGE_BUILD)
|
||||
export APPLICATION_BUILD_STR_VERSION=-${PACKAGE_BUILD}
|
||||
export PACKAGE_BUILD=1;
|
||||
fi
|
||||
|
||||
cat ".ci/app.rc" | sed \
|
||||
-e "s/MAJOR_VER/$APPLICATION_MAJOR_VERSION/g" \
|
||||
-e "s/MINOR_VER/$APPLICATION_MINOR_VERSION/g" \
|
||||
-e "s/PATCH_VER/$APPLICATION_PATCH_VERSION/g" \
|
||||
-e "s/INT_BUILD_VER/0/g" \
|
||||
-e "s/STR_BUILD_VER/$APPLICATION_BUILD_STR_VERSION/g" \
|
||||
-e "s/STR_BUILD_VER/$APPLICATION_BUILD_STR_VERSION/g" \
|
||||
> "res/app.rc"
|
||||
|
||||
if [ "${BUILD_TYPE}" == "ALPHA" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_ALPHA=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_ALPHA"
|
||||
elif [ "${BUILD_TYPE}" == "Alpha" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_ALPHA=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_ALPHA"
|
||||
elif [ "${BUILD_TYPE}" == "BETA" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_BETA=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_BETA"
|
||||
elif [ "${BUILD_TYPE}" == "Beta" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_BETA=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_BETA"
|
||||
elif [ "${BUILD_TYPE}" == "DEV" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_DEV=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DEV"
|
||||
elif [ "${BUILD_TYPE}" == "Development" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_DEV=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DEV"
|
||||
elif [ "${BUILD_TYPE}" == "DAILY" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_DAILY=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DAILY"
|
||||
elif [ "${BUILD_TYPE}" == "Daily" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_DAILY=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DAILY"
|
||||
elif [ "${BUILD_TYPE}" == "RC" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_RC=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_RC"
|
||||
elif [ "${BUILD_TYPE}" == "Release Candidate" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_RC=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_RC"
|
||||
elif [ "${BUILD_TYPE}" == "REL" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_REL=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_REL"
|
||||
elif [ "${BUILD_TYPE}" == "Release" ]; then
|
||||
export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE_REL=TRUE"
|
||||
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_REL"
|
||||
fi
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ cd ${PROJECT_DIR} && \
|
|||
echo "gta5view build version is ${APPLICATION_VERSION}" && \
|
||||
mkdir -p build && \
|
||||
mkdir -p assets && \
|
||||
chmod -x res/gta5sync_*.qm res/*.desktop res/*gta5view*.png && \
|
||||
chmod -x res/gta5sync_*.qm res/gta5view.desktop res/gta5view.png && \
|
||||
cd build && \
|
||||
mkdir -p qt4 && \
|
||||
cd qt4 && \
|
||||
|
@ -16,29 +16,18 @@ cd qt5 && \
|
|||
echo "Grand Theft Auto V Snapmatic and Savegame viewer/editor" > ./description-pak && \
|
||||
cd .. && \
|
||||
|
||||
# Set compiler
|
||||
export CC=clang && \
|
||||
export CXX=clang++ && \
|
||||
|
||||
# Prepare checkinstall step
|
||||
mkdir -p /usr/share/gta5view && \
|
||||
|
||||
# Starting build
|
||||
cd qt5 && \
|
||||
cmake \
|
||||
"-DCMAKE_INSTALL_PREFIX=/usr" \
|
||||
${CMAKE_BUILD_TYPE} \
|
||||
"-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \
|
||||
"-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \
|
||||
"-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \
|
||||
"-DWITH_TELEMETRY=ON" \
|
||||
"-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \
|
||||
"-DQCONF_BUILD=ON" \
|
||||
../../ && \
|
||||
qmake -qt=5 -spec linux-clang GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=gnu++11 ${QMAKE_FLAGS_QT5} ${QMAKE_BUILD_TYPE} "DEFINES+=GTA5SYNC_BUILDCODE=\\\\\\\"${PACKAGE_CODE}\\\\\\\"" "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" "DEFINES+=GTA5SYNC_COMMIT=\\\\\\\"${APPLICATION_COMMIT}\\\\\\\"" DEFINES+=GTA5SYNC_QCONF DEFINES+=GTA5SYNC_TELEMETRY "DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"https://dev.syping.de/gta5view-userstats/\\\\\\\"" DEFINES+=GTA5SYNC_DONATION "DEFINES+=GTA5SYNC_DONATION_EMAIL=\\\\\\\"paypal/at/syping.de\\\\\\\"" ../../gta5view.pro && \
|
||||
make depend && \
|
||||
make -j 4 && \
|
||||
checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt5 --pkgversion=${PACKAGE_VERSION} --pkgrelease=${PACKAGE_BUILD} --pkggroup=utility --maintainer="Syping \<dpkg@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5svg5,libqt5widgets5,qttranslations5-l10n --conflicts=gta5view,gta5view-qt4 --replaces=gta5view,gta5view-qt4 --pakdir=${PROJECT_DIR}/assets && \
|
||||
cd .. && \
|
||||
cd qt4 && \
|
||||
qmake -qt=4 GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=gnu++11 ${QMAKE_FLAGS_QT4} ${QMAKE_BUILD_TYPE} "DEFINES+=GTA5SYNC_BUILDCODE=\\\\\\\"${PACKAGE_CODE}\\\\\\\"" "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" DEFINES+=GTA5SYNC_QCONF ../../gta5view.pro && \
|
||||
make depend && \
|
||||
make -j 4 && \
|
||||
checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt4 --pkgversion=${PACKAGE_VERSION} --pkgrelease=${PACKAGE_BUILD} --pkggroup=utility --maintainer="Syping \<dpkg@syping.de\>" --requires=libqtcore4,libqtgui4,libqt4-network,libqt4-svg,qtcore4-l10n --conflicts=gta5view,gta5view-qt5 --replaces=gta5view,gta5view-qt5 --pakdir=${PROJECT_DIR}/assets
|
||||
|
|
|
@ -12,4 +12,4 @@ docker pull ${DOCKER_IMAGE} && \
|
|||
docker run --rm \
|
||||
-v "${PROJECT_DIR}:${PROJECT_DIR_DOCKER}" \
|
||||
${DOCKER_IMAGE} \
|
||||
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APPLICATION_COMMIT=${APPLICATION_COMMIT} && export BUILD_TYPE=${BUILD_TYPE} && export APT_INSTALL=${APT_INSTALL} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/debian_install.sh && .ci/debian_build.sh"
|
||||
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APPLICATION_COMMIT=${APPLICATION_COMMIT} && export BUILD_TYPE=${BUILD_TYPE} && export APT_INSTALL=${APT_INSTALL} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/debian_install.sh && .ci/debian_build.sh"
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
# Install packages
|
||||
apt-get update -qq && \
|
||||
apt-get install -qq ${APT_INSTALL} checkinstall cmake dpkg-dev fakeroot g++ gcc qtbase5-dev qt5-qmake qttranslations5-l10n libqt4-dev libqt5svg5-dev
|
||||
apt-get install -qq ${APT_INSTALL} checkinstall dpkg-dev fakeroot g++ gcc qtbase5-dev qt5-qmake qttranslations5-l10n libqt4-dev libqt5svg5-dev
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
!define APP_NAME "gta5view"
|
||||
!define COMP_NAME "Syping"
|
||||
!define WEB_SITE "https://gta5view.syping.de/"
|
||||
!define VERSION "1.9.2.0"
|
||||
!define COPYRIGHT "Copyright © 2016-2021 Syping"
|
||||
!define VERSION "1.7.1.0"
|
||||
!define COPYRIGHT "Copyright © 2016-2019 Syping"
|
||||
!define DESCRIPTION "Grand Theft Auto V Savegame and Snapmatic Viewer/Editor"
|
||||
!define INSTALLER_NAME "gta5view_setup.exe"
|
||||
!define MAIN_APP_EXE "gta5view.exe"
|
||||
|
@ -103,48 +103,49 @@ Section -MainProgram
|
|||
${INSTALL_TYPE}
|
||||
SetOverwrite ifnewer
|
||||
SetOutPath "$INSTDIR"
|
||||
File "../build/gta5view.exe"
|
||||
File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libc++.dll"
|
||||
File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libunwind.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/openssl/bin/libcrypto-1_1-x64.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/openssl/bin/libssl-1_1-x64.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Core.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Gui.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Network.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Svg.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Widgets.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5WinExtras.dll"
|
||||
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/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"
|
||||
File "/opt/windev/qt64d-latest/bin/Qt5Svg.dll"
|
||||
File "/opt/windev/qt64d-latest/bin/Qt5Widgets.dll"
|
||||
File "/opt/windev/qt64d-latest/bin/Qt5WinExtras.dll"
|
||||
SetOutPath "$INSTDIR\lang"
|
||||
File "../build/gta5sync_en_US.qm"
|
||||
File "../build/gta5sync_de.qm"
|
||||
File "../build/gta5sync_fr.qm"
|
||||
File "../build/gta5sync_ko.qm"
|
||||
File "../build/gta5sync_ru.qm"
|
||||
File "../build/gta5sync_uk.qm"
|
||||
File "../build/gta5sync_zh_TW.qm"
|
||||
File "../build/qtbase_en_GB.qm"
|
||||
File "../res/qt5/qtbase_de.qm"
|
||||
File "../res/qt5/qtbase_fr.qm"
|
||||
File "../res/qt5/qtbase_ko.qm"
|
||||
File "../res/qt5/qtbase_ru.qm"
|
||||
File "../res/qt5/qtbase_uk.qm"
|
||||
File "../res/qt5/qtbase_zh_TW.qm"
|
||||
File "../res/gta5sync_en_US.qm"
|
||||
File "../res/gta5sync_de.qm"
|
||||
File "../res/gta5sync_fr.qm"
|
||||
File "../res/gta5sync_ko.qm"
|
||||
File "../res/gta5sync_ru.qm"
|
||||
File "../res/gta5sync_uk.qm"
|
||||
File "../res/gta5sync_zh_TW.qm"
|
||||
File "../res/qtbase_en_GB.qm"
|
||||
File "../res/qtbase_de.qm"
|
||||
File "../res/qtbase_fr.qm"
|
||||
File "../res/qtbase_ko.qm"
|
||||
File "../res/qtbase_ru.qm"
|
||||
File "../res/qtbase_uk.qm"
|
||||
File "../res/qtbase_zh_TW.qm"
|
||||
SetOutPath "$INSTDIR\imageformats"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qgif.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qicns.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qico.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qjpeg.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qsvg.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtga.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtiff.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwbmp.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwebp.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qgif.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qicns.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qico.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qjpeg.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qsvg.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qtga.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qtiff.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qwbmp.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/imageformats/qwebp.dll"
|
||||
SetOutPath "$INSTDIR\platforms"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/platforms/qwindows.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/platforms/qwindows.dll"
|
||||
SetOutPath "$INSTDIR\styles"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qcleanlooksstyle.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qplastiquestyle.dll"
|
||||
File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qwindowsvistastyle.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/styles/qcleanlooksstyle.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/styles/qplastiquestyle.dll"
|
||||
File "/opt/windev/qt64d-latest/plugins/styles/qwindowsvistastyle.dll"
|
||||
SectionEnd
|
||||
|
||||
######################################################################
|
||||
|
@ -194,10 +195,11 @@ SectionEnd
|
|||
Section Uninstall
|
||||
${INSTALL_TYPE}
|
||||
Delete "$INSTDIR\gta5view.exe"
|
||||
Delete "$INSTDIR\libc++.dll"
|
||||
Delete "$INSTDIR\libunwind.dll"
|
||||
Delete "$INSTDIR\libgcc_s_seh-1.dll"
|
||||
Delete "$INSTDIR\libstdc++-6.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"
|
||||
|
|
|
@ -9,6 +9,7 @@ mkdir -p assets && \
|
|||
cd build && \
|
||||
|
||||
/usr/local/opt/qt/bin/qmake ${QMAKE_FLAGS_QT5} ${QMAKE_BUILD_TYPE} "DEFINES+=GTA5SYNC_BUILDCODE=\\\\\\\"${PACKAGE_CODE}\\\\\\\"" "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" "DEFINES+=GTA5SYNC_COMMIT=\\\\\\\"${APPLICATION_COMMIT}\\\\\\\"" DEFINES+=GTA5SYNC_TELEMETRY "DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"https://dev.syping.de/gta5view-userstats/\\\\\\\"" ../gta5view.pro && \
|
||||
make depend && \
|
||||
make -j 4 && \
|
||||
/usr/local/opt/qt/bin/macdeployqt gta5view.app -dmg && \
|
||||
cp -Rf gta5view.dmg ../assets/gta5view-osx_${APPLICATION_VERSION}.dmg
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Install packages
|
||||
brew upgrade qt
|
||||
brew install qt
|
||||
|
|
|
@ -12,15 +12,8 @@ mkdir -p assets && \
|
|||
|
||||
# Starting build
|
||||
cd build && \
|
||||
mingw64-qt-cmake \
|
||||
${CMAKE_BUILD_TYPE} \
|
||||
"-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \
|
||||
"-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \
|
||||
"-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \
|
||||
"-DWITH_TELEMETRY=ON" \
|
||||
"-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \
|
||||
.. && \
|
||||
qmake-static ${QMAKE_FLAGS_QT5} ${QMAKE_BUILD_TYPE} "DEFINES+=GTA5SYNC_BUILDCODE=\\\\\\\"${PACKAGE_CODE}\\\\\\\"" "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" "DEFINES+=GTA5SYNC_COMMIT=\\\\\\\"${APPLICATION_COMMIT}\\\\\\\"" DEFINES+=GTA5SYNC_TELEMETRY "DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"https://dev.syping.de/gta5view-userstats/\\\\\\\"" DEFINES+=GTA5SYNC_DONATION "DEFINES+=GTA5SYNC_DONATION_EMAIL=\\\\\\\"paypal/at/syping.de\\\\\\\"" ../gta5view.pro && \
|
||||
make depend && \
|
||||
make -j 4 && \
|
||||
x86_64-w64-mingw32-strip -s gta5view.exe && \
|
||||
cp -Rf *.exe ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} && \
|
||||
cp -Rf release/*.exe ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} && \
|
||||
cd ${PROJECT_DIR}/assets
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
DOCKER_IMAGE=sypingauto/gta5view-build:1.9-static
|
||||
DOCKER_IMAGE=sypingauto/gta5view-build:1.7-static
|
||||
PROJECT_DIR_DOCKER=/gta5view
|
||||
|
||||
cd ${PROJECT_DIR} && \
|
||||
|
@ -8,7 +8,7 @@ docker pull ${DOCKER_IMAGE} && \
|
|||
docker run --rm \
|
||||
-v "${PROJECT_DIR}:${PROJECT_DIR_DOCKER}" \
|
||||
${DOCKER_IMAGE} \
|
||||
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APPLICATION_COMMIT=${APPLICATION_COMMIT} && export BUILD_TYPE=${BUILD_TYPE} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/windows_build.sh" && \
|
||||
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APPLICATION_COMMIT=${APPLICATION_COMMIT} && export BUILD_TYPE=${BUILD_TYPE} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/windows_build.sh" && \
|
||||
|
||||
# Prepare environment variable
|
||||
export GTA5VIEW_EXECUTABLE=gta5view-${EXECUTABLE_VERSION}${EXECUTABLE_ARCH}.exe && \
|
||||
|
@ -18,8 +18,4 @@ 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
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Install nsis
|
||||
apt-get update -qq && \
|
||||
apt-get install -qq nsis && \
|
||||
|
||||
# Creating folders
|
||||
cd ${PROJECT_DIR} && \
|
||||
echo "gta5view build version is ${APPLICATION_VERSION}" && \
|
||||
|
@ -8,20 +12,9 @@ mkdir -p assets && \
|
|||
|
||||
# Starting build
|
||||
cd build && \
|
||||
mingw64-qt-cmake \
|
||||
${CMAKE_BUILD_TYPE} \
|
||||
"-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \
|
||||
"-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \
|
||||
"-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \
|
||||
"-DWITH_TELEMETRY=ON" \
|
||||
"-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \
|
||||
"-DQCONF_BUILD=ON" \
|
||||
"-DGTA5VIEW_INLANG=RUNDIR:SEPARATOR:lang" \
|
||||
"-DGTA5VIEW_LANG=RUNDIR:SEPARATOR:lang" \
|
||||
"-DGTA5VIEW_PLUG=RUNDIR:SEPARATOR:plugins" \
|
||||
.. && \
|
||||
qmake ${QMAKE_FLAGS_QT5} ${QMAKE_BUILD_TYPE} "DEFINES+=GTA5SYNC_BUILDCODE=\\\\\\\"${PACKAGE_CODE}\\\\\\\"" "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"${APPLICATION_VERSION}\\\\\\\"" "DEFINES+=GTA5SYNC_COMMIT=\\\\\\\"${APPLICATION_COMMIT}\\\\\\\"" DEFINES+=GTA5SYNC_TELEMETRY "DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"https://dev.syping.de/gta5view-userstats/\\\\\\\"" DEFINES+=GTA5SYNC_DONATION "DEFINES+=GTA5SYNC_DONATION_EMAIL=\\\\\\\"paypal/at/syping.de\\\\\\\"" DEFINES+=GTA5SYNC_QCONF DEFINES+=GTA5SYNC_INLANG='\\\"RUNDIR:SEPARATOR:lang\\\"' DEFINES+=GTA5SYNC_LANG='\\\"RUNDIR:SEPARATOR:lang\\\"' DEFINES+=GTA5SYNC_PLUG='\\\"RUNDIR:SEPARATOR:plugins\\\"' "LIBS+=-ljpeg" ../gta5view.pro && \
|
||||
make depend && \
|
||||
make -j 4 && \
|
||||
x86_64-w64-mingw32-strip -s gta5view.exe && \
|
||||
cd ${PROJECT_DIR}/assets && \
|
||||
makensis -NOCD ${PROJECT_DIR}/.ci/gta5view.nsi && \
|
||||
mv -f gta5view_setup.exe gta5view-${EXECUTABLE_VERSION}_setup.exe
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
DOCKER_IMAGE=sypingauto/gta5view-build:1.9-shared
|
||||
DOCKER_IMAGE=sypingauto/gta5view-build:1.7-shared
|
||||
PROJECT_DIR_DOCKER=/gta5view
|
||||
|
||||
cd ${PROJECT_DIR} && \
|
||||
|
@ -8,4 +8,4 @@ docker pull ${DOCKER_IMAGE} && \
|
|||
docker run --rm \
|
||||
-v "${PROJECT_DIR}:${PROJECT_DIR_DOCKER}" \
|
||||
${DOCKER_IMAGE} \
|
||||
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APPLICATION_COMMIT=${APPLICATION_COMMIT} && export BUILD_TYPE=${BUILD_TYPE} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/wininstall_build.sh"
|
||||
/bin/bash -c "export PROJECT_DIR=${PROJECT_DIR_DOCKER} && export QT_SELECT=${QT_SELECT} && export APPLICATION_VERSION=${APPLICATION_VERSION} && export APPLICATION_COMMIT=${APPLICATION_COMMIT} && export BUILD_TYPE=${BUILD_TYPE} && export QMAKE_FLAGS_QT4=${QMAKE_FLAGS_QT4} && export QMAKE_FLAGS_QT5=${QMAKE_FLAGS_QT5} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/wininstall_build.sh"
|
||||
|
|
36
.drone.yml
|
@ -1,36 +0,0 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
|
||||
environment:
|
||||
BUILD_TYPE: "REL"
|
||||
|
||||
steps:
|
||||
- name: Windows Installer
|
||||
image: sypingauto/gta5view-build:1.9-shared
|
||||
environment:
|
||||
BUILD_SCRIPT: "wininstall_build.sh"
|
||||
QT_SELECT: "qt5-x86_64-w64-mingw32"
|
||||
TCA_PASS:
|
||||
from_secret: tca_pass
|
||||
commands:
|
||||
- .drone/drone.sh
|
||||
volumes:
|
||||
- name: gta5view
|
||||
path: /srv/gta5view
|
||||
- name: Windows Portable
|
||||
image: sypingauto/gta5view-build:1.9-static
|
||||
environment:
|
||||
BUILD_SCRIPT: "windows_build.sh"
|
||||
QT_SELECT: "qt5-x86_64-w64-mingw32"
|
||||
TCA_PASS:
|
||||
from_secret: tca_pass
|
||||
commands:
|
||||
- .drone/drone.sh
|
||||
volumes:
|
||||
- name: gta5view
|
||||
path: /srv/gta5view
|
||||
|
||||
volumes:
|
||||
- name: gta5view
|
||||
host:
|
||||
path: /srv/gta5view
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Cleanup previous Drone build
|
||||
if [ -d "assets" ]; then
|
||||
rm -rf assets
|
||||
fi
|
||||
if [ -d "build" ]; then
|
||||
rm -rf build
|
||||
fi
|
||||
|
||||
# Decrypt Telemetry Authenticator
|
||||
rm -rf tmext/TelemetryClassAuthenticator.cpp && \
|
||||
openssl aes-256-cbc -k ${TCA_PASS} -in .drone/TelemetryClassAuthenticator.cpp.enc -out tmext/TelemetryClassAuthenticator.cpp -d -pbkdf2
|
||||
|
||||
# Check if build is not tagged
|
||||
if [ "${DRONE_TAG}" == "" ]; then
|
||||
export EXECUTABLE_TAG=-$(git rev-parse --short HEAD)
|
||||
else
|
||||
export EXECUTABLE_TAG=
|
||||
fi
|
||||
|
||||
# Check if package code is not set
|
||||
if [ "${PACKAGE_CODE}" == "" ]; then
|
||||
export PACKAGE_CODE=Drone
|
||||
fi
|
||||
|
||||
# Init Application Commit Hash
|
||||
export APPLICATION_COMMIT=$(git rev-parse --short HEAD)
|
||||
|
||||
# Start CI script and copying assets into gta5view directory
|
||||
.ci/ci.sh && \
|
||||
mkdir -p /srv/gta5view/${APPLICATION_COMMIT} && \
|
||||
cp -Rf assets/* /srv/gta5view/${APPLICATION_COMMIT}/
|
|
@ -1,20 +0,0 @@
|
|||
app-id: de.syping.gta5view
|
||||
runtime: org.kde.Platform
|
||||
runtime-version: '5.15'
|
||||
sdk: org.kde.Sdk
|
||||
command: gta5view
|
||||
finish-args:
|
||||
- --share=network
|
||||
- --share=ipc
|
||||
- --socket=fallback-x11
|
||||
- --socket=wayland
|
||||
- --device=dri
|
||||
modules:
|
||||
- name: gta5view
|
||||
buildsystem: cmake-ninja
|
||||
config-opts:
|
||||
- -DFLATPAK_BUILD=ON
|
||||
- -DQCONF_BUILD=ON
|
||||
sources:
|
||||
- type: dir
|
||||
path: ../
|
|
@ -6,7 +6,7 @@ variables:
|
|||
|
||||
Windows Installer:
|
||||
stage: build
|
||||
image: sypingauto/gta5view-build:1.9-shared
|
||||
image: sypingauto/gta5view-build:1.7-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.9-static
|
||||
image: sypingauto/gta5view-build:1.7-static
|
||||
variables:
|
||||
BUILD_SCRIPT: "windows_build.sh"
|
||||
QT_SELECT: "qt5-x86_64-w64-mingw32"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Decrypt Telemetry Authenticator
|
||||
rm -rf tmext/TelemetryClassAuthenticator.cpp && \
|
||||
openssl aes-256-cbc -k ${tca_pass} -in .gitlab/TelemetryClassAuthenticator.cpp.enc -out tmext/TelemetryClassAuthenticator.cpp -d
|
||||
openssl aes-256-cbc -k $tca_pass -in .gitlab/TelemetryClassAuthenticator.cpp.enc -out tmext/TelemetryClassAuthenticator.cpp -d
|
||||
|
||||
# Check if build is not tagged
|
||||
if [ "${CI_COMMIT_TAG}" == "" ]; then
|
||||
|
|
10
.travis.yml
|
@ -1,9 +1,9 @@
|
|||
dist: bionic
|
||||
dist: trusty
|
||||
sudo: required
|
||||
|
||||
language: cpp
|
||||
|
||||
services:
|
||||
service:
|
||||
- docker
|
||||
|
||||
env:
|
||||
|
@ -27,17 +27,11 @@ matrix:
|
|||
- QT_SELECT=qt5-x86_64-w64-mingw32
|
||||
- RELEASE_LABEL="Windows 64-Bit Portable for gta5-mods"
|
||||
- PACKAGE_CODE=gta5-mods
|
||||
- env:
|
||||
- BUILD_SCRIPT=windows_docker.sh
|
||||
- QT_SELECT=qt5-x86_64-w64-mingw32
|
||||
- RELEASE_LABEL="Windows 64-Bit Portable for gtainside"
|
||||
- PACKAGE_CODE=gtainside
|
||||
- env:
|
||||
- BUILD_SCRIPT=wininstall_docker.sh
|
||||
- QT_SELECT=qt5-x86_64-w64-mingw32
|
||||
- RELEASE_LABEL="Windows 64-Bit Installer"
|
||||
- os: osx
|
||||
osx_image: xcode10.3
|
||||
env:
|
||||
- BUILD_SCRIPT=osx_ci.sh
|
||||
- RELEASE_LABEL="Mac OS X 64-Bit Disk Image"
|
||||
|
|
|
@ -32,42 +32,45 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
|||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
|
||||
// Build Strings
|
||||
const QString appVersion = QApplication::applicationVersion();
|
||||
QString appVersion = qApp->applicationVersion();
|
||||
QString buildType = tr(GTA5SYNC_BUILDTYPE);
|
||||
buildType.replace("_", " ");
|
||||
const QString projectBuild = AppEnv::getBuildDateTime();
|
||||
const QString buildStr = GTA5SYNC_BUILDSTRING;
|
||||
QString projectBuild = AppEnv::getBuildDateTime();
|
||||
QString buildStr = GTA5SYNC_BUILDSTRING;
|
||||
#ifndef GTA5SYNC_BUILDTYPE_REL
|
||||
#ifdef GTA5SYNC_COMMIT
|
||||
if (!appVersion.contains("-"))
|
||||
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
|
||||
if (!appVersion.contains("-")) { appVersion = appVersion % "-" % GTA5SYNC_COMMIT; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Translator Comments
|
||||
//: Translated by translator, example Translated by Syping
|
||||
const QString translatedByStr = tr("Translated by %1");
|
||||
QString translatedByStr = tr("Translated by %1");
|
||||
//: Insert your name here and profile here in following scheme, First Translator,First Profile\\nSecond Translator\\nThird Translator,Second Profile
|
||||
const QString translatorVal = tr("TRANSLATOR");
|
||||
QString translatorVal = tr("TRANSLATOR");
|
||||
QStringList translatorContent;
|
||||
if (translatorVal != "TRANSLATOR") {
|
||||
if (translatorVal != "TRANSLATOR")
|
||||
{
|
||||
const QStringList translatorList = translatorVal.split('\n');
|
||||
for (const QString &translatorStr : translatorList) {
|
||||
for (const QString &translatorStr : translatorList)
|
||||
{
|
||||
QStringList translatorStrList = translatorStr.split(',');
|
||||
const QString translatorName = translatorStrList.at(0);
|
||||
QString translatorName = translatorStrList.at(0);
|
||||
translatorStrList.removeFirst();
|
||||
QString translatorProfile = translatorStrList.join(QString());
|
||||
if (!translatorProfile.isEmpty()) {
|
||||
if (!translatorProfile.isEmpty())
|
||||
{
|
||||
translatorContent += QString("<a href=\"%1\">%2</a>").arg(translatorProfile, translatorName);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
translatorContent += translatorName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Project Description
|
||||
const QString projectDes = tr("A project for viewing Grand Theft Auto V Snapmatic<br/>\nPictures and Savegames");
|
||||
QString projectDes = tr("A project for viewing Grand Theft Auto V Snapmatic<br/>\nPictures and Savegames");
|
||||
|
||||
// Copyright Description
|
||||
QString copyrightDes1 = tr("Copyright © <a href=\"%1\">%2</a> %3");
|
||||
|
@ -75,34 +78,40 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
|||
QString copyrightDes2 = tr("%1 is licensed under <a href=\"https://www.gnu.org/licenses/gpl-3.0.html#content\">GNU GPLv3</a>");
|
||||
copyrightDes2 = copyrightDes2.arg(GTA5SYNC_APPSTR);
|
||||
QString copyrightDesA;
|
||||
if (!translatorContent.isEmpty()) {
|
||||
if (!translatorContent.isEmpty())
|
||||
{
|
||||
copyrightDesA = copyrightDes1 % "<br/>" % translatedByStr.arg(translatorContent.join(", ")) % "<br/>" % copyrightDes2;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
copyrightDesA = copyrightDes1 % "<br/>" % copyrightDes2;
|
||||
}
|
||||
|
||||
// Setup User Interface
|
||||
ui->setupUi(this);
|
||||
aboutStr = ui->labAbout->text();
|
||||
titleStr = windowTitle();
|
||||
titleStr = this->windowTitle();
|
||||
ui->labAbout->setText(aboutStr.arg(GTA5SYNC_APPSTR, projectDes, appVersion % " (" % buildType % ")", projectBuild, buildStr, qVersion(), copyrightDesA));
|
||||
setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR));
|
||||
this->setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR));
|
||||
|
||||
// Set Icon for Close Button
|
||||
if (QIcon::hasThemeIcon("dialog-close")) {
|
||||
if (QIcon::hasThemeIcon("dialog-close"))
|
||||
{
|
||||
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-close")) {
|
||||
else if (QIcon::hasThemeIcon("gtk-close"))
|
||||
{
|
||||
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
|
||||
}
|
||||
|
||||
// DPI calculation
|
||||
qreal screenRatio = AppEnv::screenRatio();
|
||||
if (!translatorContent.isEmpty()) {
|
||||
if (!translatorContent.isEmpty())
|
||||
{
|
||||
resize(375 * screenRatio, 270 * screenRatio);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
resize(375 * screenRatio, 260 * screenRatio);
|
||||
}
|
||||
}
|
||||
|
@ -114,11 +123,13 @@ AboutDialog::~AboutDialog()
|
|||
|
||||
void AboutDialog::on_labAbout_linkActivated(const QString &link)
|
||||
{
|
||||
if (link.left(12) == "g5e://about?") {
|
||||
if (link.left(12) == "g5e://about?")
|
||||
{
|
||||
QStringList aboutStrList = QString(link).remove(0, 12).split(":");
|
||||
QMessageBox::information(this, QString::fromUtf8(QByteArray::fromBase64(aboutStrList.at(0).toUtf8())), QString::fromUtf8(QByteArray::fromBase64(aboutStrList.at(1).toUtf8())));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(link));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><span style="font-weight:600">%1</span><br/>
|
||||
<string><span style=" font-weight:600;">%1</span><br/>
|
||||
<br/>
|
||||
%2<br/>
|
||||
<br/>
|
||||
|
|
26
AppEnv.cpp
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* 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
|
||||
|
@ -22,17 +22,13 @@
|
|||
#include "StandardPaths.h"
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include <QScreen>
|
||||
#include <QDebug>
|
||||
#include <QRect>
|
||||
#include <QDir>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
@ -157,7 +153,7 @@ QString AppEnv::getPluginsFolder()
|
|||
QByteArray AppEnv::getUserAgent()
|
||||
{
|
||||
#if QT_VERSION >= 0x050400
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
QString kernelVersion = QSysInfo::kernelVersion();
|
||||
const QStringList &kernelVersionList = kernelVersion.split(".");
|
||||
if (kernelVersionList.length() > 2)
|
||||
|
@ -214,7 +210,7 @@ QUrl AppEnv::getPlayerFetchingUrl(QString crewID, int pageNumber)
|
|||
|
||||
GameVersion AppEnv::getGameVersion()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
QString argumentValue;
|
||||
#ifdef _WIN64
|
||||
argumentValue = "\\WOW6432Node";
|
||||
|
@ -272,7 +268,7 @@ GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
|
|||
{
|
||||
if (gameVersion == GameVersion::SocialClubVersion)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
QString argumentValue;
|
||||
#ifdef _WIN64
|
||||
argumentValue = "\\WOW6432Node";
|
||||
|
@ -286,7 +282,7 @@ GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
|
|||
}
|
||||
else if (gameVersion == GameVersion::SteamVersion)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
QString argumentValue;
|
||||
#ifdef _WIN64
|
||||
argumentValue = "\\WOW6432Node";
|
||||
|
@ -447,7 +443,7 @@ bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
|
|||
}
|
||||
if (socialClubVersion)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
QString argumentValue;
|
||||
#ifdef _WIN64
|
||||
argumentValue = "\\WOW6432Node";
|
||||
|
@ -472,7 +468,7 @@ bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
|
|||
}
|
||||
if (steamVersion)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
QString argumentValue;
|
||||
#ifdef _WIN64
|
||||
argumentValue = "\\WOW6432Node";
|
||||
|
@ -503,9 +499,9 @@ bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
|
|||
qreal AppEnv::screenRatio()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
qreal dpi = QApplication::primaryScreen()->logicalDotsPerInch();
|
||||
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
||||
#else
|
||||
qreal dpi = QApplication::desktop()->logicalDpiX();
|
||||
qreal dpi = qApp->desktop()->logicalDpiX();
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
return (dpi / 72);
|
||||
|
@ -517,7 +513,7 @@ qreal AppEnv::screenRatio()
|
|||
qreal AppEnv::screenRatioPR()
|
||||
{
|
||||
#if QT_VERSION >= 0x050600
|
||||
return QApplication::primaryScreen()->devicePixelRatio();
|
||||
return QGuiApplication::primaryScreen()->devicePixelRatio();
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
|
|
373
CMakeLists.txt
|
@ -1,373 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.7)
|
||||
|
||||
project(gta5view LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
option(QT6_BUILD "Build gta5view with Qt6" OFF)
|
||||
if(QT6_BUILD)
|
||||
set(QT_VERSION_MAJOR 6)
|
||||
else()
|
||||
set(QT_VERSION_MAJOR 5)
|
||||
endif()
|
||||
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network Svg Widgets REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS LinguistTools QUIET)
|
||||
|
||||
if(WIN32)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WinExtras REQUIRED)
|
||||
list(APPEND GTA5VIEW_LIBS
|
||||
Qt${QT_VERSION_MAJOR}::WinExtras
|
||||
)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DUNICODE
|
||||
-D_UNICODE
|
||||
-DWIN32
|
||||
)
|
||||
list(APPEND GTA5VIEW_RESOURCES
|
||||
res/app.rc
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_CMAKE
|
||||
-DGTA5SYNC_PROJECT
|
||||
-DSNAPMATIC_NODEFAULT
|
||||
)
|
||||
|
||||
set(GTA5VIEW_SOURCES
|
||||
main.cpp
|
||||
AboutDialog.cpp
|
||||
AppEnv.cpp
|
||||
CrewDatabase.cpp
|
||||
DatabaseThread.cpp
|
||||
ExportDialog.cpp
|
||||
ExportThread.cpp
|
||||
GlobalString.cpp
|
||||
IconLoader.cpp
|
||||
ImportDialog.cpp
|
||||
JsonEditorDialog.cpp
|
||||
MapLocationDialog.cpp
|
||||
OptionsDialog.cpp
|
||||
PictureDialog.cpp
|
||||
PictureExport.cpp
|
||||
PictureWidget.cpp
|
||||
PlayerListDialog.cpp
|
||||
ProfileDatabase.cpp
|
||||
ProfileInterface.cpp
|
||||
ProfileLoader.cpp
|
||||
ProfileWidget.cpp
|
||||
RagePhoto.cpp
|
||||
SavegameCopy.cpp
|
||||
SavegameData.cpp
|
||||
SavegameDialog.cpp
|
||||
SavegameWidget.cpp
|
||||
SidebarGenerator.cpp
|
||||
SnapmaticEditor.cpp
|
||||
SnapmaticPicture.cpp
|
||||
SnapmaticWidget.cpp
|
||||
StandardPaths.cpp
|
||||
StringParser.cpp
|
||||
TranslationClass.cpp
|
||||
UserInterface.cpp
|
||||
anpro/imagecropper.cpp
|
||||
pcg/pcg_basic.c
|
||||
uimod/JSHighlighter.cpp
|
||||
uimod/UiModLabel.cpp
|
||||
uimod/UiModWidget.cpp
|
||||
)
|
||||
|
||||
set(GTA5VIEW_HEADERS
|
||||
config.h
|
||||
AboutDialog.h
|
||||
AppEnv.h
|
||||
CrewDatabase.h
|
||||
DatabaseThread.h
|
||||
ExportDialog.h
|
||||
ExportThread.h
|
||||
GlobalString.h
|
||||
IconLoader.h
|
||||
ImportDialog.h
|
||||
JsonEditorDialog.h
|
||||
MapLocationDialog.h
|
||||
OptionsDialog.h
|
||||
PictureDialog.h
|
||||
PictureExport.h
|
||||
PictureWidget.h
|
||||
PlayerListDialog.h
|
||||
ProfileDatabase.h
|
||||
ProfileInterface.h
|
||||
ProfileLoader.h
|
||||
ProfileWidget.h
|
||||
RagePhoto.h
|
||||
SavegameCopy.h
|
||||
SavegameData.h
|
||||
SavegameDialog.h
|
||||
SavegameWidget.h
|
||||
SidebarGenerator.h
|
||||
SnapmaticEditor.h
|
||||
SnapmaticPicture.h
|
||||
SnapmaticWidget.h
|
||||
StandardPaths.h
|
||||
StringParser.h
|
||||
TranslationClass.h
|
||||
UserInterface.h
|
||||
anpro/imagecropper.h
|
||||
pcg/pcg_basic.h
|
||||
uimod/JSHighlighter.h
|
||||
uimod/UiModLabel.h
|
||||
uimod/UiModWidget.h
|
||||
)
|
||||
|
||||
set(GTA5VIEW_INCLUDEDIR
|
||||
anpro
|
||||
pcg
|
||||
uimod
|
||||
)
|
||||
|
||||
set(GTA5VIEW_FORMS
|
||||
AboutDialog.ui
|
||||
ExportDialog.ui
|
||||
ImportDialog.ui
|
||||
JsonEditorDialog.ui
|
||||
MapLocationDialog.ui
|
||||
OptionsDialog.ui
|
||||
PictureDialog.ui
|
||||
PlayerListDialog.ui
|
||||
ProfileInterface.ui
|
||||
SavegameDialog.ui
|
||||
SavegameWidget.ui
|
||||
SnapmaticEditor.ui
|
||||
SnapmaticWidget.ui
|
||||
UserInterface.ui
|
||||
)
|
||||
|
||||
list(APPEND GTA5VIEW_RESOURCES
|
||||
res/app.qrc
|
||||
res/global.qrc
|
||||
)
|
||||
set_property(SOURCE res/global.qrc PROPERTY AUTORCC_OPTIONS "-threshold;0;-compress;9")
|
||||
|
||||
if(Qt5LinguistTools_FOUND)
|
||||
qt5_add_translation(GTA5VIEW_TRANSLATIONS
|
||||
res/gta5sync_de.ts
|
||||
res/gta5sync_en_US.ts
|
||||
res/gta5sync_fr.ts
|
||||
res/gta5sync_ko.ts
|
||||
res/gta5sync_ru.ts
|
||||
res/gta5sync_uk.ts
|
||||
res/gta5sync_zh_TW.ts
|
||||
res/qt5/qtbase_en_GB.ts
|
||||
)
|
||||
add_custom_target(translations DEPENDS ${GTA5VIEW_TRANSLATIONS})
|
||||
else()
|
||||
set(GTA5VIEW_TRANSLATIONS
|
||||
res/gta5sync_de.qm
|
||||
res/gta5sync_en_US.qm
|
||||
res/gta5sync_fr.qm
|
||||
res/gta5sync_ko.qm
|
||||
res/gta5sync_ru.qm
|
||||
res/gta5sync_uk.qm
|
||||
res/gta5sync_zh_TW.qm
|
||||
res/qt${QT_VERSION_MAJOR}/qtbase_en_GB.qm
|
||||
)
|
||||
endif()
|
||||
|
||||
option(QCONF_BUILD "System installation intended Qconf build" OFF)
|
||||
if(QCONF_BUILD)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_QCONF
|
||||
)
|
||||
else()
|
||||
list(APPEND GTA5VIEW_RESOURCES
|
||||
res/tr_g5p.qrc
|
||||
res/qt${QT_VERSION_MAJOR}/tr_qt.qrc
|
||||
)
|
||||
endif()
|
||||
|
||||
option(FLATPAK_BUILD "Flatpak modifications and identifications" OFF)
|
||||
if(FLATPAK_BUILD)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_BUILDCODE=\"Flatpak\""
|
||||
"-DGTA5SYNC_BUILDTYPE=\"Flatpak\""
|
||||
-DGTA5SYNC_FLATPAK
|
||||
)
|
||||
endif()
|
||||
|
||||
option(WITH_MOTD "Developer message system directed to users" OFF)
|
||||
if(WITH_MOTD)
|
||||
set(MOTD_WEBURL "" CACHE STRING "Messages WebURL")
|
||||
list(APPEND GTA5VIEW_HEADERS
|
||||
MessageThread.h
|
||||
)
|
||||
list(APPEND GTA5VIEW_SOURCES
|
||||
MessageThread.cpp
|
||||
)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_MOTD
|
||||
)
|
||||
if(MOTD_WEBURL)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_MOTD_WEBURL=\"${MOTD_WEBURL}\""
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(WITH_TELEMETRY "Hardware survey and basic telemetry system" OFF)
|
||||
if(WITH_TELEMETRY)
|
||||
set(TELEMETRY_AUTHID "" CACHE STRING "Telemetry AuthID")
|
||||
set(TELEMETRY_AUTHPW "" CACHE STRING "Telemetry AuthPW")
|
||||
set(TELEMETRY_PUSHURL "" CACHE STRING "Telemetry PushURL")
|
||||
set(TELEMETRY_REGURL "" CACHE STRING "Telemetry RegURL")
|
||||
set(TELEMETRY_WEBURL "" CACHE STRING "Telemetry WebURL")
|
||||
list(APPEND GTA5VIEW_HEADERS
|
||||
TelemetryClass.h
|
||||
tmext/TelemetryClassAuthenticator.h
|
||||
)
|
||||
list(APPEND GTA5VIEW_SOURCES
|
||||
TelemetryClass.cpp
|
||||
tmext/TelemetryClassAuthenticator.cpp
|
||||
)
|
||||
list(APPEND GTA5VIEW_INCLUDEDIR
|
||||
tmext
|
||||
)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_TELEMETRY
|
||||
)
|
||||
if(TELEMETRY_AUTHID AND TELEMETRY_AUTHPW AND TELEMETRY_PUSHURL AND TELEMETRY_REGURL)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_TELEMETRY_AUTHID=\"${TELEMETRY_AUTHID}\""
|
||||
"-DGTA5SYNC_TELEMETRY_AUTHPW=\"${TELEMETRY_AUTHPW}\""
|
||||
"-DGTA5SYNC_TELEMETRY_PUSHURL=\"${TELEMETRY_PUSHURL}\""
|
||||
"-DGTA5SYNC_TELEMETRY_REGURL=\"${TELEMETRY_REGURL}\""
|
||||
)
|
||||
endif()
|
||||
if(TELEMETRY_WEBURL)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_TELEMETRY_WEBURL=\"${TELEMETRY_WEBURL}\""
|
||||
)
|
||||
endif()
|
||||
if(WIN32)
|
||||
list(APPEND GTA5VIEW_LIBS
|
||||
d3d9
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(GTA5VIEW_APPVER)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_APPVER=\"${GTA5VIEW_APPVER}\""
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_BUILDCODE)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_BUILDCODE=\"${GTA5VIEW_BUILDCODE}\""
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_BUILDTYPE)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_BUILDTYPE=\"${GTA5VIEW_BUILDTYPE}\""
|
||||
)
|
||||
else()
|
||||
if(GTA5VIEW_BUILDTYPE_ALPHA)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_BUILDTYPE_ALPHA
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_BUILDTYPE_BETA)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_BUILDTYPE_BETA
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_BUILDTYPE_DEV)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_BUILDTYPE_DEV
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_BUILDTYPE_DAILY)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_BUILDTYPE_DAILY
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_BUILDTYPE_RC)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_BUILDTYPE_RC
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_BUILDTYPE_REL)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_BUILDTYPE_REL
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(GTA5VIEW_COMMIT)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_COMMIT=\"${GTA5VIEW_COMMIT}\""
|
||||
)
|
||||
endif()
|
||||
|
||||
if(GTA5VIEW_INLANG)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_INLANG=\"${GTA5VIEW_INLANG}\""
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_LANG)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_LANG=\"${GTA5VIEW_LANG}\""
|
||||
)
|
||||
endif()
|
||||
if(GTA5VIEW_PLUG)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
"-DGTA5SYNC_PLUG=\"${GTA5VIEW_PLUG}\""
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(gta5view
|
||||
WIN32 MACOSX_BUNDLE
|
||||
${GTA5VIEW_HEADERS}
|
||||
${GTA5VIEW_SOURCES}
|
||||
${GTA5VIEW_FORMS}
|
||||
${GTA5VIEW_RESOURCES}
|
||||
)
|
||||
|
||||
if(Qt5LinguistTools_FOUND AND QCONF_BUILD)
|
||||
add_dependencies(gta5view translations)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0")
|
||||
target_precompile_headers(gta5view PRIVATE config.h)
|
||||
endif()
|
||||
|
||||
if(Qt5Core_VERSION VERSION_GREATER_EQUAL "5.14.0")
|
||||
qt5_import_plugins(gta5view INCLUDE Qt5::QSvgPlugin)
|
||||
elseif(Qt6Core_VERSION VERSION_GREATER_EQUAL "6.0")
|
||||
qt6_import_plugins(gta5view INCLUDE Qt6::QSvgPlugin)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(gta5view PRIVATE ${GTA5VIEW_DEFINES})
|
||||
target_include_directories(gta5view PRIVATE ${GTA5VIEW_INCLUDEDIR})
|
||||
target_link_libraries(gta5view PRIVATE Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Widgets ${GTA5VIEW_LIBS})
|
||||
|
||||
install(TARGETS gta5view DESTINATION bin)
|
||||
install(FILES res/de.syping.gta5view.desktop DESTINATION share/applications)
|
||||
install(FILES res/de.syping.gta5view.metainfo.xml DESTINATION share/metainfo)
|
||||
install(FILES res/gta5view-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-96.png DESTINATION share/icons/hicolor/96x96/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/gta5view-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME de.syping.gta5view.png)
|
||||
install(FILES res/de.syping.gta5view.png DESTINATION share/pixmaps)
|
||||
if(QCONF_BUILD)
|
||||
install(FILES ${GTA5VIEW_TRANSLATIONS} DESTINATION share/gta5view/translations)
|
||||
endif()
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* 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
|
||||
|
@ -48,8 +48,11 @@ void DatabaseThread::run()
|
|||
|
||||
while (threadRunning)
|
||||
{
|
||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||
threadLoop.exec();
|
||||
if (threadRunning)
|
||||
{
|
||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||
threadLoop.exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,9 +65,7 @@ void DatabaseThread::scanCrewReference(const QStringList &crewList, const int &r
|
|||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||
QNetworkRequest netRequest(AppEnv::getCrewFetchingUrl(crewID));
|
||||
#if QT_VERSION >= 0x050600
|
||||
#if QT_VERSION < 0x060000
|
||||
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
#endif
|
||||
#endif
|
||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||
netRequest.setRawHeader("Accept", "text/html");
|
||||
|
@ -137,9 +138,7 @@ void DatabaseThread::scanCrewMembersList(const QStringList &crewList, const int
|
|||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||
QNetworkRequest netRequest(AppEnv::getPlayerFetchingUrl(crewID, currentPage));
|
||||
#if QT_VERSION >= 0x050600
|
||||
#if QT_VERSION < 0x060000
|
||||
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||
#endif
|
||||
#endif
|
||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||
netRequest.setRawHeader("Accept", "application/json");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* 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
|
||||
|
@ -22,19 +22,14 @@
|
|||
#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)
|
||||
{
|
||||
|
@ -49,7 +44,7 @@ void ExportThread::run()
|
|||
// Quality Settings
|
||||
settings.beginGroup("Pictures");
|
||||
int defaultQuality = 100;
|
||||
QSize defExportSize = SnapmaticPicture::getSnapmaticResolution();
|
||||
QSize defExportSize = QSize(960, 536);
|
||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
||||
if (customQuality < 1 || customQuality > 100)
|
||||
{
|
||||
|
@ -106,17 +101,8 @@ void ExportThread::run()
|
|||
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();
|
||||
int desktopSizeWidth = desktopResolution.width();
|
||||
int desktopSizeHeight = desktopResolution.height();
|
||||
#endif
|
||||
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
|
||||
QRect desktopResolution = qApp->desktop()->screenGeometry();
|
||||
exportPicture = exportPicture.scaled(desktopResolution.width(), desktopResolution.height(), aspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
else if (sizeMode == "Custom")
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-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
|
||||
|
@ -35,11 +35,9 @@ QMap<QString, QString> GlobalString::getGlobalMap()
|
|||
{
|
||||
QMap<QString, QString> globalMap;
|
||||
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
||||
#if QT_VERSION < 0x060000
|
||||
globalFile.setIniCodec("UTF-8");
|
||||
#endif
|
||||
globalFile.beginGroup("Global");
|
||||
for (const QString &globalStr : globalFile.childKeys())
|
||||
for (QString globalStr : globalFile.childKeys())
|
||||
{
|
||||
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
|
||||
}
|
||||
|
@ -51,9 +49,7 @@ QString GlobalString::getString(QString valueStr, bool *ok)
|
|||
{
|
||||
QString globalString = valueStr;
|
||||
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
||||
#if QT_VERSION < 0x060000
|
||||
globalFile.setIniCodec("UTF-8");
|
||||
#endif
|
||||
globalFile.beginGroup("Global");
|
||||
QStringList globalStrList = globalFile.childKeys();
|
||||
if (globalStrList.contains(valueStr))
|
||||
|
|
|
@ -27,15 +27,15 @@ IconLoader::IconLoader()
|
|||
QIcon IconLoader::loadingAppIcon()
|
||||
{
|
||||
QIcon appIcon;
|
||||
appIcon.addFile(":/img/gta5view-16.png", QSize(16, 16));
|
||||
appIcon.addFile(":/img/gta5view-24.png", QSize(24, 24));
|
||||
appIcon.addFile(":/img/gta5view-32.png", QSize(32, 32));
|
||||
appIcon.addFile(":/img/gta5view-40.png", QSize(40, 40));
|
||||
appIcon.addFile(":/img/gta5view-48.png", QSize(48, 48));
|
||||
appIcon.addFile(":/img/gta5view-64.png", QSize(64, 64));
|
||||
appIcon.addFile(":/img/gta5view-96.png", QSize(96, 96));
|
||||
appIcon.addFile(":/img/gta5view-128.png", QSize(128, 128));
|
||||
appIcon.addFile(":/img/gta5view-256.png", QSize(256, 256));
|
||||
appIcon.addFile(":/img/5sync-16.png", QSize(16, 16));
|
||||
appIcon.addFile(":/img/5sync-24.png", QSize(24, 24));
|
||||
appIcon.addFile(":/img/5sync-32.png", QSize(32, 32));
|
||||
appIcon.addFile(":/img/5sync-40.png", QSize(40, 40));
|
||||
appIcon.addFile(":/img/5sync-48.png", QSize(48, 48));
|
||||
appIcon.addFile(":/img/5sync-64.png", QSize(64, 64));
|
||||
appIcon.addFile(":/img/5sync-96.png", QSize(96, 96));
|
||||
appIcon.addFile(":/img/5sync-128.png", QSize(128, 128));
|
||||
appIcon.addFile(":/img/5sync-256.png", QSize(256, 256));
|
||||
return appIcon;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
/*****************************************************************************
|
||||
* 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();
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2020 Syping
|
||||
* 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
|
||||
|
@ -16,33 +16,37 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MESSAGETHREAD_H
|
||||
#define MESSAGETHREAD_H
|
||||
#ifndef IMAGEEDITORDIALOG_H
|
||||
#define IMAGEEDITORDIALOG_H
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include "SnapmaticPicture.h"
|
||||
#include <QDialog>
|
||||
|
||||
class MessageThread : public QThread
|
||||
namespace Ui {
|
||||
class ImageEditorDialog;
|
||||
}
|
||||
|
||||
class ImageEditorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MessageThread(uint cacheId, QObject *parent = 0);
|
||||
|
||||
public slots:
|
||||
void terminateThread();
|
||||
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:
|
||||
bool threadRunning;
|
||||
uint cacheId;
|
||||
|
||||
protected:
|
||||
void run();
|
||||
|
||||
signals:
|
||||
void messagesArrived(const QJsonObject &messageObject);
|
||||
void updateCacheId(uint cacheId);
|
||||
void threadTerminated();
|
||||
SnapmaticPicture *smpic;
|
||||
QString profileName;
|
||||
Ui::ImageEditorDialog *ui;
|
||||
int snapmaticResolutionLW;
|
||||
int snapmaticResolutionLH;
|
||||
bool imageIsChanged;
|
||||
QImage pictureCache;
|
||||
};
|
||||
|
||||
#endif // MESSAGETHREAD_H
|
||||
#endif // IMAGEEDITORDIALOG_H
|
|
@ -0,0 +1,108 @@
|
|||
<?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>&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>&Overwrite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cmdClose">
|
||||
<property name="toolTip">
|
||||
<string>Discard changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
385
ImportDialog.cpp
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2017-2020 Syping
|
||||
* Copyright (C) 2017-2019 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
|
||||
|
@ -16,11 +16,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "ImportDialog.h"
|
||||
#include "ui_ImportDialog.h"
|
||||
#include "SnapmaticPicture.h"
|
||||
#include "SidebarGenerator.h"
|
||||
#include "StandardPaths.h"
|
||||
#include "ImportDialog.h"
|
||||
#include "imagecropper.h"
|
||||
#include "AppEnv.h"
|
||||
#include "config.h"
|
||||
|
@ -40,6 +39,8 @@
|
|||
#include <QRgb>
|
||||
|
||||
// IMAGES VALUES
|
||||
#define snapmaticResolutionW 960
|
||||
#define snapmaticResolutionH 536
|
||||
#define snapmaticAvatarResolution 470
|
||||
#define snapmaticAvatarPlacementW 145
|
||||
#define snapmaticAvatarPlacementH 66
|
||||
|
@ -87,14 +88,6 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
|
|||
ui->labBackgroundImage->setText(tr("Background Image:"));
|
||||
ui->cmdBackgroundWipe->setVisible(false);
|
||||
|
||||
// Snapmatic Resolution
|
||||
snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
||||
ui->cbResolution->addItem("GTA V", snapmaticResolution);
|
||||
ui->cbResolution->addItem("FiveM", QSize(1920, 1072));
|
||||
ui->cbResolution->addItem("1280x720", QSize(1280, 720));
|
||||
ui->cbResolution->addItem("1920x1080", QSize(1920, 1080));
|
||||
ui->cbResolution->addItem("2560x1440", QSize(2560, 1440));
|
||||
|
||||
// Set Import Settings
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
settings.beginGroup("Import");
|
||||
|
@ -123,12 +116,13 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
|
|||
#endif
|
||||
|
||||
// Options menu
|
||||
optionsMenu.addAction(tr("&Import new Picture..."), this, SLOT(importNewPicture()));
|
||||
optionsMenu.addAction(tr("&Crop Picture..."), this, SLOT(cropPicture()));
|
||||
optionsMenu.addSeparator();
|
||||
optionsMenu.addAction(tr("&Load Settings..."), this, SLOT(loadImportSettings()));
|
||||
optionsMenu.addAction(tr("&Save Settings..."), this, SLOT(saveImportSettings()));
|
||||
ui->cmdOptions->setMenu(&optionsMenu);
|
||||
optionsMenu = new QMenu(this);
|
||||
optionsMenu->addAction(tr("&Import new Picture..."), this, SLOT(importNewPicture()));
|
||||
optionsMenu->addAction(tr("&Crop Picture..."), this, SLOT(cropPicture()));
|
||||
optionsMenu->addSeparator();
|
||||
optionsMenu->addAction(tr("&Load Settings..."), this, SLOT(loadImportSettings()));
|
||||
optionsMenu->addAction(tr("&Save Settings..."), this, SLOT(saveImportSettings()));
|
||||
ui->cmdOptions->setMenu(optionsMenu);
|
||||
|
||||
setMaximumSize(sizeHint());
|
||||
setMinimumSize(sizeHint());
|
||||
|
@ -137,84 +131,97 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
|
|||
|
||||
ImportDialog::~ImportDialog()
|
||||
{
|
||||
delete optionsMenu;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ImportDialog::processImage()
|
||||
{
|
||||
if (workImage.isNull())
|
||||
return;
|
||||
|
||||
if (workImage.isNull()) return;
|
||||
QImage snapmaticImage = workImage;
|
||||
QPixmap snapmaticPixmap(snapmaticResolution);
|
||||
QPixmap snapmaticPixmap(snapmaticResolutionW, snapmaticResolutionH);
|
||||
snapmaticPixmap.fill(selectedColour);
|
||||
QPainter snapmaticPainter(&snapmaticPixmap);
|
||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
if (!backImage.isNull()) {
|
||||
if (!ui->cbStretch->isChecked()) {
|
||||
if (!backImage.isNull())
|
||||
{
|
||||
if (!ui->cbStretch->isChecked())
|
||||
{
|
||||
int diffWidth = 0;
|
||||
int diffHeight = 0;
|
||||
if (backImage.width() != snapmaticResolution.width()) {
|
||||
diffWidth = snapmaticResolution.width() - backImage.width();
|
||||
if (backImage.width() != snapmaticResolutionW)
|
||||
{
|
||||
diffWidth = snapmaticResolutionW - backImage.width();
|
||||
diffWidth = diffWidth / 2;
|
||||
}
|
||||
else if (backImage.height() != snapmaticResolution.height()) {
|
||||
diffHeight = snapmaticResolution.height() - backImage.height();
|
||||
else if (backImage.height() != snapmaticResolutionH)
|
||||
{
|
||||
diffHeight = snapmaticResolutionH - backImage.height();
|
||||
diffHeight = diffHeight / 2;
|
||||
}
|
||||
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, backImage);
|
||||
}
|
||||
else {
|
||||
snapmaticPainter.drawImage(0, 0, QImage(backImage).scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
else
|
||||
{
|
||||
snapmaticPainter.drawImage(0, 0, QImage(backImage).scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
if (ui->cbAvatar->isChecked() && ui->cbForceAvatarColour->isChecked()) {
|
||||
if (ui->cbAvatar->isChecked() && ui->cbForceAvatarColour->isChecked())
|
||||
{
|
||||
snapmaticPainter.fillRect(snapmaticAvatarPlacementW, snapmaticAvatarPlacementH, snapmaticAvatarResolution, snapmaticAvatarResolution, selectedColour);
|
||||
}
|
||||
}
|
||||
if (insideAvatarZone) {
|
||||
if (insideAvatarZone)
|
||||
{
|
||||
// Avatar mode
|
||||
int diffWidth = 0;
|
||||
int diffHeight = 0;
|
||||
if (!ui->cbIgnore->isChecked()) {
|
||||
if (!ui->cbIgnore->isChecked())
|
||||
{
|
||||
snapmaticImage = snapmaticImage.scaled(snapmaticAvatarResolution, snapmaticAvatarResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if (snapmaticImage.width() > snapmaticImage.height()) {
|
||||
if (snapmaticImage.width() > snapmaticImage.height())
|
||||
{
|
||||
diffHeight = snapmaticAvatarResolution - snapmaticImage.height();
|
||||
diffHeight = diffHeight / 2;
|
||||
}
|
||||
else if (snapmaticImage.width() < snapmaticImage.height()) {
|
||||
else if (snapmaticImage.width() < snapmaticImage.height())
|
||||
{
|
||||
diffWidth = snapmaticAvatarResolution - snapmaticImage.width();
|
||||
diffWidth = diffWidth / 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
snapmaticImage = snapmaticImage.scaled(snapmaticAvatarResolution, snapmaticAvatarResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
snapmaticPainter.drawImage(snapmaticAvatarPlacementW + diffWidth, snapmaticAvatarPlacementH + diffHeight, snapmaticImage);
|
||||
if (ui->cbWatermark->isChecked())
|
||||
processWatermark(&snapmaticPainter);
|
||||
if (ui->cbWatermark->isChecked()) { processWatermark(&snapmaticPainter); }
|
||||
imageTitle = tr("Custom Avatar", "Custom Avatar Description in SC, don't use Special Character!");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// Picture mode
|
||||
int diffWidth = 0;
|
||||
int diffHeight = 0;
|
||||
if (!ui->cbIgnore->isChecked()) {
|
||||
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if (snapmaticImage.width() != snapmaticResolution.width()) {
|
||||
diffWidth = snapmaticResolution.width() - snapmaticImage.width();
|
||||
if (!ui->cbIgnore->isChecked())
|
||||
{
|
||||
snapmaticImage = snapmaticImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if (snapmaticImage.width() != snapmaticResolutionW)
|
||||
{
|
||||
diffWidth = snapmaticResolutionW - snapmaticImage.width();
|
||||
diffWidth = diffWidth / 2;
|
||||
}
|
||||
else if (snapmaticImage.height() != snapmaticResolution.height()) {
|
||||
diffHeight = snapmaticResolution.height() - snapmaticImage.height();
|
||||
else if (snapmaticImage.height() != snapmaticResolutionH)
|
||||
{
|
||||
diffHeight = snapmaticResolutionH - snapmaticImage.height();
|
||||
diffHeight = diffHeight / 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
else
|
||||
{
|
||||
snapmaticImage = snapmaticImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, snapmaticImage);
|
||||
if (ui->cbWatermark->isChecked())
|
||||
processWatermark(&snapmaticPainter);
|
||||
if (ui->cbWatermark->isChecked()) { processWatermark(&snapmaticPainter); }
|
||||
imageTitle = tr("Custom Picture", "Custom Picture Description in SC, don't use Special Character!");
|
||||
}
|
||||
snapmaticPainter.end();
|
||||
|
@ -225,97 +232,66 @@ void ImportDialog::processImage()
|
|||
ui->labPicture->setPixmap(snapmaticPixmap.scaled(snapmaticResolutionLW * screenRatioPR, snapmaticResolutionLH * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
void ImportDialog::reworkImage()
|
||||
{
|
||||
workImage = QImage();
|
||||
if (origImage.width() == origImage.height()) {
|
||||
if (ui->cbResolution->currentIndex() == 0) {
|
||||
insideAvatarZone = true;
|
||||
ui->cbAvatar->setChecked(true);
|
||||
}
|
||||
else {
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
}
|
||||
if (origImage.height() > snapmaticResolution.height()) {
|
||||
workImage = origImage.scaled(snapmaticResolution.height(), snapmaticResolution.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
else {
|
||||
workImage = origImage;
|
||||
}
|
||||
}
|
||||
else if (origImage.width() > snapmaticResolution.width() && origImage.width() > origImage.height()) {
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
workImage = origImage.scaledToWidth(snapmaticResolution.width(), Qt::SmoothTransformation);
|
||||
}
|
||||
else if (origImage.height() > snapmaticResolution.height() && origImage.height() > origImage.width()) {
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
workImage = origImage.scaledToHeight(snapmaticResolution.height(), Qt::SmoothTransformation);
|
||||
}
|
||||
else {
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
workImage = origImage;
|
||||
}
|
||||
processImage();
|
||||
}
|
||||
|
||||
void ImportDialog::processWatermark(QPainter *snapmaticPainter)
|
||||
{
|
||||
bool blackWatermark = false;
|
||||
bool redWatermark = false;
|
||||
if (selectedColour.red() > 127) {
|
||||
if (selectedColour.green() > 127 || selectedColour.blue() > 127) {
|
||||
if (selectedColour.red() > 127)
|
||||
{
|
||||
if (selectedColour.green() > 127 || selectedColour.blue() > 127)
|
||||
{
|
||||
redWatermark = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
redWatermark = true;
|
||||
}
|
||||
if (selectedColour.lightness() > 127) {
|
||||
if (selectedColour.lightness() > 127)
|
||||
{
|
||||
blackWatermark = true;
|
||||
}
|
||||
// draw watermark
|
||||
if (redWatermark) {
|
||||
const QImage viewWatermark = QImage(":/img/watermark_2r.png");
|
||||
snapmaticPainter->drawImage(snapmaticResolution.width() - viewWatermark.width(), 0, viewWatermark);
|
||||
if (redWatermark)
|
||||
{
|
||||
snapmaticPainter->drawImage(0, 0, QImage(":/img/watermark_2r.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
QImage viewWatermark = QImage(":/img/watermark_2b.png");
|
||||
if (!blackWatermark) {
|
||||
if (!blackWatermark)
|
||||
{
|
||||
viewWatermark.invertPixels(QImage::InvertRgb);
|
||||
}
|
||||
snapmaticPainter->drawImage(snapmaticResolution.width() - viewWatermark.width(), 0, viewWatermark);
|
||||
snapmaticPainter->drawImage(0, 0, viewWatermark);
|
||||
}
|
||||
QImage textWatermark = QImage(":/img/watermark_1b.png");
|
||||
if (!blackWatermark) {
|
||||
if (!blackWatermark)
|
||||
{
|
||||
textWatermark.invertPixels(QImage::InvertRgb);
|
||||
}
|
||||
snapmaticPainter->drawImage(snapmaticResolution.width() - textWatermark.width(), 0, textWatermark);
|
||||
snapmaticPainter->drawImage(0, 0, textWatermark);
|
||||
}
|
||||
|
||||
void ImportDialog::processSettings(QString settingsProfile, bool setDefault)
|
||||
{
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
settings.beginGroup("Import");
|
||||
if (setDefault) {
|
||||
if (setDefault)
|
||||
{
|
||||
settings.setValue("Profile", settingsProfile);
|
||||
}
|
||||
if (settingsProfile == "Default") {
|
||||
if (settingsProfile == "Default")
|
||||
{
|
||||
watermarkAvatar = true;
|
||||
watermarkPicture = false;
|
||||
selectedColour = QColor::fromRgb(0, 0, 0, 255);
|
||||
backImage = QImage();
|
||||
ui->cbStretch->setChecked(false);
|
||||
ui->cbForceAvatarColour->setChecked(false);
|
||||
ui->cbUnlimited->setChecked(false);
|
||||
ui->cbImportAsIs->setChecked(false);
|
||||
ui->cbResolution->setCurrentIndex(0);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
settings.beginGroup(settingsProfile);
|
||||
watermarkAvatar = settings.value("WatermarkAvatar", true).toBool();
|
||||
watermarkPicture = settings.value("WatermarkPicture", false).toBool();
|
||||
|
@ -323,36 +299,27 @@ void ImportDialog::processSettings(QString settingsProfile, bool setDefault)
|
|||
selectedColour = qvariant_cast<QColor>(settings.value("SelectedColour", QColor::fromRgb(0, 0, 0, 255)));
|
||||
ui->cbStretch->setChecked(settings.value("BackgroundStretch", false).toBool());
|
||||
ui->cbForceAvatarColour->setChecked(settings.value("ForceAvatarColour", false).toBool());
|
||||
ui->cbUnlimited->setChecked(settings.value("UnlimitedBuffer", false).toBool());
|
||||
ui->cbImportAsIs->setChecked(settings.value("ImportAsIs", false).toBool());
|
||||
const QVariant data = settings.value("Resolution", SnapmaticPicture::getSnapmaticResolution());
|
||||
#if QT_VERSION >= 0x060000
|
||||
if (data.typeId() == QMetaType::QSize)
|
||||
#else
|
||||
if (data.type() == QVariant::Size)
|
||||
#endif
|
||||
{
|
||||
int index = ui->cbResolution->findData(data);
|
||||
if (index != -1) {
|
||||
ui->cbResolution->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
if (!workImage.isNull()) {
|
||||
if (ui->cbAvatar->isChecked()) {
|
||||
if (!workImage.isNull())
|
||||
{
|
||||
if (ui->cbAvatar->isChecked())
|
||||
{
|
||||
ui->cbWatermark->setChecked(watermarkAvatar);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ui->cbWatermark->setChecked(watermarkPicture);
|
||||
}
|
||||
}
|
||||
ui->labColour->setText(tr("Background Colour: <span style=\"color: %1\">%1</span>").arg(selectedColour.name()));
|
||||
if (!backImage.isNull()) {
|
||||
if (!backImage.isNull())
|
||||
{
|
||||
ui->labBackgroundImage->setText(tr("Background Image: %1").arg(tr("Storage", "Background Image: Storage")));
|
||||
ui->cmdBackgroundWipe->setVisible(true);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ui->labBackgroundImage->setText(tr("Background Image:"));
|
||||
ui->cmdBackgroundWipe->setVisible(false);
|
||||
}
|
||||
|
@ -370,24 +337,6 @@ void ImportDialog::saveSettings(QString settingsProfile)
|
|||
settings.setValue("SelectedColour", selectedColour);
|
||||
settings.setValue("BackgroundStretch", ui->cbStretch->isChecked());
|
||||
settings.setValue("ForceAvatarColour", ui->cbForceAvatarColour->isChecked());
|
||||
#if QT_VERSION >= 0x050000
|
||||
const QVariant data = ui->cbResolution->currentData();
|
||||
#else
|
||||
const QVariant data = ui->cbResolution->itemData(ui->cbResolution->currentIndex());
|
||||
#endif
|
||||
#if QT_VERSION >= 0x060000
|
||||
if (data.typeId() == QMetaType::QSize)
|
||||
#else
|
||||
if (data.type() == QVariant::Size)
|
||||
#endif
|
||||
{
|
||||
settings.setValue("Resolution", data);
|
||||
}
|
||||
else {
|
||||
settings.setValue("Resolution", SnapmaticPicture::getSnapmaticResolution());
|
||||
}
|
||||
settings.setValue("UnlimitedBuffer", ui->cbUnlimited->isChecked());
|
||||
settings.setValue("ImportAsIs", ui->cbImportAsIs->isChecked());
|
||||
settings.endGroup();
|
||||
settings.setValue("Profile", settingsProfile);
|
||||
settings.endGroup();
|
||||
|
@ -425,7 +374,7 @@ void ImportDialog::cropPicture()
|
|||
#endif
|
||||
imageCropper.setBackgroundColor(Qt::black);
|
||||
imageCropper.setCroppingRectBorderColor(QColor(255, 255, 255, 127));
|
||||
imageCropper.setImage(QPixmap::fromImage(origImage, Qt::AutoColor));
|
||||
imageCropper.setImage(QPixmap::fromImage(workImage, Qt::AutoColor));
|
||||
imageCropper.setProportion(QSize(1, 1));
|
||||
imageCropper.setFixedSize(workImage.size());
|
||||
cropLayout.addWidget(&imageCropper);
|
||||
|
@ -539,11 +488,11 @@ void ImportDialog::loadImportSettings()
|
|||
bool ok;
|
||||
QStringList profileList;
|
||||
profileList << tr("Default", "Default as Default Profile")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("1")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("2")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("3")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("4")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("5");
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("1")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("2")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("3")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("4")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("5");
|
||||
QString sProfile = QInputDialog::getItem(this, tr("Load Settings..."), tr("Please select your settings profile"), profileList, 0, false, &ok, windowFlags());
|
||||
if (ok)
|
||||
{
|
||||
|
@ -587,10 +536,10 @@ void ImportDialog::saveImportSettings()
|
|||
bool ok;
|
||||
QStringList profileList;
|
||||
profileList << tr("Profile %1", "Profile %1 as Profile 1").arg("1")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("2")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("3")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("4")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("5");
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("2")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("3")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("4")
|
||||
<< tr("Profile %1", "Profile %1 as Profile 1").arg("5");
|
||||
QString sProfile = QInputDialog::getItem(this, tr("Save Settings..."), tr("Please select your settings profile"), profileList, 0, false, &ok, windowFlags());
|
||||
if (ok)
|
||||
{
|
||||
|
@ -621,49 +570,43 @@ void ImportDialog::saveImportSettings()
|
|||
|
||||
QImage ImportDialog::image()
|
||||
{
|
||||
if (ui->cbImportAsIs->isChecked()) {
|
||||
return origImage;
|
||||
}
|
||||
else {
|
||||
return newImage;
|
||||
}
|
||||
return newImage;
|
||||
}
|
||||
|
||||
void ImportDialog::setImage(QImage *image_)
|
||||
{
|
||||
origImage = *image_;
|
||||
workImage = QImage();
|
||||
if (image_->width() == image_->height()) {
|
||||
if (ui->cbResolution->currentIndex() == 0) {
|
||||
insideAvatarZone = true;
|
||||
ui->cbAvatar->setChecked(true);
|
||||
}
|
||||
else {
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
}
|
||||
if (image_->height() > snapmaticResolution.height()) {
|
||||
workImage = image_->scaled(snapmaticResolution.height(), snapmaticResolution.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
if (image_->width() == image_->height())
|
||||
{
|
||||
insideAvatarZone = true;
|
||||
ui->cbAvatar->setChecked(true);
|
||||
if (image_->height() > snapmaticResolutionH)
|
||||
{
|
||||
workImage = image_->scaled(snapmaticResolutionH, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
delete image_;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
workImage = *image_;
|
||||
delete image_;
|
||||
}
|
||||
}
|
||||
else if (image_->width() > snapmaticResolution.width() && image_->width() > image_->height()) {
|
||||
else if (image_->width() > snapmaticResolutionW && image_->width() > image_->height())
|
||||
{
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
workImage = image_->scaledToWidth(snapmaticResolution.width(), Qt::SmoothTransformation);
|
||||
workImage = image_->scaledToWidth(snapmaticResolutionW, Qt::SmoothTransformation);
|
||||
delete image_;
|
||||
}
|
||||
else if (image_->height() > snapmaticResolution.height() && image_->height() > image_->width()) {
|
||||
else if (image_->height() > snapmaticResolutionH && image_->height() > image_->width())
|
||||
{
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
workImage = image_->scaledToHeight(snapmaticResolution.height(), Qt::SmoothTransformation);
|
||||
workImage = image_->scaledToHeight(snapmaticResolutionH, Qt::SmoothTransformation);
|
||||
delete image_;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
insideAvatarZone = false;
|
||||
ui->cbAvatar->setChecked(false);
|
||||
workImage = *image_;
|
||||
|
@ -675,15 +618,18 @@ void ImportDialog::setImage(QImage *image_)
|
|||
|
||||
void ImportDialog::lockSettings(bool lock)
|
||||
{
|
||||
ui->gbAdvanced->setDisabled(lock);
|
||||
if (ui->cbImportAsIs->isChecked()) {
|
||||
ui->gbBackground->setDisabled(true);
|
||||
ui->gbSettings->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
ui->gbBackground->setDisabled(lock);
|
||||
ui->gbSettings->setDisabled(lock);
|
||||
}
|
||||
ui->cbAvatar->setDisabled(lock);
|
||||
ui->cbForceAvatarColour->setDisabled(lock);
|
||||
ui->cbIgnore->setDisabled(lock);
|
||||
ui->cbStretch->setDisabled(lock);
|
||||
ui->cbWatermark->setDisabled(lock);
|
||||
ui->cmdBackgroundChange->setDisabled(lock);
|
||||
ui->cmdBackgroundWipe->setDisabled(lock);
|
||||
ui->cmdColourChange->setDisabled(lock);
|
||||
ui->labBackgroundImage->setDisabled(lock);
|
||||
ui->labColour->setDisabled(lock);
|
||||
ui->gbSettings->setDisabled(lock);
|
||||
ui->gbBackground->setDisabled(lock);
|
||||
ui->cmdOK->setDisabled(lock);
|
||||
settingsLocked = lock;
|
||||
}
|
||||
|
@ -705,11 +651,6 @@ bool ImportDialog::isImportAgreed()
|
|||
return importAgreed;
|
||||
}
|
||||
|
||||
bool ImportDialog::isUnlimitedBuffer()
|
||||
{
|
||||
return ui->cbUnlimited->isChecked();
|
||||
}
|
||||
|
||||
bool ImportDialog::areSettingsLocked()
|
||||
{
|
||||
return settingsLocked;
|
||||
|
@ -728,11 +669,10 @@ void ImportDialog::on_cbIgnore_toggled(bool checked)
|
|||
|
||||
void ImportDialog::on_cbAvatar_toggled(bool checked)
|
||||
{
|
||||
if (ui->cbResolution->currentIndex() != 0)
|
||||
return;
|
||||
|
||||
if (!workImage.isNull() && workImage.width() == workImage.height() && !checked) {
|
||||
if (QMessageBox::No == QMessageBox::warning(this, tr("Snapmatic Avatar Zone"), tr("Are you sure to use a square image outside of the Avatar Zone?\nWhen you want to use it as Avatar the image will be detached!"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) {
|
||||
if (!workImage.isNull() && workImage.width() == workImage.height() && !checked)
|
||||
{
|
||||
if (QMessageBox::No == QMessageBox::warning(this, tr("Snapmatic Avatar Zone"), tr("Are you sure to use a square image outside of the Avatar Zone?\nWhen you want to use it as Avatar the image will be detached!"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
|
||||
{
|
||||
ui->cbAvatar->setChecked(true);
|
||||
insideAvatarZone = true;
|
||||
return;
|
||||
|
@ -740,10 +680,12 @@ void ImportDialog::on_cbAvatar_toggled(bool checked)
|
|||
}
|
||||
insideAvatarZone = ui->cbAvatar->isChecked();
|
||||
watermarkBlock = true;
|
||||
if (insideAvatarZone) {
|
||||
if (insideAvatarZone)
|
||||
{
|
||||
ui->cbWatermark->setChecked(watermarkAvatar);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ui->cbWatermark->setChecked(watermarkPicture);
|
||||
}
|
||||
watermarkBlock = false;
|
||||
|
@ -845,7 +787,7 @@ fileDialogPreOpen:
|
|||
QMessageBox::warning(this, QApplication::translate("ProfileInterface", "Import"), QApplication::translate("ProfileInterface", "Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
|
||||
goto fileDialogPreOpen;
|
||||
}
|
||||
backImage = importImage.scaled(snapmaticResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
backImage = importImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
backgroundPath = selectedFile;
|
||||
ui->labBackgroundImage->setText(tr("Background Image: %1").arg(tr("File", "Background Image: File")));
|
||||
ui->cmdBackgroundWipe->setVisible(true);
|
||||
|
@ -883,59 +825,14 @@ void ImportDialog::on_cbWatermark_toggled(bool checked)
|
|||
{
|
||||
if (!watermarkBlock)
|
||||
{
|
||||
if (insideAvatarZone) {
|
||||
if (insideAvatarZone)
|
||||
{
|
||||
watermarkAvatar = checked;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
watermarkPicture = checked;
|
||||
}
|
||||
processImage();
|
||||
}
|
||||
}
|
||||
|
||||
void ImportDialog::on_cbImportAsIs_toggled(bool checked)
|
||||
{
|
||||
ui->cbResolution->setDisabled(checked);
|
||||
ui->labResolution->setDisabled(checked);
|
||||
ui->gbBackground->setDisabled(checked);
|
||||
ui->gbSettings->setDisabled(checked);
|
||||
}
|
||||
|
||||
void ImportDialog::on_cbResolution_currentIndexChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
#if QT_VERSION >= 0x050000
|
||||
const QVariant data = ui->cbResolution->currentData();
|
||||
#else
|
||||
const QVariant data = ui->cbResolution->itemData(ui->cbResolution->currentIndex());
|
||||
#endif
|
||||
#if QT_VERSION >= 0x060000
|
||||
if (data.typeId() == QMetaType::QSize)
|
||||
#else
|
||||
if (data.type() == QVariant::Size)
|
||||
#endif
|
||||
{
|
||||
const QSize dataSize = data.toSize();
|
||||
if (dataSize == SnapmaticPicture::getSnapmaticResolution()) {
|
||||
ui->cbAvatar->setEnabled(true);
|
||||
snapmaticResolution = dataSize;
|
||||
reworkImage();
|
||||
}
|
||||
else {
|
||||
if (!workImage.isNull() && workImage.width() == workImage.height() && ui->cbAvatar->isChecked()) {
|
||||
if (QMessageBox::No == QMessageBox::warning(this, tr("Snapmatic Avatar Zone"), tr("Are you sure to use a square image outside of the Avatar Zone?\nWhen you want to use it as Avatar the image will be detached!"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) {
|
||||
ui->cbResolution->setCurrentIndex(0);
|
||||
ui->cbAvatar->setChecked(true);
|
||||
insideAvatarZone = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
ui->cbAvatar->setChecked(false);
|
||||
ui->cbAvatar->setDisabled(true);
|
||||
insideAvatarZone = false;
|
||||
ui->cbWatermark->setChecked(watermarkPicture);
|
||||
snapmaticResolution = dataSize;
|
||||
reworkImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2017-2020 Syping
|
||||
* Copyright (C) 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
|
||||
|
@ -39,12 +39,10 @@ public:
|
|||
void lockSettings(bool lock);
|
||||
void enableOverwriteMode();
|
||||
bool isImportAgreed();
|
||||
bool isUnlimitedBuffer();
|
||||
bool areSettingsLocked();
|
||||
|
||||
private slots:
|
||||
void processImage();
|
||||
void reworkImage();
|
||||
void cropPicture();
|
||||
void importNewPicture();
|
||||
void loadImportSettings();
|
||||
|
@ -60,8 +58,6 @@ private slots:
|
|||
void on_cbStretch_toggled(bool checked);
|
||||
void on_cbForceAvatarColour_toggled(bool checked);
|
||||
void on_cbWatermark_toggled(bool checked);
|
||||
void on_cbImportAsIs_toggled(bool checked);
|
||||
void on_cbResolution_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
QString profileName;
|
||||
|
@ -71,11 +67,9 @@ private:
|
|||
QString imageTitle;
|
||||
QImage backImage;
|
||||
QImage workImage;
|
||||
QImage origImage;
|
||||
QImage newImage;
|
||||
QColor selectedColour;
|
||||
QMenu optionsMenu;
|
||||
QSize snapmaticResolution;
|
||||
QMenu *optionsMenu;
|
||||
bool insideAvatarZone;
|
||||
bool watermarkPicture;
|
||||
bool watermarkAvatar;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>677</height>
|
||||
<height>512</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
|
@ -174,7 +174,7 @@
|
|||
<string>Select background colour</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -227,7 +227,7 @@
|
|||
<string>Select background image</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -237,7 +237,7 @@
|
|||
<string>Remove background image</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">X</string>
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -297,63 +297,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gbAdvanced">
|
||||
<property name="title">
|
||||
<string>Advanced</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vlAdvanced">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hlResolution">
|
||||
<item>
|
||||
<widget class="QLabel" name="labResolution">
|
||||
<property name="text">
|
||||
<string>Resolution:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbResolution">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Snapmatic resolution</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hlExpert">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbUnlimited">
|
||||
<property name="toolTip">
|
||||
<string>Avoid compression and expand buffer instead, improves picture quality, but may break Snapmatic</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unlimited Buffer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbImportAsIs">
|
||||
<property name="toolTip">
|
||||
<string>Import as-is, don't change the picture at all, guaranteed to break Snapmatic unless you know what you doing</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Import as-is</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hlButtons">
|
||||
<item>
|
||||
|
|
|
@ -70,18 +70,9 @@ 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);}");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2017-2020 Syping
|
||||
* Copyright (C) 2017-2019 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
|
||||
|
@ -60,10 +60,40 @@ MapLocationDialog::~MapLocationDialog()
|
|||
|
||||
void MapLocationDialog::drawPointOnMap(double xpos_d, double ypos_d)
|
||||
{
|
||||
ui->labPos->setText(tr("X: %1\nY: %2", "X and Y position").arg(QString::number(xpos_d), QString::number(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);
|
||||
|
||||
xpos_new = xpos_d;
|
||||
ypos_new = ypos_d;
|
||||
repaint();
|
||||
ui->labPos->setText(tr("X: %1\nY: %2", "X and Y position").arg(QString::number(xpos_d), QString::number(ypos_d)));
|
||||
}
|
||||
|
||||
void MapLocationDialog::on_cmdChange_clicked()
|
||||
|
@ -95,21 +125,6 @@ void MapLocationDialog::on_cmdDone_clicked()
|
|||
changeMode = false;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
void MapLocationDialog::updatePosFromEvent(double x, double y)
|
||||
{
|
||||
QSize mapPixelSize = size();
|
||||
double xpos_ad = x;
|
||||
double ypos_ad = mapPixelSize.height() - y;
|
||||
double xrat = 10000 / (double)mapPixelSize.width();
|
||||
double yrat = 12000 / (double)mapPixelSize.height();
|
||||
double xpos_rv = xrat * xpos_ad;
|
||||
double ypos_rv = yrat * ypos_ad;
|
||||
double xpos_fp = xpos_rv - 4000;
|
||||
double ypos_fp = ypos_rv - 4000;
|
||||
drawPointOnMap(xpos_fp, ypos_fp);
|
||||
}
|
||||
#else
|
||||
void MapLocationDialog::updatePosFromEvent(int x, int y)
|
||||
{
|
||||
QSize mapPixelSize = size();
|
||||
|
@ -123,60 +138,13 @@ void MapLocationDialog::updatePosFromEvent(int x, int y)
|
|||
double ypos_fp = ypos_rv - 4000;
|
||||
drawPointOnMap(xpos_fp, ypos_fp);
|
||||
}
|
||||
#endif
|
||||
|
||||
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 Q_OS_WIN
|
||||
xpos_pr = xpos_mp - pointMarkerHalfSize;
|
||||
ypos_pr = ypos_mp + pointMarkerHalfSize;
|
||||
#else
|
||||
xpos_pr = xpos_mp - pointMarkerHalfSize + screenRatioPR;
|
||||
ypos_pr = ypos_mp + pointMarkerHalfSize - screenRatioPR;
|
||||
#endif
|
||||
}
|
||||
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(); }
|
||||
else if (ev->buttons() & Qt::LeftButton)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
updatePosFromEvent(ev->position().x(), ev->position().y());
|
||||
#else
|
||||
updatePosFromEvent(ev->x(), ev->y());
|
||||
#endif
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
|
@ -190,11 +158,7 @@ void MapLocationDialog::mouseReleaseEvent(QMouseEvent *ev)
|
|||
if (!changeMode) { ev->ignore(); }
|
||||
else if (ev->button() == Qt::LeftButton)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
updatePosFromEvent(ev->position().x(), ev->position().y());
|
||||
#else
|
||||
updatePosFromEvent(ev->x(), ev->y());
|
||||
#endif
|
||||
ev->accept();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -39,7 +39,6 @@ public:
|
|||
~MapLocationDialog();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *ev);
|
||||
void mouseMoveEvent(QMouseEvent *ev);
|
||||
void mouseReleaseEvent(QMouseEvent *ev);
|
||||
|
||||
|
@ -48,11 +47,7 @@ private slots:
|
|||
void on_cmdApply_clicked();
|
||||
void on_cmdChange_clicked();
|
||||
void on_cmdRevert_clicked();
|
||||
#if QT_VERSION >= 0x060000
|
||||
void updatePosFromEvent(double x, double y);
|
||||
#else
|
||||
void updatePosFromEvent(int x, int y);
|
||||
#endif
|
||||
void on_cmdClose_clicked();
|
||||
|
||||
private:
|
||||
|
|
|
@ -25,11 +25,6 @@
|
|||
<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>
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 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
|
||||
* 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 "TranslationClass.h"
|
||||
#include "MessageThread.h"
|
||||
#include "AppEnv.h"
|
||||
#include "config.h"
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonDocument>
|
||||
#include <QEventLoop>
|
||||
#include <QUrlQuery>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
#include <QUrl>
|
||||
|
||||
MessageThread::MessageThread(uint cacheId, QObject *parent) : QThread(parent), cacheId(cacheId)
|
||||
{
|
||||
threadRunning = true;
|
||||
}
|
||||
|
||||
void MessageThread::run()
|
||||
{
|
||||
QEventLoop threadLoop;
|
||||
|
||||
QObject::connect(this, SIGNAL(threadTerminated()), &threadLoop, SLOT(quit()));
|
||||
|
||||
while (threadRunning) {
|
||||
{
|
||||
#ifdef GTA5SYNC_MOTD_WEBURL
|
||||
QUrl motdWebUrl = QUrl(GTA5SYNC_MOTD_WEBURL);
|
||||
#else
|
||||
QUrl motdWebUrl = QUrl("https://motd.syping.de/gta5view-dev/");
|
||||
#endif
|
||||
QUrlQuery urlQuery(motdWebUrl);
|
||||
urlQuery.addQueryItem("code", GTA5SYNC_BUILDCODE);
|
||||
urlQuery.addQueryItem("cacheid", QString::number(cacheId));
|
||||
urlQuery.addQueryItem("lang", Translator->getCurrentLanguage());
|
||||
urlQuery.addQueryItem("version", GTA5SYNC_APPVER);
|
||||
motdWebUrl.setQuery(urlQuery);
|
||||
|
||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||
QNetworkRequest netRequest(motdWebUrl);
|
||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||
QNetworkReply *netReply = netManager->get(netRequest);
|
||||
|
||||
QEventLoop downloadLoop;
|
||||
QObject::connect(netManager, SIGNAL(finished(QNetworkReply*)), &downloadLoop, SLOT(quit()));
|
||||
QObject::connect(this, SIGNAL(threadTerminated()), &threadLoop, SLOT(quit()));
|
||||
QTimer::singleShot(60000, &downloadLoop, SLOT(quit()));
|
||||
downloadLoop.exec();
|
||||
|
||||
if (netReply->isFinished()) {
|
||||
QByteArray jsonContent = netReply->readAll();
|
||||
QString headerData = QString::fromUtf8(netReply->rawHeader("gta5view"));
|
||||
if (!headerData.isEmpty()) {
|
||||
QMap<QString,QString> headerMap;
|
||||
const QStringList headerVarList = headerData.split(';');
|
||||
for (QString headerVar : headerVarList) {
|
||||
QStringList varValueList = headerVar.split('=');
|
||||
if (varValueList.length() >= 2) {
|
||||
const QString variable = varValueList.at(0).trimmed();
|
||||
varValueList.removeFirst();
|
||||
const QString value = varValueList.join('=');
|
||||
headerMap.insert(variable, value);
|
||||
}
|
||||
}
|
||||
if (headerMap.value("update", "false") == "true") {
|
||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonContent);
|
||||
emit messagesArrived(jsonDocument.object());
|
||||
}
|
||||
if (headerMap.contains("cache")) {
|
||||
bool uintOk;
|
||||
uint cacheVal = headerMap.value("cache").toUInt(&uintOk);
|
||||
if (uintOk) {
|
||||
cacheId = cacheVal;
|
||||
emit updateCacheId(cacheId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete netReply;
|
||||
delete netManager;
|
||||
}
|
||||
|
||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||
threadLoop.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MessageThread::terminateThread()
|
||||
{
|
||||
threadRunning = false;
|
||||
emit threadTerminated();
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-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
|
||||
|
@ -24,12 +24,12 @@
|
|||
#include "AppEnv.h"
|
||||
#include "config.h"
|
||||
#include <QStringBuilder>
|
||||
#include <QDesktopWidget>
|
||||
#include <QJsonDocument>
|
||||
#include <QStyleFactory>
|
||||
#include <QApplication>
|
||||
#include <QJsonObject>
|
||||
#include <QFileDialog>
|
||||
#include <QFontDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QStringList>
|
||||
#include <QClipboard>
|
||||
|
@ -40,12 +40,6 @@
|
|||
#include <QList>
|
||||
#include <QDir>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QScreen>
|
||||
#else
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#ifdef GTA5SYNC_TELEMETRY
|
||||
#include "TelemetryClass.h"
|
||||
#endif
|
||||
|
@ -64,18 +58,11 @@ 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 = SnapmaticPicture::getSnapmaticResolution();
|
||||
defExportSize = QSize(960, 536);
|
||||
cusExportSize = defExportSize;
|
||||
defaultQuality = 100;
|
||||
customQuality = 100;
|
||||
|
@ -124,8 +111,6 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
|||
resize(435 * screenRatio, 405 * screenRatio);
|
||||
#endif
|
||||
|
||||
ui->rbModern->setText(ui->rbModern->text().arg(GTA5SYNC_APPSTR));
|
||||
ui->rbClassic->setText(ui->rbClassic->text().arg(GTA5SYNC_APPSTR));
|
||||
setWindowTitle(windowTitle().arg(GTA5SYNC_APPSTR));
|
||||
}
|
||||
|
||||
|
@ -139,33 +124,24 @@ OptionsDialog::~OptionsDialog()
|
|||
|
||||
void OptionsDialog::setupTreeWidget()
|
||||
{
|
||||
const QStringList players = profileDB->getPlayers();
|
||||
if (players.length() != 0) {
|
||||
QStringList::const_iterator it = players.constBegin();
|
||||
QStringList::const_iterator end = players.constEnd();
|
||||
while (it != end)
|
||||
for (QString playerIDStr : profileDB->getPlayers())
|
||||
{
|
||||
bool ok;
|
||||
int playerID = playerIDStr.toInt(&ok);
|
||||
if (ok)
|
||||
{
|
||||
bool ok;
|
||||
int playerID = it->toInt(&ok);
|
||||
if (ok)
|
||||
{
|
||||
QString playerName = profileDB->getPlayerName(playerID);
|
||||
QString playerName = profileDB->getPlayerName(playerID);
|
||||
|
||||
QStringList playerTreeViewList;
|
||||
playerTreeViewList += *it;
|
||||
playerTreeViewList += playerName;
|
||||
QStringList playerTreeViewList;
|
||||
playerTreeViewList += playerIDStr;
|
||||
playerTreeViewList += playerName;
|
||||
|
||||
QTreeWidgetItem *playerItem = new QTreeWidgetItem(playerTreeViewList);
|
||||
ui->twPlayers->addTopLevelItem(playerItem);
|
||||
playerItems += playerItem;
|
||||
}
|
||||
it++;
|
||||
QTreeWidgetItem *playerItem = new QTreeWidgetItem(playerTreeViewList);
|
||||
ui->twPlayers->addTopLevelItem(playerItem);
|
||||
playerItems += playerItem;
|
||||
}
|
||||
ui->twPlayers->sortItems(1, Qt::AscendingOrder);
|
||||
}
|
||||
else {
|
||||
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabPlayers));
|
||||
}
|
||||
ui->twPlayers->sortItems(1, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void OptionsDialog::setupLanguageBox()
|
||||
|
@ -177,7 +153,7 @@ void OptionsDialog::setupLanguageBox()
|
|||
|
||||
QString cbSysStr = tr("%1 (Language priority)", "First language a person can talk with a different person/application. \"Native\" or \"Not Native\".").arg(tr("System",
|
||||
"System in context of System default"));
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
QString cbAutoStr;
|
||||
if (AppEnv::getGameLanguage(AppEnv::getGameVersion()) != GameLanguage::Undefined)
|
||||
{
|
||||
|
@ -287,22 +263,14 @@ void OptionsDialog::setupRadioButtons()
|
|||
switch (contentMode)
|
||||
{
|
||||
case 0:
|
||||
case 20:
|
||||
ui->rbModern->setChecked(true);
|
||||
ui->rbOpenWithSC->setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 21:
|
||||
ui->rbModern->setChecked(true);
|
||||
ui->cbDoubleclick->setChecked(true);
|
||||
ui->rbOpenWithDC->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
ui->rbSelectWithSC->setChecked(true);
|
||||
break;
|
||||
case 10:
|
||||
ui->rbClassic->setChecked(true);
|
||||
#if QT_VERSION >= 0x050800
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
case 11:
|
||||
ui->cbDoubleclick->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -310,16 +278,31 @@ void OptionsDialog::setupRadioButtons()
|
|||
void OptionsDialog::setupInterfaceSettings()
|
||||
{
|
||||
settings->beginGroup("Startup");
|
||||
const QString currentStyle = QApplication::style()->objectName();
|
||||
const QString appStyle = settings->value("AppStyle", currentStyle).toString();
|
||||
bool alwaysUseMessageFont = settings->value("AlwaysUseMessageFont", false).toBool();
|
||||
ui->cbAlwaysUseMessageFont->setChecked(alwaysUseMessageFont);
|
||||
#ifdef GTA5SYNC_WIN
|
||||
if (QSysInfo::windowsVersion() >= 0x0080)
|
||||
{
|
||||
ui->gbFont->setVisible(false);
|
||||
ui->cbAlwaysUseMessageFont->setVisible(false);
|
||||
}
|
||||
#else
|
||||
ui->gbFont->setVisible(false);
|
||||
ui->cbAlwaysUseMessageFont->setVisible(false);
|
||||
#endif
|
||||
QString currentStyle = QApplication::style()->objectName();
|
||||
QString appStyle = settings->value("AppStyle", currentStyle).toString();
|
||||
bool customStyle = settings->value("CustomStyle", false).toBool();
|
||||
const QStringList availableStyles = QStyleFactory::keys();
|
||||
ui->cbStyleList->addItems(availableStyles);
|
||||
if (availableStyles.contains(appStyle, Qt::CaseInsensitive)) {
|
||||
if (availableStyles.contains(appStyle, Qt::CaseInsensitive))
|
||||
{
|
||||
// use 'for' for select to be sure it's case insensitive
|
||||
int currentIndex = 0;
|
||||
for (const QString ¤tStyleFF : availableStyles) {
|
||||
if (currentStyleFF.toLower() == appStyle.toLower()) {
|
||||
for (QString currentStyleFF : availableStyles)
|
||||
{
|
||||
if (currentStyleFF.toLower() == appStyle.toLower())
|
||||
{
|
||||
ui->cbStyleList->setCurrentIndex(currentIndex);
|
||||
}
|
||||
currentIndex++;
|
||||
|
@ -327,24 +310,23 @@ void OptionsDialog::setupInterfaceSettings()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (availableStyles.contains(currentStyle, Qt::CaseInsensitive)) {
|
||||
if (availableStyles.contains(currentStyle, Qt::CaseInsensitive))
|
||||
{
|
||||
int currentIndex = 0;
|
||||
for (const QString ¤tStyleFF : availableStyles) {
|
||||
if (currentStyleFF.toLower() == currentStyle.toLower()) {
|
||||
for (QString currentStyleFF : availableStyles)
|
||||
{
|
||||
if (currentStyleFF.toLower() == currentStyle.toLower())
|
||||
{
|
||||
ui->cbStyleList->setCurrentIndex(currentIndex);
|
||||
}
|
||||
currentIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ui->cbDefaultStyle->setChecked(!customStyle);
|
||||
ui->cbStyleList->setEnabled(customStyle);
|
||||
const QFont currentFont = QApplication::font();
|
||||
const QFont appFont = qvariant_cast<QFont>(settings->value("AppFont", currentFont));
|
||||
bool customFont = settings->value("CustomFont", false).toBool();
|
||||
ui->cbDefaultFont->setChecked(!customFont);
|
||||
ui->cbFont->setEnabled(customFont);
|
||||
ui->cbFont->setCurrentFont(appFont);
|
||||
if (customStyle)
|
||||
{
|
||||
ui->cbDefaultStyle->setChecked(false);
|
||||
}
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
|
@ -364,28 +346,26 @@ void OptionsDialog::applySettings()
|
|||
settings->setValue("Language", ui->cbLanguage->itemData(ui->cbLanguage->currentIndex()));
|
||||
settings->setValue("AreaLanguage", ui->cbAreaLanguage->itemData(ui->cbAreaLanguage->currentIndex()));
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
||||
#endif
|
||||
#else
|
||||
settings->setValue("NavigationBar", ui->cbSnapmaticNavigationBar->isChecked());
|
||||
#endif
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Profile");
|
||||
int newContentMode = 20;
|
||||
if (ui->rbModern->isChecked())
|
||||
int newContentMode = 0;
|
||||
if (ui->rbOpenWithSC->isChecked())
|
||||
{
|
||||
newContentMode = 20;
|
||||
newContentMode = 0;
|
||||
}
|
||||
else if (ui->rbClassic->isChecked())
|
||||
else if (ui->rbOpenWithDC->isChecked())
|
||||
{
|
||||
newContentMode = 10;
|
||||
newContentMode = 1;
|
||||
}
|
||||
if (ui->cbDoubleclick->isChecked())
|
||||
else if (ui->rbSelectWithSC->isChecked())
|
||||
{
|
||||
newContentMode++;
|
||||
newContentMode = 2;
|
||||
}
|
||||
settings->setValue("ContentMode", newContentMode);
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
@ -423,25 +403,18 @@ void OptionsDialog::applySettings()
|
|||
|
||||
bool defaultStyle = ui->cbDefaultStyle->isChecked();
|
||||
settings->beginGroup("Startup");
|
||||
if (!defaultStyle) {
|
||||
if (!defaultStyle)
|
||||
{
|
||||
QString newStyle = ui->cbStyleList->currentText();
|
||||
settings->setValue("CustomStyle", true);
|
||||
settings->setValue("AppStyle", newStyle);
|
||||
QApplication::setStyle(QStyleFactory::create(newStyle));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
settings->setValue("CustomStyle", false);
|
||||
}
|
||||
bool defaultFont = ui->cbDefaultFont->isChecked();
|
||||
if (!defaultFont) {
|
||||
QFont newFont = ui->cbFont->currentFont();
|
||||
settings->setValue("CustomFont", true);
|
||||
settings->setValue("AppFont", newFont);
|
||||
QApplication::setFont(newFont);
|
||||
}
|
||||
else {
|
||||
settings->setValue("CustomFont", false);
|
||||
}
|
||||
settings->setValue("AlwaysUseMessageFont", ui->cbAlwaysUseMessageFont->isChecked());
|
||||
settings->endGroup();
|
||||
|
||||
#ifdef GTA5SYNC_TELEMETRY
|
||||
|
@ -630,7 +603,7 @@ void OptionsDialog::setupWindowsGameSettings()
|
|||
{
|
||||
#ifdef GTA5SYNC_GAME
|
||||
GameVersion gameVersion = AppEnv::getGameVersion();
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
if (gameVersion != GameVersion::NoVersion)
|
||||
{
|
||||
if (gameVersion == GameVersion::SocialClubVersion)
|
||||
|
@ -727,7 +700,7 @@ void OptionsDialog::setupCustomGTAFolder()
|
|||
|
||||
void OptionsDialog::setupSnapmaticPictureViewer()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
settings->beginGroup("Interface");
|
||||
ui->cbSnapmaticNavigationBar->setChecked(settings->value("NavigationBar", true).toBool());
|
||||
|
@ -737,9 +710,8 @@ void OptionsDialog::setupSnapmaticPictureViewer()
|
|||
ui->gbSnapmaticPictureViewer->setVisible(false);
|
||||
#endif
|
||||
#else
|
||||
settings->beginGroup("Interface");
|
||||
ui->cbSnapmaticNavigationBar->setChecked(settings->value("NavigationBar", true).toBool());
|
||||
settings->endGroup();
|
||||
ui->cbSnapmaticNavigationBar->setVisible(false);
|
||||
ui->gbSnapmaticPictureViewer->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -755,14 +727,6 @@ void OptionsDialog::on_cmdExploreFolder_clicked()
|
|||
void OptionsDialog::on_cbDefaultStyle_toggled(bool checked)
|
||||
{
|
||||
ui->cbStyleList->setDisabled(checked);
|
||||
ui->labStyle->setDisabled(checked);
|
||||
}
|
||||
|
||||
void OptionsDialog::on_cbDefaultFont_toggled(bool checked)
|
||||
{
|
||||
ui->cbFont->setDisabled(checked);
|
||||
ui->cmdFont->setDisabled(checked);
|
||||
ui->labFont->setDisabled(checked);
|
||||
}
|
||||
|
||||
void OptionsDialog::on_cmdCopyStatsID_clicked()
|
||||
|
@ -771,18 +735,3 @@ void OptionsDialog::on_cmdCopyStatsID_clicked()
|
|||
QApplication::clipboard()->setText(Telemetry->getRegisteredID());
|
||||
#endif
|
||||
}
|
||||
|
||||
void OptionsDialog::on_cbFont_currentFontChanged(const QFont &font)
|
||||
{
|
||||
ui->cbFont->setFont(font);
|
||||
}
|
||||
|
||||
void OptionsDialog::on_cmdFont_clicked()
|
||||
{
|
||||
bool ok;
|
||||
const QFont font = QFontDialog::getFont(&ok, ui->cbFont->currentFont(), this);
|
||||
if (ok) {
|
||||
ui->cbFont->setCurrentFont(font);
|
||||
ui->cbFont->setFont(font);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,10 +47,7 @@ private slots:
|
|||
void on_cbIgnoreAspectRatio_toggled(bool checked);
|
||||
void on_cmdExploreFolder_clicked();
|
||||
void on_cbDefaultStyle_toggled(bool checked);
|
||||
void on_cbDefaultFont_toggled(bool checked);
|
||||
void on_cmdCopyStatsID_clicked();
|
||||
void on_cbFont_currentFontChanged(const QFont &font);
|
||||
void on_cmdFont_clicked();
|
||||
|
||||
signals:
|
||||
void settingsApplied(int contentMode, bool languageChanged);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>435</width>
|
||||
<height>524</height>
|
||||
<height>474</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -34,9 +34,9 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="vlProfileContentMode">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbModern">
|
||||
<widget class="QRadioButton" name="rbOpenWithSC">
|
||||
<property name="text">
|
||||
<string notr="true">%1 1.9+</string>
|
||||
<string>Open with Singleclick</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
@ -44,16 +44,16 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rbClassic">
|
||||
<widget class="QRadioButton" name="rbOpenWithDC">
|
||||
<property name="text">
|
||||
<string notr="true">%1 1.0-1.8</string>
|
||||
<string>Open with Doubleclick</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbDoubleclick">
|
||||
<widget class="QRadioButton" name="rbSelectWithSC">
|
||||
<property name="text">
|
||||
<string>Open with Doubleclick</string>
|
||||
<string>Select with Singleclick</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -660,9 +660,6 @@
|
|||
<layout class="QHBoxLayout" name="hlStyle">
|
||||
<item>
|
||||
<widget class="QLabel" name="labStyle">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Style:</string>
|
||||
</property>
|
||||
|
@ -693,52 +690,12 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="vlFont">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbDefaultFont">
|
||||
<widget class="QCheckBox" name="cbAlwaysUseMessageFont">
|
||||
<property name="text">
|
||||
<string>Use Default Font (Restart)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<string>Always use Message Font (Windows 2003 and earlier)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hlFont">
|
||||
<item>
|
||||
<widget class="QLabel" name="labFont">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFontComboBox" name="cbFont">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="cmdFont">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-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
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include "ui_PictureDialog.h"
|
||||
#include "SidebarGenerator.h"
|
||||
#include "MapLocationDialog.h"
|
||||
#include "ImageEditorDialog.h"
|
||||
#include "JsonEditorDialog.h"
|
||||
#include "SnapmaticEditor.h"
|
||||
#include "StandardPaths.h"
|
||||
|
@ -33,11 +34,7 @@
|
|||
#include "AppEnv.h"
|
||||
#include "config.h"
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
#include <QtWinExtras/QtWin>
|
||||
#include <QtWinExtras/QWinEvent>
|
||||
|
@ -45,6 +42,7 @@
|
|||
#endif
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include <QDesktopWidget>
|
||||
#include <QJsonDocument>
|
||||
#include <QApplication>
|
||||
#include <QFontMetrics>
|
||||
|
@ -84,11 +82,7 @@
|
|||
#define picPath picture->getPictureFilePath()
|
||||
#define picTitl StringParser::escapeString(picture->getPictureTitle())
|
||||
#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)
|
||||
#endif
|
||||
|
||||
PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
|
||||
QDialog(parent), profileDB(profileDB), crewDB(crewDB),
|
||||
|
@ -142,15 +136,12 @@ 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(snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::FastTransformation);
|
||||
avatarAreaPicture = QImage(":/img/avatararea.png").scaledToHeight(536 * screenRatio * screenRatioPR, Qt::FastTransformation);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -161,7 +152,7 @@ void PictureDialog::setupPictureDialog()
|
|||
avatarSize = 470;
|
||||
|
||||
// DPI calculation (picture)
|
||||
ui->labPicture->setFixedSize(snapmaticResolution.width() * screenRatio, snapmaticResolution.height() * screenRatio);
|
||||
ui->labPicture->setFixedSize(960 * screenRatio, 536 * screenRatio);
|
||||
ui->labPicture->setFocusPolicy(Qt::StrongFocus);
|
||||
ui->labPicture->setScaledContents(true);
|
||||
|
||||
|
@ -199,7 +190,7 @@ void PictureDialog::setupPictureDialog()
|
|||
}
|
||||
|
||||
installEventFilter(this);
|
||||
// installEventFilter(ui->labPicture);
|
||||
installEventFilter(ui->labPicture);
|
||||
|
||||
// DPI calculation
|
||||
ui->hlButtons->setSpacing(6 * screenRatio);
|
||||
|
@ -208,38 +199,29 @@ void PictureDialog::setupPictureDialog()
|
|||
ui->jsonLayout->setContentsMargins(4 * screenRatio, 10 * screenRatio, 4 * screenRatio, 4 * screenRatio);
|
||||
|
||||
// Pre-adapt window for DPI
|
||||
setFixedWidth(snapmaticResolution.width() * screenRatio);
|
||||
setFixedHeight(snapmaticResolution.height() * screenRatio);
|
||||
setFixedWidth(960 * screenRatio);
|
||||
setFixedHeight(536 * screenRatio);
|
||||
}
|
||||
|
||||
PictureDialog::~PictureDialog()
|
||||
{
|
||||
//#ifdef Q_OS_WIN
|
||||
//#if QT_VERSION >= 0x050200
|
||||
// if (naviEnabled)
|
||||
// {
|
||||
// for (QObject *obj : layout()->menuBar()->children())
|
||||
// {
|
||||
// delete obj;
|
||||
// }
|
||||
// delete layout()->menuBar();
|
||||
// }
|
||||
//#endif
|
||||
//#else
|
||||
// if (naviEnabled)
|
||||
// {
|
||||
// for (QObject *obj : layout()->menuBar()->children())
|
||||
// {
|
||||
// delete obj;
|
||||
// }
|
||||
// delete layout()->menuBar();
|
||||
// }
|
||||
//#endif
|
||||
// for (QObject *obj : manageMenu->children())
|
||||
// {
|
||||
// delete obj;
|
||||
// }
|
||||
// delete manageMenu;
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
if (naviEnabled)
|
||||
{
|
||||
for (QObject *obj : layout()->menuBar()->children())
|
||||
{
|
||||
delete obj;
|
||||
}
|
||||
delete layout()->menuBar();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
for (QObject *obj : manageMenu->children())
|
||||
{
|
||||
delete obj;
|
||||
}
|
||||
delete manageMenu;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -254,38 +236,139 @@ void PictureDialog::closeEvent(QCloseEvent *ev)
|
|||
|
||||
void PictureDialog::addPreviousNextButtons()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// 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
|
||||
}
|
||||
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
#ifdef GTA5SYNC_APV
|
||||
bool PictureDialog::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||
{
|
||||
*result = 0;
|
||||
MSG *msg = static_cast<MSG*>(message);
|
||||
LRESULT lRet = 0;
|
||||
|
||||
if (naviEnabled && QtWin::isCompositionEnabled())
|
||||
{
|
||||
if (msg->message == WM_NCCALCSIZE && msg->wParam == TRUE)
|
||||
{
|
||||
NCCALCSIZE_PARAMS *pncsp = reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||
|
||||
int sideBorderSize = ((frameSize().width() - size().width()) / 2);
|
||||
#ifdef GTA5SYNC_APV_SIDE
|
||||
int buttomBorderSize = sideBorderSize;
|
||||
#else
|
||||
int buttomBorderSize = (frameSize().height() - size().height());
|
||||
#endif
|
||||
pncsp->rgrc[0].left += sideBorderSize;
|
||||
pncsp->rgrc[0].right -= sideBorderSize;
|
||||
pncsp->rgrc[0].bottom -= buttomBorderSize;
|
||||
}
|
||||
else if (msg->message == WM_NCHITTEST)
|
||||
{
|
||||
int CLOSE_BUTTON_ID = 20;
|
||||
lRet = HitTestNCA(msg->hwnd, msg->lParam);
|
||||
DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lRet);
|
||||
*result = lRet;
|
||||
if (lRet != CLOSE_BUTTON_ID) { return QWidget::nativeEvent(eventType, message, result); }
|
||||
}
|
||||
else
|
||||
{
|
||||
return QWidget::nativeEvent(eventType, message, result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return QWidget::nativeEvent(eventType, message, result);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
LRESULT PictureDialog::HitTestNCA(HWND hWnd, LPARAM lParam)
|
||||
{
|
||||
int LEFTEXTENDWIDTH = 0;
|
||||
int RIGHTEXTENDWIDTH = 0;
|
||||
int BOTTOMEXTENDWIDTH = 0;
|
||||
int TOPEXTENDWIDTH = layout()->menuBar()->height();
|
||||
|
||||
POINT ptMouse = {(int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)};
|
||||
|
||||
RECT rcWindow;
|
||||
GetWindowRect(hWnd, &rcWindow);
|
||||
|
||||
RECT rcFrame = {};
|
||||
AdjustWindowRectEx(&rcFrame, WS_OVERLAPPEDWINDOW & ~WS_CAPTION, FALSE, NULL);
|
||||
|
||||
USHORT uRow = 1;
|
||||
USHORT uCol = 1;
|
||||
bool fOnResizeBorder = false;
|
||||
|
||||
if (ptMouse.y >= rcWindow.top && ptMouse.y < rcWindow.top + TOPEXTENDWIDTH)
|
||||
{
|
||||
fOnResizeBorder = (ptMouse.y < (rcWindow.top - rcFrame.top));
|
||||
uRow = 0;
|
||||
}
|
||||
else if (ptMouse.y < rcWindow.bottom && ptMouse.y >= rcWindow.bottom - BOTTOMEXTENDWIDTH)
|
||||
{
|
||||
uRow = 2;
|
||||
}
|
||||
|
||||
if (ptMouse.x >= rcWindow.left && ptMouse.x < rcWindow.left + LEFTEXTENDWIDTH)
|
||||
{
|
||||
uCol = 0;
|
||||
}
|
||||
else if (ptMouse.x < rcWindow.right && ptMouse.x >= rcWindow.right - RIGHTEXTENDWIDTH)
|
||||
{
|
||||
uCol = 2;
|
||||
}
|
||||
|
||||
LRESULT hitTests[3][3] =
|
||||
{
|
||||
{ HTTOPLEFT, fOnResizeBorder ? HTTOP : HTCAPTION, HTTOPRIGHT },
|
||||
{ HTLEFT, HTNOWHERE, HTRIGHT },
|
||||
{ HTBOTTOMLEFT, HTBOTTOM, HTBOTTOMRIGHT },
|
||||
};
|
||||
|
||||
return hitTests[uRow][uCol];
|
||||
}
|
||||
|
||||
void PictureDialog::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
// int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
|
||||
// newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
||||
// if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
||||
// int buttomBorderSize = (frameSize().height() - size().height());
|
||||
// int sideBorderSize = ((frameSize().width() - size().width()) / 2);
|
||||
// int brokenDialogHeight = newDialogHeight + (buttomBorderSize - sideBorderSize);
|
||||
// if (event->size().height() == brokenDialogHeight)
|
||||
// {
|
||||
// qDebug() << "BROKEN 1";
|
||||
// setGeometry(geometry().x(), geometry().y(), width(), newDialogHeight);
|
||||
// qDebug() << "BROKEN 2";
|
||||
// event->ignore();
|
||||
// }
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
||||
{
|
||||
Q_UNUSED(newLabelSize)
|
||||
int newDialogHeight = SnapmaticPicture::getSnapmaticResolution().height() * AppEnv::screenRatio();
|
||||
int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
|
||||
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
||||
if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
||||
setMaximumSize(width(), newDialogHeight);
|
||||
|
@ -298,19 +381,21 @@ void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
|||
|
||||
void PictureDialog::styliseDialog()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
if (QtWin::isCompositionEnabled()) {
|
||||
if (QtWin::isCompositionEnabled())
|
||||
{
|
||||
QPalette palette;
|
||||
QtWin::extendFrameIntoClientArea(this, 0, qRound(layout()->menuBar()->height() * AppEnv::screenRatioPR()), 0, 0);
|
||||
ui->jsonFrame->setStyleSheet(QString("QFrame{background:%1;}").arg(palette.window().color().name()));
|
||||
setStyleSheet("PictureDialog{background:transparent;}");
|
||||
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
|
||||
setStyleSheet("PictureDialog { background: transparent; }");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
QPalette palette;
|
||||
QtWin::resetExtendedFrame(this);
|
||||
ui->jsonFrame->setStyleSheet(QString("QFrame{background:%1;}").arg(palette.window().color().name()));
|
||||
setStyleSheet(QString("PictureDialog{background:%1;}").arg(QtWin::realColorizationColor().name()));
|
||||
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
|
||||
setStyleSheet(QString("PictureDialog { background: %1; }").arg(QtWin::realColorizationColor().name()));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -318,10 +403,12 @@ void PictureDialog::styliseDialog()
|
|||
|
||||
bool PictureDialog::event(QEvent *event)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
if (naviEnabled) {
|
||||
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange) {
|
||||
if (naviEnabled)
|
||||
{
|
||||
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange)
|
||||
{
|
||||
styliseDialog();
|
||||
}
|
||||
}
|
||||
|
@ -401,7 +488,7 @@ bool PictureDialog::eventFilter(QObject *obj, QEvent *ev)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
if (obj != ui->labPicture && naviEnabled)
|
||||
{
|
||||
|
@ -535,7 +622,8 @@ void PictureDialog::renderOverlayPicture()
|
|||
|
||||
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool _indexed, int _index)
|
||||
{
|
||||
if (smpic != nullptr) {
|
||||
if (smpic != nullptr)
|
||||
{
|
||||
QObject::disconnect(smpic, SIGNAL(updated()), this, SLOT(updated()));
|
||||
QObject::disconnect(smpic, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
||||
}
|
||||
|
@ -543,29 +631,35 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk,
|
|||
indexed = _indexed;
|
||||
index = _index;
|
||||
smpic = picture;
|
||||
if (!readOk) {
|
||||
if (!readOk)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Snapmatic Picture Viewer"), tr("Failed at %1").arg(picture->getLastStep()));
|
||||
return;
|
||||
}
|
||||
if (picture->isPicOk()) {
|
||||
if (picture->isPicOk())
|
||||
{
|
||||
snapmaticPicture = picture->getImage();
|
||||
renderPicture();
|
||||
ui->cmdManage->setEnabled(true);
|
||||
}
|
||||
if (picture->isJsonOk()) {
|
||||
if (picture->isJsonOk())
|
||||
{
|
||||
crewStr = crewDB->getCrewName(crewID);
|
||||
if (globalMap.contains(picArea)) {
|
||||
picAreaStr = globalMap.value(picArea);
|
||||
if (globalMap.contains(picArea))
|
||||
{
|
||||
picAreaStr = globalMap[picArea];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
picAreaStr = picArea;
|
||||
}
|
||||
setWindowTitle(windowTitleStr.arg(picTitl));
|
||||
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, generatePlayersString(), generateCrewString(), picTitl, picAreaStr, created));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
ui->labJSON->setText(jsonDrawString.arg("0", "0", "0", tr("No Players"), tr("No Crew"), tr("Unknown Location")));
|
||||
// QMessageBox::warning(this, tr("Snapmatic Picture Viewer"), tr("Failed at %1").arg(picture->getLastStep()));
|
||||
QMessageBox::warning(this,tr("Snapmatic Picture Viewer"),tr("Failed at %1").arg(picture->getLastStep()));
|
||||
}
|
||||
QObject::connect(smpic, SIGNAL(updated()), this, SLOT(updated()));
|
||||
QObject::connect(smpic, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
||||
|
@ -594,39 +688,54 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
|
|||
|
||||
void PictureDialog::renderPicture()
|
||||
{
|
||||
const qreal screenRatio = AppEnv::screenRatio();
|
||||
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
const QSize snapmaticResolution(SnapmaticPicture::getSnapmaticResolution());
|
||||
const QSize renderResolution(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
|
||||
QPixmap shownImagePixmap(renderResolution);
|
||||
shownImagePixmap.fill(Qt::black);
|
||||
QPainter shownImagePainter(&shownImagePixmap);
|
||||
const QImage renderImage = snapmaticPicture.scaled(renderResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if (renderImage.width() < renderResolution.width()) {
|
||||
shownImagePainter.drawImage((renderResolution.width() - renderImage.width()) / 2, 0, renderImage, Qt::AutoColor);
|
||||
}
|
||||
else if (renderImage.height() < renderResolution.height()) {
|
||||
shownImagePainter.drawImage(0, (renderResolution.height() - renderImage.height()) / 2, renderImage, Qt::AutoColor);
|
||||
}
|
||||
else {
|
||||
shownImagePainter.drawImage(0, 0, renderImage, Qt::AutoColor);
|
||||
}
|
||||
if (previewMode) {
|
||||
QFont shownImagePainterFont;
|
||||
shownImagePainterFont.setPixelSize(12 * screenRatio * screenRatioPR);
|
||||
shownImagePainter.drawImage(0, 0, avatarAreaPicture);
|
||||
shownImagePainter.setPen(QColor::fromRgb(255, 255, 255, 255));
|
||||
shownImagePainter.setFont(shownImagePainterFont);
|
||||
shownImagePainter.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"));
|
||||
}
|
||||
else if (overlayEnabled) {
|
||||
shownImagePainter.drawImage(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage, Qt::AutoColor);
|
||||
}
|
||||
shownImagePainter.end();
|
||||
qreal screenRatio = AppEnv::screenRatio();
|
||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
if (!previewMode)
|
||||
{
|
||||
if (overlayEnabled)
|
||||
{
|
||||
QPixmap shownImagePixmap(960 * screenRatio * screenRatioPR, 536 * 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(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage);
|
||||
shownImagePainter.end();
|
||||
#if QT_VERSION >= 0x050600
|
||||
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
||||
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
||||
#endif
|
||||
ui->labPicture->setPixmap(shownImagePixmap);
|
||||
ui->labPicture->setPixmap(shownImagePixmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
QPixmap shownImagePixmap(960 * screenRatio * screenRatioPR, 536 * 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.end();
|
||||
#if QT_VERSION >= 0x050600
|
||||
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
||||
#endif
|
||||
ui->labPicture->setPixmap(shownImagePixmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generating Avatar Preview
|
||||
QPixmap avatarPixmap(960 * screenRatio * screenRatioPR, 536 * 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, 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.end();
|
||||
#if QT_VERSION >= 0x050600
|
||||
avatarPixmap.setDevicePixelRatio(screenRatioPR);
|
||||
#endif
|
||||
ui->labPicture->setPixmap(avatarPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
void PictureDialog::crewNameUpdated()
|
||||
|
@ -670,8 +779,10 @@ QString PictureDialog::generatePlayersString()
|
|||
SnapmaticPicture *picture = smpic; // used by macro
|
||||
const QStringList playersList = plyrsList; // save operation time
|
||||
QString plyrsStr;
|
||||
if (playersList.length() >= 1) {
|
||||
for (const QString &player : playersList) {
|
||||
if (playersList.length() >= 1)
|
||||
{
|
||||
for (const QString player : playersList)
|
||||
{
|
||||
const QString playerName = profileDB->getPlayerName(player);
|
||||
if (player != playerName) {
|
||||
plyrsStr += ", <a href=\"https://socialclub.rockstargames.com/member/" % playerName % "/" % player % "\">" % playerName % "</a>";
|
||||
|
@ -682,7 +793,8 @@ QString PictureDialog::generatePlayersString()
|
|||
}
|
||||
plyrsStr.remove(0, 2);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
plyrsStr = tr("No Players");
|
||||
}
|
||||
return plyrsStr;
|
||||
|
@ -690,42 +802,43 @@ QString PictureDialog::generatePlayersString()
|
|||
|
||||
void PictureDialog::exportSnapmaticPicture()
|
||||
{
|
||||
if (rqFullscreen && fullscreenWidget != nullptr) {
|
||||
if (rqFullscreen && fullscreenWidget != nullptr)
|
||||
{
|
||||
PictureExport::exportAsPicture(fullscreenWidget, smpic);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
PictureExport::exportAsPicture(this, smpic);
|
||||
}
|
||||
}
|
||||
|
||||
void PictureDialog::copySnapmaticPicture()
|
||||
{
|
||||
if (rqFullscreen && fullscreenWidget != nullptr) {
|
||||
if (rqFullscreen && fullscreenWidget != nullptr)
|
||||
{
|
||||
PictureExport::exportAsSnapmatic(fullscreenWidget, smpic);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
PictureExport::exportAsSnapmatic(this, smpic);
|
||||
}
|
||||
}
|
||||
|
||||
void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
||||
{
|
||||
if (button == Qt::LeftButton) {
|
||||
#if QT_VERSION >= 0x060000
|
||||
QRect desktopRect = QApplication::screenAt(pos())->geometry();
|
||||
#else
|
||||
if (button == Qt::LeftButton)
|
||||
{
|
||||
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
||||
#endif
|
||||
PictureWidget *pictureWidget = new PictureWidget(this); // Work!
|
||||
pictureWidget->setObjectName("PictureWidget");
|
||||
#if QT_VERSION >= 0x050600
|
||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::MaximizeUsingFullscreenGeometryHint);
|
||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::WindowStaysOnTopHint^Qt::MaximizeUsingFullscreenGeometryHint);
|
||||
#else
|
||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint);
|
||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint^Qt::WindowStaysOnTopHint);
|
||||
#endif
|
||||
pictureWidget->setWindowTitle(windowTitle());
|
||||
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color:black;}");
|
||||
pictureWidget->setImage(smpic->getImage(), desktopRect);
|
||||
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color: black;}");
|
||||
pictureWidget->setImage(snapmaticPicture, desktopRect);
|
||||
pictureWidget->setModal(true);
|
||||
|
||||
fullscreenWidget = pictureWidget;
|
||||
|
@ -735,7 +848,7 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
|||
|
||||
pictureWidget->move(desktopRect.x(), desktopRect.y());
|
||||
pictureWidget->resize(desktopRect.width(), desktopRect.height());
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
QtWin::markFullscreenWindow(pictureWidget, true);
|
||||
#endif
|
||||
|
|
|
@ -29,6 +29,14 @@
|
|||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
#ifdef GTA5SYNC_APV
|
||||
#include <dwmapi.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class PictureDialog;
|
||||
}
|
||||
|
@ -90,6 +98,15 @@ protected:
|
|||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
void mousePressEvent(QMouseEvent *ev);
|
||||
bool event(QEvent *event);
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
#ifdef GTA5SYNC_APV
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
|
||||
LRESULT HitTestNCA(HWND hWnd, LPARAM lParam);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString generateCrewString();
|
||||
|
@ -119,7 +136,7 @@ private:
|
|||
int avatarLocY;
|
||||
int avatarSize;
|
||||
QMenu *manageMenu;
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050200
|
||||
QPoint dragPosition;
|
||||
bool dragStart;
|
||||
|
|
|
@ -111,10 +111,10 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><span style="font-weight:600">Title: </span>%6<br/>
|
||||
<span style="font-weight:600">Location: </span>%7 (%1, %2, %3)<br/>
|
||||
<span style="font-weight:600">Players: </span>%4 (Crew %5)<br/>
|
||||
<span style="font-weight:600">Created: </span>%8</string>
|
||||
<string><span style=" font-weight:600;">Title: </span>%6<br/>
|
||||
<span style=" font-weight:600;">Location: </span>%7 (%1, %2, %3)<br/>
|
||||
<span style=" font-weight:600;">Players: </span>%4 (Crew %5)<br/>
|
||||
<span style=" font-weight:600;">Created: </span>%8</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* 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
|
||||
|
@ -17,29 +17,26 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "AppEnv.h"
|
||||
#include "PictureExport.h"
|
||||
#include "PictureDialog.h"
|
||||
#include "StandardPaths.h"
|
||||
#include "SidebarGenerator.h"
|
||||
#include <QStringBuilder>
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
#include <QRegExp>
|
||||
#include <QDebug>
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QSaveFile>
|
||||
#include <QScreen>
|
||||
#endif
|
||||
|
||||
PictureExport::PictureExport()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
||||
|
@ -50,25 +47,30 @@ void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
|||
// Quality Settings
|
||||
settings.beginGroup("Pictures");
|
||||
int defaultQuality = 100;
|
||||
QSize defExportSize = SnapmaticPicture::getSnapmaticResolution();
|
||||
QSize defExportSize = QSize(960, 536);
|
||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
||||
if (customQuality < 1 || customQuality > 100) {
|
||||
if (customQuality < 1 || customQuality > 100)
|
||||
{
|
||||
customQuality = 100;
|
||||
}
|
||||
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
||||
|
||||
// Size Settings
|
||||
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
||||
if (cusExportSize.width() > 3840) {
|
||||
if (cusExportSize.width() > 3840)
|
||||
{
|
||||
cusExportSize.setWidth(3840);
|
||||
}
|
||||
else if (cusExportSize.height() > 2160) {
|
||||
else if (cusExportSize.height() > 2160)
|
||||
{
|
||||
cusExportSize.setHeight(2160);
|
||||
}
|
||||
if (cusExportSize.width() < 1) {
|
||||
if (cusExportSize.width() < 1)
|
||||
{
|
||||
cusExportSize.setWidth(1);
|
||||
}
|
||||
else if (cusExportSize.height() < 1) {
|
||||
else if (cusExportSize.height() < 1)
|
||||
{
|
||||
cusExportSize.setHeight(1);
|
||||
}
|
||||
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
||||
|
@ -107,55 +109,59 @@ fileDialogPreSave: //Work?
|
|||
QString newPictureFileName = getPictureFileName(picture) % defaultExportFormat;
|
||||
fileDialog.selectFile(newPictureFileName);
|
||||
|
||||
if (fileDialog.exec()) {
|
||||
if (fileDialog.exec())
|
||||
{
|
||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||
if (selectedFiles.length() == 1) {
|
||||
if (selectedFiles.length() == 1)
|
||||
{
|
||||
QString saveFileFormat;
|
||||
QString selectedFile = selectedFiles.at(0);
|
||||
|
||||
if (selectedFile.right(4) == ".jpg") {
|
||||
if (selectedFile.right(4) == ".jpg")
|
||||
{
|
||||
saveFileFormat = "JPEG";
|
||||
}
|
||||
else if (selectedFile.right(4) == ".jpeg") {
|
||||
else if (selectedFile.right(4) == ".jpeg")
|
||||
{
|
||||
saveFileFormat = "JPEG";
|
||||
}
|
||||
else if (selectedFile.right(4) == ".png") {
|
||||
else if (selectedFile.right(4) == ".png")
|
||||
{
|
||||
saveFileFormat = "PNG";
|
||||
}
|
||||
else if (selectedFile.right(7) == ".suffix") {
|
||||
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)") {
|
||||
else if (selectedFile.right(7) == ".suffix")
|
||||
{
|
||||
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)")
|
||||
{
|
||||
selectedFile.replace(".suffix", ".jpg");
|
||||
}
|
||||
else if (fileDialog.selectedNameFilter() == "Portable Network Graphics (*.png)") {
|
||||
else if (fileDialog.selectedNameFilter() == "Portable Network Graphics (*.png)")
|
||||
{
|
||||
selectedFile.replace(".suffix", ".png");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
selectedFile.replace(".suffix", ".jpg");
|
||||
}
|
||||
}
|
||||
|
||||
if (QFile::exists(selectedFile)) {
|
||||
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)) {
|
||||
if (QFile::exists(selectedFile))
|
||||
{
|
||||
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
||||
{
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
}
|
||||
|
||||
// Scale Picture
|
||||
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
|
||||
if (sizeMode == "Desktop")
|
||||
{
|
||||
QRect desktopResolution = QApplication::desktop()->screenGeometry();
|
||||
int desktopSizeWidth = desktopResolution.width();
|
||||
int desktopSizeHeight = desktopResolution.height();
|
||||
#endif
|
||||
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
|
||||
exportPicture = exportPicture.scaled(desktopResolution.width(), desktopResolution.height(), aspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
else if (sizeMode == "Custom") {
|
||||
else if (sizeMode == "Custom")
|
||||
{
|
||||
exportPicture = exportPicture.scaled(cusExportSize, aspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
|
@ -166,26 +172,32 @@ fileDialogPreSave: //Work?
|
|||
#else
|
||||
QFile *picFile = new QFile(selectedFile);
|
||||
#endif
|
||||
if (picFile->open(QIODevice::WriteOnly)) {
|
||||
if (picFile->open(QIODevice::WriteOnly))
|
||||
{
|
||||
isSaved = exportPicture.save(picFile, saveFileFormat.toStdString().c_str(), useCustomQuality ? customQuality : defaultQuality);
|
||||
#if QT_VERSION >= 0x050000
|
||||
if (isSaved) {
|
||||
if (isSaved)
|
||||
{
|
||||
isSaved = picFile->commit();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
errorId = 1;
|
||||
}
|
||||
#else
|
||||
picFile->close();
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
errorId = 2;
|
||||
}
|
||||
delete picFile;
|
||||
|
||||
if (!isSaved) {
|
||||
switch (errorId) {
|
||||
if (!isSaved)
|
||||
{
|
||||
switch (errorId)
|
||||
{
|
||||
case 0:
|
||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Failed to export the picture because the system occurred a write failure"));
|
||||
break;
|
||||
|
@ -201,7 +213,8 @@ fileDialogPreSave: //Work?
|
|||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("No valid file is selected"));
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
|
@ -237,9 +250,7 @@ fileDialogPreSave: //Work?
|
|||
|
||||
QStringList filters;
|
||||
filters << PictureDialog::tr("GTA V Export (*.g5e)");
|
||||
#ifndef GTA5SYNC_FLATPAK
|
||||
filters << PictureDialog::tr("GTA V Raw Export (*.auto)");
|
||||
#endif
|
||||
filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
|
||||
fileDialog.setNameFilters(filters);
|
||||
|
||||
|
@ -250,48 +261,58 @@ fileDialogPreSave: //Work?
|
|||
fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
|
||||
fileDialog.selectFile(QString(picture->getExportPictureFileName() % ".g5e"));
|
||||
|
||||
if (fileDialog.exec()) {
|
||||
if (fileDialog.exec())
|
||||
{
|
||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||
if (selectedFiles.length() == 1) {
|
||||
if (selectedFiles.length() == 1)
|
||||
{
|
||||
QString selectedFile = selectedFiles.at(0);
|
||||
bool isAutoExt = false;
|
||||
#ifndef GTA5SYNC_FLATPAK
|
||||
if (selectedFile.right(5) == ".auto") {
|
||||
if (selectedFile.right(5) == ".auto")
|
||||
{
|
||||
isAutoExt = true;
|
||||
QString dirPath = QFileInfo(selectedFile).dir().path();
|
||||
QString stockFileName = sgdFileInfo.fileName();
|
||||
selectedFile = dirPath % "/" % stockFileName;
|
||||
}
|
||||
#endif
|
||||
if (selectedFile.right(4) == ".rem") {
|
||||
else if (selectedFile.right(4) == ".rem")
|
||||
{
|
||||
selectedFile.remove(selectedFile.length() - 4, 4);
|
||||
}
|
||||
|
||||
if (QFile::exists(selectedFile)) {
|
||||
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)) {
|
||||
if (QFile::exists(selectedFile))
|
||||
{
|
||||
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
||||
{
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedFile.right(4) == ".g5e") {
|
||||
if (selectedFile.right(4) == ".g5e")
|
||||
{
|
||||
bool isExported = picture->exportPicture(selectedFile, SnapmaticFormat::G5E_Format);
|
||||
if (!isExported) {
|
||||
if (!isExported)
|
||||
{
|
||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
bool isCopied = picture->exportPicture(selectedFile, SnapmaticFormat::PGTA_Format);
|
||||
if (!isCopied) {
|
||||
if (!isCopied)
|
||||
{
|
||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (isAutoExt) QMessageBox::information(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Exported Snapmatic to \"%1\" because of using the .auto extension.").arg(selectedFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("No valid file is selected"));
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* 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
|
||||
|
@ -19,12 +19,13 @@
|
|||
#include "PictureDialog.h"
|
||||
#include "PictureWidget.h"
|
||||
#include "UiModLabel.h"
|
||||
#include "AppEnv.h"
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QPixmap>
|
||||
#include <QEvent>
|
||||
#include <QDebug>
|
||||
|
||||
PictureWidget::PictureWidget(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
|
@ -43,6 +44,7 @@ PictureWidget::PictureWidget(QWidget *parent) : QDialog(parent)
|
|||
|
||||
QObject::connect(pictureLabel, SIGNAL(mouseDoubleClicked(Qt::MouseButton)), this, SLOT(pictureDoubleClicked(Qt::MouseButton)));
|
||||
QObject::connect(pictureLabel, SIGNAL(customContextMenuRequested(QPoint)), parent, SLOT(exportCustomContextMenuRequested(QPoint)));
|
||||
QObject::connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(updateWindowSize(int)));
|
||||
|
||||
setLayout(widgetLayout);
|
||||
}
|
||||
|
@ -56,10 +58,12 @@ PictureWidget::~PictureWidget()
|
|||
|
||||
bool PictureWidget::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
if (obj == this) {
|
||||
if (ev->type() == QEvent::KeyPress) {
|
||||
if (obj == this)
|
||||
{
|
||||
if (ev->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent *keyEvent = (QKeyEvent*)ev;
|
||||
switch (keyEvent->key()) {
|
||||
switch (keyEvent->key()){
|
||||
case Qt::Key_Left:
|
||||
emit previousPictureRequested();
|
||||
break;
|
||||
|
@ -74,29 +78,32 @@ bool PictureWidget::eventFilter(QObject *obj, QEvent *ev)
|
|||
|
||||
void PictureWidget::pictureDoubleClicked(Qt::MouseButton button)
|
||||
{
|
||||
if (button == Qt::LeftButton) {
|
||||
if (button == Qt::LeftButton)
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
void PictureWidget::setImage(QImage image_, QRect rec)
|
||||
{
|
||||
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
image = image_;
|
||||
QPixmap pixmap = QPixmap::fromImage(image.scaled(rec.width() * screenRatioPR, rec.height() * screenRatioPR, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
#if QT_VERSION >= 0x050600
|
||||
pixmap.setDevicePixelRatio(AppEnv::screenRatioPR());
|
||||
#endif
|
||||
pictureLabel->setPixmap(pixmap);
|
||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(rec.width(), rec.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
||||
}
|
||||
|
||||
void PictureWidget::setImage(QImage image_)
|
||||
{
|
||||
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
image = image_;
|
||||
QPixmap pixmap = QPixmap::fromImage(image.scaled(geometry().width() * screenRatioPR, geometry().height() * screenRatioPR, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
#if QT_VERSION >= 0x050600
|
||||
pixmap.setDevicePixelRatio(screenRatioPR);
|
||||
#endif
|
||||
pictureLabel->setPixmap(pixmap);
|
||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(geometry().width(), geometry().height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
||||
}
|
||||
|
||||
void PictureWidget::updateWindowSize(int screenID)
|
||||
{
|
||||
if (screenID == QApplication::desktop()->screenNumber(this))
|
||||
{
|
||||
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
||||
this->move(desktopRect.x(), desktopRect.y());
|
||||
this->resize(desktopRect.width(), desktopRect.height());
|
||||
this->showFullScreen();
|
||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(desktopRect.width(), desktopRect.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ private:
|
|||
|
||||
private slots:
|
||||
void pictureDoubleClicked(Qt::MouseButton button);
|
||||
void updateWindowSize(int screenID);
|
||||
|
||||
signals:
|
||||
void nextPictureRequested();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-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
|
||||
|
@ -73,32 +73,12 @@ 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"));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-2019 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
|
||||
|
@ -52,6 +52,7 @@
|
|||
#include <QClipboard>
|
||||
#include <QFileInfo>
|
||||
#include <QPainter>
|
||||
#include <QRegExp>
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QColor>
|
||||
|
@ -61,7 +62,6 @@
|
|||
#include <QUrl>
|
||||
#include <QDir>
|
||||
|
||||
#include <cstdint>
|
||||
#include <random>
|
||||
#include <ctime>
|
||||
|
||||
|
@ -206,16 +206,14 @@ void ProfileInterface::savegameLoaded(SavegameData *savegame, QString savegamePa
|
|||
sgdWidget->installEventFilter(this);
|
||||
widgets[sgdWidget] = "SGD" % QFileInfo(savegamePath).fileName();
|
||||
savegames += savegame;
|
||||
if (selectedWidgts != 0 || contentMode == 2)
|
||||
sgdWidget->setSelectionMode(true);
|
||||
if (selectedWidgts != 0 || contentMode == 2) { sgdWidget->setSelectionMode(true); }
|
||||
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(savegameDeleted_event()));
|
||||
QObject::connect(sgdWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
|
||||
QObject::connect(sgdWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
|
||||
QObject::connect(sgdWidget, SIGNAL(allWidgetsSelected()), this, SLOT(selectAllWidgets()));
|
||||
QObject::connect(sgdWidget, SIGNAL(allWidgetsDeselected()), this, SLOT(deselectAllWidgets()));
|
||||
QObject::connect(sgdWidget, SIGNAL(contextMenuTriggered(QContextMenuEvent*)), this, SLOT(contextMenuTriggeredSGD(QContextMenuEvent*)));
|
||||
if (inserted)
|
||||
insertSavegameIPI(sgdWidget);
|
||||
if (inserted) { insertSavegameIPI(sgdWidget); }
|
||||
}
|
||||
|
||||
void ProfileInterface::pictureLoaded_event(SnapmaticPicture *picture)
|
||||
|
@ -238,8 +236,7 @@ void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, bool inserted)
|
|||
picWidget->installEventFilter(this);
|
||||
widgets[picWidget] = "PIC" % picture->getPictureSortStr();
|
||||
pictures += picture;
|
||||
if (selectedWidgts != 0 || contentMode == 2)
|
||||
picWidget->setSelectionMode(true);
|
||||
if (selectedWidgts != 0 || contentMode == 2) { picWidget->setSelectionMode(true); }
|
||||
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(pictureDeleted_event()));
|
||||
QObject::connect(picWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
|
||||
QObject::connect(picWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
|
||||
|
@ -248,8 +245,7 @@ void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, bool inserted)
|
|||
QObject::connect(picWidget, SIGNAL(nextPictureRequested(QWidget*)), this, SLOT(dialogNextPictureRequested(QWidget*)));
|
||||
QObject::connect(picWidget, SIGNAL(previousPictureRequested(QWidget*)), this, SLOT(dialogPreviousPictureRequested(QWidget*)));
|
||||
QObject::connect(picWidget, SIGNAL(contextMenuTriggered(QContextMenuEvent*)), this, SLOT(contextMenuTriggeredPIC(QContextMenuEvent*)));
|
||||
if (inserted)
|
||||
insertSnapmaticIPI(picWidget);
|
||||
if (inserted) { insertSnapmaticIPI(picWidget); }
|
||||
}
|
||||
|
||||
void ProfileInterface::loadingProgress(int value, int maximum)
|
||||
|
@ -262,19 +258,20 @@ void ProfileInterface::loadingProgress(int value, int maximum)
|
|||
void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
|
||||
{
|
||||
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
|
||||
if (widgets.contains(proWidget)) {
|
||||
if (widgets.contains(proWidget))
|
||||
{
|
||||
QString widgetKey = widgets[proWidget];
|
||||
QStringList widgetsKeyList = widgets.values();
|
||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||
#if QT_VERSION >= 0x050600
|
||||
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||
#else
|
||||
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
||||
#endif
|
||||
int picIndex = pictureKeyList.indexOf(widgetKey);
|
||||
int picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
||||
ui->vlSnapmatic->insertWidget(picIndex, proWidget);
|
||||
|
||||
QApplication::processEvents();
|
||||
qApp->processEvents();
|
||||
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -282,19 +279,16 @@ void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
|
|||
void ProfileInterface::insertSavegameIPI(QWidget *widget)
|
||||
{
|
||||
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
|
||||
if (widgets.contains(proWidget)) {
|
||||
if (widgets.contains(proWidget))
|
||||
{
|
||||
QString widgetKey = widgets[proWidget];
|
||||
QStringList widgetsKeyList = widgets.values();
|
||||
QStringList savegameKeyList = widgetsKeyList.filter("SGD", Qt::CaseSensitive);
|
||||
#if QT_VERSION >= 0x050600
|
||||
std::sort(savegameKeyList.begin(), savegameKeyList.end());
|
||||
#else
|
||||
qSort(savegameKeyList.begin(), savegameKeyList.end());
|
||||
#endif
|
||||
int sgdIndex = savegameKeyList.indexOf(widgetKey);
|
||||
int sgdIndex = savegameKeyList.indexOf(QRegExp(widgetKey));
|
||||
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
|
||||
|
||||
QApplication::processEvents();
|
||||
qApp->processEvents();
|
||||
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -303,12 +297,13 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
|
|||
{
|
||||
PictureDialog *picDialog = qobject_cast<PictureDialog*>(dialog);
|
||||
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(sender());
|
||||
if (widgets.contains(proWidget)) {
|
||||
if (widgets.contains(proWidget))
|
||||
{
|
||||
QString widgetKey = widgets[proWidget];
|
||||
QStringList widgetsKeyList = widgets.values();
|
||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||
#if QT_VERSION >= 0x050600
|
||||
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||
#else
|
||||
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
||||
#endif
|
||||
|
@ -319,7 +314,7 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
|
|||
}
|
||||
else
|
||||
{
|
||||
picIndex = pictureKeyList.indexOf(widgetKey);
|
||||
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
||||
}
|
||||
picIndex++;
|
||||
if (pictureKeyList.length() > picIndex)
|
||||
|
@ -343,7 +338,7 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
|
|||
QStringList widgetsKeyList = widgets.values();
|
||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||
#if QT_VERSION >= 0x050600
|
||||
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||
qSort(pictureKeyList.rbegin(), pictureKeyList.rend());
|
||||
#else
|
||||
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
|
||||
#endif
|
||||
|
@ -354,7 +349,7 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
|
|||
}
|
||||
else
|
||||
{
|
||||
picIndex = pictureKeyList.indexOf(widgetKey);
|
||||
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
|
||||
}
|
||||
if (picIndex > 0)
|
||||
{
|
||||
|
@ -374,12 +369,7 @@ void ProfileInterface::sortingProfileInterface()
|
|||
ui->vlSnapmatic->setEnabled(false);
|
||||
|
||||
QStringList widgetsKeyList = widgets.values();
|
||||
|
||||
#if QT_VERSION >= 0x050600
|
||||
std::sort(widgetsKeyList.begin(), widgetsKeyList.end());
|
||||
#else
|
||||
qSort(widgetsKeyList.begin(), widgetsKeyList.end());
|
||||
#endif
|
||||
|
||||
for (QString widgetKey : widgetsKeyList)
|
||||
{
|
||||
|
@ -397,7 +387,7 @@ void ProfileInterface::sortingProfileInterface()
|
|||
ui->vlSavegame->setEnabled(true);
|
||||
ui->vlSnapmatic->setEnabled(true);
|
||||
|
||||
QApplication::processEvents();
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
void ProfileInterface::profileLoaded_p()
|
||||
|
@ -608,7 +598,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
|||
if ((selectedFileName.left(4) == "PGTA" && !selectedFileName.contains('.')) || selectedFileName.right(4) == ".g5e")
|
||||
{
|
||||
SnapmaticPicture *picture = new SnapmaticPicture(selectedFile);
|
||||
if (picture->readingPicture(true))
|
||||
if (picture->readingPicture(true, true, true))
|
||||
{
|
||||
bool success = importSnapmaticPicture(picture, notMultiple);
|
||||
if (!success) delete picture;
|
||||
|
@ -679,7 +669,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
|||
else if (isSupportedImageFile(selectedFileName))
|
||||
{
|
||||
SnapmaticPicture *picture = new SnapmaticPicture(":/template/template.g5e");
|
||||
if (picture->readingPicture(false))
|
||||
if (picture->readingPicture(true, false, true, false))
|
||||
{
|
||||
if (!notMultiple)
|
||||
{
|
||||
|
@ -761,15 +751,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
|||
cEnough++;
|
||||
}
|
||||
spJson.createdDateTime = importDateTime;
|
||||
#if QT_VERSION >= 0x060000
|
||||
quint64 timestamp = spJson.createdDateTime.toSecsSinceEpoch();
|
||||
if (timestamp > UINT32_MAX) {
|
||||
timestamp = UINT32_MAX;
|
||||
}
|
||||
spJson.createdTimestamp = (quint32)timestamp;
|
||||
#else
|
||||
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
||||
#endif
|
||||
picture->setSnapmaticProperties(spJson);
|
||||
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
|
||||
picture->setPictureTitle(customImageTitle);
|
||||
|
@ -806,7 +788,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
|||
importDialog->exec();
|
||||
if (importDialog->isImportAgreed())
|
||||
{
|
||||
if (picture->setImage(importDialog->image(), importDialog->isUnlimitedBuffer()))
|
||||
if (picture->setImage(importDialog->image()))
|
||||
{
|
||||
SnapmaticProperties spJson = picture->getSnapmaticProperties();
|
||||
spJson.uid = getRandomUid();
|
||||
|
@ -823,15 +805,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
|
|||
cEnough++;
|
||||
}
|
||||
spJson.createdDateTime = importDateTime;
|
||||
#if QT_VERSION >= 0x060000
|
||||
quint64 timestamp = spJson.createdDateTime.toSecsSinceEpoch();
|
||||
if (timestamp > UINT32_MAX) {
|
||||
timestamp = UINT32_MAX;
|
||||
}
|
||||
spJson.createdTimestamp = (quint32)timestamp;
|
||||
#else
|
||||
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
||||
#endif
|
||||
picture->setSnapmaticProperties(spJson);
|
||||
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
|
||||
picture->setPictureTitle(importDialog->getImageTitle());
|
||||
|
@ -1049,7 +1023,7 @@ bool ProfileInterface::importRemote(QUrl remoteUrl)
|
|||
bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateTime)
|
||||
{
|
||||
SnapmaticPicture *picture = new SnapmaticPicture(":/template/template.g5e");
|
||||
if (picture->readingPicture(false))
|
||||
if (picture->readingPicture(true, false, true, false))
|
||||
{
|
||||
bool success = false;
|
||||
ImportDialog *importDialog = new ImportDialog(profileName, this);
|
||||
|
@ -1059,7 +1033,7 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
|
|||
importDialog->exec();
|
||||
if (importDialog->isImportAgreed())
|
||||
{
|
||||
if (picture->setImage(importDialog->image(), importDialog->isUnlimitedBuffer()))
|
||||
if (picture->setImage(importDialog->image()))
|
||||
{
|
||||
SnapmaticProperties spJson = picture->getSnapmaticProperties();
|
||||
spJson.uid = getRandomUid();
|
||||
|
@ -1076,15 +1050,7 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
|
|||
cEnough++;
|
||||
}
|
||||
spJson.createdDateTime = importDateTime;
|
||||
#if QT_VERSION >= 0x060000
|
||||
quint64 timestamp = spJson.createdDateTime.toSecsSinceEpoch();
|
||||
if (timestamp > UINT32_MAX) {
|
||||
timestamp = UINT32_MAX;
|
||||
}
|
||||
spJson.createdTimestamp = (quint32)timestamp;
|
||||
#else
|
||||
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
|
||||
#endif
|
||||
picture->setSnapmaticProperties(spJson);
|
||||
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
|
||||
picture->setPictureTitle(importDialog->getImageTitle());
|
||||
|
@ -1128,15 +1094,7 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
|
|||
// Update Snapmatic uid
|
||||
snapmaticProperties.uid = getRandomUid();
|
||||
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
|
||||
#if QT_VERSION >= 0x060000
|
||||
quint64 timestamp = snapmaticProperties.createdDateTime.toSecsSinceEpoch();
|
||||
if (timestamp > UINT32_MAX) {
|
||||
timestamp = UINT32_MAX;
|
||||
}
|
||||
snapmaticProperties.createdTimestamp = (quint32)timestamp;
|
||||
#else
|
||||
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
|
||||
#endif
|
||||
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid));
|
||||
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
|
||||
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
|
||||
|
@ -1173,15 +1131,7 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
|
|||
// Update Snapmatic uid
|
||||
snapmaticProperties.uid = getRandomUid();
|
||||
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
|
||||
#if QT_VERSION >= 0x060000
|
||||
quint64 timestamp = snapmaticProperties.createdDateTime.toSecsSinceEpoch();
|
||||
if (timestamp > UINT32_MAX) {
|
||||
timestamp = UINT32_MAX;
|
||||
}
|
||||
snapmaticProperties.createdTimestamp = (quint32)timestamp;
|
||||
#else
|
||||
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
|
||||
#endif
|
||||
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid));
|
||||
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
|
||||
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
|
||||
|
@ -1354,11 +1304,11 @@ void ProfileInterface::exportSelected()
|
|||
|
||||
QString ExportPreSpan;
|
||||
QString ExportPostSpan;
|
||||
#ifdef Q_OS_WIN
|
||||
ExportPreSpan = "<span style=\"color:#003399;font-size:12pt\">";
|
||||
#ifdef GTA5SYNC_WIN
|
||||
ExportPreSpan = "<span style=\"color: #003399; font-size: 12pt\">";
|
||||
ExportPostSpan = "</span>";
|
||||
#else
|
||||
ExportPreSpan = "<span style=\"font-weight:bold\">";
|
||||
ExportPreSpan = "<span style=\"font-weight: bold\">";
|
||||
ExportPostSpan = "</span>";
|
||||
#endif
|
||||
|
||||
|
@ -1467,7 +1417,7 @@ void ProfileInterface::exportSelected()
|
|||
}
|
||||
}
|
||||
|
||||
void ProfileInterface::deleteSelectedL(bool isRemoteEmited)
|
||||
void ProfileInterface::deleteSelected()
|
||||
{
|
||||
if (selectedWidgts != 0)
|
||||
{
|
||||
|
@ -1482,7 +1432,7 @@ void ProfileInterface::deleteSelectedL(bool isRemoteEmited)
|
|||
SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(widget);
|
||||
if (picWidget->getPicture()->deletePictureFile())
|
||||
{
|
||||
pictureDeleted(picWidget, isRemoteEmited);
|
||||
pictureDeleted(picWidget);
|
||||
}
|
||||
}
|
||||
else if (widget->getWidgetType() == "SavegameWidget")
|
||||
|
@ -1492,7 +1442,7 @@ void ProfileInterface::deleteSelectedL(bool isRemoteEmited)
|
|||
QString fileName = savegame->getSavegameFileName();
|
||||
if (!QFile::exists(fileName) || QFile::remove(fileName))
|
||||
{
|
||||
savegameDeleted(sgdWidget, isRemoteEmited);
|
||||
savegameDeleted(sgdWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1509,36 +1459,6 @@ void ProfileInterface::deleteSelectedL(bool isRemoteEmited)
|
|||
}
|
||||
}
|
||||
|
||||
void ProfileInterface::deleteSelected()
|
||||
{
|
||||
deleteSelectedL(false);
|
||||
}
|
||||
|
||||
void ProfileInterface::deleteSelectedR()
|
||||
{
|
||||
deleteSelectedL(true);
|
||||
}
|
||||
|
||||
void ProfileInterface::massToolQualify()
|
||||
{
|
||||
massTool(MassTool::Qualify);
|
||||
}
|
||||
|
||||
void ProfileInterface::massToolPlayers()
|
||||
{
|
||||
massTool(MassTool::Players);
|
||||
}
|
||||
|
||||
void ProfileInterface::massToolCrew()
|
||||
{
|
||||
massTool(MassTool::Crew);
|
||||
}
|
||||
|
||||
void ProfileInterface::massToolTitle()
|
||||
{
|
||||
massTool(MassTool::Title);
|
||||
}
|
||||
|
||||
void ProfileInterface::importFiles()
|
||||
{
|
||||
on_cmdImport_clicked();
|
||||
|
@ -1661,146 +1581,85 @@ int ProfileInterface::selectedWidgets()
|
|||
void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
|
||||
{
|
||||
SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(sender());
|
||||
if (picWidget != previousWidget) {
|
||||
if (previousWidget != nullptr) {
|
||||
if (picWidget != previousWidget)
|
||||
{
|
||||
if (previousWidget != nullptr)
|
||||
{
|
||||
previousWidget->setStyleSheet(QLatin1String(""));
|
||||
}
|
||||
picWidget->setStyleSheet(QString("QFrame#SnapmaticFrame{background-color:palette(highlight)}QLabel#labPicStr{color:palette(highlighted-text)}"));
|
||||
previousWidget = picWidget;
|
||||
}
|
||||
QMenu contextMenu(picWidget);
|
||||
const int selectedCount = selectedWidgets();
|
||||
if (contentMode < 20 || selectedCount == 0) {
|
||||
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
|
||||
if (picWidget->isHidden()) {
|
||||
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), picWidget, SLOT(makePictureVisibleSlot()));
|
||||
}
|
||||
else {
|
||||
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), picWidget, SLOT(makePictureHiddenSlot()));
|
||||
}
|
||||
editMenu.addAction(PictureDialog::tr("&Edit Properties..."), picWidget, SLOT(editSnapmaticProperties()));
|
||||
editMenu.addAction(PictureDialog::tr("&Overwrite Image..."), picWidget, SLOT(editSnapmaticImage()));
|
||||
editMenu.addSeparator();
|
||||
editMenu.addAction(PictureDialog::tr("Open &Map Viewer..."), picWidget, SLOT(openMapViewer()));
|
||||
editMenu.addAction(PictureDialog::tr("Open &JSON Editor..."), picWidget, SLOT(editSnapmaticRawJson()));
|
||||
QMenu exportMenu(SnapmaticWidget::tr("&Export"), this);
|
||||
exportMenu.addAction(PictureDialog::tr("Export as &Picture..."), picWidget, SLOT(on_cmdExport_clicked()));
|
||||
exportMenu.addAction(PictureDialog::tr("Export as &Snapmatic..."), picWidget, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&View"), picWidget, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addMenu(&editMenu);
|
||||
contextMenu.addMenu(&exportMenu);
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Remove"), picWidget, SLOT(on_cmdDelete_clicked()));
|
||||
contextMenu.addSeparator();
|
||||
if (!picWidget->isSelected())
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected()));
|
||||
else {
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Deselect"), picWidget, SLOT(pictureSelected()));
|
||||
}
|
||||
if (selectedCount != widgets.count()) {
|
||||
contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
if (selectedCount != 0) {
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Deselect All"), picWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
contextMenuOpened = true;
|
||||
contextMenu.exec(ev->globalPos());
|
||||
contextMenuOpened = false;
|
||||
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
|
||||
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
|
||||
if (picWidget->isHidden())
|
||||
{
|
||||
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), picWidget, SLOT(makePictureVisibleSlot()));
|
||||
}
|
||||
else {
|
||||
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "&Qualify as Avatar"), this, SLOT(massToolQualify()), QKeySequence::fromString("Shift+Q"));
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "Change &Players..."), this, SLOT(massToolPlayers()), QKeySequence::fromString("Shift+P"));
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "Change &Crew..."), this, SLOT(massToolCrew()), QKeySequence::fromString("Shift+C"));
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "Change &Title..."), this, SLOT(massToolTitle()), QKeySequence::fromString("Shift+T"));
|
||||
editMenu.addSeparator();
|
||||
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), this, SLOT(enableSelected()), QKeySequence::fromString("Shift+E"));
|
||||
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), this, SLOT(disableSelected()), QKeySequence::fromString("Shift+D"));
|
||||
contextMenu.addMenu(&editMenu);
|
||||
contextMenu.addAction(SavegameWidget::tr("&Export"), this, SLOT(exportSelected()), QKeySequence::fromString("Ctrl+E"));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Remove"), this, SLOT(deleteSelectedR()), QKeySequence::fromString("Ctrl+Del"));
|
||||
contextMenu.addSeparator();
|
||||
if (!picWidget->isSelected())
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected()));
|
||||
else {
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Deselect"), picWidget, SLOT(pictureSelected()));
|
||||
}
|
||||
if (selectedCount != widgets.count()) {
|
||||
contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
if (selectedCount != 0) {
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Deselect All"), picWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
contextMenuOpened = true;
|
||||
contextMenu.exec(ev->globalPos());
|
||||
contextMenuOpened = false;
|
||||
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
|
||||
else
|
||||
{
|
||||
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), picWidget, SLOT(makePictureHiddenSlot()));
|
||||
}
|
||||
editMenu.addAction(PictureDialog::tr("&Edit Properties..."), picWidget, SLOT(editSnapmaticProperties()));
|
||||
editMenu.addAction(PictureDialog::tr("&Overwrite Image..."), picWidget, SLOT(editSnapmaticImage()));
|
||||
editMenu.addSeparator();
|
||||
editMenu.addAction(PictureDialog::tr("Open &Map Viewer..."), picWidget, SLOT(openMapViewer()));
|
||||
editMenu.addAction(PictureDialog::tr("Open &JSON Editor..."), picWidget, SLOT(editSnapmaticRawJson()));
|
||||
QMenu exportMenu(SnapmaticWidget::tr("&Export"), this);
|
||||
exportMenu.addAction(PictureDialog::tr("Export as &Picture..."), picWidget, SLOT(on_cmdExport_clicked()));
|
||||
exportMenu.addAction(PictureDialog::tr("Export as &Snapmatic..."), picWidget, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&View"), picWidget, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addMenu(&editMenu);
|
||||
contextMenu.addMenu(&exportMenu);
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Remove"), picWidget, SLOT(on_cmdDelete_clicked()));
|
||||
contextMenu.addSeparator();
|
||||
if (!picWidget->isSelected()) { contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected())); }
|
||||
if (picWidget->isSelected()) { contextMenu.addAction(SnapmaticWidget::tr("&Deselect"), picWidget, SLOT(pictureSelected())); }
|
||||
if (selectedWidgets() != widgets.count())
|
||||
{
|
||||
contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
if (selectedWidgets() != 0)
|
||||
{
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&Deselect All"), picWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
contextMenuOpened = true;
|
||||
contextMenu.exec(ev->globalPos());
|
||||
contextMenuOpened = false;
|
||||
hoverProfileWidgetCheck();
|
||||
}
|
||||
|
||||
void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
|
||||
{
|
||||
SavegameWidget *sgdWidget = qobject_cast<SavegameWidget*>(sender());
|
||||
if (sgdWidget != previousWidget) {
|
||||
if (previousWidget != nullptr) {
|
||||
if (sgdWidget != previousWidget)
|
||||
{
|
||||
if (previousWidget != nullptr)
|
||||
{
|
||||
previousWidget->setStyleSheet(QLatin1String(""));
|
||||
}
|
||||
sgdWidget->setStyleSheet(QString("QFrame#SavegameFrame{background-color:palette(highlight)}QLabel#labSavegameStr{color:palette(highlighted-text)}"));
|
||||
previousWidget = sgdWidget;
|
||||
}
|
||||
QMenu contextMenu(sgdWidget);
|
||||
const int selectedCount = selectedWidgets();
|
||||
if (contentMode < 20 || selectedCount == 0) {
|
||||
contextMenu.addAction(SavegameWidget::tr("&View"), sgdWidget, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Export"), sgdWidget, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Remove"), sgdWidget, SLOT(on_cmdDelete_clicked()));
|
||||
contextMenu.addSeparator();
|
||||
if (!sgdWidget->isSelected()) {
|
||||
contextMenu.addAction(SavegameWidget::tr("&Select"), sgdWidget, SLOT(savegameSelected()));
|
||||
}
|
||||
else {
|
||||
contextMenu.addAction(SavegameWidget::tr("&Deselect"), sgdWidget, SLOT(savegameSelected()));
|
||||
}
|
||||
if (selectedCount != widgets.count()) {
|
||||
contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
if (selectedCount != 0) {
|
||||
contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
contextMenuOpened = true;
|
||||
contextMenu.exec(ev->globalPos());
|
||||
contextMenuOpened = false;
|
||||
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
|
||||
contextMenu.addAction(SavegameWidget::tr("&View"), sgdWidget, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Export"), sgdWidget, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Remove"), sgdWidget, SLOT(on_cmdDelete_clicked()));
|
||||
contextMenu.addSeparator();
|
||||
if (!sgdWidget->isSelected()) { contextMenu.addAction(SavegameWidget::tr("&Select"), sgdWidget, SLOT(savegameSelected())); }
|
||||
if (sgdWidget->isSelected()) { contextMenu.addAction(SavegameWidget::tr("&Deselect"), sgdWidget, SLOT(savegameSelected())); }
|
||||
if (selectedWidgets() != widgets.count())
|
||||
{
|
||||
contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
else {
|
||||
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), sgdWidget);
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "&Qualify as Avatar"), this, SLOT(massToolQualify()), QKeySequence::fromString("Shift+Q"));
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "Change &Players..."), this, SLOT(massToolPlayers()), QKeySequence::fromString("Shift+P"));
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "Change &Crew..."), this, SLOT(massToolCrew()), QKeySequence::fromString("Shift+C"));
|
||||
editMenu.addAction(QApplication::translate("UserInterface", "Change &Title..."), this, SLOT(massToolTitle()), QKeySequence::fromString("Shift+T"));
|
||||
editMenu.addSeparator();
|
||||
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), this, SLOT(enableSelected()), QKeySequence::fromString("Shift+E"));
|
||||
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), this, SLOT(disableSelected()), QKeySequence::fromString("Shift+D"));
|
||||
contextMenu.addMenu(&editMenu);
|
||||
contextMenu.addAction(SavegameWidget::tr("&Export"), this, SLOT(exportSelected()), QKeySequence::fromString("Ctrl+E"));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Remove"), this, SLOT(deleteSelectedR()), QKeySequence::fromString("Ctrl+Del"));
|
||||
contextMenu.addSeparator();
|
||||
if (!sgdWidget->isSelected())
|
||||
contextMenu.addAction(SavegameWidget::tr("&Select"), sgdWidget, SLOT(savegameSelected()));
|
||||
else {
|
||||
contextMenu.addAction(SavegameWidget::tr("&Deselect"), sgdWidget, SLOT(savegameSelected()));
|
||||
}
|
||||
if (selectedCount != widgets.count()) {
|
||||
contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
if (selectedCount != 0) {
|
||||
contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
contextMenuOpened = true;
|
||||
contextMenu.exec(ev->globalPos());
|
||||
contextMenuOpened = false;
|
||||
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
|
||||
if (selectedWidgets() != 0)
|
||||
{
|
||||
contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
contextMenuOpened = true;
|
||||
contextMenu.exec(ev->globalPos());
|
||||
contextMenuOpened = false;
|
||||
hoverProfileWidgetCheck();
|
||||
}
|
||||
|
||||
void ProfileInterface::on_saProfileContent_dropped(const QMimeData *mimeData)
|
||||
|
@ -1921,23 +1780,19 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease)
|
||||
else if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::WindowActivate)
|
||||
{
|
||||
if ((watched->objectName() == "SavegameWidget" || watched->objectName() == "SnapmaticWidget") && isProfileLoaded)
|
||||
{
|
||||
ProfileWidget *pWidget = nullptr;
|
||||
QMap<ProfileWidget*, QString>::const_iterator it = widgets.constBegin();
|
||||
QMap<ProfileWidget*, QString>::const_iterator end = widgets.constEnd();
|
||||
while (it != end)
|
||||
for (ProfileWidget *widget : widgets.keys())
|
||||
{
|
||||
ProfileWidget *widget = it.key();
|
||||
QPoint mousePos = widget->mapFromGlobal(QCursor::pos());
|
||||
if (widget->rect().contains(mousePos))
|
||||
{
|
||||
pWidget = widget;
|
||||
break;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
if (pWidget != nullptr)
|
||||
{
|
||||
|
@ -1971,7 +1826,7 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
|||
}
|
||||
else if (event->type() == QEvent::WindowDeactivate && isProfileLoaded)
|
||||
{
|
||||
if (previousWidget != nullptr && watched == previousWidget)
|
||||
if (previousWidget != nullptr)
|
||||
{
|
||||
previousWidget->setStyleSheet(QLatin1String(""));
|
||||
previousWidget = nullptr;
|
||||
|
@ -2007,17 +1862,13 @@ bool ProfileInterface::eventFilter(QObject *watched, QEvent *event)
|
|||
void ProfileInterface::hoverProfileWidgetCheck()
|
||||
{
|
||||
ProfileWidget *pWidget = nullptr;
|
||||
QMap<ProfileWidget*, QString>::const_iterator it = widgets.constBegin();
|
||||
QMap<ProfileWidget*, QString>::const_iterator end = widgets.constEnd();
|
||||
while (it != end)
|
||||
for (ProfileWidget *widget : widgets.keys())
|
||||
{
|
||||
ProfileWidget *widget = it.key();
|
||||
if (widget->underMouse())
|
||||
{
|
||||
pWidget = widget;
|
||||
break;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
if (pWidget != nullptr)
|
||||
{
|
||||
|
@ -2166,7 +2017,7 @@ void ProfileInterface::massTool(MassTool tool)
|
|||
else
|
||||
{
|
||||
picture->emitUpdate();
|
||||
QApplication::processEvents();
|
||||
qApp->processEvents();
|
||||
}
|
||||
}
|
||||
pbDialog.close();
|
||||
|
@ -2265,7 +2116,7 @@ void ProfileInterface::massTool(MassTool tool)
|
|||
else
|
||||
{
|
||||
picture->emitUpdate();
|
||||
QApplication::processEvents();
|
||||
qApp->processEvents();
|
||||
}
|
||||
}
|
||||
pbDialog.close();
|
||||
|
@ -2318,7 +2169,7 @@ preSelectionCrewID:
|
|||
}
|
||||
if (crewList.contains(QString::number(crewID)))
|
||||
{
|
||||
indexNum = crewList.indexOf(QString::number(crewID));
|
||||
indexNum = crewList.indexOf(QRegExp(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);
|
||||
if (ok && !newCrew.isEmpty())
|
||||
|
@ -2396,7 +2247,7 @@ preSelectionCrewID:
|
|||
else
|
||||
{
|
||||
picture->emitUpdate();
|
||||
QApplication::processEvents();
|
||||
qApp->processEvents();
|
||||
}
|
||||
}
|
||||
pbDialog.close();
|
||||
|
@ -2499,7 +2350,7 @@ preSelectionTitle:
|
|||
else
|
||||
{
|
||||
picture->emitUpdate();
|
||||
QApplication::processEvents();
|
||||
qApp->processEvents();
|
||||
}
|
||||
}
|
||||
pbDialog.close();
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
void settingsApplied(int contentMode, bool languageChanged);
|
||||
void setupProfileInterface();
|
||||
void massTool(MassTool tool);
|
||||
void disableSelected();
|
||||
void enableSelected();
|
||||
int selectedWidgets();
|
||||
void retranslateUi();
|
||||
~ProfileInterface();
|
||||
|
@ -62,11 +64,8 @@ public slots:
|
|||
void hoverProfileWidgetCheck();
|
||||
void selectAllWidgets();
|
||||
void deselectAllWidgets();
|
||||
void disableSelected();
|
||||
void enableSelected();
|
||||
void exportSelected();
|
||||
void deleteSelected();
|
||||
void deleteSelectedR();
|
||||
void updatePalette();
|
||||
void importFiles();
|
||||
|
||||
|
@ -82,10 +81,6 @@ private slots:
|
|||
void profileLoaded_p();
|
||||
void profileWidgetSelected();
|
||||
void profileWidgetDeselected();
|
||||
void massToolQualify();
|
||||
void massToolPlayers();
|
||||
void massToolCrew();
|
||||
void massToolTitle();
|
||||
void dialogNextPictureRequested(QWidget *dialog);
|
||||
void dialogPreviousPictureRequested(QWidget *dialog);
|
||||
void on_saProfileContent_dropped(const QMimeData *mimeData);
|
||||
|
@ -129,7 +124,6 @@ private:
|
|||
void savegameLoaded(SavegameData *savegame, QString savegamePath, bool inserted);
|
||||
void savegameDeleted(SavegameWidget *sgdWidget, bool isRemoteEmited = false);
|
||||
void pictureDeleted(SnapmaticWidget *picWidget, bool isRemoteEmited = false);
|
||||
void deleteSelectedL(bool isRemoteEmited = false);
|
||||
void insertSnapmaticIPI(QWidget *widget);
|
||||
void insertSavegameIPI(QWidget *widget);
|
||||
void sortingProfileInterface();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* 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
|
||||
|
@ -30,6 +30,7 @@
|
|||
|
||||
ProfileLoader::ProfileLoader(QString profileFolder, CrewDatabase *crewDB, QObject *parent) : QThread(parent), profileFolder(profileFolder), crewDB(crewDB)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ProfileLoader::run()
|
||||
|
@ -40,16 +41,17 @@ void ProfileLoader::run()
|
|||
profileDir.setPath(profileFolder);
|
||||
|
||||
// Seek pictures and savegames
|
||||
profileDir.setNameFilters(QStringList("SGTA5*"));
|
||||
profileDir.setNameFilters(QStringList("SGTA*"));
|
||||
QStringList SavegameFiles = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
|
||||
QStringList BackupFiles = SavegameFiles.filter(".bak", Qt::CaseInsensitive);
|
||||
profileDir.setNameFilters(QStringList("PGTA5*"));
|
||||
profileDir.setNameFilters(QStringList("PGTA*"));
|
||||
QStringList SnapmaticPics = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
|
||||
BackupFiles += SnapmaticPics.filter(".bak", Qt::CaseInsensitive);
|
||||
|
||||
SavegameFiles.removeDuplicates();
|
||||
SnapmaticPics.removeDuplicates();
|
||||
for (const QString &BackupFile : BackupFiles) {
|
||||
for (QString BackupFile : BackupFiles)
|
||||
{
|
||||
SavegameFiles.removeAll(BackupFile);
|
||||
SnapmaticPics.removeAll(BackupFile);
|
||||
}
|
||||
|
@ -58,29 +60,36 @@ void ProfileLoader::run()
|
|||
|
||||
// Loading pictures and savegames
|
||||
emit loadingProgress(curFile, maximumV);
|
||||
for (const QString &SavegameFile : SavegameFiles) {
|
||||
for (QString SavegameFile : SavegameFiles)
|
||||
{
|
||||
emit loadingProgress(curFile, maximumV);
|
||||
const QString sgdPath = profileFolder % "/" % SavegameFile;
|
||||
QString sgdPath = profileFolder % "/" % SavegameFile;
|
||||
SavegameData *savegame = new SavegameData(sgdPath);
|
||||
if (savegame->readingSavegame()) {
|
||||
if (savegame->readingSavegame())
|
||||
{
|
||||
emit savegameLoaded(savegame, sgdPath);
|
||||
}
|
||||
curFile++;
|
||||
}
|
||||
for (const QString &SnapmaticPic : SnapmaticPics) {
|
||||
for (QString SnapmaticPic : SnapmaticPics)
|
||||
{
|
||||
emit loadingProgress(curFile, maximumV);
|
||||
const QString picturePath = profileFolder % "/" % SnapmaticPic;
|
||||
QString picturePath = profileFolder % "/" % SnapmaticPic;
|
||||
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
|
||||
if (picture->readingPicture(true)) {
|
||||
if (picture->isFormatSwitched()) {
|
||||
if (picture->readingPicture(true, true, true))
|
||||
{
|
||||
if (picture->isFormatSwitched())
|
||||
{
|
||||
picture->setSnapmaticFormat(SnapmaticFormat::PGTA_Format);
|
||||
if (picture->exportPicture(picturePath, SnapmaticFormat::PGTA_Format)) {
|
||||
if (picture->exportPicture(picturePath, SnapmaticFormat::PGTA_Format))
|
||||
{
|
||||
emit pictureFixed(picture);
|
||||
}
|
||||
}
|
||||
emit pictureLoaded(picture);
|
||||
int crewNumber = picture->getSnapmaticProperties().crewID;
|
||||
if (!crewList.contains(crewNumber)) {
|
||||
if (!crewList.contains(crewNumber))
|
||||
{
|
||||
crewList += crewNumber;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +98,8 @@ void ProfileLoader::run()
|
|||
|
||||
// adding found crews
|
||||
crewDB->setAddingCrews(true);
|
||||
for (int crewID : crewList) {
|
||||
for (int crewID : crewList)
|
||||
{
|
||||
crewDB->addCrew(crewID);
|
||||
}
|
||||
crewDB->setAddingCrews(false);
|
||||
|
@ -97,9 +107,10 @@ void ProfileLoader::run()
|
|||
|
||||
void ProfileLoader::preloaded()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ProfileLoader::loaded()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
38
README.md
|
@ -4,7 +4,7 @@ Grand Theft Auto V Savegame and Snapmatic viewer/editor
|
|||
- View Snapmatics with the ability to disable them in-game
|
||||
- Edit Snapmatic pictures and properties in multiple ways
|
||||
- Import/Export Snapmatics, Savegames and pictures
|
||||
- Choose between multiple Social Club accounts as GTA V profiles IDs
|
||||
- Let choose between multiple Social Club accounts as GTA V profiles IDs
|
||||
|
||||
#### Screenshots
|
||||
![Snapmatic Picture Viewer](res/src/picture.png)
|
||||
|
@ -15,35 +15,39 @@ 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 sypingauto/gta5view-build:1.9-static
|
||||
docker run --rm -v ${PWD}:/gta5view -it sypingauto/gta5view-build:1.9-static
|
||||
docker pull syping/qt5-static-mingw
|
||||
docker run --rm -v ${PWD}:/gta5view -it syping/qt5-static-mingw
|
||||
cd /gta5view && mkdir -p build && cd build
|
||||
mingw64-qt-cmake ../
|
||||
qmake-static ../gta5view.pro
|
||||
make depend
|
||||
make -j $(nproc --all)
|
||||
|
||||
#### Build gta5view for Debian/Ubuntu
|
||||
|
||||
sudo apt-get install cmake git gcc g++ libqt5svg5-dev make qtbase5-dev qttranslations5-l10n
|
||||
sudo apt-get install git gcc g++ qtbase5-dev qttranslations5-l10n qt5-qmake make
|
||||
git clone https://gitlab.com/Syping/gta5view && cd gta5view
|
||||
mkdir -p build && cd build
|
||||
cmake ../
|
||||
make -j $(nproc --all)
|
||||
sudo make install
|
||||
|
||||
#### Build gta5view for Arch/Manjaro
|
||||
|
||||
sudo pacman -S cmake gcc git make qt5-base qt5-svg qt5-tools qt5-translations
|
||||
git clone https://gitlab.com/Syping/gta5view && cd gta5view
|
||||
mkdir -p build && cd build
|
||||
cmake ../
|
||||
../configure --prefix=/opt/gta5view
|
||||
make depend
|
||||
make -j $(nproc --all)
|
||||
sudo make install
|
||||
|
||||
#### Build gta5view for Fedora
|
||||
|
||||
sudo dnf install cmake git gcc gcc-c++ make qt5-qtbase-devel qt5-qtsvg-devel qt5-qttranslations
|
||||
sudo dnf install git gcc gcc-c++ qt5-qtbase-devel qt5-qttranslations make
|
||||
git clone https://gitlab.com/Syping/gta5view && cd gta5view
|
||||
mkdir -p build && cd build
|
||||
cmake ../
|
||||
../configure --prefix=/opt/gta5view
|
||||
make depend
|
||||
make -j $(nproc --all)
|
||||
sudo make install
|
||||
|
||||
#### Build gta5view for Windows (Beginner)
|
||||
|
||||
Download the [Qt Framework](https://www.qt.io/) and install the MinGW version.
|
||||
Download the Source Code over the Repository or with your Git client.
|
||||
Open the gta5view.pro Project file with Qt Creator and build it over Qt Creator.
|
||||
|
||||
#### Download Binary Releases
|
||||
|
||||
Go to [gta5view release](https://github.com/SyDevTeam/gta5view/releases) and download the .exe file for Windows, .deb file for Debian/Ubuntu and .dmg file for OS X.
|
||||
|
|
846
RagePhoto.cpp
|
@ -1,846 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2020-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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "RagePhoto.h"
|
||||
#include <QJsonDocument>
|
||||
#include <QBuffer>
|
||||
#include <QFile>
|
||||
#if QT_VERSION < 0x060000
|
||||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
RagePhoto::RagePhoto()
|
||||
{
|
||||
p_photoFormat = PhotoFormat::Undefined;
|
||||
p_isLoaded = false;
|
||||
p_inputMode = -1;
|
||||
}
|
||||
|
||||
RagePhoto::RagePhoto(const QByteArray &data) : p_fileData(data)
|
||||
{
|
||||
p_photoFormat = PhotoFormat::Undefined;
|
||||
p_isLoaded = false;
|
||||
p_inputMode = 0;
|
||||
}
|
||||
|
||||
RagePhoto::RagePhoto(const QString &filePath) : p_filePath(filePath)
|
||||
{
|
||||
p_photoFormat = PhotoFormat::Undefined;
|
||||
p_isLoaded = false;
|
||||
p_inputMode = 1;
|
||||
}
|
||||
|
||||
RagePhoto::RagePhoto(QIODevice *ioDevice) : p_ioDevice(ioDevice)
|
||||
{
|
||||
p_photoFormat = PhotoFormat::Undefined;
|
||||
p_isLoaded = false;
|
||||
p_inputMode = 2;
|
||||
}
|
||||
|
||||
bool RagePhoto::isLoaded()
|
||||
{
|
||||
return p_isLoaded;
|
||||
}
|
||||
|
||||
bool RagePhoto::load()
|
||||
{
|
||||
if (p_inputMode == -1)
|
||||
return false;
|
||||
|
||||
if (p_isLoaded)
|
||||
clear();
|
||||
|
||||
if (p_inputMode == 1) {
|
||||
QFile pictureFile(p_filePath);
|
||||
if (pictureFile.open(QIODevice::ReadOnly)) {
|
||||
p_fileData = pictureFile.readAll();
|
||||
}
|
||||
pictureFile.close();
|
||||
}
|
||||
else if (p_inputMode == 2) {
|
||||
if (!p_ioDevice->isOpen()) {
|
||||
if (!p_ioDevice->open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
}
|
||||
p_fileData = p_ioDevice->readAll();
|
||||
}
|
||||
|
||||
QBuffer dataBuffer(&p_fileData);
|
||||
dataBuffer.open(QIODevice::ReadOnly);
|
||||
|
||||
char uInt32Buffer[4];
|
||||
qint64 size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
quint32 format = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
if (format == static_cast<quint32>(PhotoFormat::GTA5)) {
|
||||
char *photoHeader = static_cast<char*>(malloc(256));
|
||||
if (!photoHeader)
|
||||
return false;
|
||||
size = dataBuffer.read(photoHeader, 256);
|
||||
if (size != 256) {
|
||||
free(photoHeader);
|
||||
return false;
|
||||
}
|
||||
for (const QChar &photoChar : utf16LEToString(photoHeader, 256)) {
|
||||
if (photoChar.isNull())
|
||||
break;
|
||||
p_photoString += photoChar;
|
||||
}
|
||||
free(photoHeader);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_headerSum = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_endOfFile = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_jsonOffset = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_titlOffset = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_descOffset = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char markerBuffer[4];
|
||||
size = dataBuffer.read(markerBuffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
if (strncmp(markerBuffer, "JPEG", 4) != 0)
|
||||
return false;
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_photoBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
quint32 t_photoSize = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *photoData = static_cast<char*>(malloc(t_photoSize));
|
||||
if (!photoData)
|
||||
return false;
|
||||
size = dataBuffer.read(photoData, t_photoSize);
|
||||
if (size != t_photoSize) {
|
||||
free(photoData);
|
||||
return false;
|
||||
}
|
||||
p_photoData = QByteArray(photoData, t_photoSize);
|
||||
free(photoData);
|
||||
|
||||
dataBuffer.seek(p_jsonOffset + 264);
|
||||
size = dataBuffer.read(markerBuffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
if (strncmp(markerBuffer, "JSON", 4) != 0)
|
||||
return false;
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_jsonBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *jsonBytes = static_cast<char*>(malloc(p_jsonBuffer));
|
||||
if (!jsonBytes)
|
||||
return false;
|
||||
size = dataBuffer.read(jsonBytes, p_jsonBuffer);
|
||||
if (size != p_jsonBuffer) {
|
||||
free(jsonBytes);
|
||||
return false;
|
||||
}
|
||||
for (quint32 i = 0; i != p_jsonBuffer; i++) {
|
||||
if (jsonBytes[i] == '\x00')
|
||||
break;
|
||||
p_jsonData += jsonBytes[i];
|
||||
}
|
||||
free(jsonBytes);
|
||||
QJsonDocument t_jsonDocument = QJsonDocument::fromJson(p_jsonData);
|
||||
if (t_jsonDocument.isNull())
|
||||
return false;
|
||||
p_jsonObject = t_jsonDocument.object();
|
||||
|
||||
dataBuffer.seek(p_titlOffset + 264);
|
||||
size = dataBuffer.read(markerBuffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
if (strncmp(markerBuffer, "TITL", 4) != 0)
|
||||
return false;
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_titlBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *titlBytes = static_cast<char*>(malloc(p_titlBuffer));
|
||||
if (!titlBytes)
|
||||
return false;
|
||||
size = dataBuffer.read(titlBytes, p_titlBuffer);
|
||||
if (size != p_titlBuffer){
|
||||
free(titlBytes);
|
||||
return false;
|
||||
}
|
||||
for (const QChar &titlChar : QString::fromUtf8(titlBytes, p_titlBuffer)) {
|
||||
if (titlChar.isNull())
|
||||
break;
|
||||
p_titleString += titlChar;
|
||||
}
|
||||
free(titlBytes);
|
||||
|
||||
dataBuffer.seek(p_descOffset + 264);
|
||||
size = dataBuffer.read(markerBuffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
if (strncmp(markerBuffer, "DESC", 4) != 0)
|
||||
return false;
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_descBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *descBytes = static_cast<char*>(malloc(p_descBuffer));
|
||||
if (!descBytes)
|
||||
return false;
|
||||
size = dataBuffer.read(descBytes, p_descBuffer);
|
||||
if (size != p_descBuffer) {
|
||||
free(descBytes);
|
||||
return false;
|
||||
}
|
||||
for (const QChar &descChar : QString::fromUtf8(descBytes, p_descBuffer)) {
|
||||
if (descChar.isNull())
|
||||
break;
|
||||
p_descriptionString += descChar;
|
||||
}
|
||||
free(descBytes);
|
||||
|
||||
dataBuffer.seek(p_endOfFile + 260);
|
||||
size = dataBuffer.read(markerBuffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
if (strncmp(markerBuffer, "JEND", 4) != 0)
|
||||
return false;
|
||||
|
||||
if (p_photoFormat != PhotoFormat::G5EX)
|
||||
p_photoFormat = PhotoFormat::GTA5;
|
||||
|
||||
p_fileData.clear();
|
||||
p_isLoaded = true;
|
||||
return true;
|
||||
}
|
||||
else if (format == static_cast<quint32>(PhotoFormat::G5EX)) {
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
format = charToUInt32LE(uInt32Buffer);
|
||||
if (format == static_cast<quint32>(ExportFormat::G5E3P)) {
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
quint32 compressedSize = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *compressedPhotoHeader = static_cast<char*>(malloc(compressedSize));
|
||||
if (!compressedPhotoHeader)
|
||||
return false;
|
||||
size = dataBuffer.read(compressedPhotoHeader, compressedSize);
|
||||
if (size != compressedSize) {
|
||||
free(compressedPhotoHeader);
|
||||
return false;
|
||||
}
|
||||
QByteArray t_photoHeader = QByteArray::fromRawData(compressedPhotoHeader, compressedSize);
|
||||
t_photoHeader = qUncompress(t_photoHeader);
|
||||
free(compressedPhotoHeader);
|
||||
if (t_photoHeader.isEmpty())
|
||||
return false;
|
||||
p_photoString = QString::fromUtf8(t_photoHeader);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_headerSum = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_photoBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
compressedSize = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *compressedPhoto = static_cast<char*>(malloc(compressedSize));
|
||||
if (!compressedPhoto)
|
||||
return false;
|
||||
size = dataBuffer.read(compressedPhoto, compressedSize);
|
||||
if (size != compressedSize) {
|
||||
free(compressedPhoto);
|
||||
return false;
|
||||
}
|
||||
QByteArray t_photoData = QByteArray::fromRawData(compressedPhoto, compressedSize);
|
||||
p_photoData = qUncompress(t_photoData);
|
||||
free(compressedPhoto);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_jsonOffset = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_jsonBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
compressedSize = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *compressedJson = static_cast<char*>(malloc(compressedSize));
|
||||
if (!compressedJson)
|
||||
return false;
|
||||
size = dataBuffer.read(compressedJson, compressedSize);
|
||||
if (size != compressedSize) {
|
||||
free(compressedJson);
|
||||
return false;
|
||||
}
|
||||
QByteArray t_jsonBytes = QByteArray::fromRawData(compressedJson, compressedSize);
|
||||
p_jsonData = qUncompress(t_jsonBytes);
|
||||
free(compressedJson);
|
||||
if (p_jsonData.isEmpty())
|
||||
return false;
|
||||
QJsonDocument t_jsonDocument = QJsonDocument::fromJson(p_jsonData);
|
||||
if (t_jsonDocument.isNull())
|
||||
return false;
|
||||
p_jsonObject = t_jsonDocument.object();
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_titlOffset = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_titlBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
compressedSize = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *compressedTitl = static_cast<char*>(malloc(compressedSize));
|
||||
if (!compressedTitl)
|
||||
return false;
|
||||
size = dataBuffer.read(compressedTitl, compressedSize);
|
||||
if (size != compressedSize) {
|
||||
free(compressedTitl);
|
||||
return false;
|
||||
}
|
||||
QByteArray t_titlBytes = QByteArray::fromRawData(compressedTitl, compressedSize);
|
||||
t_titlBytes = qUncompress(t_titlBytes);
|
||||
free(compressedTitl);
|
||||
p_titleString = QString::fromUtf8(t_titlBytes);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_descOffset = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_descBuffer = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
compressedSize = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
char *compressedDesc = static_cast<char*>(malloc(compressedSize));
|
||||
if (!compressedDesc)
|
||||
return false;
|
||||
size = dataBuffer.read(compressedDesc, compressedSize);
|
||||
if (size != compressedSize) {
|
||||
free(compressedDesc);
|
||||
return false;
|
||||
}
|
||||
QByteArray t_descBytes = QByteArray::fromRawData(compressedDesc, compressedSize);
|
||||
t_descBytes = qUncompress(t_descBytes);
|
||||
free(compressedDesc);
|
||||
p_descriptionString = QString::fromUtf8(t_descBytes);
|
||||
|
||||
size = dataBuffer.read(uInt32Buffer, 4);
|
||||
if (size != 4)
|
||||
return false;
|
||||
p_endOfFile = charToUInt32LE(uInt32Buffer);
|
||||
|
||||
p_photoFormat = PhotoFormat::G5EX;
|
||||
|
||||
p_fileData.clear();
|
||||
p_isLoaded = true;
|
||||
return true;
|
||||
}
|
||||
else if (format == static_cast<quint32>(ExportFormat::G5E2P)) {
|
||||
p_photoFormat = PhotoFormat::G5EX;
|
||||
p_fileData = qUncompress(dataBuffer.readAll());
|
||||
if (p_fileData.isEmpty())
|
||||
return false;
|
||||
p_inputMode = 0;
|
||||
return load();
|
||||
}
|
||||
else if (format == static_cast<quint32>(ExportFormat::G5E1P)) {
|
||||
#if QT_VERSION >= 0x050A00
|
||||
size = dataBuffer.skip(1);
|
||||
#else
|
||||
QByteArray skipData = dataBuffer.read(1);
|
||||
size = skipData.size();
|
||||
#endif
|
||||
if (size != 1)
|
||||
return false;
|
||||
|
||||
char length[1];
|
||||
size = dataBuffer.read(length, 1);
|
||||
if (size != 1)
|
||||
return false;
|
||||
int i_length = QByteArray::number(static_cast<int>(length[0]), 16).toInt() + 6;
|
||||
|
||||
#if QT_VERSION >= 0x050A00
|
||||
size = dataBuffer.skip(i_length);
|
||||
#else
|
||||
skipData = dataBuffer.read(i_length);
|
||||
size = skipData.size();
|
||||
#endif
|
||||
if (size != i_length)
|
||||
return false;
|
||||
|
||||
p_photoFormat = PhotoFormat::G5EX;
|
||||
p_fileData = qUncompress(dataBuffer.readAll());
|
||||
if (p_fileData.isEmpty())
|
||||
return false;
|
||||
p_inputMode = 0;
|
||||
return load();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void RagePhoto::clear()
|
||||
{
|
||||
p_photoFormat = PhotoFormat::Undefined;
|
||||
p_jsonObject = QJsonObject();
|
||||
p_descriptionString.clear();
|
||||
p_jsonData.clear();
|
||||
p_photoData.clear();
|
||||
p_photoString.clear();
|
||||
p_titleString.clear();
|
||||
p_headerSum = 0;
|
||||
p_isLoaded = false;
|
||||
}
|
||||
|
||||
void RagePhoto::setDescription(const QString &description)
|
||||
{
|
||||
p_descriptionString = description;
|
||||
}
|
||||
|
||||
void RagePhoto::setFileData(const QByteArray &data)
|
||||
{
|
||||
p_fileData = data;
|
||||
p_inputMode = 0;
|
||||
}
|
||||
|
||||
void RagePhoto::setFilePath(const QString &filePath)
|
||||
{
|
||||
p_filePath = filePath;
|
||||
p_inputMode = 1;
|
||||
}
|
||||
|
||||
void RagePhoto::setIODevice(QIODevice *ioDevice)
|
||||
{
|
||||
p_ioDevice = ioDevice;
|
||||
p_inputMode = 2;
|
||||
}
|
||||
|
||||
bool RagePhoto::setJsonData(const QByteArray &data)
|
||||
{
|
||||
QJsonDocument t_jsonDocument = QJsonDocument::fromJson(data);
|
||||
if (t_jsonDocument.isNull())
|
||||
return false;
|
||||
p_jsonData = t_jsonDocument.toJson(QJsonDocument::Compact);
|
||||
p_jsonObject = t_jsonDocument.object();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RagePhoto::setPhotoBuffer(quint32 size, bool moveOffsets)
|
||||
{
|
||||
if (size < static_cast<quint32>(p_photoData.size()))
|
||||
return false;
|
||||
p_photoBuffer = size;
|
||||
if (moveOffsets) {
|
||||
p_jsonOffset = size + 28;
|
||||
p_titlOffset = p_jsonOffset + p_jsonBuffer + 8;
|
||||
p_descOffset = p_titlOffset + p_titlBuffer + 8;
|
||||
p_endOfFile = p_descOffset + p_descBuffer + 12;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RagePhoto::setPhotoData(const QByteArray &data)
|
||||
{
|
||||
quint32 size = data.size();
|
||||
if (size > p_photoBuffer)
|
||||
return false;
|
||||
p_photoData = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RagePhoto::setPhotoData(const char *data, int size)
|
||||
{
|
||||
if (static_cast<quint32>(size) > p_photoBuffer)
|
||||
return false;
|
||||
p_photoData = QByteArray(data, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
void RagePhoto::setPhotoFormat(PhotoFormat photoFormat)
|
||||
{
|
||||
p_photoFormat = photoFormat;
|
||||
}
|
||||
|
||||
void RagePhoto::setTitle(const QString &title)
|
||||
{
|
||||
p_titleString = title;
|
||||
}
|
||||
|
||||
const QByteArray RagePhoto::jsonData(JsonFormat jsonFormat)
|
||||
{
|
||||
if (jsonFormat == JsonFormat::Compact) {
|
||||
return QJsonDocument(p_jsonObject).toJson(QJsonDocument::Compact);
|
||||
}
|
||||
else if (jsonFormat == JsonFormat::Indented) {
|
||||
return QJsonDocument(p_jsonObject).toJson(QJsonDocument::Indented);
|
||||
}
|
||||
else {
|
||||
return p_jsonData;
|
||||
}
|
||||
}
|
||||
|
||||
const QJsonObject RagePhoto::jsonObject()
|
||||
{
|
||||
return p_jsonObject;
|
||||
}
|
||||
|
||||
const QByteArray RagePhoto::photoData()
|
||||
{
|
||||
return p_photoData;
|
||||
}
|
||||
|
||||
const QString RagePhoto::description()
|
||||
{
|
||||
return p_descriptionString;
|
||||
}
|
||||
|
||||
const QString RagePhoto::photoString()
|
||||
{
|
||||
return p_photoString;
|
||||
}
|
||||
|
||||
const QString RagePhoto::title()
|
||||
{
|
||||
return p_titleString;
|
||||
}
|
||||
|
||||
quint32 RagePhoto::photoBuffer()
|
||||
{
|
||||
return p_photoBuffer;
|
||||
}
|
||||
|
||||
quint32 RagePhoto::photoSize()
|
||||
{
|
||||
return p_photoData.size();
|
||||
}
|
||||
|
||||
RagePhoto::PhotoFormat RagePhoto::photoFormat()
|
||||
{
|
||||
return p_photoFormat;
|
||||
}
|
||||
|
||||
QByteArray RagePhoto::save(PhotoFormat photoFormat)
|
||||
{
|
||||
QByteArray data;
|
||||
QBuffer dataBuffer(&data);
|
||||
dataBuffer.open(QIODevice::WriteOnly);
|
||||
save(&dataBuffer, photoFormat);
|
||||
return data;
|
||||
}
|
||||
|
||||
void RagePhoto::save(QIODevice *ioDevice, PhotoFormat photoFormat)
|
||||
{
|
||||
if (photoFormat == PhotoFormat::G5EX) {
|
||||
char uInt32Buffer[4];
|
||||
quint32 format = static_cast<quint32>(PhotoFormat::G5EX);
|
||||
uInt32ToCharLE(&format, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
format = static_cast<quint32>(ExportFormat::G5E3P);
|
||||
uInt32ToCharLE(&format, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
QByteArray compressedData = qCompress(p_photoString.toUtf8(), 9);
|
||||
quint32 compressedSize = compressedData.size();
|
||||
uInt32ToCharLE(&compressedSize, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
ioDevice->write(compressedData);
|
||||
|
||||
uInt32ToCharLE(&p_headerSum, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_photoBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
compressedData = qCompress(p_photoData, 9);
|
||||
compressedSize = compressedData.size();
|
||||
uInt32ToCharLE(&compressedSize, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
ioDevice->write(compressedData);
|
||||
|
||||
uInt32ToCharLE(&p_jsonOffset, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_jsonBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
compressedData = qCompress(p_jsonData, 9);
|
||||
compressedSize = compressedData.size();
|
||||
uInt32ToCharLE(&compressedSize, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
ioDevice->write(compressedData);
|
||||
|
||||
uInt32ToCharLE(&p_titlOffset, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_titlBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
compressedData = qCompress(p_titleString.toUtf8(), 9);
|
||||
compressedSize = compressedData.size();
|
||||
uInt32ToCharLE(&compressedSize, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
ioDevice->write(compressedData);
|
||||
|
||||
uInt32ToCharLE(&p_descOffset, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_descBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
compressedData = qCompress(p_descriptionString.toUtf8(), 9);
|
||||
compressedSize = compressedData.size();
|
||||
uInt32ToCharLE(&compressedSize, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
ioDevice->write(compressedData);
|
||||
|
||||
uInt32ToCharLE(&p_endOfFile, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
ioDevice->aboutToClose();
|
||||
#endif
|
||||
}
|
||||
else if (photoFormat == PhotoFormat::GTA5) {
|
||||
char uInt32Buffer[4];
|
||||
quint32 format = static_cast<quint32>(PhotoFormat::GTA5);
|
||||
uInt32ToCharLE(&format, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
QByteArray photoHeader = stringToUtf16LE(p_photoString);
|
||||
if (photoHeader.left(2) == "\xFF\xFE") {
|
||||
photoHeader.remove(0, 2);
|
||||
}
|
||||
qint64 photoHeaderSize = photoHeader.size();
|
||||
if (photoHeaderSize > 256) {
|
||||
photoHeader = photoHeader.left(256);
|
||||
photoHeaderSize = 256;
|
||||
}
|
||||
ioDevice->write(photoHeader);
|
||||
for (qint64 size = photoHeaderSize; size < 256; size++) {
|
||||
ioDevice->write("\x00", 1);
|
||||
}
|
||||
|
||||
uInt32ToCharLE(&p_headerSum, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_endOfFile, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_jsonOffset, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_titlOffset, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
uInt32ToCharLE(&p_descOffset, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
ioDevice->write("JPEG", 4);
|
||||
|
||||
uInt32ToCharLE(&p_photoBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
quint32 t_photoSize = p_photoData.size();
|
||||
uInt32ToCharLE(&t_photoSize, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
ioDevice->write(p_photoData);
|
||||
for (qint64 size = t_photoSize; size < p_photoBuffer; size++) {
|
||||
ioDevice->write("\x00", 1);
|
||||
}
|
||||
|
||||
ioDevice->seek(p_jsonOffset + 264);
|
||||
ioDevice->write("JSON", 4);
|
||||
|
||||
uInt32ToCharLE(&p_jsonBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
qint64 dataSize = p_jsonData.size();
|
||||
ioDevice->write(p_jsonData);
|
||||
for (qint64 size = dataSize; size < p_jsonBuffer; size++) {
|
||||
ioDevice->write("\x00", 1);
|
||||
}
|
||||
|
||||
ioDevice->seek(p_titlOffset + 264);
|
||||
ioDevice->write("TITL", 4);
|
||||
|
||||
uInt32ToCharLE(&p_titlBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
QByteArray data = p_titleString.toUtf8();
|
||||
dataSize = data.size();
|
||||
ioDevice->write(data);
|
||||
for (qint64 size = dataSize; size < p_titlBuffer; size++) {
|
||||
ioDevice->write("\x00", 1);
|
||||
}
|
||||
|
||||
ioDevice->seek(p_descOffset + 264);
|
||||
ioDevice->write("DESC", 4);
|
||||
|
||||
uInt32ToCharLE(&p_descBuffer, uInt32Buffer);
|
||||
ioDevice->write(uInt32Buffer, 4);
|
||||
|
||||
data = p_descriptionString.toUtf8();
|
||||
dataSize = data.size();
|
||||
ioDevice->write(data);
|
||||
for (qint64 size = dataSize; size < p_descBuffer; size++) {
|
||||
ioDevice->write("\x00", 1);
|
||||
}
|
||||
|
||||
ioDevice->seek(p_endOfFile + 260);
|
||||
ioDevice->write("JEND", 4);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
ioDevice->aboutToClose();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
RagePhoto* RagePhoto::loadFile(const QString &filePath)
|
||||
{
|
||||
RagePhoto *ragePhoto = new RagePhoto(filePath);
|
||||
ragePhoto->load();
|
||||
return ragePhoto;
|
||||
}
|
||||
|
||||
quint32 RagePhoto::charToUInt32BE(char *x)
|
||||
{
|
||||
return (static_cast<unsigned char>(x[0]) << 24 |
|
||||
static_cast<unsigned char>(x[1]) << 16 |
|
||||
static_cast<unsigned char>(x[2]) << 8 |
|
||||
static_cast<unsigned char>(x[3]));
|
||||
}
|
||||
|
||||
quint32 RagePhoto::charToUInt32LE(char *x)
|
||||
{
|
||||
return (static_cast<unsigned char>(x[3]) << 24 |
|
||||
static_cast<unsigned char>(x[2]) << 16 |
|
||||
static_cast<unsigned char>(x[1]) << 8 |
|
||||
static_cast<unsigned char>(x[0]));
|
||||
}
|
||||
|
||||
void RagePhoto::uInt32ToCharBE(quint32 *x, char *y)
|
||||
{
|
||||
y[0] = (*x >> 24) & 0xFF;
|
||||
y[1] = (*x >> 16) & 0xFF;
|
||||
y[2] = (*x >> 8) & 0xFF;
|
||||
y[3] = (*x) & 0xFF;
|
||||
}
|
||||
|
||||
void RagePhoto::uInt32ToCharLE(quint32 *x, char *y)
|
||||
{
|
||||
y[0] = (*x) & 0xFF;
|
||||
y[1] = (*x >> 8) & 0xFF;
|
||||
y[2] = (*x >> 16) & 0xFF;
|
||||
y[3] = (*x >> 24) & 0xFF;
|
||||
}
|
||||
|
||||
QByteArray RagePhoto::stringToUtf16LE(const QString &string)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QStringEncoder stringEncoder = QStringEncoder(QStringEncoder::Utf16LE);
|
||||
return stringEncoder(string);
|
||||
#else
|
||||
return QTextCodec::codecForName("UTF-16LE")->fromUnicode(string);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString RagePhoto::utf16LEToString(const QByteArray &data)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QStringDecoder stringDecoder = QStringDecoder(QStringDecoder::Utf16LE);
|
||||
return stringDecoder(data);
|
||||
#else
|
||||
return QTextCodec::codecForName("UTF-16LE")->toUnicode(data);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString RagePhoto::utf16LEToString(const char *data, int size)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QStringDecoder stringDecoder = QStringDecoder(QStringDecoder::Utf16LE);
|
||||
return stringDecoder(QByteArray::fromRawData(data, size));
|
||||
#else
|
||||
return QTextCodec::codecForName("UTF-16LE")->toUnicode(data, size);
|
||||
#endif
|
||||
}
|
110
RagePhoto.h
|
@ -1,110 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 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
|
||||
* 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 RAGEPHOTO_H
|
||||
#define RAGEPHOTO_H
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QIODevice>
|
||||
#include <QObject>
|
||||
|
||||
class RagePhoto : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum class JsonFormat : quint8 {
|
||||
Original = 0,
|
||||
Compact = 1,
|
||||
Indented = 2,
|
||||
};
|
||||
enum class ExportFormat : quint32 {
|
||||
G5E1P = 0x454C0010U,
|
||||
G5E2P = 0x01000032U,
|
||||
G5E2S = 0x02000032U,
|
||||
G5E3P = 0x01000033U,
|
||||
G5E3S = 0x02000033U,
|
||||
Undefined = 0,
|
||||
};
|
||||
enum class PhotoFormat : quint32 {
|
||||
G5EX = 0x45354700U,
|
||||
GTA5 = 0x01000000U,
|
||||
RDR2 = 0x04000000U,
|
||||
Undefined = 0,
|
||||
};
|
||||
explicit RagePhoto();
|
||||
explicit RagePhoto(const QByteArray &data);
|
||||
explicit RagePhoto(const QString &filePath);
|
||||
explicit RagePhoto(QIODevice *ioDevice);
|
||||
bool isLoaded();
|
||||
bool load();
|
||||
void clear();
|
||||
void setDescription(const QString &description);
|
||||
void setFileData(const QByteArray &data);
|
||||
void setFilePath(const QString &filePath);
|
||||
void setIODevice(QIODevice *ioDevice);
|
||||
bool setJsonData(const QByteArray &data);
|
||||
bool setPhotoBuffer(quint32 size, bool moveOffsets = true);
|
||||
bool setPhotoData(const QByteArray &data);
|
||||
bool setPhotoData(const char *data, int size);
|
||||
void setPhotoFormat(PhotoFormat photoFormat);
|
||||
void setTitle(const QString &title);
|
||||
const QJsonObject jsonObject();
|
||||
const QByteArray jsonData(JsonFormat jsonFormat = JsonFormat::Original);
|
||||
const QByteArray photoData();
|
||||
const QString description();
|
||||
const QString photoString();
|
||||
const QString title();
|
||||
quint32 photoBuffer();
|
||||
quint32 photoSize();
|
||||
PhotoFormat photoFormat();
|
||||
QByteArray save(PhotoFormat photoFormat);
|
||||
void save(QIODevice *ioDevice, PhotoFormat photoFormat);
|
||||
static RagePhoto* loadFile(const QString &filePath);
|
||||
|
||||
private:
|
||||
inline quint32 charToUInt32BE(char *x);
|
||||
inline quint32 charToUInt32LE(char *x);
|
||||
inline void uInt32ToCharBE(quint32 *x, char *y);
|
||||
inline void uInt32ToCharLE(quint32 *x, char *y);
|
||||
inline QByteArray stringToUtf16LE(const QString &string);
|
||||
inline QString utf16LEToString(const QByteArray &data);
|
||||
inline QString utf16LEToString(const char *data, int size);
|
||||
PhotoFormat p_photoFormat;
|
||||
QJsonObject p_jsonObject;
|
||||
QByteArray p_fileData;
|
||||
QByteArray p_jsonData;
|
||||
QByteArray p_photoData;
|
||||
QIODevice *p_ioDevice;
|
||||
QString p_descriptionString;
|
||||
QString p_filePath;
|
||||
QString p_photoString;
|
||||
QString p_titleString;
|
||||
quint32 p_descBuffer;
|
||||
quint32 p_descOffset;
|
||||
quint32 p_endOfFile;
|
||||
quint32 p_headerSum;
|
||||
quint32 p_jsonBuffer;
|
||||
quint32 p_jsonOffset;
|
||||
quint32 p_photoBuffer;
|
||||
quint32 p_titlBuffer;
|
||||
quint32 p_titlOffset;
|
||||
bool p_isLoaded;
|
||||
int p_inputMode;
|
||||
};
|
||||
|
||||
#endif // RAGEPHOTO_H
|
|
@ -20,6 +20,7 @@
|
|||
#include "StringParser.h"
|
||||
#include "SavegameData.h"
|
||||
#include <QStringBuilder>
|
||||
#include <QTextCodec>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>112</height>
|
||||
<height>105</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -20,7 +20,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="labSavegameText">
|
||||
<property name="text">
|
||||
<string><span style="font-weight:600">Savegame</span><br><br>%1</string>
|
||||
<string><span style=" font-weight:600;">Savegame</span><br><br>%1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
|
|
|
@ -217,8 +217,7 @@ void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
|||
}
|
||||
else
|
||||
{
|
||||
const int contentMode = getContentMode();
|
||||
if ((contentMode == 0 || contentMode == 10 || contentMode == 20) && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||
{
|
||||
if (ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||
{
|
||||
|
@ -229,7 +228,7 @@ void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
|||
on_cmdView_clicked();
|
||||
}
|
||||
}
|
||||
else if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||
else if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||
{
|
||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||
}
|
||||
|
@ -240,8 +239,7 @@ void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
|||
{
|
||||
ProfileWidget::mouseDoubleClickEvent(ev);
|
||||
|
||||
const int contentMode = getContentMode();
|
||||
if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton)
|
||||
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
||||
{
|
||||
on_cmdView_clicked();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "StringParser.h"
|
||||
#include "AppEnv.h"
|
||||
#include "config.h"
|
||||
#include <QStringListIterator>
|
||||
#include <QStringBuilder>
|
||||
#include <QTextDocument>
|
||||
#include <QInputDialog>
|
||||
|
@ -437,7 +438,7 @@ void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
|
|||
}
|
||||
if (crewList.contains(QString::number(crewID)))
|
||||
{
|
||||
indexNum = crewList.indexOf(QString::number(crewID));
|
||||
indexNum = crewList.indexOf(QRegExp(QString::number(crewID)));
|
||||
}
|
||||
QString newCrew = QInputDialog::getItem(this, tr("Snapmatic Crew"), tr("New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags());
|
||||
if (ok && !newCrew.isEmpty())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5spv Grand Theft Auto Snapmatic Picture Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-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
|
||||
|
@ -19,7 +19,6 @@
|
|||
#ifndef SNAPMATICPICTURE_H
|
||||
#define SNAPMATICPICTURE_H
|
||||
|
||||
#include "RagePhoto.h"
|
||||
#include <QStringList>
|
||||
#include <QDateTime>
|
||||
#include <QObject>
|
||||
|
@ -58,15 +57,17 @@ public:
|
|||
~SnapmaticPicture();
|
||||
void reset();
|
||||
bool preloadFile();
|
||||
bool readingPictureFromFile(const QString &fileName, bool cacheEnabled = false);
|
||||
bool readingPicture(bool cacheEnabled = false);
|
||||
bool readingPictureFromFile(const QString &fileName, bool writeEnabled = true, bool cacheEnabled = false, bool fastLoad = true, bool lowRamMode = false);
|
||||
bool readingPicture(bool writeEnabled = true, bool cacheEnabled = false, bool fastLoad = true, bool lowRamMode = false);
|
||||
bool isPicOk(); // Please use isPictureOk instead
|
||||
void clearCache();
|
||||
QImage getImage();
|
||||
QImage getImage(bool fastLoad = false);
|
||||
QByteArray getPictureStream();
|
||||
QString getLastStep(bool readable = true);
|
||||
QString getPictureStr();
|
||||
QString getPictureHead();
|
||||
QString getPictureTitl();
|
||||
QString getPictureDesc();
|
||||
QString getPictureSortStr();
|
||||
QString getPictureFileName();
|
||||
QString getPictureFilePath();
|
||||
|
@ -74,7 +75,7 @@ public:
|
|||
QString getOriginalPictureFileName();
|
||||
QString getOriginalPictureFilePath();
|
||||
int getContentMaxLength();
|
||||
bool setImage(const QImage &picture, bool eXtendMode = false);
|
||||
bool setImage(const QImage &picture);
|
||||
bool setPictureTitl(const QString &newTitle); // Please use setPictureTitle instead
|
||||
bool setPictureStream(const QByteArray &streamArray);
|
||||
void updateStrings();
|
||||
|
@ -105,6 +106,7 @@ public:
|
|||
QString getPictureJson() { return getJsonStr(); }
|
||||
QString getPictureTitle() { return getPictureTitl(); }
|
||||
QString getPictureString() { return getPictureStr(); }
|
||||
QString getPictureDescription() { return getPictureDesc(); }
|
||||
bool setJsonString(const QString &jsonString, bool updateProperties = false) { return setJsonStr(jsonString, updateProperties); } // Please use setPictureJson instead
|
||||
bool setPictureJson(const QString &json, bool updateProperties = false) { return setJsonStr(json, updateProperties); }
|
||||
bool setPictureTitle(const QString &title) { return setPictureTitl(title); }
|
||||
|
@ -118,7 +120,11 @@ public:
|
|||
bool setVisible() { return setPictureVisible(); } // Please use setPictureVisible instead
|
||||
|
||||
// PREDEFINED PROPERTIES
|
||||
static QSize getSnapmaticResolution();
|
||||
QSize getSnapmaticResolution();
|
||||
|
||||
// SNAPMATIC DEFAULTS
|
||||
bool isSnapmaticDefaultsEnforced();
|
||||
void setSnapmaticDefaultsEnforced(bool enforced);
|
||||
|
||||
// SNAPMATIC FORMAT
|
||||
SnapmaticFormat getSnapmaticFormat();
|
||||
|
@ -133,32 +139,44 @@ public:
|
|||
static QString convertDrawStringForLog(const QString &inputStr);
|
||||
static QString convertLogStringForDraw(const QString &inputStr);
|
||||
|
||||
// RAGEPHOTO
|
||||
RagePhoto* ragePhoto();
|
||||
|
||||
private:
|
||||
QString getSnapmaticHeaderString(const QByteArray &snapmaticHeader);
|
||||
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
||||
QString getSnapmaticTIDEString(const QByteArray &tideBytes);
|
||||
QImage cachePicture;
|
||||
QString picExportFileName;
|
||||
QString picFileName;
|
||||
QString picFilePath;
|
||||
QString pictureHead;
|
||||
QString pictureStr;
|
||||
QString lastStep;
|
||||
QString sortStr;
|
||||
QString titlStr;
|
||||
QString descStr;
|
||||
bool picOk;
|
||||
bool lowRamMode;
|
||||
bool writeEnabled;
|
||||
bool cacheEnabled;
|
||||
bool isLoadedInRAM;
|
||||
bool isCustomFormat;
|
||||
bool isFormatSwitch;
|
||||
bool isModernFormat;
|
||||
bool careSnapDefault;
|
||||
int jpegRawContentSize;
|
||||
int jpegRawContentSizeE;
|
||||
|
||||
// PICTURE STREAM
|
||||
QByteArray rawPicContent;
|
||||
|
||||
// JSON
|
||||
void parseJsonContent();
|
||||
bool jsonOk;
|
||||
QString jsonStr;
|
||||
SnapmaticProperties localProperties;
|
||||
|
||||
// VERIFY CONTENT
|
||||
static bool verifyTitleChar(const QChar &titleChar);
|
||||
|
||||
// RAGEPHOTO
|
||||
RagePhoto p_ragePhoto;
|
||||
|
||||
signals:
|
||||
void customSignal(QString signal);
|
||||
void preloaded();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-2019 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,6 +18,7 @@
|
|||
|
||||
#include "SnapmaticWidget.h"
|
||||
#include "ui_SnapmaticWidget.h"
|
||||
#include "ImageEditorDialog.h"
|
||||
#include "MapLocationDialog.h"
|
||||
#include "JsonEditorDialog.h"
|
||||
#include "SnapmaticPicture.h"
|
||||
|
@ -31,9 +32,9 @@
|
|||
#include "config.h"
|
||||
#include <QStringBuilder>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
#include <QFile>
|
||||
|
||||
|
@ -76,32 +77,19 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
|
|||
QObject::connect(picture, SIGNAL(updated()), this, SLOT(snapmaticUpdated()));
|
||||
QObject::connect(picture, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
||||
|
||||
const qreal screenRatio = AppEnv::screenRatio();
|
||||
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
const QSize renderResolution(48 * screenRatio * screenRatioPR, 27 * screenRatio * screenRatioPR);
|
||||
qreal screenRatio = AppEnv::screenRatio();
|
||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||
ui->labPicture->setFixedSize(48 * screenRatio, 27 * screenRatio);
|
||||
|
||||
ui->labPicture->setScaledContents(true);
|
||||
|
||||
QPixmap renderPixmap(renderResolution);
|
||||
renderPixmap.fill(Qt::transparent);
|
||||
QPainter renderPainter(&renderPixmap);
|
||||
const QImage renderImage = picture->getImage().scaled(renderResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
if (renderImage.width() < renderResolution.width()) {
|
||||
renderPainter.drawImage((renderResolution.width() - renderImage.width()) / 2, 0, renderImage, Qt::AutoColor);
|
||||
}
|
||||
else if (renderImage.height() < renderResolution.height()) {
|
||||
renderPainter.drawImage(0, (renderResolution.height() - renderImage.height()) / 2, renderImage, Qt::AutoColor);
|
||||
}
|
||||
else {
|
||||
renderPainter.drawImage(0, 0, renderImage, Qt::AutoColor);
|
||||
}
|
||||
renderPainter.end();
|
||||
QPixmap SnapmaticPixmap = QPixmap::fromImage(picture->getImage().scaled(ui->labPicture->width() * screenRatioPR, ui->labPicture->height() * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
||||
#if QT_VERSION >= 0x050600
|
||||
renderPixmap.setDevicePixelRatio(screenRatioPR);
|
||||
SnapmaticPixmap.setDevicePixelRatio(screenRatioPR);
|
||||
#endif
|
||||
|
||||
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
|
||||
ui->labPicture->setPixmap(renderPixmap);
|
||||
ui->labPicture->setPixmap(SnapmaticPixmap);
|
||||
|
||||
picture->clearCache();
|
||||
|
||||
|
@ -229,8 +217,7 @@ void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
|
|||
}
|
||||
else
|
||||
{
|
||||
const int contentMode = getContentMode();
|
||||
if ((contentMode == 0 || contentMode == 10 || contentMode == 20) && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||
{
|
||||
if (ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||
{
|
||||
|
@ -241,7 +228,7 @@ void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
|
|||
on_cmdView_clicked();
|
||||
}
|
||||
}
|
||||
else if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||
else if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||
{
|
||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||
}
|
||||
|
@ -252,8 +239,7 @@ void SnapmaticWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
|||
{
|
||||
ProfileWidget::mouseDoubleClickEvent(ev);
|
||||
|
||||
const int contentMode = getContentMode();
|
||||
if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton)
|
||||
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
||||
{
|
||||
on_cmdView_clicked();
|
||||
}
|
||||
|
|
|
@ -48,9 +48,7 @@ QString StandardPaths::cacheLocation()
|
|||
|
||||
QString StandardPaths::dataLocation()
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
|
||||
#elif QT_VERSION >= 0x050000
|
||||
#if QT_VERSION >= 0x050000
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#else
|
||||
return QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "StringParser.h"
|
||||
#include <QTextDocument>
|
||||
#include <QLibraryInfo>
|
||||
#include <QTextCodec>
|
||||
#include <QByteArray>
|
||||
#include <QFileInfo>
|
||||
#include <QString>
|
||||
|
@ -48,16 +49,12 @@ QString StringParser::escapeString(const QString &toEscape)
|
|||
QString StringParser::convertBuildedString(const QString &buildedStr)
|
||||
{
|
||||
QString outputStr = buildedStr;
|
||||
outputStr.replace("APPNAME:", QString::fromUtf8(GTA5SYNC_APPSTR));
|
||||
outputStr.replace("SHAREDDIR:", QString::fromUtf8(GTA5SYNC_SHARE));
|
||||
outputStr.replace("RUNDIR:", QFileInfo(QApplication::applicationFilePath()).canonicalPath());
|
||||
#if QT_VERSION >= 0x060000
|
||||
outputStr.replace("QCONFLANG:", QLibraryInfo::path(QLibraryInfo::TranslationsPath));
|
||||
outputStr.replace("QCONFPLUG:", QLibraryInfo::path(QLibraryInfo::PluginsPath));
|
||||
#else
|
||||
QByteArray sharePath = GTA5SYNC_SHARE;
|
||||
outputStr.replace("APPNAME:", GTA5SYNC_APPSTR);
|
||||
outputStr.replace("SHAREDDIR:", QString::fromUtf8(sharePath));
|
||||
outputStr.replace("RUNDIR:", QFileInfo(qApp->applicationFilePath()).absoluteDir().absolutePath());
|
||||
outputStr.replace("QCONFLANG:", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
outputStr.replace("QCONFPLUG:", QLibraryInfo::location(QLibraryInfo::PluginsPath));
|
||||
#endif
|
||||
outputStr.replace("SEPARATOR:", QDir::separator());
|
||||
return outputStr;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#define GTA5SYNC_TELEMETRY_WEBURL ""
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#include "windows.h"
|
||||
#include "intrin.h"
|
||||
#include "d3d9.h"
|
||||
|
@ -228,7 +228,7 @@ QJsonDocument TelemetryClass::getSystemHardware()
|
|||
{
|
||||
QJsonDocument jsonDocument;
|
||||
QJsonObject jsonObject;
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
{
|
||||
int CPUInfo[4] = {-1};
|
||||
unsigned nExIds, ic = 0;
|
||||
|
|
|
@ -63,11 +63,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
|||
{
|
||||
app->installTranslator(&inQtTranslator);
|
||||
}
|
||||
#if QT_VERSION >= 0x060000
|
||||
QLocale::setDefault(QLocale(currentLanguage));
|
||||
#else
|
||||
QLocale::setDefault(currentLanguage);
|
||||
#endif
|
||||
isLangLoaded = true;
|
||||
return;
|
||||
}
|
||||
|
@ -151,11 +147,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
|||
{
|
||||
app->installTranslator(&inQtTranslator);
|
||||
}
|
||||
#if QT_VERSION >= 0x060000
|
||||
QLocale::setDefault(QLocale(currentLanguage));
|
||||
#else
|
||||
QLocale::setDefault(currentLanguage);
|
||||
#endif
|
||||
isLangLoaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -184,11 +176,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
|||
{
|
||||
app->installTranslator(&inQtTranslator);
|
||||
}
|
||||
#if QT_VERSION >= 0x060000
|
||||
QLocale::setDefault(QLocale(currentLanguage));
|
||||
#else
|
||||
QLocale::setDefault(currentLanguage);
|
||||
#endif
|
||||
isLangLoaded = true;
|
||||
}
|
||||
else
|
||||
|
@ -207,11 +195,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
|||
{
|
||||
app->installTranslator(&inQtTranslator);
|
||||
}
|
||||
#if QT_VERSION >= 0x060000
|
||||
QLocale::setDefault(QLocale(currentLanguage));
|
||||
#else
|
||||
QLocale::setDefault(currentLanguage);
|
||||
#endif
|
||||
isLangLoaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -235,11 +219,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
|||
{
|
||||
app->installTranslator(&inQtTranslator);
|
||||
}
|
||||
#if QT_VERSION >= 0x060000
|
||||
QLocale::setDefault(QLocale(currentLanguage));
|
||||
#else
|
||||
QLocale::setDefault(currentLanguage);
|
||||
#endif
|
||||
isLangLoaded = true;
|
||||
}
|
||||
else if (!trLoadSuccess)
|
||||
|
@ -256,11 +236,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
|||
{
|
||||
app->installTranslator(&inQtTranslator);
|
||||
}
|
||||
#if QT_VERSION >= 0x060000
|
||||
QLocale::setDefault(QLocale(currentLanguage));
|
||||
#else
|
||||
QLocale::setDefault(currentLanguage);
|
||||
#endif
|
||||
isLangLoaded = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,21 +40,14 @@
|
|||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <QFileInfo>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, MessageThread *threadMessage, QWidget *parent) :
|
||||
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), threadMessage(threadMessage),
|
||||
ui(new Ui::UserInterface)
|
||||
#else
|
||||
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
|
||||
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
|
||||
ui(new Ui::UserInterface)
|
||||
#endif
|
||||
{
|
||||
ui->setupUi(this);
|
||||
contentMode = 0;
|
||||
|
@ -67,7 +60,7 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
|||
ui->cmdClose->setToolTip(ui->cmdClose->toolTip().arg(GTA5SYNC_APPSTR));
|
||||
defaultWindowTitle = tr("%2 - %1").arg("%1", GTA5SYNC_APPSTR);
|
||||
|
||||
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||
QString appVersion = GTA5SYNC_APPVER;
|
||||
#ifndef GTA5SYNC_BUILDTYPE_REL
|
||||
#ifdef GTA5SYNC_COMMIT
|
||||
|
@ -179,32 +172,33 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
|||
ui->vlUserInterface->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
|
||||
}
|
||||
|
||||
void UserInterface::setupDirEnv(bool showFolderDialog)
|
||||
void UserInterface::setupDirEnv()
|
||||
{
|
||||
// settings init
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
|
||||
bool folderExists;
|
||||
GTAV_Folder = AppEnv::getGameFolder(&folderExists);
|
||||
if (folderExists) {
|
||||
if (folderExists)
|
||||
{
|
||||
QDir::setCurrent(GTAV_Folder);
|
||||
}
|
||||
else {
|
||||
if (showFolderDialog) {
|
||||
GTAV_Folder = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||
if (QFileInfo(GTAV_Folder).exists()) {
|
||||
folderExists = true;
|
||||
QDir::setCurrent(GTAV_Folder);
|
||||
AppEnv::setGameFolder(GTAV_Folder);
|
||||
else
|
||||
{
|
||||
GTAV_Folder = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||
if (QFileInfo(GTAV_Folder).exists())
|
||||
{
|
||||
folderExists = true;
|
||||
QDir::setCurrent(GTAV_Folder);
|
||||
AppEnv::setGameFolder(GTAV_Folder);
|
||||
|
||||
// First time folder selection save
|
||||
settings.beginGroup("dir");
|
||||
if (settings.value("dir", "").toString().isEmpty())
|
||||
{
|
||||
settings.setValue("dir", GTAV_Folder);
|
||||
}
|
||||
settings.endGroup();
|
||||
// First time folder selection save
|
||||
settings.beginGroup("dir");
|
||||
if (settings.value("dir", "").toString().isEmpty())
|
||||
{
|
||||
settings.setValue("dir", GTAV_Folder);
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,15 +206,15 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
|
|||
settings.beginGroup("Profile");
|
||||
QString defaultProfile = settings.value("Default", "").toString();
|
||||
|
||||
contentMode = settings.value("ContentMode", 0).toInt();
|
||||
if (contentMode == 1) {
|
||||
contentMode = 21;
|
||||
}
|
||||
else if (contentMode != 10 && contentMode != 11 && contentMode != 20 && contentMode != 21) {
|
||||
contentMode = 20;
|
||||
bool contentModeOk;
|
||||
contentMode = settings.value("ContentMode", 0).toInt(&contentModeOk);
|
||||
if (contentMode != 0 && contentMode != 1 && contentMode != 2)
|
||||
{
|
||||
contentMode = 0;
|
||||
}
|
||||
|
||||
if (folderExists) {
|
||||
if (folderExists)
|
||||
{
|
||||
QDir GTAV_ProfilesDir;
|
||||
GTAV_ProfilesFolder = GTAV_Folder % "/Profiles";
|
||||
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
|
||||
|
@ -228,14 +222,17 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
|
|||
GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
||||
setupProfileUi();
|
||||
|
||||
if (GTAV_Profiles.length() == 1) {
|
||||
if (GTAV_Profiles.length() == 1)
|
||||
{
|
||||
openProfile(GTAV_Profiles.at(0));
|
||||
}
|
||||
else if(GTAV_Profiles.contains(defaultProfile)) {
|
||||
else if(GTAV_Profiles.contains(defaultProfile))
|
||||
{
|
||||
openProfile(defaultProfile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
GTAV_Profiles = QStringList();
|
||||
setupProfileUi();
|
||||
}
|
||||
|
@ -304,7 +301,7 @@ void UserInterface::openProfile(const QString &profileName_)
|
|||
profileUI->setupProfileInterface();
|
||||
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));
|
||||
QObject::connect(profileUI, SIGNAL(profileLoaded()), this, SLOT(profileLoaded()));
|
||||
setWindowTitle(defaultWindowTitle.arg(profileName));
|
||||
this->setWindowTitle(defaultWindowTitle.arg(profileName));
|
||||
}
|
||||
|
||||
void UserInterface::closeProfile()
|
||||
|
@ -313,7 +310,7 @@ void UserInterface::closeProfile()
|
|||
{
|
||||
closeProfile_p();
|
||||
}
|
||||
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||
}
|
||||
|
||||
void UserInterface::closeProfile_p()
|
||||
|
@ -331,11 +328,7 @@ void UserInterface::closeProfile_p()
|
|||
void UserInterface::closeEvent(QCloseEvent *ev)
|
||||
{
|
||||
Q_UNUSED(ev)
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
threadMessage->terminateThread();
|
||||
#else
|
||||
threadDB->terminateThread();
|
||||
#endif
|
||||
}
|
||||
|
||||
UserInterface::~UserInterface()
|
||||
|
@ -354,7 +347,7 @@ UserInterface::~UserInterface()
|
|||
|
||||
void UserInterface::on_actionExit_triggered()
|
||||
{
|
||||
close();
|
||||
this->close();
|
||||
}
|
||||
|
||||
void UserInterface::on_actionSelect_profile_triggered()
|
||||
|
@ -566,8 +559,7 @@ void UserInterface::openSnapmaticFile(SnapmaticPicture *picture)
|
|||
picDialog.setModal(true);
|
||||
|
||||
int crewID = picture->getSnapmaticProperties().crewID;
|
||||
if (crewID != 0)
|
||||
crewDB->addCrew(crewID);
|
||||
if (crewID != 0) { crewDB->addCrew(crewID); }
|
||||
|
||||
QObject::connect(threadDB, SIGNAL(crewNameUpdated()), &picDialog, SLOT(crewNameUpdated()));
|
||||
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), &picDialog, SLOT(playerNameUpdated()));
|
||||
|
@ -611,119 +603,6 @@ void UserInterface::settingsApplied(int _contentMode, bool languageChanged)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
void UserInterface::messagesArrived(const QJsonObject &object)
|
||||
{
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
settings.beginGroup("Messages");
|
||||
QJsonObject::const_iterator it = object.constBegin();
|
||||
QJsonObject::const_iterator end = object.constEnd();
|
||||
QStringList messages;
|
||||
while (it != end) {
|
||||
const QString key = it.key();
|
||||
const QJsonValue value = it.value();
|
||||
bool uintOk;
|
||||
uint messageId = key.toUInt(&uintOk);
|
||||
if (uintOk && value.isString()) {
|
||||
const QString valueStr = value.toString();
|
||||
settings.setValue(QString::number(messageId), valueStr);
|
||||
messages << valueStr;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
settings.endGroup();
|
||||
if (!messages.isEmpty())
|
||||
showMessages(messages);
|
||||
}
|
||||
|
||||
void UserInterface::showMessages(const QStringList messages)
|
||||
{
|
||||
QDialog *messageDialog = new QDialog(this);
|
||||
messageDialog->setWindowTitle(tr("%1 - Messages").arg(GTA5SYNC_APPSTR));
|
||||
messageDialog->setWindowFlags(messageDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
QVBoxLayout *messageLayout = new QVBoxLayout;
|
||||
messageDialog->setLayout(messageLayout);
|
||||
QStackedWidget *stackWidget = new QStackedWidget(messageDialog);
|
||||
for (const QString message : messages) {
|
||||
QLabel *messageLabel = new QLabel(messageDialog);
|
||||
messageLabel->setText(message);
|
||||
messageLabel->setWordWrap(true);
|
||||
stackWidget->addWidget(messageLabel);
|
||||
}
|
||||
messageLayout->addWidget(stackWidget);
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
QPushButton *backButton = new QPushButton(messageDialog);
|
||||
QPushButton *nextButton = new QPushButton(messageDialog);
|
||||
if (QIcon::hasThemeIcon("go-previous") && QIcon::hasThemeIcon("go-next") && QIcon::hasThemeIcon("list-add")) {
|
||||
backButton->setIcon(QIcon::fromTheme("go-previous"));
|
||||
nextButton->setIcon(QIcon::fromTheme("go-next"));
|
||||
}
|
||||
else {
|
||||
backButton->setIcon(QIcon(":/img/back.svgz"));
|
||||
nextButton->setIcon(QIcon(":/img/next.svgz"));
|
||||
}
|
||||
backButton->setEnabled(false);
|
||||
if (stackWidget->count() <= 1) {
|
||||
nextButton->setEnabled(false);
|
||||
}
|
||||
buttonLayout->addWidget(backButton);
|
||||
buttonLayout->addWidget(nextButton);
|
||||
buttonLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
QPushButton *closeButton = new QPushButton(messageDialog);
|
||||
closeButton->setText(tr("&Close"));
|
||||
if (QIcon::hasThemeIcon("dialog-close")) {
|
||||
closeButton->setIcon(QIcon::fromTheme("dialog-close"));
|
||||
}
|
||||
else if (QIcon::hasThemeIcon("gtk-close")) {
|
||||
closeButton->setIcon(QIcon::fromTheme("gtk-close"));
|
||||
}
|
||||
buttonLayout->addWidget(closeButton);
|
||||
messageLayout->addLayout(buttonLayout);
|
||||
QObject::connect(backButton, &QPushButton::clicked, [stackWidget,backButton,nextButton,closeButton]() {
|
||||
int index = stackWidget->currentIndex();
|
||||
if (index > 0) {
|
||||
index--;
|
||||
stackWidget->setCurrentIndex(index);
|
||||
nextButton->setEnabled(true);
|
||||
if (index > 0) {
|
||||
backButton->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
backButton->setEnabled(false);
|
||||
closeButton->setFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
QObject::connect(nextButton, &QPushButton::clicked, [stackWidget,backButton,nextButton,closeButton]() {
|
||||
int index = stackWidget->currentIndex();
|
||||
if (index < stackWidget->count()-1) {
|
||||
index++;
|
||||
stackWidget->setCurrentIndex(index);
|
||||
backButton->setEnabled(true);
|
||||
if (index < stackWidget->count()-1) {
|
||||
nextButton->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
nextButton->setEnabled(false);
|
||||
closeButton->setFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
QObject::connect(closeButton, &QPushButton::clicked, messageDialog, &QDialog::accept);
|
||||
QObject::connect(messageDialog, &QDialog::finished, messageDialog, &QDialog::deleteLater);
|
||||
QTimer::singleShot(0, closeButton, SLOT(setFocus()));
|
||||
messageDialog->show();
|
||||
}
|
||||
|
||||
void UserInterface::updateCacheId(uint cacheId)
|
||||
{
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
settings.beginGroup("Messages");
|
||||
settings.setValue("CacheId", cacheId);
|
||||
settings.endGroup();
|
||||
}
|
||||
#endif
|
||||
|
||||
void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
||||
{
|
||||
QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||
|
@ -769,11 +648,11 @@ void UserInterface::retranslateUi()
|
|||
ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, appVersion));
|
||||
if (profileOpen)
|
||||
{
|
||||
setWindowTitle(defaultWindowTitle.arg(profileName));
|
||||
this->setWindowTitle(defaultWindowTitle.arg(profileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
#include "MessageThread.h"
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class UserInterface;
|
||||
}
|
||||
|
@ -43,12 +39,8 @@ class UserInterface : public QMainWindow
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, MessageThread *messageThread, QWidget *parent = 0);
|
||||
#else
|
||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||
#endif
|
||||
void setupDirEnv(bool showFolderDialog = true);
|
||||
void setupDirEnv();
|
||||
~UserInterface();
|
||||
|
||||
private slots:
|
||||
|
@ -75,11 +67,6 @@ private slots:
|
|||
void on_actionSet_Crew_triggered();
|
||||
void on_actionSet_Title_triggered();
|
||||
void settingsApplied(int contentMode, bool languageChanged);
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
void messagesArrived(const QJsonObject &object);
|
||||
void showMessages(const QStringList messages);
|
||||
void updateCacheId(uint cacheId);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *ev);
|
||||
|
@ -88,9 +75,6 @@ private:
|
|||
ProfileDatabase *profileDB;
|
||||
CrewDatabase *crewDB;
|
||||
DatabaseThread *threadDB;
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
MessageThread *threadMessage;
|
||||
#endif
|
||||
Ui::UserInterface *ui;
|
||||
ProfileInterface *profileUI;
|
||||
QList<QPushButton*> profileBtns;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* 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
|
||||
|
@ -18,9 +17,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "imagecropper.h"
|
||||
#include "AppEnv.h"
|
||||
|
||||
#include <QPainterPath>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
|
@ -115,16 +112,16 @@ const QPixmap ImageCropper::cropImage()
|
|||
// Получим размер отображаемого изображения
|
||||
QSize scaledImageSize =
|
||||
pimpl->imageForCropping.scaled(
|
||||
size(), Qt::KeepAspectRatio, Qt::SmoothTransformation
|
||||
this->size(), Qt::KeepAspectRatio, Qt::FastTransformation
|
||||
).size();
|
||||
// Определим расстояние от левого и верхнего краёв
|
||||
float leftDelta = 0;
|
||||
float topDelta = 0;
|
||||
const float HALF_COUNT = 2;
|
||||
if (size().height() == scaledImageSize.height()) {
|
||||
leftDelta = (width() - scaledImageSize.width()) / HALF_COUNT;
|
||||
if (this->size().height() == scaledImageSize.height()) {
|
||||
leftDelta = (this->width() - scaledImageSize.width()) / HALF_COUNT;
|
||||
} else {
|
||||
topDelta = (height() - scaledImageSize.height()) / HALF_COUNT;
|
||||
topDelta = (this->height() - scaledImageSize.height()) / HALF_COUNT;
|
||||
}
|
||||
// Определим пропорцию области обрезки по отношению к исходному изображению
|
||||
float xScale = (float)pimpl->imageForCropping.width() / scaledImageSize.width();
|
||||
|
@ -148,54 +145,39 @@ 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(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
|
||||
pimpl->imageForCropping.scaled(this->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
|
||||
// ... заливаем фон
|
||||
widgetPainter.fillRect(rect(), pimpl->backgroundColor);
|
||||
widgetPainter.fillRect( this->rect(), pimpl->backgroundColor );
|
||||
// ... рисуем изображение по центру виджета
|
||||
#if QT_VERSION >= 0x050600
|
||||
if (qRound((double)height() * screenRatioPR) == scaledImage.height()) {
|
||||
widgetPainter.drawPixmap( ( qRound((double)width() * screenRatioPR) - scaledImage.width() ) / 2, 0, scaledImage );
|
||||
if ( this->size().height() == scaledImage.height() ) {
|
||||
widgetPainter.drawPixmap( ( this->width() - scaledImage.width() ) / 2, 0, scaledImage );
|
||||
} else {
|
||||
widgetPainter.drawPixmap( 0, ( qRound((double)height() * screenRatioPR) - scaledImage.height() ) / 2, scaledImage );
|
||||
widgetPainter.drawPixmap( 0, ( this->height() - 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 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;
|
||||
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;
|
||||
pimpl->croppingRect.moveTo(x, y);
|
||||
}
|
||||
|
||||
// ... рисуем затемненную область
|
||||
QPainterPath p;
|
||||
p.addRect(pimpl->croppingRect);
|
||||
p.addRect(rect());
|
||||
p.addRect(this->rect());
|
||||
widgetPainter.setBrush(QBrush(QColor(0,0,0,120)));
|
||||
widgetPainter.setPen(Qt::transparent);
|
||||
widgetPainter.drawPath(p);
|
||||
|
|
16
config.h
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2020 Syping
|
||||
* Copyright (C) 2016-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
|
||||
|
@ -28,7 +28,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_APPVENDORLINK
|
||||
#define GTA5SYNC_APPVENDORLINK "g5e://about?U3lwaW5n:R2l0TGFiOiA8YSBocmVmPSJodHRwczovL2dpdGxhYi5jb20vU3lwaW5nIj5TeXBpbmc8L2E+PGJyLz5HaXRIdWI6IDxhIGhyZWY9Imh0dHBzOi8vZ2l0aHViLmNvbS9TeXBpbmciPlN5cGluZzwvYT48YnIvPlNvY2lhbCBDbHViOiA8YSBocmVmPSJodHRwczovL3NvY2lhbGNsdWIucm9ja3N0YXJnYW1lcy5jb20vbWVtYmVyL1N5cGluZy80NjMwMzA1NiI+U3lwaW5nPC9hPg"
|
||||
#define GTA5SYNC_APPVENDORLINK "g5e://about?U3lwaW5n:R2l0TGFiOiA8YSBocmVmPSJodHRwczovL2dpdGxhYi5jb20vU3lwaW5nIj5TeXBpbmc8L2E+PGJyLz5HaXRIdWI6IDxhIGhyZWY9Imh0dHBzOi8vZ2l0aHViLmNvbS9TeXBpbmciPlN5cGluZzwvYT48YnIvPlNvY2lhbCBDbHViOiA8YSBocmVmPSJodHRwczovL3NvY2lhbGNsdWIucm9ja3N0YXJnYW1lcy5jb20vbWVtYmVyL1N5cGluZy80NjMwMzA1NiI+U3lwaW5nPC9hPg=="
|
||||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_APPSTR
|
||||
|
@ -40,11 +40,11 @@
|
|||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_COPYRIGHT
|
||||
#define GTA5SYNC_COPYRIGHT "2016-2021"
|
||||
#define GTA5SYNC_COPYRIGHT "2016-2019"
|
||||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_APPVER
|
||||
#define GTA5SYNC_APPVER "1.9.2"
|
||||
#define GTA5SYNC_APPVER "1.7.1"
|
||||
#endif
|
||||
|
||||
#if __cplusplus
|
||||
|
@ -107,16 +107,22 @@
|
|||
#define GTA5SYNC_INLANG ":/tr"
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_SHARE
|
||||
#define GTA5SYNC_SHARE "RUNDIR:"
|
||||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_LANG
|
||||
#define GTA5SYNC_LANG "SHAREDDIR:SEPARATOR:lang"
|
||||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_PLUG
|
||||
#define GTA5SYNC_PLUG "RUNDIR:SEPARATOR:plugins"
|
||||
#endif
|
||||
|
||||
#ifdef GTA5SYNC_WINRT
|
||||
#undef GTA5SYNC_WIN
|
||||
#endif
|
||||
|
||||
#ifndef GTA5SYNC_COMPILER
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
#!/usr/bin/env bash
|
||||
#*****************************************************************************
|
||||
# gta5view Grand Theft Auto V Profile Viewer
|
||||
# Copyright (C) 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/>.
|
||||
#*****************************************************************************
|
||||
|
||||
# Argbash generated code
|
||||
die()
|
||||
{
|
||||
local _ret=$2
|
||||
test -n "$_ret" || _ret=1
|
||||
test "$_PRINT_HELP" = yes && print_help >&2
|
||||
echo "$1" >&2
|
||||
exit ${_ret}
|
||||
}
|
||||
begins_with_short_option()
|
||||
{
|
||||
local first_option all_short_options
|
||||
all_short_options='h'
|
||||
first_option="${1:0:1}"
|
||||
test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0
|
||||
}
|
||||
_arg_prefix=
|
||||
_arg_qmake=
|
||||
_arg_telemetry_authid=
|
||||
_arg_telemetry_authpw=
|
||||
_arg_telemetry_pushurl=
|
||||
_arg_telemetry_regurl=
|
||||
_arg_telemetry_weburl=
|
||||
print_help ()
|
||||
{
|
||||
printf '%s\n' "gta5view Configure Script"
|
||||
printf 'Usage: %s [--prefix <arg>] [--qmake <arg>] [--telemetry-authid <arg>] [--telemetry-authpw <arg>] [--telemetry-pushurl <arg>] [--telemetry-regurl <arg>] [--telemetry-weburl <arg>] [-h|--help]\n' "$0"
|
||||
printf '\t%s\n' "-h,--help: Prints help"
|
||||
}
|
||||
parse_commandline ()
|
||||
{
|
||||
while test $# -gt 0
|
||||
do
|
||||
_key="$1"
|
||||
case "$_key" in
|
||||
--prefix)
|
||||
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
|
||||
_arg_prefix="$2"
|
||||
shift
|
||||
;;
|
||||
--prefix=*)
|
||||
_arg_prefix="${_key##--prefix=}"
|
||||
;;
|
||||
--qmake)
|
||||
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
|
||||
_arg_qmake="$2"
|
||||
shift
|
||||
;;
|
||||
--qmake=*)
|
||||
_arg_qmake="${_key##--qmake=}"
|
||||
;;
|
||||
--telemetry-authid)
|
||||
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
|
||||
_arg_telemetry_authid="$2"
|
||||
shift
|
||||
;;
|
||||
--telemetry-authid=*)
|
||||
_arg_telemetry_authid="${_key##--telemetry-authid=}"
|
||||
;;
|
||||
--telemetry-authpw)
|
||||
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
|
||||
_arg_telemetry_authpw="$2"
|
||||
shift
|
||||
;;
|
||||
--telemetry-authpw=*)
|
||||
_arg_telemetry_authpw="${_key##--telemetry-authpw=}"
|
||||
;;
|
||||
--telemetry-pushurl)
|
||||
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
|
||||
_arg_telemetry_pushurl="$2"
|
||||
shift
|
||||
;;
|
||||
--telemetry-pushurl=*)
|
||||
_arg_telemetry_pushurl="${_key##--telemetry-pushurl=}"
|
||||
;;
|
||||
--telemetry-regurl)
|
||||
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
|
||||
_arg_telemetry_regurl="$2"
|
||||
shift
|
||||
;;
|
||||
--telemetry-regurl=*)
|
||||
_arg_telemetry_regurl="${_key##--telemetry-regurl=}"
|
||||
;;
|
||||
--telemetry-weburl)
|
||||
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
|
||||
_arg_telemetry_weburl="$2"
|
||||
shift
|
||||
;;
|
||||
--telemetry-weburl=*)
|
||||
_arg_telemetry_weburl="${_key##--telemetry-weburl=}"
|
||||
;;
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
-h*)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
_PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
parse_commandline "$@"
|
||||
|
||||
# Initialise bash script - Step 1
|
||||
if [ "${_arg_prefix}" != "" ]; then
|
||||
PREFIX=${_arg_prefix}
|
||||
fi
|
||||
if [ "${_arg_qmake}" != "" ]; then
|
||||
QMAKE_PATH=${_arg_qmake}
|
||||
fi
|
||||
if [ "${_arg_telemetry_authid}" != "" ] && [ "${_arg_telemetry_authpw}" != "" ] && [ "${_arg_telemetry_pushurl}" != "" ] && [ "${_arg_telemetry_regurl}" != "" ]; then
|
||||
_telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY"
|
||||
_telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_AUTHID=\\\\\\\"${_arg_telemetry_authid}\\\\\\\""
|
||||
_telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_AUTHPW=\\\\\\\"${_arg_telemetry_authpw}\\\\\\\""
|
||||
_telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_PUSHURL=\\\\\\\"${_arg_telemetry_pushurl}\\\\\\\""
|
||||
_telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_REGURL=\\\\\\\"${_arg_telemetry_regurl}\\\\\\\""
|
||||
if [ "${_arg_telemetry_weburl}" != "" ]; then
|
||||
_telemetry_args="${_telemetry_args} DEFINES+=GTA5SYNC_TELEMETRY_WEBURL=\\\\\\\"${_arg_telemetry_weburl}\\\\\\\""
|
||||
fi
|
||||
else
|
||||
_telemetry_args=
|
||||
fi
|
||||
|
||||
# Initialise bash script - Step 2
|
||||
set +e
|
||||
_extra_args=
|
||||
|
||||
# Find Source Directory
|
||||
SOURCE=${BASH_SOURCE[0]}
|
||||
while [ -h "$SOURCE" ]; do
|
||||
SOURCE_DIR=$(cd -P "$(dirname "$SOURCE")" && pwd)
|
||||
SOURCE=$(readlink "$SOURCE")
|
||||
[[ $SOURCE != /* ]] && SOURCE="${SOURCE_DIR}/${SOURCE}"
|
||||
done
|
||||
SOURCE_DIR=$(cd -P "$(dirname "$SOURCE")" && pwd)
|
||||
|
||||
# Find Qt Installation
|
||||
export QT_SELECT=qt5
|
||||
if [ -x "${QMAKE_PATH}" ]; then
|
||||
QMAKE_PATH=${QMAKE_PATH}
|
||||
QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
|
||||
elif [ -x "$(command -v qmake-qt5)" ]; then
|
||||
QMAKE_PATH=$(command -v qmake-qt5)
|
||||
QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
|
||||
elif [ -x "$(command -v qmake)" ]; then
|
||||
QMAKE_PATH=$(command -v qmake)
|
||||
QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
|
||||
else
|
||||
QMAKE_PATH=$(find /usr/ -executable -name qmake -type f 2> /dev/null | sed -n 1p)
|
||||
if [ "${QMAKE_PATH}" == "" ]; then
|
||||
echo "Qt qmake not found"
|
||||
exit 1
|
||||
fi
|
||||
QT_VERSION=$(${QMAKE_PATH} -query "QT_VERSION")
|
||||
fi
|
||||
echo "Found Qt ${QT_VERSION} with qmake located at ${QMAKE_PATH}"
|
||||
|
||||
# Find Make Installation
|
||||
if [ -x "${MAKE_PATH}" ]; then
|
||||
MAKE_PATH=${MAKE_PATH}
|
||||
elif [ -x "$(command -v make)" ]; then
|
||||
MAKE_PATH=$(command -v make)
|
||||
else
|
||||
MAKE_PATH=$(find /usr/ -executable -name make -type f 2> /dev/null | sed -n 1p)
|
||||
if [ "${MAKE_PATH}" == "" ]; then
|
||||
echo "Make not found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clean Makefile
|
||||
if [ "${RUN_MAKE_CLEAN}" != "NO" ]; then
|
||||
if [ -f "Makefile" ]; then
|
||||
echo "${MAKE_PATH} distclean"
|
||||
${MAKE_PATH} distclean
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set qConf
|
||||
if [ "${NO_QCONF}" != "YES" ]; then
|
||||
_extra_args="${_extra_args} DEFINES+=GTA5SYNC_QCONF"
|
||||
fi
|
||||
|
||||
# Set Prefix
|
||||
if [ "${PREFIX}" != "" ]; then
|
||||
_extra_args="${_extra_args} GTA5SYNC_PREFIX=${PREFIX}"
|
||||
fi
|
||||
|
||||
# Set Build Type
|
||||
if [ "${BUILDTYPE}" == "Alpha" ]; then
|
||||
_extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_ALPHA"
|
||||
elif [ "${BUILDTYPE}" == "Beta" ]; then
|
||||
_extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_BETA"
|
||||
elif [ "${BUILDTYPE}" == "Developer" ]; then
|
||||
_extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_DEV"
|
||||
elif [ "${BUILDTYPE}" == "Daily Build" ]; then
|
||||
_extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_DAILY"
|
||||
elif [ "${BUILDTYPE}" == "Release Candidate" ]; then
|
||||
_extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_RC"
|
||||
elif [ "${BUILDTYPE}" == "Release" ]; then
|
||||
_extra_args="${_extra_args} DEFINES+=GTA5SYNC_BUILDTYPE_REL"
|
||||
fi
|
||||
|
||||
# Add Telemetry Args
|
||||
if [ "${_telemetry_args}" != "" ]; then
|
||||
_extra_args="${_extra_args}${_telemetry_args}"
|
||||
fi
|
||||
|
||||
# Generating Makefile
|
||||
echo "${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro"
|
||||
${QMAKE_PATH}${_extra_args} ${SOURCE_DIR}/gta5view.pro
|
||||
|
||||
# Make dependencies
|
||||
if [ "${RUN_MAKE_DEPEND}" == "YES" ]; then
|
||||
echo "${MAKE_PATH} depend"
|
||||
${MAKE_PATH} depend
|
||||
fi
|
||||
exit 0
|
99
gta5view.pro
|
@ -1,6 +1,6 @@
|
|||
#/*****************************************************************************
|
||||
#* gta5view Grand Theft Auto V Profile Viewer
|
||||
#* Copyright (C) 2015-2020 Syping
|
||||
#* Copyright (C) 2015-2019 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
#* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#*****************************************************************************/
|
||||
|
||||
QT += core gui network svg
|
||||
QT += core gui network svg
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
greaterThan(QT_MAJOR_VERSION, 4): greaterThan(QT_MINOR_VERSION, 1): win32: QT += winextras
|
||||
|
@ -37,10 +37,10 @@ SOURCES += main.cpp \
|
|||
ExportThread.cpp \
|
||||
GlobalString.cpp \
|
||||
IconLoader.cpp \
|
||||
ImageEditorDialog.cpp \
|
||||
ImportDialog.cpp \
|
||||
JsonEditorDialog.cpp \
|
||||
MapLocationDialog.cpp \
|
||||
MessageThread.cpp \
|
||||
OptionsDialog.cpp \
|
||||
PictureDialog.cpp \
|
||||
PictureExport.cpp \
|
||||
|
@ -50,7 +50,6 @@ SOURCES += main.cpp \
|
|||
ProfileInterface.cpp \
|
||||
ProfileLoader.cpp \
|
||||
ProfileWidget.cpp \
|
||||
RagePhoto.cpp \
|
||||
SavegameCopy.cpp \
|
||||
SavegameData.cpp \
|
||||
SavegameDialog.cpp \
|
||||
|
@ -71,7 +70,7 @@ SOURCES += main.cpp \
|
|||
uimod/UiModLabel.cpp \
|
||||
uimod/UiModWidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
HEADERS += \
|
||||
AboutDialog.h \
|
||||
AppEnv.h \
|
||||
CrewDatabase.h \
|
||||
|
@ -80,10 +79,10 @@ HEADERS += \
|
|||
ExportThread.h \
|
||||
GlobalString.h \
|
||||
IconLoader.h \
|
||||
ImageEditorDialog.h \
|
||||
ImportDialog.h \
|
||||
JsonEditorDialog.h \
|
||||
MapLocationDialog.h \
|
||||
MessageThread.h \
|
||||
OptionsDialog.h \
|
||||
PictureDialog.h \
|
||||
PictureExport.h \
|
||||
|
@ -93,7 +92,6 @@ HEADERS += \
|
|||
ProfileInterface.h \
|
||||
ProfileLoader.h \
|
||||
ProfileWidget.h \
|
||||
RagePhoto.h \
|
||||
SavegameCopy.h \
|
||||
SavegameData.h \
|
||||
SavegameDialog.h \
|
||||
|
@ -116,9 +114,10 @@ HEADERS += \
|
|||
uimod/UiModLabel.h \
|
||||
uimod/UiModWidget.h
|
||||
|
||||
FORMS += \
|
||||
FORMS += \
|
||||
AboutDialog.ui \
|
||||
ExportDialog.ui \
|
||||
ImageEditorDialog.ui \
|
||||
ImportDialog.ui \
|
||||
JsonEditorDialog.ui \
|
||||
MapLocationDialog.ui \
|
||||
|
@ -136,6 +135,7 @@ TRANSLATIONS += \
|
|||
res/gta5sync.ts \
|
||||
res/gta5sync_de.ts \
|
||||
res/gta5sync_en_US.ts \
|
||||
res/gta5sync_es.ts \
|
||||
res/gta5sync_fr.ts \
|
||||
res/gta5sync_ko.ts \
|
||||
res/gta5sync_ru.ts \
|
||||
|
@ -143,25 +143,14 @@ TRANSLATIONS += \
|
|||
res/gta5sync_zh_TW.ts
|
||||
|
||||
RESOURCES += \
|
||||
res/app.qrc \
|
||||
res/tr_g5p.qrc
|
||||
res/tr_g5p.qrc \
|
||||
res/app.qrc
|
||||
|
||||
DISTFILES += \
|
||||
res/gta5view-16.png \
|
||||
res/gta5view-24.png \
|
||||
res/gta5view-32.png \
|
||||
res/gta5view-40.png \
|
||||
res/gta5view-48.png \
|
||||
res/gta5view-64.png \
|
||||
res/gta5view-96.png \
|
||||
res/gta5view-128.png \
|
||||
res/gta5view-256.png \
|
||||
res/gta5view-512.png \
|
||||
res/app.rc \
|
||||
res/de.syping.gta5view.desktop \
|
||||
res/de.syping.gta5view.png \
|
||||
DISTFILES += res/app.rc \
|
||||
res/gta5view.desktop \
|
||||
res/gta5sync_de.ts \
|
||||
res/gta5sync_en_US.ts \
|
||||
res/gta5sync_es.ts \
|
||||
res/gta5sync_fr.ts \
|
||||
res/gta5sync_ko.ts \
|
||||
res/gta5sync_ru.ts \
|
||||
|
@ -175,14 +164,16 @@ INCLUDEPATH += ./anpro ./pcg ./tmext ./uimod
|
|||
|
||||
# GTA5SYNC/GTA5VIEW ONLY
|
||||
|
||||
DEFINES += GTA5SYNC_QMAKE # We using qmake do we?
|
||||
DEFINES += GTA5SYNC_PROJECT # Enable exclusive gta5sync/gta5view functions
|
||||
DEFINES += SNAPMATIC_NODEFAULT # Not assisting at proper usage of SnapmaticPicture class
|
||||
DEFINES += GTA5SYNC_NOASSIST # Not assisting at proper usage of SnapmaticPicture class
|
||||
|
||||
# WINDOWS ONLY
|
||||
|
||||
win32: DEFINES += GTA5SYNC_WIN
|
||||
win32: RC_FILE += res/app.rc
|
||||
win32: LIBS += -luser32
|
||||
win32: CONFIG -= embed_manifest_exe
|
||||
contains(DEFINES, GTA5SYNC_APV): greaterThan(QT_MAJOR_VERSION, 4): greaterThan(QT_MINOR_VERSION, 1): win32: LIBS += -ldwmapi
|
||||
contains(DEFINES, GTA5SYNC_TELEMETRY): win32: LIBS += -ld3d9 # Required for getting information about GPU
|
||||
|
||||
# MAC OS X ONLY
|
||||
|
@ -208,77 +199,49 @@ isEqual(QT_MAJOR_VERSION, 4): SOURCES += qjson4/QJsonArray.cpp \
|
|||
qjson4/QJsonValueRef.cpp \
|
||||
qjson4/QJsonParser.cpp
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 4): RESOURCES += res/qt4/tr_qt.qrc
|
||||
isEqual(QT_MAJOR_VERSION, 4): RESOURCES += res/tr_qt4.qrc
|
||||
isEqual(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_INSTALL_BINS]/rcc
|
||||
|
||||
# QT5 ONLY STUFF
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 5): RESOURCES += res/qt5/tr_qt.qrc
|
||||
|
||||
# QT5+ ONLY STUFF
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc
|
||||
|
||||
# QT6 ONLY STUFF
|
||||
|
||||
isEqual(QT_MAJOR_VERSION, 6): RESOURCES += res/qt6/tr_qt.qrc
|
||||
isEqual(QT_MAJOR_VERSION, 5): RESOURCES += res/tr_qt5.qrc
|
||||
isEqual(QT_MAJOR_VERSION, 5): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc
|
||||
|
||||
# RESOURCE COMPILATION
|
||||
|
||||
system($$GTA5SYNC_RCC -threshold 0 -compress 9 $$PWD/res/global.qrc -o $$OUT_PWD/qrc_global.cpp) {
|
||||
SOURCES += $$OUT_PWD/qrc_global.cpp
|
||||
} else {
|
||||
message("Failed to generate qrc_global.cpp")
|
||||
}
|
||||
depend.depends += $$PWD/res/global.qrc
|
||||
depend.commands += $$GTA5SYNC_RCC -binary -threshold 0 -compress 9 $$PWD/res/global.qrc -o $$PWD/res/global.rcc
|
||||
QMAKE_EXTRA_TARGETS += depend
|
||||
|
||||
# PROJECT INSTALLATION
|
||||
|
||||
isEmpty(GTA5SYNC_PREFIX): GTA5SYNC_PREFIX = /usr/local
|
||||
|
||||
appfiles.path = $$GTA5SYNC_PREFIX/share/applications
|
||||
appfiles.files = $$PWD/res/de.syping.gta5view.desktop
|
||||
appfiles.files = $$PWD/res/gta5view.desktop
|
||||
pixmaps.path = $$GTA5SYNC_PREFIX/share/pixmaps
|
||||
pixmaps.files = $$PWD/res/de.syping.gta5view.png
|
||||
pixmaps.files = $$PWD/res/gta5view.png
|
||||
target.path = $$GTA5SYNC_PREFIX/bin
|
||||
INSTALLS += target pixmaps appfiles
|
||||
|
||||
# QCONF BASED BUILD STUFF
|
||||
|
||||
contains(DEFINES, GTA5SYNC_QCONF) {
|
||||
isEqual(QT_MAJOR_VERSION, 4): RESOURCES -= res/qt4/tr_qt.qrc
|
||||
isEqual(QT_MAJOR_VERSION, 5): RESOURCES -= res/qt5/tr_qt.qrc
|
||||
isEqual(QT_MAJOR_VERSION, 6): RESOURCES -= res/qt6/tr_qt.qrc
|
||||
!contains(DEFINES, GTA5SYNC_QCONF_IN) {
|
||||
contains(DEFINES, GTA5SYNC_QCONF){
|
||||
isEqual(QT_MAJOR_VERSION, 4): RESOURCES -= res/tr_qt4.qrc
|
||||
isEqual(QT_MAJOR_VERSION, 5): RESOURCES -= res/tr_qt5.qrc
|
||||
!contains(DEFINES, GTA5SYNC_QCONF_IN){
|
||||
RESOURCES -= res/tr_g5p.qrc
|
||||
langfiles.path = $$GTA5SYNC_PREFIX/share/gta5view/translations
|
||||
langfiles.files = $$PWD/res/gta5sync_en_US.qm $$PWD/res/gta5sync_de.qm $$PWD/res/gta5sync_fr.qm $$PWD/res/gta5sync_ko.qm $$PWD/res/gta5sync_ru.qm $$PWD/res/gta5sync_uk.qm $$PWD/res/gta5sync_zh_TW.qm $$PWD/res/qtbase_en_GB.qm
|
||||
langfiles.files = $$PWD/res/gta5sync_en_US.qm $$PWD/res/gta5sync_de.qm $$PWD/res/gta5sync_fr.qm $$PWD/res/gta5sync_ko.qm $$PWD/res/gta5sync_ru.qm $$PWD/res/gta5sync_uk.qm $$PWD/res/gta5sync_zh_TW.qm $$PWD/res/qtbase_en_GB.qm $$PWD/res/qtbase_zh_TW.qm
|
||||
INSTALLS += langfiles
|
||||
}
|
||||
}
|
||||
|
||||
# TELEMETRY BASED STUFF
|
||||
|
||||
!contains(DEFINES, GTA5SYNC_TELEMETRY) {
|
||||
!contains(DEFINES, GTA5SYNC_TELEMETRY){
|
||||
SOURCES -= TelemetryClass.cpp \
|
||||
tmext/TelemetryClassAuthenticator.cpp
|
||||
HEADERS -= TelemetryClass.h \
|
||||
tmext/TelemetryClassAuthenticator.h
|
||||
}
|
||||
|
||||
!contains(DEFINES, GTA5SYNC_MOTD) {
|
||||
SOURCES -= MessageThread.cpp
|
||||
HEADERS -= MessageThread.h
|
||||
} else {
|
||||
lessThan(QT_MAJOR_VERSION, 5) {
|
||||
SOURCES -= MessageThread.cpp
|
||||
HEADERS -= MessageThread.h
|
||||
DEFINES -= GTA5SYNC_MOTD
|
||||
message("Messages require Qt5 or newer!")
|
||||
}
|
||||
}
|
||||
|
||||
# CMAKE BASED STUFF
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
message("Building gta5view with QMake is deprecated, please use CMake instead!")
|
||||
}
|
||||
|
|
76
main.cpp
|
@ -31,6 +31,7 @@
|
|||
#include "IconLoader.h"
|
||||
#include "AppEnv.h"
|
||||
#include "config.h"
|
||||
#include <QDesktopWidget>
|
||||
#include <QStringBuilder>
|
||||
#include <QSignalMapper>
|
||||
#include <QStyleFactory>
|
||||
|
@ -53,19 +54,11 @@
|
|||
#include <QFont>
|
||||
#include <QFile>
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#include "windows.h"
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
#include "MessageThread.h"
|
||||
#endif
|
||||
|
||||
#ifdef GTA5SYNC_TELEMETRY
|
||||
#include "TelemetryClass.h"
|
||||
#endif
|
||||
|
@ -73,16 +66,16 @@
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if QT_VERSION >= 0x050600
|
||||
#if QT_VERSION < 0x060000
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||
#endif
|
||||
#endif
|
||||
QApplication a(argc, argv);
|
||||
a.setApplicationName(GTA5SYNC_APPSTR);
|
||||
a.setApplicationVersion(GTA5SYNC_APPVER);
|
||||
a.setQuitOnLastWindowClosed(false);
|
||||
|
||||
QResource::registerResource(":/global/global.rcc");
|
||||
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
settings.beginGroup("Startup");
|
||||
|
||||
|
@ -96,26 +89,38 @@ int main(int argc, char *argv[])
|
|||
|
||||
bool isFirstStart = settings.value("IsFirstStart", true).toBool();
|
||||
bool customStyle = settings.value("CustomStyle", false).toBool();
|
||||
if (customStyle) {
|
||||
const QString appStyle = settings.value("AppStyle", "Default").toString();
|
||||
if (QStyleFactory::keys().contains(appStyle, Qt::CaseInsensitive)) {
|
||||
QString appStyle = settings.value("AppStyle", "Default").toString();
|
||||
|
||||
if (customStyle)
|
||||
{
|
||||
if (QStyleFactory::keys().contains(appStyle, Qt::CaseInsensitive))
|
||||
{
|
||||
a.setStyle(QStyleFactory::create(appStyle));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef GTA5SYNC_WIN
|
||||
#if QT_VERSION >= 0x050400
|
||||
if (QSysInfo::windowsVersion() >= 0x0080) {
|
||||
a.setFont(QApplication::font("QMenu"));
|
||||
}
|
||||
#endif
|
||||
bool alwaysUseMessageFont = settings.value("AlwaysUseMessageFont", false).toBool();
|
||||
if (QSysInfo::windowsVersion() >= 0x0080 || alwaysUseMessageFont)
|
||||
{
|
||||
// Get Windows Font
|
||||
NONCLIENTMETRICS ncm;
|
||||
ncm.cbSize = sizeof(ncm);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
|
||||
LOGFONTW uiFont = ncm.lfMessageFont;
|
||||
QString uiFontStr(QString::fromStdWString(std::wstring(uiFont.lfFaceName)));
|
||||
|
||||
#ifdef GTA5SYNC_DEBUG
|
||||
qDebug() << QApplication::tr("Font") << QApplication::tr("Selected Font: %1").arg(uiFontStr);
|
||||
#endif
|
||||
|
||||
bool customFont = settings.value("CustomFont", false).toBool();
|
||||
if (customFont) {
|
||||
const QFont appFont = qvariant_cast<QFont>(settings.value("AppFont", a.font()));
|
||||
// Set Application Font
|
||||
QFont appFont(uiFontStr, 9);
|
||||
a.setFont(appFont);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
QStringList applicationArgs = a.arguments();
|
||||
QString selectedAction;
|
||||
|
@ -134,7 +139,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
if (isFirstStart)
|
||||
{
|
||||
QMessageBox::StandardButton button = QMessageBox::information(nullptr, QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER), QApplication::tr("<h4>Welcome to %1!</h4>You want to configure %1 before you start using it?").arg(GTA5SYNC_APPSTR), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
QMessageBox::StandardButton button = QMessageBox::information(a.desktop(), QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER), QApplication::tr("<h4>Welcome to %1!</h4>You want to configure %1 before you start using it?").arg(GTA5SYNC_APPSTR), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
if (button == QMessageBox::Yes)
|
||||
{
|
||||
ProfileDatabase profileDB;
|
||||
|
@ -255,7 +260,9 @@ int main(int argc, char *argv[])
|
|||
bool readOk = picture.readingPictureFromFile(arg1);
|
||||
picDialog.setWindowIcon(IconLoader::loadingAppIcon());
|
||||
picDialog.setSnapmaticPicture(&picture, readOk);
|
||||
#ifndef Q_OS_LINUX
|
||||
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::Dialog^Qt::Window);
|
||||
#endif
|
||||
|
||||
int crewID = picture.getSnapmaticProperties().crewID;
|
||||
if (crewID != 0) { crewDB.addCrew(crewID); }
|
||||
|
@ -300,32 +307,9 @@ int main(int argc, char *argv[])
|
|||
QObject::connect(&threadDB, SIGNAL(finished()), &a, SLOT(quit()));
|
||||
threadDB.start();
|
||||
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
uint cacheId;
|
||||
{
|
||||
QSettings messageSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
messageSettings.beginGroup("Messages");
|
||||
cacheId = messageSettings.value("CacheId", 0).toUInt();
|
||||
messageSettings.endGroup();
|
||||
}
|
||||
MessageThread threadMessage(cacheId);
|
||||
QObject::connect(&threadMessage, SIGNAL(finished()), &threadDB, SLOT(terminateThread()));
|
||||
threadMessage.start();
|
||||
#endif
|
||||
|
||||
#ifdef GTA5SYNC_MOTD
|
||||
UserInterface uiWindow(&profileDB, &crewDB, &threadDB, &threadMessage);
|
||||
QObject::connect(&threadMessage, SIGNAL(messagesArrived(QJsonObject)), &uiWindow, SLOT(messagesArrived(QJsonObject)));
|
||||
QObject::connect(&threadMessage, SIGNAL(updateCacheId(uint)), &uiWindow, SLOT(updateCacheId(uint)));
|
||||
#else
|
||||
UserInterface uiWindow(&profileDB, &crewDB, &threadDB);
|
||||
#endif
|
||||
uiWindow.setWindowIcon(IconLoader::loadingAppIcon());
|
||||
#ifdef GTA5SYNC_FLATPAK
|
||||
uiWindow.setupDirEnv(false);
|
||||
#else
|
||||
uiWindow.setupDirEnv();
|
||||
#endif
|
||||
#ifdef Q_OS_ANDROID
|
||||
uiWindow.showMaximized();
|
||||
#else
|
||||
|
|
|
@ -39,45 +39,45 @@ QJsonDocument::QJsonDocument() : root_(0) {
|
|||
// Name: QJsonDocument
|
||||
//------------------------------------------------------------------------------
|
||||
QJsonDocument::QJsonDocument(const QJsonObject &object) : root_(0) {
|
||||
setObject(object);
|
||||
setObject(object);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: QJsonDocument
|
||||
//------------------------------------------------------------------------------
|
||||
QJsonDocument::QJsonDocument(const QJsonArray &array) : root_(0) {
|
||||
setArray(array);
|
||||
setArray(array);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: QJsonDocument
|
||||
//------------------------------------------------------------------------------
|
||||
QJsonDocument::QJsonDocument(const QJsonDocument &other) : root_(0) {
|
||||
if(other.root_) {
|
||||
root_ = other.root_->clone();
|
||||
}
|
||||
if(other.root_) {
|
||||
root_ = other.root_->clone();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: ~QJsonDocument
|
||||
//------------------------------------------------------------------------------
|
||||
QJsonDocument::~QJsonDocument() {
|
||||
delete root_;
|
||||
delete root_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: operator=
|
||||
//------------------------------------------------------------------------------
|
||||
QJsonDocument &QJsonDocument::operator=(const QJsonDocument &other) {
|
||||
QJsonDocument(other).swap(*this);
|
||||
return *this;
|
||||
QJsonDocument(other).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: operator!=
|
||||
//------------------------------------------------------------------------------
|
||||
bool QJsonDocument::operator!=(const QJsonDocument &other) const {
|
||||
return !(*this == other);
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -85,30 +85,30 @@ bool QJsonDocument::operator!=(const QJsonDocument &other) const {
|
|||
//------------------------------------------------------------------------------
|
||||
bool QJsonDocument::operator==(const QJsonDocument &other) const {
|
||||
|
||||
if(isArray() && other.isArray()) {
|
||||
return array() == other.array();
|
||||
}
|
||||
if(isArray() && other.isArray()) {
|
||||
return array() == other.array();
|
||||
}
|
||||
|
||||
if(isObject() && other.isObject()) {
|
||||
return object() == other.object();
|
||||
}
|
||||
if(isObject() && other.isObject()) {
|
||||
return object() == other.object();
|
||||
}
|
||||
|
||||
if(isEmpty() && other.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if(isEmpty() && other.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(isNull() && other.isNull()) {
|
||||
return true;
|
||||
}
|
||||
if(isNull() && other.isNull()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: isArray
|
||||
//------------------------------------------------------------------------------
|
||||
bool QJsonDocument::isArray() const {
|
||||
return root_ && root_->toArray();
|
||||
return root_ && root_->toArray();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -116,56 +116,56 @@ bool QJsonDocument::isArray() const {
|
|||
//------------------------------------------------------------------------------
|
||||
bool QJsonDocument::isEmpty() const {
|
||||
|
||||
// TODO(eteran): figure out the rules here that Qt5 uses
|
||||
// it *looks* like they define empty as being NULL
|
||||
// which is obviously different than this
|
||||
// TODO(eteran): figure out the rules here that Qt5 uses
|
||||
// it *looks* like they define empty as being NULL
|
||||
// which is obviously different than this
|
||||
|
||||
return !root_;
|
||||
return !root_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: isNull
|
||||
//------------------------------------------------------------------------------
|
||||
bool QJsonDocument::isNull() const {
|
||||
return !root_;
|
||||
return !root_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: isObject
|
||||
//------------------------------------------------------------------------------
|
||||
bool QJsonDocument::isObject() const {
|
||||
return root_ && root_->toObject();
|
||||
return root_ && root_->toObject();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: setArray
|
||||
//------------------------------------------------------------------------------
|
||||
void QJsonDocument::setArray(const QJsonArray &array) {
|
||||
setRoot(array);
|
||||
setRoot(array);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: setObject
|
||||
//------------------------------------------------------------------------------
|
||||
void QJsonDocument::setObject(const QJsonObject &object) {
|
||||
setRoot(object);
|
||||
setRoot(object);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: setRoot
|
||||
//------------------------------------------------------------------------------
|
||||
void QJsonDocument::setRoot(const QJsonRoot &root) {
|
||||
delete root_;
|
||||
root_ = root.clone();
|
||||
delete root_;
|
||||
root_ = root.clone();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: toBinaryData
|
||||
//------------------------------------------------------------------------------
|
||||
QByteArray QJsonDocument::toBinaryData() const {
|
||||
QByteArray r;
|
||||
// TODO(eteran): implement this
|
||||
return r;
|
||||
QByteArray r;
|
||||
// TODO(eteran): implement this
|
||||
return r;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -173,107 +173,100 @@ QByteArray QJsonDocument::toBinaryData() const {
|
|||
//------------------------------------------------------------------------------
|
||||
QString QJsonDocument::escapeString(const QString &s) const {
|
||||
|
||||
QString r;
|
||||
QString r;
|
||||
|
||||
Q_FOREACH(QChar ch, s) {
|
||||
switch(ch.toLatin1()) {
|
||||
case '\"': r.append("\\\""); break;
|
||||
case '\\': r.append("\\\\"); break;
|
||||
#if 0
|
||||
case '/': r.append("\\/"); break;
|
||||
#endif
|
||||
case '\b': r.append("\\b"); break;
|
||||
case '\f': r.append("\\f"); break;
|
||||
case '\n': r.append("\\n"); break;
|
||||
case '\r': r.append("\\r"); break;
|
||||
case '\t': r.append("\\t"); break;
|
||||
default:
|
||||
r += ch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Q_FOREACH(QChar ch, s) {
|
||||
switch(ch.toLatin1()) {
|
||||
case '\"': r.append("\\\""); break;
|
||||
case '\\': r.append("\\\\"); break;
|
||||
#if 0
|
||||
case '/': r.append("\\/"); break;
|
||||
#endif
|
||||
case '\b': r.append("\\b"); break;
|
||||
case '\f': r.append("\\f"); break;
|
||||
case '\n': r.append("\\n"); break;
|
||||
case '\r': r.append("\\r"); break;
|
||||
case '\t': r.append("\\t"); break;
|
||||
default:
|
||||
r += ch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
return r;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: toJson
|
||||
//------------------------------------------------------------------------------
|
||||
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int indent) const {
|
||||
QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format) const {
|
||||
|
||||
QString b;
|
||||
QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text);
|
||||
bool compact = (format == JsonFormat::Compact);
|
||||
QString b;
|
||||
QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text);
|
||||
|
||||
switch(v.type()) {
|
||||
case QJsonValue::Null:
|
||||
ss << "null";
|
||||
break;
|
||||
case QJsonValue::Bool:
|
||||
ss << (v.toBool() ? "true" : "false");
|
||||
break;
|
||||
case QJsonValue::Double:
|
||||
{
|
||||
double d = v.toDouble ();
|
||||
if (qIsFinite(d)) {
|
||||
// +2 to format to ensure the expected precision
|
||||
ss << QByteArray::number(d, 'g', 15 + 2); // ::digits10 is 15
|
||||
} else {
|
||||
ss << "null"; // +INF || -INF || NaN (see RFC4627#section2.4)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QJsonValue::String:
|
||||
ss << '"' << escapeString(v.toString()) << '"';
|
||||
break;
|
||||
case QJsonValue::Array:
|
||||
{
|
||||
const QJsonArray a = v.toArray();
|
||||
ss << (compact ? "[" : "[\n");
|
||||
if(!a.empty()) {
|
||||
QJsonArray::const_iterator it = a.begin();
|
||||
QJsonArray::const_iterator e = a.end();
|
||||
switch(v.type()) {
|
||||
case QJsonValue::Null:
|
||||
ss << "null";
|
||||
break;
|
||||
case QJsonValue::Bool:
|
||||
ss << (v.toBool() ? "true" : "false");
|
||||
break;
|
||||
case QJsonValue::Double:
|
||||
{
|
||||
double d = v.toDouble ();
|
||||
if (qIsFinite(d)) {
|
||||
// +2 to format to ensure the expected precision
|
||||
ss << QByteArray::number(d, 'g', 15 + 2); // ::digits10 is 15
|
||||
} else {
|
||||
ss << "null"; // +INF || -INF || NaN (see RFC4627#section2.4)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QJsonValue::String:
|
||||
ss << '"' << escapeString(v.toString()) << '"';
|
||||
break;
|
||||
case QJsonValue::Array:
|
||||
{
|
||||
const QJsonArray a = v.toArray();
|
||||
ss << "[";
|
||||
if(!a.empty()) {
|
||||
QJsonArray::const_iterator it = a.begin();
|
||||
QJsonArray::const_iterator e = a.end();
|
||||
|
||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||
ss << toJson(*it++, format, indent+1);
|
||||
ss << toJson(*it++, format);
|
||||
|
||||
for(;it != e; ++it) {
|
||||
ss << (compact ? "," : ",\n");
|
||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||
ss << toJson(*it, format, indent+1);
|
||||
}
|
||||
}
|
||||
indent--;
|
||||
ss << (compact ? "]" : QString("\n%1]").arg(QString(4*indent, ' ')));
|
||||
}
|
||||
break;
|
||||
case QJsonValue::Object:
|
||||
{
|
||||
const QJsonObject o = v.toObject();
|
||||
ss << (compact ? "{" : "{\n");
|
||||
if(!o.empty()) {
|
||||
QJsonObject::const_iterator it = o.begin();
|
||||
QJsonObject::const_iterator e = o.end();
|
||||
for(;it != e; ++it) {
|
||||
ss << ',';
|
||||
ss << toJson(*it, format);
|
||||
}
|
||||
}
|
||||
ss << "]";
|
||||
}
|
||||
break;
|
||||
case QJsonValue::Object:
|
||||
{
|
||||
const QJsonObject o = v.toObject();
|
||||
ss << "{";
|
||||
if(!o.empty()) {
|
||||
QJsonObject::const_iterator it = o.begin();
|
||||
QJsonObject::const_iterator e = o.end();
|
||||
|
||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
|
||||
++it;
|
||||
for(;it != e; ++it) {
|
||||
ss << (compact ? "," : ",\n");
|
||||
if (!compact) ss << QByteArray(4*indent, ' ');
|
||||
ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1);
|
||||
}
|
||||
}
|
||||
indent--;
|
||||
ss << (compact ? "}" : QString("\n%1}").arg(QString(4*indent, ' ')));
|
||||
}
|
||||
break;
|
||||
case QJsonValue::Undefined:
|
||||
Q_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
ss << '"' << escapeString(it.key()) << "\": " << toJson(it.value(), format);
|
||||
++it;
|
||||
for(;it != e; ++it) {
|
||||
ss << ',';
|
||||
ss << '"' << escapeString(it.key()) << "\": " << toJson(it.value(), format);
|
||||
}
|
||||
}
|
||||
ss << "}";
|
||||
}
|
||||
break;
|
||||
case QJsonValue::Undefined:
|
||||
Q_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return b;
|
||||
return b;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -281,19 +274,19 @@ QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int indent
|
|||
//------------------------------------------------------------------------------
|
||||
QByteArray QJsonDocument::toJson(JsonFormat format) const {
|
||||
|
||||
Q_UNUSED(format);
|
||||
Q_UNUSED(format);
|
||||
|
||||
if(isArray()) {
|
||||
QString s = toJson(array(), format);
|
||||
return s.toUtf8();
|
||||
}
|
||||
if(isArray()) {
|
||||
QString s = toJson(array(), format);
|
||||
return s.toUtf8();
|
||||
}
|
||||
|
||||
if(isObject()) {
|
||||
QString s = toJson(object(), format);
|
||||
return s.toUtf8();
|
||||
}
|
||||
if(isObject()) {
|
||||
QString s = toJson(object(), format);
|
||||
return s.toUtf8();
|
||||
}
|
||||
|
||||
return QByteArray();
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -301,17 +294,17 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const {
|
|||
//------------------------------------------------------------------------------
|
||||
QVariant QJsonDocument::toVariant() const {
|
||||
|
||||
if(!isEmpty()) {
|
||||
if(QJsonObject *const object = root_->toObject()) {
|
||||
return object->toVariantMap();
|
||||
}
|
||||
if(!isEmpty()) {
|
||||
if(QJsonObject *const object = root_->toObject()) {
|
||||
return object->toVariantMap();
|
||||
}
|
||||
|
||||
if(QJsonArray *const array = root_->toArray()) {
|
||||
return array->toVariantList();
|
||||
}
|
||||
}
|
||||
if(QJsonArray *const array = root_->toArray()) {
|
||||
return array->toVariantList();
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -319,13 +312,13 @@ QVariant QJsonDocument::toVariant() const {
|
|||
//------------------------------------------------------------------------------
|
||||
QJsonArray QJsonDocument::array() const {
|
||||
|
||||
if(!isEmpty()) {
|
||||
if(QJsonArray *const array = root_->toArray()) {
|
||||
return *array;
|
||||
}
|
||||
}
|
||||
if(!isEmpty()) {
|
||||
if(QJsonArray *const array = root_->toArray()) {
|
||||
return *array;
|
||||
}
|
||||
}
|
||||
|
||||
return QJsonArray();
|
||||
return QJsonArray();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -333,54 +326,54 @@ QJsonArray QJsonDocument::array() const {
|
|||
//------------------------------------------------------------------------------
|
||||
QJsonObject QJsonDocument::object() const {
|
||||
|
||||
if(!isEmpty()) {
|
||||
if(QJsonObject *const object = root_->toObject()) {
|
||||
return *object;
|
||||
}
|
||||
}
|
||||
if(!isEmpty()) {
|
||||
if(QJsonObject *const object = root_->toObject()) {
|
||||
return *object;
|
||||
}
|
||||
}
|
||||
|
||||
return QJsonObject();
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: rawData
|
||||
//------------------------------------------------------------------------------
|
||||
const char *QJsonDocument::rawData(int *size) const {
|
||||
Q_UNUSED(size);
|
||||
// TODO(eteran): implement this
|
||||
return 0;
|
||||
Q_UNUSED(size);
|
||||
// TODO(eteran): implement this
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: fromBinaryData
|
||||
//------------------------------------------------------------------------------
|
||||
QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation) {
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(validation);
|
||||
Q_UNUSED(data);
|
||||
Q_UNUSED(validation);
|
||||
|
||||
QJsonDocument doc;
|
||||
// TODO(eteran): implement this
|
||||
return doc;
|
||||
QJsonDocument doc;
|
||||
// TODO(eteran): implement this
|
||||
return doc;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: fromJson
|
||||
//------------------------------------------------------------------------------
|
||||
QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) {
|
||||
QJsonDocument doc;
|
||||
QJsonDocument doc;
|
||||
|
||||
const char *const begin = json.constData();
|
||||
const char *const end = begin + json.size();
|
||||
const char *const begin = json.constData();
|
||||
const char *const end = begin + json.size();
|
||||
|
||||
QJsonParser parser(begin, end);
|
||||
QJsonParser parser(begin, end);
|
||||
|
||||
doc.root_ = parser.parse();
|
||||
doc.root_ = parser.parse();
|
||||
|
||||
if(error) {
|
||||
*error = parser.state();
|
||||
}
|
||||
if(error) {
|
||||
*error = parser.state();
|
||||
}
|
||||
|
||||
return doc;
|
||||
return doc;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -388,10 +381,10 @@ QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *e
|
|||
//------------------------------------------------------------------------------
|
||||
QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidation validation) {
|
||||
|
||||
// data has to be aligned to a 4 byte boundary.
|
||||
Q_ASSERT(!(reinterpret_cast<quintptr>(data) % 3));
|
||||
// data has to be aligned to a 4 byte boundary.
|
||||
Q_ASSERT(!(reinterpret_cast<quintptr>(data) % 3));
|
||||
|
||||
return fromBinaryData(QByteArray::fromRawData(data, size), validation);
|
||||
return fromBinaryData(QByteArray::fromRawData(data, size), validation);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -399,26 +392,26 @@ QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidat
|
|||
//------------------------------------------------------------------------------
|
||||
QJsonDocument QJsonDocument::fromVariant(const QVariant &variant) {
|
||||
|
||||
QJsonDocument doc;
|
||||
QJsonDocument doc;
|
||||
|
||||
if (variant.type() == QVariant::Map) {
|
||||
doc.setObject(QJsonObject::fromVariantMap(variant.toMap()));
|
||||
} else if (variant.type() == QVariant::Hash) {
|
||||
doc.setObject(QJsonObject::fromVariantHash(variant.toHash()));
|
||||
} else if (variant.type() == QVariant::List) {
|
||||
doc.setArray(QJsonArray::fromVariantList(variant.toList()));
|
||||
} else if (variant.type() == QVariant::StringList) {
|
||||
doc.setArray(QJsonArray::fromStringList(variant.toStringList()));
|
||||
}
|
||||
if (variant.type() == QVariant::Map) {
|
||||
doc.setObject(QJsonObject::fromVariantMap(variant.toMap()));
|
||||
} else if (variant.type() == QVariant::Hash) {
|
||||
doc.setObject(QJsonObject::fromVariantHash(variant.toHash()));
|
||||
} else if (variant.type() == QVariant::List) {
|
||||
doc.setArray(QJsonArray::fromVariantList(variant.toList()));
|
||||
} else if (variant.type() == QVariant::StringList) {
|
||||
doc.setArray(QJsonArray::fromStringList(variant.toStringList()));
|
||||
}
|
||||
|
||||
return doc;
|
||||
return doc;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: swap
|
||||
//------------------------------------------------------------------------------
|
||||
void QJsonDocument::swap(QJsonDocument &other) {
|
||||
qSwap(root_, other.root_);
|
||||
qSwap(root_, other.root_);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,66 +36,66 @@ class QJsonRoot;
|
|||
|
||||
class QJsonDocument {
|
||||
public:
|
||||
enum DataValidation {
|
||||
Validate = 0,
|
||||
BypassValidation = 1
|
||||
};
|
||||
enum DataValidation {
|
||||
Validate = 0,
|
||||
BypassValidation = 1
|
||||
};
|
||||
|
||||
enum JsonFormat {
|
||||
Indented,
|
||||
Compact
|
||||
};
|
||||
enum JsonFormat {
|
||||
Indented,
|
||||
Compact
|
||||
};
|
||||
|
||||
public:
|
||||
QJsonDocument();
|
||||
QJsonDocument(const QJsonObject &object);
|
||||
QJsonDocument(const QJsonArray &array);
|
||||
QJsonDocument(const QJsonDocument &other);
|
||||
~QJsonDocument();
|
||||
QJsonDocument();
|
||||
QJsonDocument(const QJsonObject &object);
|
||||
QJsonDocument(const QJsonArray &array);
|
||||
QJsonDocument(const QJsonDocument &other);
|
||||
~QJsonDocument();
|
||||
|
||||
public:
|
||||
QJsonDocument &operator=(const QJsonDocument &other);
|
||||
QJsonDocument &operator=(const QJsonDocument &other);
|
||||
|
||||
public:
|
||||
bool operator!=(const QJsonDocument &other) const;
|
||||
bool operator==(const QJsonDocument &other) const;
|
||||
bool operator!=(const QJsonDocument &other) const;
|
||||
bool operator==(const QJsonDocument &other) const;
|
||||
|
||||
public:
|
||||
bool isArray() const;
|
||||
bool isEmpty() const;
|
||||
bool isNull() const;
|
||||
bool isObject() const;
|
||||
bool isArray() const;
|
||||
bool isEmpty() const;
|
||||
bool isNull() const;
|
||||
bool isObject() const;
|
||||
|
||||
public:
|
||||
QByteArray toBinaryData() const;
|
||||
QByteArray toJson(JsonFormat format = Indented) const;
|
||||
QVariant toVariant() const;
|
||||
QByteArray toBinaryData() const;
|
||||
QByteArray toJson(JsonFormat format = Indented) const;
|
||||
QVariant toVariant() const;
|
||||
|
||||
public:
|
||||
QJsonArray array() const;
|
||||
QJsonObject object() const;
|
||||
const char *rawData(int *size) const;
|
||||
QJsonArray array() const;
|
||||
QJsonObject object() const;
|
||||
const char *rawData(int *size) const;
|
||||
|
||||
public:
|
||||
void setArray(const QJsonArray &array);
|
||||
void setObject(const QJsonObject &object);
|
||||
void setArray(const QJsonArray &array);
|
||||
void setObject(const QJsonObject &object);
|
||||
|
||||
public:
|
||||
static QJsonDocument fromBinaryData(const QByteArray &data, DataValidation validation = Validate);
|
||||
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0);
|
||||
static QJsonDocument fromRawData(const char *data, int size, DataValidation validation = Validate);
|
||||
static QJsonDocument fromVariant(const QVariant &variant);
|
||||
static QJsonDocument fromBinaryData(const QByteArray &data, DataValidation validation = Validate);
|
||||
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0);
|
||||
static QJsonDocument fromRawData(const char *data, int size, DataValidation validation = Validate);
|
||||
static QJsonDocument fromVariant(const QVariant &variant);
|
||||
|
||||
private:
|
||||
void setRoot(const QJsonRoot &root);
|
||||
QString toJson(const QJsonValue &v, JsonFormat format, int indent = 1) const;
|
||||
QString escapeString(const QString &s) const;
|
||||
void setRoot(const QJsonRoot &root);
|
||||
QString toJson(const QJsonValue &v, JsonFormat format) const;
|
||||
QString escapeString(const QString &s) const;
|
||||
|
||||
private:
|
||||
void swap(QJsonDocument &other);
|
||||
void swap(QJsonDocument &other);
|
||||
|
||||
private:
|
||||
QJsonRoot *root_;
|
||||
QJsonRoot *root_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 585 B After Width: | Height: | Size: 585 B |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 776 B After Width: | Height: | Size: 776 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
21
res/app.qrc
|
@ -1,19 +1,19 @@
|
|||
<RCC>
|
||||
<qresource prefix="/img">
|
||||
<file>5sync-48.png</file>
|
||||
<file>5sync-16.png</file>
|
||||
<file>5sync-24.png</file>
|
||||
<file>5sync-32.png</file>
|
||||
<file>5sync-40.png</file>
|
||||
<file>5sync-64.png</file>
|
||||
<file>5sync-96.png</file>
|
||||
<file>5sync-128.png</file>
|
||||
<file>5sync-256.png</file>
|
||||
<file>add.svgz</file>
|
||||
<file>avatararea.png</file>
|
||||
<file>avatarareaimport.png</file>
|
||||
<file>back.svgz</file>
|
||||
<file>empty1x16.png</file>
|
||||
<file>gta5view-16.png</file>
|
||||
<file>gta5view-24.png</file>
|
||||
<file>gta5view-32.png</file>
|
||||
<file>gta5view-40.png</file>
|
||||
<file>gta5view-48.png</file>
|
||||
<file>gta5view-64.png</file>
|
||||
<file>gta5view-96.png</file>
|
||||
<file>gta5view-128.png</file>
|
||||
<file>gta5view-256.png</file>
|
||||
<file>mappreview.jpg</file>
|
||||
<file>next.svgz</file>
|
||||
<file>pointmaker-8.png</file>
|
||||
|
@ -25,6 +25,9 @@
|
|||
<file>watermark_2b.png</file>
|
||||
<file>watermark_2r.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/global">
|
||||
<file>global.rcc</file>
|
||||
</qresource>
|
||||
<qresource prefix="/template">
|
||||
<file>template.g5e</file>
|
||||
</qresource>
|
||||
|
|
15
res/app.rc
|
@ -1,11 +1,14 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "5sync.ico"
|
||||
IDI_ICON1 ICON DISCARDABLE "5sync.ico"
|
||||
|
||||
#define RT_MANIFEST 24
|
||||
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1, 9, 2, 0
|
||||
PRODUCTVERSION 1, 9, 2, 0
|
||||
FILEVERSION 1, 7, 1, 0
|
||||
PRODUCTVERSION 1, 7, 1, 0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
|
@ -22,12 +25,12 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Syping"
|
||||
VALUE "FileDescription", "gta5view"
|
||||
VALUE "FileVersion", "1.9.2"
|
||||
VALUE "FileVersion", "1.7.1"
|
||||
VALUE "InternalName", "gta5view"
|
||||
VALUE "LegalCopyright", "Copyright © 2016-2021 Syping"
|
||||
VALUE "LegalCopyright", "Copyright © 2016-2019 Syping"
|
||||
VALUE "OriginalFilename", "gta5view.exe"
|
||||
VALUE "ProductName", "gta5view"
|
||||
VALUE "ProductVersion", "1.9.2"
|
||||
VALUE "ProductVersion", "1.7.1"
|
||||
END
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=gta5view
|
||||
Comment=Open and edit GTA V profiles
|
||||
Comment[de]=GTA V Profile öffnen und bearbeiten
|
||||
Comment[ru]=Просмотрщик и редактор профилей GTA V
|
||||
Categories=Qt;Utility;FileTools
|
||||
Exec=gta5view
|
||||
Icon=de.syping.gta5view
|
||||
Terminal=false
|
||||
StartupNotify=false
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright 2021 Syping -->
|
||||
<component type="desktop-application">
|
||||
<id>de.syping.gta5view</id>
|
||||
<launchable type="desktop-id">de.syping.gta5view.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0+</project_license>
|
||||
|
||||
<name>gta5view</name>
|
||||
|
||||
<summary>Open and edit GTA V profiles</summary>
|
||||
<summary xml:lang="de">GTA V Profile öffnen und bearbeiten</summary>
|
||||
<summary xml:lang="ru">Просмотрщик и редактор профилей GTA V</summary>
|
||||
|
||||
<icon type="remote">https://img.syping.de/gta5view/gta5view.png</icon>
|
||||
|
||||
<description>
|
||||
<p>Open Source Snapmatic picture and Savegame viewer/editor for GTA V</p>
|
||||
<p>Features</p>
|
||||
<ul>
|
||||
<li>View Snapmatics with the ability to disable them in-game</li>
|
||||
<li>Edit Snapmatic pictures and properties in multiple ways</li>
|
||||
<li>Import/Export Snapmatics, Savegames and pictures</li>
|
||||
<li>Choose between multiple Social Club accounts as GTA V profiles IDs</li>
|
||||
</ul>
|
||||
</description>
|
||||
|
||||
<categories>
|
||||
<category>Utility</category>
|
||||
</categories>
|
||||
|
||||
<developer_name>Syping</developer_name>
|
||||
|
||||
<releases>
|
||||
<release date="2021-03-22" version="1.9.2"/>
|
||||
<release date="2020-12-16" version="1.9.1"/>
|
||||
<release date="2020-11-30" version="1.9.0"/>
|
||||
<release date="2020-10-11" version="1.8.0"/>
|
||||
</releases>
|
||||
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<caption>User Interface</caption>
|
||||
<image type="source">https://img.syping.de/gta5view/mainui_kde.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<caption>Snapmatic Viewer</caption>
|
||||
<image type="source">https://img.syping.de/gta5view/picture_kde.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<caption>Picture Importer</caption>
|
||||
<image type="source">https://img.syping.de/gta5view/import_kde.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<caption>Snapmatic Player Editor</caption>
|
||||
<image type="source">https://img.syping.de/gta5view/players_kde.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<caption>Snapmatic Property Editor</caption>
|
||||
<image type="source">https://img.syping.de/gta5view/prop_kde.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
|
||||
<content_rating type="oars-1.1" />
|
||||
|
||||
<url type="homepage">https://gta5view.syping.de/</url>
|
||||
</component>
|
|
@ -42,7 +42,6 @@ HAWICK="Hawick"
|
|||
HEART="Heart Attacks Beach"
|
||||
HORS="Vinewood-Rennbahn"
|
||||
HUMLAB="Humane Labs and Research"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Bolingbroke-Strafanstalt"
|
||||
KOREAT="Little Seoul"
|
||||
LACT="Land-Act-Stausee"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="Hawick"
|
|||
HEART="Heart Attacks Beach"
|
||||
HORS="Vinewood Racetrack"
|
||||
HUMLAB="Humane Labs and Research"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Bolingbroke Penitentiary"
|
||||
KOREAT="Little Seoul"
|
||||
LACT="Land Act Reservoir"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="Hawick"
|
|||
HEART="Heart Attacks Beach"
|
||||
HORS="Circuito de Vinewood"
|
||||
HUMLAB="Laboratorios Humane"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Penitenciaría de Bolingbroke"
|
||||
KOREAT="Little Seoul"
|
||||
LACT="Embalse de Land Act"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="Hawick"
|
|||
HEART="Heart Attacks Beach"
|
||||
HORS="Circuito de Vinewood"
|
||||
HUMLAB="Humane Labs and Research"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Penitenciaría de Bolingbroke"
|
||||
KOREAT="Little Seoul"
|
||||
LACT="Presa de Land Act"
|
||||
|
|
|
@ -41,7 +41,6 @@ HAWICK="Hawick"
|
|||
HEART="Heart Attacks Beach"
|
||||
HORS="Hippodrome de Vinewood"
|
||||
HUMLAB="Laboratoires Humane"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Pénitencier de Bolingbroke"
|
||||
KOREAT="Little Seoul"
|
||||
LACT="Land Act Reservoir"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="Hawick"
|
|||
HEART="Heart Attacks Beach"
|
||||
HORS="Vinewood Racetrack"
|
||||
HUMLAB="Laboratori di ricerca Humane"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Bolingbroke Penitentiary"
|
||||
KOREAT="Little Seoul"
|
||||
LACT="Land Act Reservoir"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="ハウィック"
|
|||
HEART="ハートアタック・ビーチ"
|
||||
HORS="バインウッド・レーストラック"
|
||||
HUMLAB="ヒューメイン研究所"
|
||||
ISHEIST="カヨ・ペリコ"
|
||||
JAIL="ボーリングブローク刑務所"
|
||||
KOREAT="リトル・ソウル"
|
||||
LACT="ランド・アクト貯水池"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="호익"
|
|||
HEART="하트 어택 해변"
|
||||
HORS="바인우드 레이스트랙"
|
||||
HUMLAB="휴메인 실험 연구소"
|
||||
ISHEIST="카요 페리코"
|
||||
JAIL="볼링브로크 교도소"
|
||||
KOREAT="리틀 서울"
|
||||
LACT="랜드 액트 저수지"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="Hawick"
|
|||
HEART="Plaża Zawałowców"
|
||||
HORS="Tor wyścigowy Vinewood"
|
||||
HUMLAB="Humane Labs and Research"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Zakład karny Bolingbroke"
|
||||
KOREAT="Mały Seul"
|
||||
LACT="Jezioro zaporowe"
|
||||
|
|
|
@ -41,7 +41,6 @@ HAWICK="Hawick"
|
|||
HEART="Heart Attacks Beach"
|
||||
HORS="Hipódromo de Vinewood"
|
||||
HUMLAB="Laboratórios e Pesquisas Humane"
|
||||
ISHEIST="Cayo Perico"
|
||||
JAIL="Penitenciária Bolingbroke"
|
||||
KOREAT="Little Seoul"
|
||||
LACT="Reservatório Land Act"
|
||||
|
|
|
@ -42,7 +42,6 @@ HAWICK="Хавик"
|
|||
HEART="Харт-Аттакс-Бич"
|
||||
HORS="Гоночная трасса Вайнвуда"
|
||||
HUMLAB="Лаборатория Humane Labs and Research"
|
||||
ISHEIST="Кайо-Перико"
|
||||
JAIL="Тюрьма Болингброук"
|
||||
KOREAT="Маленький Сеул"
|
||||
LACT="Лэнд-экт-резервуар"
|
||||
|
|
|
@ -41,7 +41,6 @@ HAWICK="霍伊克"
|
|||
HEART="驚心海灘"
|
||||
HORS="好麥塢賽馬場"
|
||||
HUMLAB="人道研究實驗室"
|
||||
ISHEIST="佩里克島"
|
||||
JAIL="博林布魯克監獄"
|
||||
KOREAT="小首爾"
|
||||
LACT="蘭艾水庫"
|
||||
|
|