Compare commits
209 Commits
Author | SHA1 | Date |
---|---|---|
Syping | 8732b9d64d | |
Syping | bb4a9b484c | |
Syping | c79c8dbe6e | |
Syping | 4e31d159fa | |
Syping | 0633d14d6b | |
Syping | c6b39546ba | |
Syping | eac9caa2c6 | |
Syping | a80b5843a7 | |
Syping | 07797f6e60 | |
Syping | 55186e8b88 | |
Syping | eee9100d8b | |
Syping | b73719ed4e | |
Syping | a143b43d15 | |
Syping | 032475ddfd | |
Syping | bdde72573b | |
Syping | 827676768a | |
Syping | 0c02c3ce98 | |
Syping | 6063803d5e | |
Syping | 1f3c036b47 | |
Syping | ea0526ae9d | |
Syping | aeae6c9311 | |
Syping | c39c3a3e9f | |
Syping | 9989d9d869 | |
Syping | fa86e8f8a7 | |
Syping | f9880fff70 | |
Syping | 7ba5322643 | |
Syping | 1f409b0f25 | |
Syping | dea33f8ab0 | |
Syping | 6b54b2e6ae | |
VADemon | 38f2877ea3 | |
Syping | c67a0a0fc9 | |
Syping | 7a15c3e56b | |
Syping | feabaac48e | |
Jean | 6ab75420ec | |
Syping | cda974d5df | |
VenJam1n | 36677ed07a | |
Syping | 17014925c5 | |
Syping | f151035574 | |
Syping | 53ef2bdb54 | |
Syping | 2606cd8965 | |
Syping | 973fb58a5d | |
Syping | 39f20aca9d | |
Syping | c29cc44717 | |
Syping | 9ced2253fc | |
Syping | 778abdd36a | |
Syping | 30a6b55c9e | |
Syping | b02f06ae97 | |
Syping | 193bb60caa | |
Syping | 414867f13e | |
Syping | 7b68bb10b5 | |
Syping | 2487a188d5 | |
Syping | c34d3331fb | |
Syping | afeab6120d | |
Syping | 4c6962ab23 | |
Syping | 08ecd5ca61 | |
Syping | 5f35428cd0 | |
Syping | 714be43280 | |
Syping | 1165c3b536 | |
Syping | 06eb2e4277 | |
Syping | 00db9ecab2 | |
Syping | dc101a66da | |
Syping | 541a7d18bd | |
Syping | f932a8d5ee | |
Syping | 81ea0490cf | |
Syping | a8db3985a2 | |
Syping | 0127bc61e6 | |
Syping | 25c64b7f5d | |
Syping | c3d684436b | |
Syping | 4135b1f588 | |
Syping | 7c08e1486e | |
Syping | d61cbd4743 | |
Syping | efa88cc46e | |
Syping | f1cfbbf573 | |
Syping | ca8003c2e8 | |
Syping | 69a7ec8dbe | |
Syping | 0321d79136 | |
Syping | e2b7062e26 | |
Syping | 99f3c22ab0 | |
Syping | 9b5cb46c35 | |
Syping | c909e20178 | |
Syping | 0e337b4dec | |
Syping | 3b305fb809 | |
Syping | 06a8657423 | |
Syping | caffd9f246 | |
Syping | caaa6a1d85 | |
Syping | 196cb8bc55 | |
Syping | 2d62bbb97e | |
Syping | c3e030e827 | |
Syping | 291236ff2c | |
Syping | c7ec038e26 | |
Syping | cde4b380f8 | |
Syping | bcd7e3cd15 | |
Syping | 1f1025787e | |
Syping | fd5ce958bd | |
Syping | 681e76737e | |
Syping | 24ca667537 | |
Syping | e6c8a48e12 | |
Syping | 867281f80a | |
Syping | a33bc8145b | |
Syping | e3a8edae2d | |
Syping | 609efb7fba | |
Syping | 29f883555d | |
Syping | 8fc3dc6c7c | |
Syping | 72377e49eb | |
Syping | 5840d8e8e9 | |
Syping | d0e157bf1c | |
Syping | 9b41d80d9a | |
Syping | 06ada3d770 | |
Syping | cd20e0b512 | |
Syping | bd97ee86ba | |
Syping | 7b98e75f8d | |
Syping | 99ffbf4178 | |
Syping | 108f1725f6 | |
Syping | 5c7cb24c36 | |
Syping | 6e335638a3 | |
Syping | 5a4b2f1d67 | |
Syping | d91b9f5f43 | |
Syping | 3dfc2e001b | |
Syping | 1b54c8c456 | |
Syping | 979747b8f5 | |
Syping | e74b19fed0 | |
Syping | d94a3712be | |
Syping | e765511614 | |
Syping | 61864c65eb | |
Syping | bf81aea0c9 | |
Syping | 48650633a5 | |
Syping | 2b3a22b893 | |
Syping | 9b373669b2 | |
Syping | 55a01e7fe4 | |
Syping | fdf07dd681 | |
Syping | b799c4551d | |
Syping | 2f4de16e5d | |
Syping | 65bc740b88 | |
Syping | eb505c7d8a | |
Syping | a6939e9a82 | |
Rafael | b6ac8f8283 | |
VenJam1n | 919bd50b6e | |
Syping | 7e8e452850 | |
Syping | 7662b374e5 | |
Syping | 9272f0d3c1 | |
Syping | 8a3bd5497e | |
Syping | 12f8430f34 | |
Syping | fbc9e66de2 | |
Syping | 4af7e2e819 | |
Syping | 6f8d28c844 | |
Syping | bcd2d570c2 | |
Syping | 9362e88708 | |
Syping | 10b6222ae8 | |
Syping | d1a2b03353 | |
Syping | 39a83200d2 | |
Syping | ebe8d616f2 | |
Syping | 023aa0223e | |
Syping | cff6af34ce | |
Syping | 47a5074ed1 | |
Syping | 4ce39ab7fd | |
Syping | fc44406caf | |
Syping | bcd0e28618 | |
Syping | 508da61af8 | |
Syping | f7382db6ab | |
Syping | e9511cd3eb | |
Syping | add51460a3 | |
Syping | 42845e1cb5 | |
Syping | 09c9f3418c | |
Syping | 3e8c018dcf | |
Syping | f57b7f3354 | |
Syping | b4d0388fdc | |
Syping | 0cf2f53342 | |
Syping | 5db4bd4492 | |
Syping | a1d4071d55 | |
Syping | 43b9f4f94b | |
Syping | 67dfcf09ee | |
Syping | 951f3d05c0 | |
Syping | fb9e6074d8 | |
Syping | 1c124d4ce3 | |
Syping | c6e66b26f5 | |
Syping | 3a00e9b5b0 | |
Syping | 885045d4fd | |
Syping | 3b7542d361 | |
Syping | 26a24122e1 | |
Syping | 68c8a971ee | |
Syping | ed05abc8ae | |
Syping | 27c242cf68 | |
Syping | 4e3323cbf2 | |
Syping | d0caea372c | |
Syping | d3ce20a710 | |
Syping | a44ee9ea44 | |
Syping | 30b2dce0bf | |
Syping | ca093737cc | |
Syping | 37a6d073b4 | |
Syping | 9b6253b848 | |
Syping | 98b7c766fe | |
Syping | 6938ca577d | |
Syping | eeb0c01a5f | |
Syping | f9eee75757 | |
Syping | a591adf6ea | |
Syping | f62b1b08c0 | |
Syping | 15255874ff | |
Vadim VADemon | 61ead2c7e4 | |
Syping | d5572d4212 | |
Syping | a2cb844c56 | |
Syping | 9bb5e6755e | |
Syping | 4169e86f31 | |
Syping | cfdc36d207 | |
Syping | 948d12694c | |
Syping | 1edf71eedc | |
Syping | 38cefbbe45 | |
Syping | 68bbfbd843 | |
Syping | a6d5062ff6 | |
Syping | 0069bb0b95 |
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $(git name-rev --tags --name-only $(git rev-parse HEAD)) == "undefined" ]; then
|
||||||
|
export APPLICATION_VERSION=$(lua -e 'for line in io.lines("config.h") do local m = string.match(line, "#define GTA5SYNC_APPVER \"(.+)\"$"); if m then print(m); os.exit(0) end end')
|
||||||
|
else
|
||||||
|
export APPLICATION_VERSION=$(git name-rev --tags --name-only $(git rev-parse HEAD))
|
||||||
|
fi
|
||||||
|
export PACKAGE_VERSION=$(grep -oE '^[^\-]*' <<< $APPLICATION_VERSION)
|
||||||
|
export PACKAGE_BUILD=$(grep -oP '\-\K.+' <<< $APPLICATION_VERSION)
|
||||||
|
export EXECUTABLE_VERSION=${PACKAGE_VERSION}${PACKAGE_BUILD}${EXECUTABLE_TAG}
|
||||||
|
|
||||||
|
if [ "${PACKAGE_BUILD}" == "" ]; then
|
||||||
|
export PACKAGE_BUILD=1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${BUILD_TYPE}" == "ALPHA" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_ALPHA"
|
||||||
|
elif [ "${BUILD_TYPE}" == "Alpha" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_ALPHA"
|
||||||
|
elif [ "${BUILD_TYPE}" == "BETA" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_BETA"
|
||||||
|
elif [ "${BUILD_TYPE}" == "Beta" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_BETA"
|
||||||
|
elif [ "${BUILD_TYPE}" == "DEV" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DEV"
|
||||||
|
elif [ "${BUILD_TYPE}" == "Development" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DEV"
|
||||||
|
elif [ "${BUILD_TYPE}" == "DAILY" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DAILY"
|
||||||
|
elif [ "${BUILD_TYPE}" == "Daily" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_DAILY"
|
||||||
|
elif [ "${BUILD_TYPE}" == "RC" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_RC"
|
||||||
|
elif [ "${BUILD_TYPE}" == "Release Candidate" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_RC"
|
||||||
|
elif [ "${BUILD_TYPE}" == "REL" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_REL"
|
||||||
|
elif [ "${BUILD_TYPE}" == "Release" ]; then
|
||||||
|
export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE_REL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PROJECT_DIR=$(pwd)
|
||||||
|
|
||||||
|
.ci/${BUILD_SCRIPT}
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Creating folders
|
||||||
|
cd ${PROJECT_DIR} && \
|
||||||
|
echo "gta5view build version is ${APPLICATION_VERSION}" && \
|
||||||
|
mkdir -p build && \
|
||||||
|
mkdir -p assets && \
|
||||||
|
chmod -x res/gta5sync_*.qm res/gta5view.desktop res/gta5view.png && \
|
||||||
|
cd build && \
|
||||||
|
mkdir -p qt4 && \
|
||||||
|
cd qt4 && \
|
||||||
|
echo "Grand Theft Auto V Snapmatic and Savegame viewer/editor" > ./description-pak && \
|
||||||
|
cd .. && \
|
||||||
|
mkdir -p qt5 && \
|
||||||
|
cd qt5 && \
|
||||||
|
echo "Grand Theft Auto V Snapmatic and Savegame viewer/editor" > ./description-pak && \
|
||||||
|
cd .. && \
|
||||||
|
|
||||||
|
# Prepare checkinstall step
|
||||||
|
mkdir -p /usr/share/gta5view && \
|
||||||
|
|
||||||
|
# Starting build
|
||||||
|
cd qt5 && \
|
||||||
|
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
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
.ci/debian_install.sh && \
|
||||||
|
|
||||||
|
# Build gta5view
|
||||||
|
.ci/debian_build.sh && \
|
||||||
|
cd ${PROJECT_DIR}
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "${DOCKER_USER}" != "" ]; then
|
||||||
|
DOCKER_IMAGE=${DOCKER_USER}/debian:${DEBIAN_VERSION}
|
||||||
|
else
|
||||||
|
DOCKER_IMAGE=debian:${DEBIAN_VERSION}
|
||||||
|
fi
|
||||||
|
PROJECT_DIR_DOCKER=/gta5view
|
||||||
|
|
||||||
|
cd ${PROJECT_DIR} && \
|
||||||
|
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 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"
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
apt-get update -qq && \
|
||||||
|
apt-get install -qq ${APT_INSTALL} checkinstall dpkg-dev fakeroot g++ gcc qtbase5-dev qt5-qmake qttranslations5-l10n libqt4-dev libqt5svg5-dev
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,278 @@
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
!define APP_NAME "gta5view"
|
||||||
|
!define COMP_NAME "Syping"
|
||||||
|
!define WEB_SITE "https://gta5view.syping.de/"
|
||||||
|
!define VERSION "1.7.1.0"
|
||||||
|
!define COPYRIGHT "Copyright © 2016-2019 Syping"
|
||||||
|
!define DESCRIPTION "Grand Theft Auto V Savegame and Snapmatic Viewer/Editor"
|
||||||
|
!define INSTALLER_NAME "gta5view_setup.exe"
|
||||||
|
!define MAIN_APP_EXE "gta5view.exe"
|
||||||
|
!define INSTALL_TYPE "SetShellVarContext all"
|
||||||
|
!define REG_ROOT "HKLM"
|
||||||
|
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
|
||||||
|
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
||||||
|
!define LICENSE_TXT "../LICENSE"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
VIProductVersion "${VERSION}"
|
||||||
|
VIAddVersionKey "ProductName" "${APP_NAME}"
|
||||||
|
VIAddVersionKey "ProductVersion" "${VERSION}"
|
||||||
|
VIAddVersionKey "CompanyName" "${COMP_NAME}"
|
||||||
|
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
|
||||||
|
VIAddVersionKey "FileDescription" "${DESCRIPTION}"
|
||||||
|
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
!include "x64.nsh"
|
||||||
|
SetCompressor LZMA
|
||||||
|
Name "${APP_NAME}"
|
||||||
|
Caption "${APP_NAME}"
|
||||||
|
OutFile "${INSTALLER_NAME}"
|
||||||
|
#BrandingText "${APP_NAME}"
|
||||||
|
XPStyle on
|
||||||
|
Unicode true
|
||||||
|
InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
|
||||||
|
InstallDir "$PROGRAMFILES64\Syping\gta5view"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
!include "MUI2.nsh"
|
||||||
|
|
||||||
|
!define MUI_ABORTWARNING
|
||||||
|
!define MUI_UNABORTWARNING
|
||||||
|
|
||||||
|
!define MUI_LANGDLL_REGISTRY_ROOT "${REG_ROOT}"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_KEY "${UNINSTALL_PATH}"
|
||||||
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
||||||
|
|
||||||
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
|
|
||||||
|
!ifdef LICENSE_TXT
|
||||||
|
!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
|
||||||
|
!ifdef REG_START_MENU
|
||||||
|
!define MUI_STARTMENUPAGE_NODISABLE
|
||||||
|
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "gta5view"
|
||||||
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}"
|
||||||
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
|
||||||
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}"
|
||||||
|
!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
|
|
||||||
|
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAIN_APP_EXE}"
|
||||||
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
|
|
||||||
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
|
|
||||||
|
!insertmacro MUI_UNPAGE_FINISH
|
||||||
|
|
||||||
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
!insertmacro MUI_LANGUAGE "French"
|
||||||
|
!insertmacro MUI_LANGUAGE "German"
|
||||||
|
!insertmacro MUI_LANGUAGE "Korean"
|
||||||
|
!insertmacro MUI_LANGUAGE "Russian"
|
||||||
|
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||||
|
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||||
|
|
||||||
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
Function .onInit
|
||||||
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
!ifdef WIN32
|
||||||
|
MessageBox MB_OK|MB_ICONSTOP "Windows 32-Bit is not supported anymore!"
|
||||||
|
Quit
|
||||||
|
!endif
|
||||||
|
SetRegView 64
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
Section -MainProgram
|
||||||
|
${INSTALL_TYPE}
|
||||||
|
SetOverwrite ifnewer
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
File "../build/release/gta5view.exe"
|
||||||
|
File "/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/libgcc_s_seh-1.dll"
|
||||||
|
File "/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32/libstdc++-6.dll"
|
||||||
|
File "/opt/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 "../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 "/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 "/opt/windev/qt64d-latest/plugins/platforms/qwindows.dll"
|
||||||
|
SetOutPath "$INSTDIR\styles"
|
||||||
|
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
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
Section -Icons_Reg
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
!ifdef REG_START_MENU
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
|
CreateDirectory "$SMPROGRAMS\$SM_Folder"
|
||||||
|
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
|
||||||
|
CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
!ifdef WEB_SITE
|
||||||
|
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
|
||||||
|
CreateShortCut "$SMPROGRAMS\$SM_Folder\gta5view Website.lnk" "$INSTDIR\${APP_NAME} website.url"
|
||||||
|
!endif
|
||||||
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifndef REG_START_MENU
|
||||||
|
CreateDirectory "$SMPROGRAMS\gta5view"
|
||||||
|
CreateShortCut "$SMPROGRAMS\gta5view\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}"
|
||||||
|
CreateShortCut "$SMPROGRAMS\gta5view\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
!ifdef WEB_SITE
|
||||||
|
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
|
||||||
|
CreateShortCut "$SMPROGRAMS\gta5view\gta5view Website.lnk" "$INSTDIR\${APP_NAME} website.url"
|
||||||
|
!endif
|
||||||
|
!endif
|
||||||
|
|
||||||
|
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
|
||||||
|
|
||||||
|
!ifdef WEB_SITE
|
||||||
|
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}"
|
||||||
|
!endif
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
Section Uninstall
|
||||||
|
${INSTALL_TYPE}
|
||||||
|
Delete "$INSTDIR\gta5view.exe"
|
||||||
|
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"
|
||||||
|
Delete "$INSTDIR\Qt5Svg.dll"
|
||||||
|
Delete "$INSTDIR\Qt5Widgets.dll"
|
||||||
|
Delete "$INSTDIR\Qt5WinExtras.dll"
|
||||||
|
Delete "$INSTDIR\lang\gta5sync_en_US.qm"
|
||||||
|
Delete "$INSTDIR\lang\gta5sync_de.qm"
|
||||||
|
Delete "$INSTDIR\lang\gta5sync_fr.qm"
|
||||||
|
Delete "$INSTDIR\lang\gta5sync_ko.qm"
|
||||||
|
Delete "$INSTDIR\lang\gta5sync_ru.qm"
|
||||||
|
Delete "$INSTDIR\lang\gta5sync_uk.qm"
|
||||||
|
Delete "$INSTDIR\lang\gta5sync_zh_TW.qm"
|
||||||
|
Delete "$INSTDIR\lang\qtbase_en_GB.qm"
|
||||||
|
Delete "$INSTDIR\lang\qtbase_de.qm"
|
||||||
|
Delete "$INSTDIR\lang\qtbase_fr.qm"
|
||||||
|
Delete "$INSTDIR\lang\qtbase_ko.qm"
|
||||||
|
Delete "$INSTDIR\lang\qtbase_ru.qm"
|
||||||
|
Delete "$INSTDIR\lang\qtbase_uk.qm"
|
||||||
|
Delete "$INSTDIR\lang\qtbase_zh_TW.qm"
|
||||||
|
Delete "$INSTDIR\imageformats\qgif.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qicns.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qico.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qjpeg.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qsvg.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qtga.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qtiff.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qwbmp.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qwebp.dll"
|
||||||
|
Delete "$INSTDIR\platforms\qwindows.dll"
|
||||||
|
Delete "$INSTDIR\styles\qcleanlooksstyle.dll"
|
||||||
|
Delete "$INSTDIR\styles\qplastiquestyle.dll"
|
||||||
|
Delete "$INSTDIR\styles\qwindowsvistastyle.dll"
|
||||||
|
RmDir "$INSTDIR\lang"
|
||||||
|
RmDir "$INSTDIR\imageformats"
|
||||||
|
RmDir "$INSTDIR\platforms"
|
||||||
|
RmDir "$INSTDIR\styles"
|
||||||
|
|
||||||
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
|
!ifdef WEB_SITE
|
||||||
|
Delete "$INSTDIR\${APP_NAME} website.url"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
RmDir "$INSTDIR"
|
||||||
|
|
||||||
|
!ifdef REG_START_MENU
|
||||||
|
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
|
||||||
|
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk"
|
||||||
|
Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk"
|
||||||
|
!ifdef WEB_SITE
|
||||||
|
Delete "$SMPROGRAMS\$SM_Folder\gta5view Website.lnk"
|
||||||
|
!endif
|
||||||
|
RmDir "$SMPROGRAMS\$SM_Folder"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifndef REG_START_MENU
|
||||||
|
Delete "$SMPROGRAMS\gta5view\${APP_NAME}.lnk"
|
||||||
|
Delete "$SMPROGRAMS\gta5view\Uninstall ${APP_NAME}.lnk"
|
||||||
|
!ifdef WEB_SITE
|
||||||
|
Delete "$SMPROGRAMS\gta5view\gta5view Website.lnk"
|
||||||
|
!endif
|
||||||
|
RmDir "$SMPROGRAMS\gta5view"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
|
||||||
|
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
Function un.onInit
|
||||||
|
!insertmacro MUI_UNGETLANGUAGE
|
||||||
|
SetRegView 64
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
######################################################################
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Creating folders
|
||||||
|
cd ${PROJECT_DIR} && \
|
||||||
|
echo "gta5view build version is ${APPLICATION_VERSION}" && \
|
||||||
|
echo "gta5view image name is gta5view-osx_${APPLICATION_VERSION}.dmg" && \
|
||||||
|
mkdir -p build && \
|
||||||
|
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
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
.ci/osx_install.sh && \
|
||||||
|
|
||||||
|
# Build gta5view
|
||||||
|
.ci/osx_build.sh && \
|
||||||
|
cd ${PROJECT_DIR}
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
brew install qt
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Prepare environment variable
|
||||||
|
export GTA5VIEW_EXECUTABLE=gta5view-${EXECUTABLE_VERSION}${EXECUTABLE_ARCH}.exe && \
|
||||||
|
|
||||||
|
# Creating folders
|
||||||
|
cd ${PROJECT_DIR} && \
|
||||||
|
echo "gta5view build version is ${APPLICATION_VERSION}" && \
|
||||||
|
echo "gta5view executable is ${GTA5VIEW_EXECUTABLE}" && \
|
||||||
|
mkdir -p build && \
|
||||||
|
mkdir -p assets && \
|
||||||
|
|
||||||
|
# Starting build
|
||||||
|
cd build && \
|
||||||
|
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 && \
|
||||||
|
cp -Rf release/*.exe ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} && \
|
||||||
|
cd ${PROJECT_DIR}/assets
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DOCKER_IMAGE=sypingauto/gta5view-build:1.7-static
|
||||||
|
PROJECT_DIR_DOCKER=/gta5view
|
||||||
|
|
||||||
|
cd ${PROJECT_DIR} && \
|
||||||
|
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 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 && \
|
||||||
|
|
||||||
|
# Upload Assets to Dropbox
|
||||||
|
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}
|
||||||
|
fi
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/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}" && \
|
||||||
|
mkdir -p build && \
|
||||||
|
mkdir -p assets && \
|
||||||
|
|
||||||
|
# Starting build
|
||||||
|
cd build && \
|
||||||
|
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 && \
|
||||||
|
cd ${PROJECT_DIR}/assets && \
|
||||||
|
makensis -NOCD ${PROJECT_DIR}/.ci/gta5view.nsi && \
|
||||||
|
mv -f gta5view_setup.exe gta5view-${EXECUTABLE_VERSION}_setup.exe
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DOCKER_IMAGE=sypingauto/gta5view-build:1.7-shared
|
||||||
|
PROJECT_DIR_DOCKER=/gta5view
|
||||||
|
|
||||||
|
cd ${PROJECT_DIR} && \
|
||||||
|
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 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"
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
# Development files
|
||||||
|
*.cpp text eol=lf
|
||||||
|
*.h text eol=lf
|
||||||
|
*.ui text eol=lf
|
||||||
|
*.qrc text eol=lf
|
||||||
|
|
||||||
|
# Development resources
|
||||||
|
*.ini text eol=lf
|
||||||
|
|
||||||
|
# Linux development files
|
||||||
|
*.desktop text eol=lf
|
||||||
|
|
||||||
|
# Windows development files
|
||||||
|
*.rc text eol=crlf
|
||||||
|
*.nsi text eol=crlf
|
||||||
|
*.exe.manifest text eol=crlf
|
||||||
|
|
||||||
|
# Binary files
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.qm binary
|
||||||
|
*.ico binary
|
||||||
|
*.icns binary
|
||||||
|
*.xcf binary
|
||||||
|
*.g5e binary
|
|
@ -29,3 +29,7 @@
|
||||||
|
|
||||||
# Qt project user file
|
# Qt project user file
|
||||||
*.pro.user
|
*.pro.user
|
||||||
|
|
||||||
|
# Gettext translation files
|
||||||
|
*.po
|
||||||
|
*.pot
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
|
||||||
|
variables:
|
||||||
|
BUILD_TYPE: "REL"
|
||||||
|
|
||||||
|
Windows Installer:
|
||||||
|
stage: build
|
||||||
|
image: sypingauto/gta5view-build:1.7-shared
|
||||||
|
variables:
|
||||||
|
BUILD_SCRIPT: "wininstall_build.sh"
|
||||||
|
QT_SELECT: "qt5-x86_64-w64-mingw32"
|
||||||
|
script:
|
||||||
|
- .gitlab/gitlab.sh
|
||||||
|
artifacts:
|
||||||
|
name: "gta5view-$CI_COMMIT_REF_NAME-${CI_COMMIT_SHA:0:8}_setup"
|
||||||
|
paths:
|
||||||
|
- "gta5view-*.exe"
|
||||||
|
|
||||||
|
Windows Portable:
|
||||||
|
stage: build
|
||||||
|
image: sypingauto/gta5view-build:1.7-static
|
||||||
|
variables:
|
||||||
|
BUILD_SCRIPT: "windows_build.sh"
|
||||||
|
QT_SELECT: "qt5-x86_64-w64-mingw32"
|
||||||
|
script:
|
||||||
|
- .gitlab/gitlab.sh
|
||||||
|
artifacts:
|
||||||
|
name: "gta5view-$CI_COMMIT_REF_NAME-${CI_COMMIT_SHA:0:8}_portable"
|
||||||
|
paths:
|
||||||
|
- "gta5view-*.exe"
|
Binary file not shown.
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Check if build is not tagged
|
||||||
|
if [ "${CI_COMMIT_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=GitLab
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Init Application Commit Hash
|
||||||
|
export APPLICATION_COMMIT=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
# Start CI script and copying assets into base directory
|
||||||
|
.ci/ci.sh && \
|
||||||
|
cp -Rf assets/* ./
|
58
.travis.yml
58
.travis.yml
|
@ -3,36 +3,52 @@ sudo: required
|
||||||
|
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
|
service:
|
||||||
|
- docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- PACKAGE_VERSION="1.4.0"
|
global:
|
||||||
|
- BUILD_TYPE=REL
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- env:
|
||||||
|
- BUILD_SCRIPT=debian_docker.sh
|
||||||
|
- RELEASE_LABEL="Debian 64-Bit Package"
|
||||||
|
- DEBIAN_VERSION=stretch
|
||||||
|
- DOCKER_USER=amd64
|
||||||
|
- APT_INSTALL=clang
|
||||||
|
- env:
|
||||||
|
- BUILD_SCRIPT=windows_docker.sh
|
||||||
|
- QT_SELECT=qt5-x86_64-w64-mingw32
|
||||||
|
- RELEASE_LABEL="Windows 64-Bit Portable"
|
||||||
|
- env:
|
||||||
|
- BUILD_SCRIPT=windows_docker.sh
|
||||||
|
- QT_SELECT=qt5-x86_64-w64-mingw32
|
||||||
|
- RELEASE_LABEL="Windows 64-Bit Portable for gta5-mods"
|
||||||
|
- PACKAGE_CODE=gta5-mods
|
||||||
|
- env:
|
||||||
|
- BUILD_SCRIPT=wininstall_docker.sh
|
||||||
|
- QT_SELECT=qt5-x86_64-w64-mingw32
|
||||||
|
- RELEASE_LABEL="Windows 64-Bit Installer"
|
||||||
|
- os: osx
|
||||||
|
env:
|
||||||
|
- BUILD_SCRIPT=osx_ci.sh
|
||||||
|
- RELEASE_LABEL="Mac OS X 64-Bit Disk Image"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- test -n $CC && unset CC
|
- ".travis/source.sh"
|
||||||
- test -n $CXX && unset CXX
|
|
||||||
|
|
||||||
install:
|
|
||||||
- sudo apt-get update -qq
|
|
||||||
- sudo apt-get install -qq checkinstall dpkg-dev g++ gcc qtbase5-dev qt5-qmake
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- export INSTALL_ROOT=/usr
|
|
||||||
- if [ `git name-rev --tags --name-only $(git rev-parse HEAD)` == "undefined" ]; then export APPLICATION_VERSION="$PACKAGE_VERSION.$TRAVIS_BUILD_NUMBER"; else export APPLICATION_VERSION=`git name-rev --tags --name-only $(git rev-parse HEAD)`; fi
|
|
||||||
- echo "gta5view build version is $APPLICATION_VERSION"
|
|
||||||
- mkdir build
|
|
||||||
- mkdir package
|
|
||||||
- cd build
|
|
||||||
- echo "Grand Theft Auto V Snapmatic and Savegame viewer" > ./description-pak
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- qmake -qt=5 "DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Release\\\\\\\"" "DEFINES+=GTA5SYNC_DAILYB=\\\\\\\"$APPLICATION_VERSION\\\\\\\"" ../gta5view.pro
|
- ".travis/travis.sh"
|
||||||
- make -j 4
|
|
||||||
- sudo checkinstall -D --default --nodoc --pkgname=gta5view --pkgversion=$APPLICATION_VERSION --pkgrelease=travis1 --pkggroup=utility --maintainer="Syping on Travis \<travisci@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5 --pakdir=../package
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
api_key:
|
api_key:
|
||||||
secure: "o7VneEz1aHfdVwZvOZLfopf6uJWNrFsZaBvunTmXFzpmNFhlNS1qwqgMUkIA2yBRbZ3wIzVs4vfwIHv7W9yE/PqK+AYL+R8+AwKGrwlgT4HqJNuk6VM/LNJ6GwT/qkQuaoOVw29bUjmzzgIRdHmw53SlJv6Hh1VE8HphlTT//aex6nCfcFhUZ0BETdZDWz5FSHwL3NalUoqfKfQrJeky5RXzCyCANQC2tKt0bV46GaWIgWrDo2KCTNqPtRWWf5GDmnkXE5IYRMQ3mXvO9iYh0v5Y2jo4PiXGUiFUU6Z3aAWFAiPdGclrBO697cf3lCTzDMhuCETR153qFYsLShUlFf61ITAmCeHAWETjZDri0lmPONo3GoNB6alGfYEA51qw14kXakrTpICtTJj7gw/gtUYOabW6hrzmieNzMBIy62RikDPjyakFnuwW2qNHRlD65e0jYv+6nCpb6E+OV16Ysh1zhV2vTfpfzVmSuyu2J+ELqXD3OZCXRSPpDIih9UQ8335p8FBji6jHORcgym/TRgdgRmENibh8tLzWp+UjpWHuWfcpvZgOskjfwU0iDMCayMJ7tDpOhXHcAhDRnd6XRIiOJ5YZCzflj2nEwmt3YUd7DwXS/AU+WHOmcNQBjXBxF/FJa35XXcy3HKJM5TTKqtph3medo30us5yXHeG6NNg="
|
secure: o7VneEz1aHfdVwZvOZLfopf6uJWNrFsZaBvunTmXFzpmNFhlNS1qwqgMUkIA2yBRbZ3wIzVs4vfwIHv7W9yE/PqK+AYL+R8+AwKGrwlgT4HqJNuk6VM/LNJ6GwT/qkQuaoOVw29bUjmzzgIRdHmw53SlJv6Hh1VE8HphlTT//aex6nCfcFhUZ0BETdZDWz5FSHwL3NalUoqfKfQrJeky5RXzCyCANQC2tKt0bV46GaWIgWrDo2KCTNqPtRWWf5GDmnkXE5IYRMQ3mXvO9iYh0v5Y2jo4PiXGUiFUU6Z3aAWFAiPdGclrBO697cf3lCTzDMhuCETR153qFYsLShUlFf61ITAmCeHAWETjZDri0lmPONo3GoNB6alGfYEA51qw14kXakrTpICtTJj7gw/gtUYOabW6hrzmieNzMBIy62RikDPjyakFnuwW2qNHRlD65e0jYv+6nCpb6E+OV16Ysh1zhV2vTfpfzVmSuyu2J+ELqXD3OZCXRSPpDIih9UQ8335p8FBji6jHORcgym/TRgdgRmENibh8tLzWp+UjpWHuWfcpvZgOskjfwU0iDMCayMJ7tDpOhXHcAhDRnd6XRIiOJ5YZCzflj2nEwmt3YUd7DwXS/AU+WHOmcNQBjXBxF/FJa35XXcy3HKJM5TTKqtph3medo30us5yXHeG6NNg=
|
||||||
file: "../package/gta5view_$APPLICATION_VERSION-travis1_amd64.deb"
|
label: ${RELEASE_LABEL}
|
||||||
|
file_glob: true
|
||||||
|
file: assets/*
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
Poァ鏖<EFBFBD>劾ラ<作1x」%几<>ャネw|RtZv<>kホ銓顴Z肄2チ廁湮ォ`<1A>ム,4vヨマ・@<>ヲeハ・~U$+<2B><><EFBFBD><1A><牾&蓬熙
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
rm -rf tmext/TelemetryClassAuthenticator.cpp && \
|
||||||
|
openssl aes-256-cbc -K $encrypted_db000a5d87d6_key -iv $encrypted_db000a5d87d6_iv -in .travis/TelemetryClassAuthenticator.cpp.enc -out tmext/TelemetryClassAuthenticator.cpp -d && \
|
||||||
|
openssl aes-256-cbc -K $encrypted_d57e7d2f8877_key -iv $encrypted_d57e7d2f8877_iv -in .travis/dropbox_uploader.enc -out ~/.dropbox_uploader -d
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install lua
|
||||||
|
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
|
||||||
|
brew install lua
|
||||||
|
else
|
||||||
|
sudo apt-get update -qq && \
|
||||||
|
sudo apt-get install -qq lua5.2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if build is not tagged
|
||||||
|
if [ "${TRAVIS_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=GitHub
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Init Application Commit Hash
|
||||||
|
export APPLICATION_COMMIT=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
# Start CI script
|
||||||
|
.ci/ci.sh
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
sudo .ci/debian_install.sh && \
|
||||||
|
|
||||||
|
# Build gta5view
|
||||||
|
sudo .ci/debian_build.sh && \
|
||||||
|
cd ${PROJECT_DIR}
|
|
@ -1,121 +1,135 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2019 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <QStringBuilder>
|
#include <QDesktopServices>
|
||||||
#include "AboutDialog.h"
|
#include <QStringBuilder>
|
||||||
#include "ui_AboutDialog.h"
|
#include <QMessageBox>
|
||||||
#include "AppEnv.h"
|
#include "AboutDialog.h"
|
||||||
#include "config.h"
|
#include "ui_AboutDialog.h"
|
||||||
|
#include "AppEnv.h"
|
||||||
AboutDialog::AboutDialog(QWidget *parent) :
|
#include "config.h"
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::AboutDialog)
|
AboutDialog::AboutDialog(QWidget *parent) :
|
||||||
{
|
QDialog(parent),
|
||||||
// Set Window Flags
|
ui(new Ui::AboutDialog)
|
||||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
{
|
||||||
|
// Set Window Flags
|
||||||
// Build Strings
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
QString appVersion = qApp->applicationVersion();
|
|
||||||
QString buildType = GTA5SYNC_BUILDTYPE;
|
// Build Strings
|
||||||
buildType.replace("_", " ");
|
QString appVersion = qApp->applicationVersion();
|
||||||
QString projectBuild = GTA5SYNC_BUILDDATETIME;
|
QString buildType = tr(GTA5SYNC_BUILDTYPE);
|
||||||
QString buildStr = GTA5SYNC_BUILDSTRING;
|
buildType.replace("_", " ");
|
||||||
|
QString projectBuild = AppEnv::getBuildDateTime();
|
||||||
// Additional Content
|
QString buildStr = GTA5SYNC_BUILDSTRING;
|
||||||
QString usingStr = tr("Using %1 %2", "Exp. Using libmyfuck");
|
#ifndef GTA5SYNC_BUILDTYPE_REL
|
||||||
QString translatedByStr = tr("Translated by %1", "Exp. Translated by Syping");
|
#ifdef GTA5SYNC_COMMIT
|
||||||
QString translatedByVal = tr("NAME_OF_TRANSLATOR", "Your Name (The person behind your screen looking at this text!)");
|
if (!appVersion.contains("-")) { appVersion = appVersion % "-" % GTA5SYNC_COMMIT; }
|
||||||
QString translatorProfile = tr("TRANSLATOR_PROFILE", "mailto: http:// https:// Exp. https://github.com/Syping/");
|
#endif
|
||||||
QString additionalContent = "";
|
#endif
|
||||||
if (translatedByVal != "NAME_OF_TRANSLATOR")
|
|
||||||
{
|
// Translator Comments
|
||||||
if (translatorProfile != "TRANSLATOR_PROFILE")
|
//: Translated by translator, example Translated by Syping
|
||||||
{
|
QString translatedByStr = tr("Translated by %1");
|
||||||
additionalContent.append(translatedByStr.arg(QString("<a href=\"%1\">%2</a>").arg(translatorProfile, translatedByVal)));
|
//: Insert your name here and profile here in following scheme, First Translator,First Profile\\nSecond Translator\\nThird Translator,Second Profile
|
||||||
}
|
QString translatorVal = tr("TRANSLATOR");
|
||||||
else
|
QStringList translatorContent;
|
||||||
{
|
if (translatorVal != "TRANSLATOR")
|
||||||
additionalContent.append(translatedByStr.arg(translatedByVal));
|
{
|
||||||
}
|
const QStringList translatorList = translatorVal.split('\n');
|
||||||
}
|
for (const QString &translatorStr : translatorList)
|
||||||
#ifdef WITH_LIBJPEGTURBO // DONT USE IT FOR NOW
|
{
|
||||||
bool additionalContentClip = false;
|
QStringList translatorStrList = translatorStr.split(',');
|
||||||
if (!additionalContent.isEmpty())
|
QString translatorName = translatorStrList.at(0);
|
||||||
{
|
translatorStrList.removeFirst();
|
||||||
additionalContentClip = true;
|
QString translatorProfile = translatorStrList.join(QString());
|
||||||
additionalContent.append(" (");
|
if (!translatorProfile.isEmpty())
|
||||||
}
|
{
|
||||||
additionalContent.append(usingStr.arg("libjpegturbo", WITH_LIBJPEGTURBO));
|
translatorContent += QString("<a href=\"%1\">%2</a>").arg(translatorProfile, translatorName);
|
||||||
if (additionalContentClip)
|
}
|
||||||
{
|
else
|
||||||
additionalContent.append(")");
|
{
|
||||||
}
|
translatorContent += translatorName;
|
||||||
#else
|
}
|
||||||
Q_UNUSED(usingStr)
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// Project Description
|
// Project Description
|
||||||
#ifdef GTA5SYNC_ENABLED
|
QString projectDes = tr("A project for viewing Grand Theft Auto V Snapmatic<br/>\nPictures and Savegames");
|
||||||
QString projectDes = tr("A project for viewing and sync Grand Theft Auto V Snapmatic<br/>\nPictures and Savegames");
|
|
||||||
#else
|
// Copyright Description
|
||||||
QString projectDes = tr("A project for viewing Grand Theft Auto V Snapmatic<br/>\nPictures and Savegames");
|
QString copyrightDes1 = tr("Copyright © <a href=\"%1\">%2</a> %3");
|
||||||
#endif
|
copyrightDes1 = copyrightDes1.arg(GTA5SYNC_APPVENDORLINK, GTA5SYNC_APPVENDOR, GTA5SYNC_COPYRIGHT);
|
||||||
|
QString copyrightDes2 = tr("%1 is licensed under <a href=\"https://www.gnu.org/licenses/gpl-3.0.html#content\">GNU GPLv3</a>");
|
||||||
// Copyright Description
|
copyrightDes2 = copyrightDes2.arg(GTA5SYNC_APPSTR);
|
||||||
QString copyrightDes1 = tr("Copyright © <a href=\"%1\">%2</a> %3");
|
QString copyrightDesA;
|
||||||
copyrightDes1 = copyrightDes1.arg(GTA5SYNC_APPVENDORLINK, GTA5SYNC_APPVENDOR, GTA5SYNC_COPYRIGHT);
|
if (!translatorContent.isEmpty())
|
||||||
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);
|
copyrightDesA = copyrightDes1 % "<br/>" % translatedByStr.arg(translatorContent.join(", ")) % "<br/>" % copyrightDes2;
|
||||||
QString copyrightDesA;
|
}
|
||||||
if (!additionalContent.isEmpty())
|
else
|
||||||
{
|
{
|
||||||
copyrightDesA = copyrightDes1 % "<br/>" % additionalContent % "<br/>" % copyrightDes2;
|
copyrightDesA = copyrightDes1 % "<br/>" % copyrightDes2;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// Setup User Interface
|
||||||
copyrightDesA = copyrightDes1 % "<br/>" % copyrightDes2;
|
ui->setupUi(this);
|
||||||
}
|
aboutStr = ui->labAbout->text();
|
||||||
|
titleStr = this->windowTitle();
|
||||||
// Setup User Interface
|
ui->labAbout->setText(aboutStr.arg(GTA5SYNC_APPSTR, projectDes, appVersion % " (" % buildType % ")", projectBuild, buildStr, qVersion(), copyrightDesA));
|
||||||
ui->setupUi(this);
|
this->setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR));
|
||||||
aboutStr = ui->labAbout->text();
|
|
||||||
titleStr = this->windowTitle();
|
// Set Icon for Close Button
|
||||||
ui->labAbout->setText(aboutStr.arg(GTA5SYNC_APPSTR, projectDes, appVersion % " (" % buildType % ")", projectBuild, buildStr, qVersion(), copyrightDesA));
|
if (QIcon::hasThemeIcon("dialog-close"))
|
||||||
this->setWindowTitle(titleStr.arg(GTA5SYNC_APPSTR));
|
{
|
||||||
|
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
||||||
if (QIcon::hasThemeIcon("dialog-close"))
|
}
|
||||||
{
|
else if (QIcon::hasThemeIcon("gtk-close"))
|
||||||
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
{
|
||||||
}
|
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
|
||||||
|
}
|
||||||
// DPI calculation
|
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
// DPI calculation
|
||||||
if (!additionalContent.isEmpty())
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
{
|
if (!translatorContent.isEmpty())
|
||||||
resize(375 * screenRatio, 270 * screenRatio);
|
{
|
||||||
}
|
resize(375 * screenRatio, 270 * screenRatio);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
resize(375 * screenRatio, 260 * screenRatio);
|
{
|
||||||
}
|
resize(375 * screenRatio, 260 * screenRatio);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
AboutDialog::~AboutDialog()
|
|
||||||
{
|
AboutDialog::~AboutDialog()
|
||||||
delete ui;
|
{
|
||||||
}
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AboutDialog::on_labAbout_linkActivated(const QString &link)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl(QUrl(link));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,44 +1,45 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef ABOUTDIALOG_H
|
#ifndef ABOUTDIALOG_H
|
||||||
#define ABOUTDIALOG_H
|
#define ABOUTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AboutDialog;
|
class AboutDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AboutDialog : public QDialog
|
class AboutDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AboutDialog(QWidget *parent = 0);
|
explicit AboutDialog(QWidget *parent = 0);
|
||||||
~AboutDialog();
|
~AboutDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_labAbout_linkActivated(const QString &link);
|
||||||
private:
|
|
||||||
Ui::AboutDialog *ui;
|
private:
|
||||||
QString aboutStr;
|
Ui::AboutDialog *ui;
|
||||||
QString titleStr;
|
QString aboutStr;
|
||||||
};
|
QString titleStr;
|
||||||
|
};
|
||||||
#endif // ABOUTDIALOG_H
|
|
||||||
|
#endif // ABOUTDIALOG_H
|
||||||
|
|
|
@ -1,102 +1,102 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AboutDialog</class>
|
<class>AboutDialog</class>
|
||||||
<widget class="QDialog" name="AboutDialog">
|
<widget class="QDialog" name="AboutDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>375</width>
|
<width>375</width>
|
||||||
<height>260</height>
|
<height>260</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>About %1</string>
|
<string>About %1</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlAbout">
|
<layout class="QVBoxLayout" name="vlAbout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labAbout">
|
<widget class="QLabel" name="labAbout">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><span style=" font-weight:600;">%1</span><br/>
|
<string><span style=" font-weight:600;">%1</span><br/>
|
||||||
<br/>
|
<br/>
|
||||||
%2<br/>
|
%2<br/>
|
||||||
<br/>
|
<br/>
|
||||||
Version %3<br/>
|
Version %3<br/>
|
||||||
Created on %4<br/>
|
Created on %4<br/>
|
||||||
Built with Qt %5<br/>
|
Built with Qt %5<br/>
|
||||||
Running with Qt %6<br/>
|
Running with Qt %6<br/>
|
||||||
<br/>
|
<br/>
|
||||||
%7</string>
|
%7</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
<property name="textInteractionFlags">
|
||||||
<bool>true</bool>
|
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hsButtons">
|
<spacer name="hsButtons">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdClose">
|
<widget class="QPushButton" name="cmdClose">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Close</string>
|
<string>&Close</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>cmdClose</sender>
|
<sender>cmdClose</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>AboutDialog</receiver>
|
<receiver>AboutDialog</receiver>
|
||||||
<slot>close()</slot>
|
<slot>close()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>327</x>
|
<x>327</x>
|
||||||
<y>228</y>
|
<y>228</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>187</x>
|
<x>187</x>
|
||||||
<y>124</y>
|
<y>124</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -1,155 +1,520 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include "StringParser.h"
|
#include "StringParser.h"
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QDesktopWidget>
|
#include <QStringBuilder>
|
||||||
#include <QApplication>
|
#include <QDesktopWidget>
|
||||||
#include <QSettings>
|
#include <QApplication>
|
||||||
#include <QScreen>
|
#include <QSettings>
|
||||||
#include <QDebug>
|
#include <QScreen>
|
||||||
#include <QRect>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QRect>
|
||||||
#include <iostream>
|
#include <QDir>
|
||||||
using namespace std;
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
AppEnv::AppEnv()
|
|
||||||
{
|
AppEnv::AppEnv()
|
||||||
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
// Folder Stuff
|
|
||||||
|
// Build Stuff
|
||||||
QString AppEnv::getGameFolder(bool *ok)
|
|
||||||
{
|
QString AppEnv::getBuildDateTime()
|
||||||
QDir dir;
|
{
|
||||||
QString GTAV_FOLDER = QString::fromUtf8(qgetenv("GTAV_FOLDER"));
|
return GTA5SYNC_BUILDDATETIME;
|
||||||
if (GTAV_FOLDER != "")
|
}
|
||||||
{
|
|
||||||
dir.setPath(GTAV_FOLDER);
|
QString AppEnv::getBuildCode()
|
||||||
if (dir.exists())
|
{
|
||||||
{
|
return GTA5SYNC_BUILDCODE;
|
||||||
if (ok != NULL) *ok = true;
|
}
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
|
||||||
return dir.absolutePath();
|
// Folder Stuff
|
||||||
}
|
|
||||||
}
|
QString AppEnv::getGameFolder(bool *ok)
|
||||||
|
{
|
||||||
QString GTAV_defaultFolder = StandardPaths::documentsLocation() + QDir::separator() + "Rockstar Games" + QDir::separator() + "GTA V";
|
QDir dir;
|
||||||
QString GTAV_returnFolder = GTAV_defaultFolder;
|
QString GTAV_FOLDER = QString::fromUtf8(qgetenv("GTAV_FOLDER"));
|
||||||
|
if (GTAV_FOLDER != "")
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
{
|
||||||
settings.beginGroup("dir");
|
dir.setPath(GTAV_FOLDER);
|
||||||
bool forceDir = settings.value("force", false).toBool();
|
if (dir.exists())
|
||||||
GTAV_returnFolder = settings.value("dir", GTAV_defaultFolder).toString();
|
{
|
||||||
settings.endGroup();
|
if (ok != NULL) *ok = true;
|
||||||
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
if (forceDir)
|
return dir.absolutePath();
|
||||||
{
|
}
|
||||||
dir.setPath(GTAV_returnFolder);
|
}
|
||||||
if (dir.exists())
|
|
||||||
{
|
QString GTAV_defaultFolder = StandardPaths::documentsLocation() % QDir::separator() % "Rockstar Games" % QDir::separator() % "GTA V";
|
||||||
if (ok != 0) *ok = true;
|
QString GTAV_returnFolder = GTAV_defaultFolder;
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
|
||||||
return dir.absolutePath();
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
}
|
settings.beginGroup("dir");
|
||||||
}
|
bool forceDir = settings.value("force", false).toBool();
|
||||||
|
GTAV_returnFolder = settings.value("dir", GTAV_defaultFolder).toString();
|
||||||
dir.setPath(GTAV_defaultFolder);
|
settings.endGroup();
|
||||||
if (dir.exists())
|
|
||||||
{
|
if (forceDir)
|
||||||
if (ok != 0) *ok = true;
|
{
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
dir.setPath(GTAV_returnFolder);
|
||||||
return dir.absolutePath();
|
if (dir.exists())
|
||||||
}
|
{
|
||||||
|
if (ok != 0) *ok = true;
|
||||||
if (!forceDir)
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
{
|
return dir.absolutePath();
|
||||||
dir.setPath(GTAV_returnFolder);
|
}
|
||||||
if (dir.exists())
|
}
|
||||||
{
|
|
||||||
if (ok != 0) *ok = true;
|
dir.setPath(GTAV_defaultFolder);
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
if (dir.exists())
|
||||||
return dir.absolutePath();
|
{
|
||||||
}
|
if (ok != 0) *ok = true;
|
||||||
}
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
|
return dir.absolutePath();
|
||||||
if (ok != 0) *ok = false;
|
}
|
||||||
return "";
|
|
||||||
}
|
if (!forceDir)
|
||||||
|
{
|
||||||
bool AppEnv::setGameFolder(QString gameFolder)
|
dir.setPath(GTAV_returnFolder);
|
||||||
{
|
if (dir.exists())
|
||||||
QDir dir;
|
{
|
||||||
dir.setPath(gameFolder);
|
if (ok != 0) *ok = true;
|
||||||
if (dir.exists())
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
{
|
return dir.absolutePath();
|
||||||
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
}
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
return false;
|
if (ok != 0) *ok = false;
|
||||||
}
|
return "";
|
||||||
|
}
|
||||||
QString AppEnv::getLangFolder()
|
|
||||||
{
|
bool AppEnv::setGameFolder(QString gameFolder)
|
||||||
return StringParser::convertBuildedString(QString::fromUtf8(GTA5SYNC_LANG));
|
{
|
||||||
}
|
QDir dir;
|
||||||
|
dir.setPath(gameFolder);
|
||||||
QString AppEnv::getPluginsFolder()
|
if (dir.exists())
|
||||||
{
|
{
|
||||||
return StringParser::convertBuildedString(QString::fromUtf8(GTA5SYNC_PLUG));
|
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
// Web Stuff
|
return false;
|
||||||
|
}
|
||||||
QByteArray AppEnv::getUserAgent()
|
|
||||||
{
|
QString AppEnv::getExLangFolder()
|
||||||
return QString("Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 %1/%2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8();
|
{
|
||||||
}
|
return StringParser::convertBuildedString(GTA5SYNC_LANG);
|
||||||
|
}
|
||||||
// QUrl AppEnv::getCrewFetchingUrl(QString crewID)
|
|
||||||
// {
|
QString AppEnv::getInLangFolder()
|
||||||
// return QUrl(QString("https://socialclub.rockstargames.com/reference/crewfeed/%1").arg(crewID));
|
{
|
||||||
// }
|
#ifdef GTA5SYNC_QCONF
|
||||||
|
#ifdef GTA5SYNC_INLANG
|
||||||
QUrl AppEnv::getCrewFetchingUrl(QString crewID)
|
return StringParser::convertBuildedString(GTA5SYNC_INLANG);
|
||||||
{
|
#else
|
||||||
return QUrl(QString("https://socialclub.rockstargames.com/crew/%1/%1").arg(crewID));
|
return StringParser::convertBuildedString(GTA5SYNC_SHARE % QLatin1String("SEPARATOR:APPNAME:SEPARATOR:translations"));
|
||||||
}
|
#endif
|
||||||
|
#else
|
||||||
QUrl AppEnv::getPlayerFetchingUrl(QString crewID, QString pageNumber)
|
#ifdef GTA5SYNC_INLANG
|
||||||
{
|
return StringParser::convertBuildedString(GTA5SYNC_INLANG);
|
||||||
return QUrl(QString("https://socialclub.rockstargames.com/crewsapi/GetMembersList?crewId=%1&pageNumber=%2").arg(crewID, pageNumber));
|
#else
|
||||||
}
|
return QString(":/tr");
|
||||||
|
#endif
|
||||||
qreal AppEnv::screenRatio()
|
#endif
|
||||||
{
|
}
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
QString AppEnv::getPluginsFolder()
|
||||||
#else
|
{
|
||||||
qreal dpi = qApp->desktop()->logicalDpiX();
|
return StringParser::convertBuildedString(GTA5SYNC_PLUG);
|
||||||
#endif
|
}
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
return (dpi / 72);
|
// Web Stuff
|
||||||
#else
|
|
||||||
return (dpi / 96);
|
QByteArray AppEnv::getUserAgent()
|
||||||
#endif
|
{
|
||||||
}
|
#if QT_VERSION >= 0x050400
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
QString kernelVersion = QSysInfo::kernelVersion();
|
||||||
|
const QStringList &kernelVersionList = kernelVersion.split(".");
|
||||||
|
if (kernelVersionList.length() > 2)
|
||||||
|
{
|
||||||
|
kernelVersion = kernelVersionList.at(0) % "." % kernelVersionList.at(1);
|
||||||
|
}
|
||||||
|
QString runArch = QSysInfo::buildCpuArchitecture();
|
||||||
|
if (runArch == "x86_64")
|
||||||
|
{
|
||||||
|
runArch = "Win64; x64";
|
||||||
|
}
|
||||||
|
else if (runArch == "i686")
|
||||||
|
{
|
||||||
|
const QString &curArch = QSysInfo::currentCpuArchitecture();
|
||||||
|
if (curArch == "x86_64")
|
||||||
|
{
|
||||||
|
runArch = "WOW64";
|
||||||
|
}
|
||||||
|
else if (curArch == "i686")
|
||||||
|
{
|
||||||
|
runArch = "Win32; x86";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QString("Mozilla/5.0 (Windows NT %1; %2) %3/%4").arg(kernelVersion, runArch, GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8();
|
||||||
|
#else
|
||||||
|
return QString("Mozilla/5.0 (%1; %2) %3/%4").arg(QSysInfo::kernelType(), QSysInfo::kernelVersion(), GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8();
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
return QString("Mozilla/5.0 %1/%2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// QUrl AppEnv::getCrewFetchingUrl(QString crewID)
|
||||||
|
// {
|
||||||
|
// return QUrl(QString("https://socialclub.rockstargames.com/reference/crewfeed/%1").arg(crewID));
|
||||||
|
// }
|
||||||
|
|
||||||
|
QUrl AppEnv::getCrewFetchingUrl(QString crewID)
|
||||||
|
{
|
||||||
|
return QUrl(QString("https://socialclub.rockstargames.com/crew/%1/%1").arg(crewID));
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl AppEnv::getPlayerFetchingUrl(QString crewID, QString pageNumber)
|
||||||
|
{
|
||||||
|
return QUrl(QString("https://socialclub.rockstargames.com/crewsapi/GetMembersList?crewId=%1&pageNumber=%2&pageSize=5000").arg(crewID, pageNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl AppEnv::getPlayerFetchingUrl(QString crewID, int pageNumber)
|
||||||
|
{
|
||||||
|
return getPlayerFetchingUrl(crewID, QString::number(pageNumber));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Game Stuff
|
||||||
|
|
||||||
|
GameVersion AppEnv::getGameVersion()
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
QString argumentValue;
|
||||||
|
#ifdef _WIN64
|
||||||
|
argumentValue = "\\WOW6432Node";
|
||||||
|
#endif
|
||||||
|
QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
|
||||||
|
QString installFolderSc = registrySettingsSc.value("InstallFolder", "").toString();
|
||||||
|
QDir installFolderScDir(installFolderSc);
|
||||||
|
bool scVersionInstalled = false;
|
||||||
|
if (!installFolderSc.isEmpty() && installFolderScDir.exists())
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "gameVersionFoundSocialClubVersion";
|
||||||
|
#endif
|
||||||
|
scVersionInstalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\GTAV").arg(argumentValue), QSettings::NativeFormat);
|
||||||
|
QString installFolderSteam = registrySettingsSteam.value("installfoldersteam", "").toString();
|
||||||
|
if (installFolderSteam.right(5) == "\\GTAV")
|
||||||
|
{
|
||||||
|
installFolderSteam = installFolderSteam.remove(installFolderSteam.length() - 5, 5);
|
||||||
|
}
|
||||||
|
QDir installFolderSteamDir(installFolderSteam);
|
||||||
|
bool steamVersionInstalled = false;
|
||||||
|
if (!installFolderSteam.isEmpty() && installFolderSteamDir.exists())
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "gameVersionFoundSteamVersion";
|
||||||
|
#endif
|
||||||
|
steamVersionInstalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scVersionInstalled && steamVersionInstalled)
|
||||||
|
{
|
||||||
|
return GameVersion::BothVersions;
|
||||||
|
}
|
||||||
|
else if (scVersionInstalled)
|
||||||
|
{
|
||||||
|
return GameVersion::SocialClubVersion;
|
||||||
|
}
|
||||||
|
else if (steamVersionInstalled)
|
||||||
|
{
|
||||||
|
return GameVersion::SteamVersion;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GameVersion::NoVersion;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return GameVersion::NoVersion;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
|
||||||
|
{
|
||||||
|
if (gameVersion == GameVersion::SocialClubVersion)
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
QString argumentValue;
|
||||||
|
#ifdef _WIN64
|
||||||
|
argumentValue = "\\WOW6432Node";
|
||||||
|
#endif
|
||||||
|
QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
|
||||||
|
QString languageSc = registrySettingsSc.value("Language", "").toString();
|
||||||
|
return gameLanguageFromString(languageSc);
|
||||||
|
#else
|
||||||
|
return GameLanguage::Undefined;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (gameVersion == GameVersion::SteamVersion)
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
QString argumentValue;
|
||||||
|
#ifdef _WIN64
|
||||||
|
argumentValue = "\\WOW6432Node";
|
||||||
|
#endif
|
||||||
|
QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V Steam").arg(argumentValue), QSettings::NativeFormat);
|
||||||
|
QString languageSteam = registrySettingsSteam.value("Language", "").toString();
|
||||||
|
return gameLanguageFromString(languageSteam);
|
||||||
|
#else
|
||||||
|
return GameLanguage::Undefined;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GameLanguage::Undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLanguage AppEnv::gameLanguageFromString(QString gameLanguage)
|
||||||
|
{
|
||||||
|
if (gameLanguage == "en-US")
|
||||||
|
{
|
||||||
|
return GameLanguage::English;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "fr-FR")
|
||||||
|
{
|
||||||
|
return GameLanguage::French;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "it-IT")
|
||||||
|
{
|
||||||
|
return GameLanguage::Italian;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "de-DE")
|
||||||
|
{
|
||||||
|
return GameLanguage::German;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "es-ES")
|
||||||
|
{
|
||||||
|
return GameLanguage::Spanish;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "es-MX")
|
||||||
|
{
|
||||||
|
return GameLanguage::Mexican;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "pt-BR")
|
||||||
|
{
|
||||||
|
return GameLanguage::Brasilian;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "ru-RU")
|
||||||
|
{
|
||||||
|
return GameLanguage::Russian;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "pl-PL")
|
||||||
|
{
|
||||||
|
return GameLanguage::Polish;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "ja-JP")
|
||||||
|
{
|
||||||
|
return GameLanguage::Japanese;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "zh-CHS")
|
||||||
|
{
|
||||||
|
return GameLanguage::SChinese;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "zh-CHT")
|
||||||
|
{
|
||||||
|
return GameLanguage::TChinese;
|
||||||
|
}
|
||||||
|
else if (gameLanguage == "ko-KR")
|
||||||
|
{
|
||||||
|
return GameLanguage::Koreana;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GameLanguage::Undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AppEnv::gameLanguageToString(GameLanguage gameLanguage)
|
||||||
|
{
|
||||||
|
if (gameLanguage == GameLanguage::English)
|
||||||
|
{
|
||||||
|
return "en-US";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::French)
|
||||||
|
{
|
||||||
|
return "fr-FR";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Italian)
|
||||||
|
{
|
||||||
|
return "it-IT";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::German)
|
||||||
|
{
|
||||||
|
return "de-DE";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Spanish)
|
||||||
|
{
|
||||||
|
return "es-ES";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Mexican)
|
||||||
|
{
|
||||||
|
return "es-MX";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Brasilian)
|
||||||
|
{
|
||||||
|
return "pt-BR";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Russian)
|
||||||
|
{
|
||||||
|
return "ru-RU";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Polish)
|
||||||
|
{
|
||||||
|
return "pl-PL";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Japanese)
|
||||||
|
{
|
||||||
|
return "ja-JP";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::SChinese)
|
||||||
|
{
|
||||||
|
return "zh-CHS";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::TChinese)
|
||||||
|
{
|
||||||
|
return "zh-CHT";
|
||||||
|
}
|
||||||
|
else if (gameLanguage == GameLanguage::Koreana)
|
||||||
|
{
|
||||||
|
return "ko-KR";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "Undefinied";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
|
||||||
|
{
|
||||||
|
bool socialClubVersion = false;
|
||||||
|
bool steamVersion = false;
|
||||||
|
if (gameVersion == GameVersion::SocialClubVersion)
|
||||||
|
{
|
||||||
|
socialClubVersion = true;
|
||||||
|
}
|
||||||
|
else if (gameVersion == GameVersion::SteamVersion)
|
||||||
|
{
|
||||||
|
steamVersion = true;
|
||||||
|
}
|
||||||
|
else if (gameVersion == GameVersion::BothVersions)
|
||||||
|
{
|
||||||
|
socialClubVersion = true;
|
||||||
|
steamVersion = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (socialClubVersion)
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
QString argumentValue;
|
||||||
|
#ifdef _WIN64
|
||||||
|
argumentValue = "\\WOW6432Node";
|
||||||
|
#endif
|
||||||
|
QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
|
||||||
|
if (gameLanguage != GameLanguage::Undefined)
|
||||||
|
{
|
||||||
|
registrySettingsSc.setValue("Language", gameLanguageToString(gameLanguage));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
registrySettingsSc.remove("Language");
|
||||||
|
}
|
||||||
|
registrySettingsSc.sync();
|
||||||
|
if (registrySettingsSc.status() != QSettings::NoError)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Q_UNUSED(gameLanguage)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (steamVersion)
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
QString argumentValue;
|
||||||
|
#ifdef _WIN64
|
||||||
|
argumentValue = "\\WOW6432Node";
|
||||||
|
#endif
|
||||||
|
QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V Steam").arg(argumentValue), QSettings::NativeFormat);
|
||||||
|
if (gameLanguage != GameLanguage::Undefined)
|
||||||
|
{
|
||||||
|
registrySettingsSteam.setValue("Language", gameLanguageToString(gameLanguage));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
registrySettingsSteam.remove("Language");
|
||||||
|
}
|
||||||
|
registrySettingsSteam.sync();
|
||||||
|
if (registrySettingsSteam.status() != QSettings::NoError)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Q_UNUSED(gameLanguage)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Screen Stuff
|
||||||
|
|
||||||
|
qreal AppEnv::screenRatio()
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
qreal dpi = QGuiApplication::primaryScreen()->logicalDotsPerInch();
|
||||||
|
#else
|
||||||
|
qreal dpi = qApp->desktop()->logicalDpiX();
|
||||||
|
#endif
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
return (dpi / 72);
|
||||||
|
#else
|
||||||
|
return (dpi / 96);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal AppEnv::screenRatioPR()
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
|
return QGuiApplication::primaryScreen()->devicePixelRatio();
|
||||||
|
#else
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -1,45 +1,62 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2018 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef APPENV_H
|
#ifndef APPENV_H
|
||||||
#define APPENV_H
|
#define APPENV_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
class AppEnv
|
enum class GameVersion : int { NoVersion = 0, SocialClubVersion = 1, SteamVersion = 2, BothVersions = 3 };
|
||||||
{
|
enum class GameLanguage : int { Undefined = 0, English = 1, French = 2, Italian = 3, German = 4, Spanish = 5, Mexican = 6, Brasilian = 7, Russian = 8, Polish = 9, Japanese = 10, SChinese = 11, TChinese = 12, Koreana = 13 };
|
||||||
public:
|
|
||||||
AppEnv();
|
class AppEnv
|
||||||
|
{
|
||||||
// Folder Stuff
|
public:
|
||||||
static QString getGameFolder(bool *ok = 0);
|
AppEnv();
|
||||||
static bool setGameFolder(QString gameFolder);
|
|
||||||
static QString getLangFolder();
|
// Build Stuff
|
||||||
static QString getPluginsFolder();
|
static QString getBuildDateTime();
|
||||||
|
static QString getBuildCode();
|
||||||
// Web Stuff
|
|
||||||
static QByteArray getUserAgent();
|
// Folder Stuff
|
||||||
static QUrl getCrewFetchingUrl(QString crewID);
|
static QString getGameFolder(bool *ok = 0);
|
||||||
static QUrl getPlayerFetchingUrl(QString crewID, QString pageNumber);
|
static bool setGameFolder(QString gameFolder);
|
||||||
|
static QString getExLangFolder();
|
||||||
// Screen Stuff
|
static QString getInLangFolder();
|
||||||
static qreal screenRatio();
|
static QString getPluginsFolder();
|
||||||
};
|
|
||||||
|
// Web Stuff
|
||||||
#endif // APPENV_H
|
static QByteArray getUserAgent();
|
||||||
|
static QUrl getCrewFetchingUrl(QString crewID);
|
||||||
|
static QUrl getPlayerFetchingUrl(QString crewID, QString pageNumber);
|
||||||
|
static QUrl getPlayerFetchingUrl(QString crewID, int pageNumber);
|
||||||
|
|
||||||
|
// Game Stuff
|
||||||
|
static GameVersion getGameVersion();
|
||||||
|
static GameLanguage getGameLanguage(GameVersion gameVersion);
|
||||||
|
static GameLanguage gameLanguageFromString(QString gameLanguage);
|
||||||
|
static QString gameLanguageToString(GameLanguage gameLanguage);
|
||||||
|
static bool setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage);
|
||||||
|
|
||||||
|
// Screen Stuff
|
||||||
|
static qreal screenRatio();
|
||||||
|
static qreal screenRatioPR();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // APPENV_H
|
||||||
|
|
|
@ -1,83 +1,176 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <QFile>
|
#include <QStringBuilder>
|
||||||
#include <QDir>
|
#include <QMutexLocker>
|
||||||
|
#include <QDebug>
|
||||||
CrewDatabase::CrewDatabase(QObject *parent) : QObject(parent)
|
#include <QFile>
|
||||||
{
|
#include <QDir>
|
||||||
QDir dir;
|
|
||||||
dir.mkpath(StandardPaths::dataLocation());
|
CrewDatabase::CrewDatabase(QObject *parent) : QObject(parent)
|
||||||
dir.setPath(StandardPaths::dataLocation());
|
{
|
||||||
QString dirPath = dir.absolutePath();
|
QDir dir;
|
||||||
QString defaultConfPath = dirPath + QDir::separator() + "crews.ini";
|
dir.mkpath(StandardPaths::dataLocation());
|
||||||
|
dir.setPath(StandardPaths::dataLocation());
|
||||||
QSettings confPathSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QString dirPath = dir.absolutePath();
|
||||||
confPathSettings.beginGroup("Database");
|
QString defaultConfPath = dirPath % "/crews.ini";
|
||||||
QString confPathFile = confPathSettings.value("Crews", defaultConfPath).toString();
|
|
||||||
confPathSettings.endGroup();
|
QSettings confPathSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
confPathSettings.beginGroup("Database");
|
||||||
crewDB = new QSettings(confPathFile, QSettings::IniFormat);
|
QString confPathFile = confPathSettings.value("Crews", defaultConfPath).toString();
|
||||||
crewDB->beginGroup("Crews");
|
confPathSettings.endGroup();
|
||||||
}
|
|
||||||
|
crewDB = new QSettings(confPathFile, QSettings::IniFormat);
|
||||||
CrewDatabase::~CrewDatabase()
|
crewDB->beginGroup("Crews");
|
||||||
{
|
|
||||||
crewDB->endGroup();
|
addProcess = false;
|
||||||
delete crewDB;
|
}
|
||||||
}
|
|
||||||
|
CrewDatabase::~CrewDatabase()
|
||||||
QStringList CrewDatabase::getCrews()
|
{
|
||||||
{
|
crewDB->endGroup();
|
||||||
QStringList compatibleCrewList = crewDB->childKeys();
|
delete crewDB;
|
||||||
crewDB->endGroup();
|
}
|
||||||
crewDB->beginGroup("CrewList");
|
|
||||||
QStringList crewIDs = crewDB->value("IDs", QStringList()).toStringList();
|
QStringList CrewDatabase::getCrews()
|
||||||
crewIDs.append(compatibleCrewList);
|
{
|
||||||
crewIDs.removeDuplicates();
|
QMutexLocker locker(&mutex);
|
||||||
crewDB->endGroup();
|
#ifdef GTA5SYNC_DEBUG
|
||||||
crewDB->beginGroup("Crews");
|
qDebug() << "getCrews";
|
||||||
return crewIDs;
|
#endif
|
||||||
}
|
return getCrews_p();
|
||||||
|
}
|
||||||
QString CrewDatabase::getCrewName(int crewID)
|
|
||||||
{
|
QStringList CrewDatabase::getCrews_p()
|
||||||
QString crewStr = crewDB->value(QString::number(crewID), crewID).toString();
|
{
|
||||||
if (crewID == 0) crewStr = tr("No Crew", "");
|
#ifdef GTA5SYNC_DEBUG
|
||||||
return crewStr;
|
qDebug() << "getCrews_p";
|
||||||
}
|
#endif
|
||||||
|
QStringList compatibleCrewList = getCompatibleCrews_p();
|
||||||
void CrewDatabase::setCrewName(int crewID, QString crewName)
|
crewDB->endGroup();
|
||||||
{
|
crewDB->beginGroup("CrewList");
|
||||||
crewDB->setValue(QString::number(crewID), crewName);
|
QStringList crewIDs = crewDB->value("IDs", QStringList()).toStringList();
|
||||||
}
|
crewIDs += compatibleCrewList;
|
||||||
|
crewIDs.removeDuplicates();
|
||||||
void CrewDatabase::addCrew(int crewID)
|
crewDB->endGroup();
|
||||||
{
|
crewDB->beginGroup("Crews");
|
||||||
QStringList crews = getCrews();
|
return crewIDs;
|
||||||
crews.append(QString::number(crewID));
|
}
|
||||||
crews.removeDuplicates();
|
|
||||||
crewDB->endGroup();
|
QStringList CrewDatabase::getCompatibleCrews()
|
||||||
crewDB->beginGroup("CrewList");
|
{
|
||||||
crewDB->setValue("IDs", crews);
|
QMutexLocker locker(&mutex);
|
||||||
crewDB->endGroup();
|
#ifdef GTA5SYNC_DEBUG
|
||||||
crewDB->beginGroup("Crews");
|
qDebug() << "getCompatibleCrews";
|
||||||
}
|
#endif
|
||||||
|
return getCompatibleCrews_p();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList CrewDatabase::getCompatibleCrews_p()
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "getCompatibleCrews_p";
|
||||||
|
#endif
|
||||||
|
return crewDB->childKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CrewDatabase::getCrewName(QString crewID)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "getCrewName" << crewID;
|
||||||
|
#endif
|
||||||
|
QString crewStr = crewDB->value(crewID, crewID).toString();
|
||||||
|
if (crewID == "0") crewStr = tr("No Crew", "");
|
||||||
|
return crewStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CrewDatabase::getCrewName(int crewID)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "getCrewName" << crewID;
|
||||||
|
#endif
|
||||||
|
QString crewStr = crewDB->value(QString::number(crewID), crewID).toString();
|
||||||
|
if (crewID == 0) crewStr = tr("No Crew", "");
|
||||||
|
return crewStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CrewDatabase::setCrewName(int crewID, QString crewName)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "setCrewName" << crewID << crewName;
|
||||||
|
#endif
|
||||||
|
crewDB->setValue(QString::number(crewID), crewName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CrewDatabase::addCrew(int crewID)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "addCrew" << crewID;
|
||||||
|
#endif
|
||||||
|
QStringList crews = getCrews_p();
|
||||||
|
crews += QString::number(crewID);
|
||||||
|
crews.removeDuplicates();
|
||||||
|
crewDB->endGroup();
|
||||||
|
crewDB->beginGroup("CrewList");
|
||||||
|
crewDB->setValue("IDs", crews);
|
||||||
|
crewDB->endGroup();
|
||||||
|
crewDB->beginGroup("Crews");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CrewDatabase::isCompatibleCrew(QString crewNID)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "isCompatibleCrew" << crewNID;
|
||||||
|
#endif
|
||||||
|
return crewDB->contains(crewNID);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CrewDatabase::isCompatibleCrew(int crewID)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "isCompatibleCrew" << crewID;
|
||||||
|
#endif
|
||||||
|
return crewDB->contains(QString::number(crewID));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CrewDatabase::setAddingCrews(bool addingCrews)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "setAddingCrews" << addingCrews;
|
||||||
|
#endif
|
||||||
|
addProcess = addingCrews;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CrewDatabase::isAddingCrews()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "isAddingCrews";
|
||||||
|
#endif
|
||||||
|
return addProcess;
|
||||||
|
}
|
||||||
|
|
|
@ -1,43 +1,54 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef CREWDATABASE_H
|
#ifndef CREWDATABASE_H
|
||||||
#define CREWDATABASE_H
|
#define CREWDATABASE_H
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMap>
|
#include <QMutex>
|
||||||
|
#include <QMap>
|
||||||
class CrewDatabase : public QObject
|
|
||||||
{
|
class CrewDatabase : public QObject
|
||||||
Q_OBJECT
|
{
|
||||||
public:
|
Q_OBJECT
|
||||||
explicit CrewDatabase(QObject *parent = 0);
|
public:
|
||||||
void setCrewName(int crewID, QString crewName);
|
explicit CrewDatabase(QObject *parent = 0);
|
||||||
QString getCrewName(int crewID);
|
QString getCrewName(QString crewID);
|
||||||
QStringList getCrews();
|
QString getCrewName(int crewID);
|
||||||
~CrewDatabase();
|
QStringList getCompatibleCrews();
|
||||||
|
QStringList getCrews();
|
||||||
private:
|
void setAddingCrews(bool addingCrews);
|
||||||
QSettings *crewDB;
|
bool isCompatibleCrew(QString crewNID);
|
||||||
|
bool isCompatibleCrew(int crewID);
|
||||||
public slots:
|
bool isAddingCrews();
|
||||||
void addCrew(int crewID);
|
~CrewDatabase();
|
||||||
};
|
|
||||||
|
private:
|
||||||
#endif // CREWDATABASE_H
|
mutable QMutex mutex;
|
||||||
|
bool addProcess;
|
||||||
|
QSettings *crewDB;
|
||||||
|
QStringList getCrews_p();
|
||||||
|
QStringList getCompatibleCrews_p();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setCrewName(int crewID, QString crewName);
|
||||||
|
void addCrew(int crewID);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREWDATABASE_H
|
||||||
|
|
|
@ -1,296 +1,244 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "DatabaseThread.h"
|
#include "DatabaseThread.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
DatabaseThread::DatabaseThread(CrewDatabase *crewDB, QObject *parent) : QThread(parent), crewDB(crewDB)
|
#define crewMaxPages 83
|
||||||
{
|
#define maxLoadFails 3
|
||||||
crewMaxPages = 83;
|
|
||||||
threadRunning = true;
|
DatabaseThread::DatabaseThread(CrewDatabase *crewDB, QObject *parent) : QThread(parent), crewDB(crewDB)
|
||||||
}
|
{
|
||||||
|
continueLastCrew = true;
|
||||||
void DatabaseThread::run()
|
threadRunning = true;
|
||||||
{
|
}
|
||||||
QEventLoop threadLoop;
|
|
||||||
QStringList crewList;
|
void DatabaseThread::run()
|
||||||
|
{
|
||||||
// Register thread loop end signal
|
QEventLoop threadLoop;
|
||||||
QObject::connect(this, SIGNAL(threadEndCommited()), &threadLoop, SLOT(quit()));
|
|
||||||
|
QObject::connect(this, SIGNAL(threadTerminated()), &threadLoop, SLOT(quit()));
|
||||||
// Quick time scan
|
|
||||||
if (crewList.length() <= 3)
|
while (threadRunning)
|
||||||
{
|
{
|
||||||
scanCrewReference(crewList, 2500);
|
if (threadRunning)
|
||||||
scanCrewMembersList(crewList, 3, 2500);
|
{
|
||||||
emit playerNameUpdated();
|
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
||||||
}
|
threadLoop.exec();
|
||||||
else if (crewList.length() <= 5)
|
}
|
||||||
{
|
}
|
||||||
scanCrewReference(crewList, 2500);
|
}
|
||||||
scanCrewMembersList(crewList, 2, 2500);
|
|
||||||
emit playerNameUpdated();
|
void DatabaseThread::scanCrewReference(const QStringList &crewList, const int &requestDelay)
|
||||||
}
|
{
|
||||||
|
for (QString crewID : crewList)
|
||||||
QEventLoop *waitingLoop = new QEventLoop();
|
{
|
||||||
QTimer::singleShot(10000, waitingLoop, SLOT(quit()));
|
if (threadRunning && crewID != QLatin1String("0"))
|
||||||
QObject::connect(this, SIGNAL(threadEndCommited()), waitingLoop, SLOT(quit()));
|
{
|
||||||
waitingLoop->exec();
|
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||||
delete waitingLoop;
|
QNetworkRequest netRequest(AppEnv::getCrewFetchingUrl(crewID));
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
while (threadRunning)
|
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
{
|
#endif
|
||||||
crewList = crewDB->getCrews();
|
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||||
|
netRequest.setRawHeader("Accept", "text/html");
|
||||||
// Long time scan
|
netRequest.setRawHeader("Accept-Charset", "utf-8");
|
||||||
scanCrewReference(crewList, 10000);
|
netRequest.setRawHeader("Accept-Language", "en-US,en;q=0.9");
|
||||||
scanCrewMembersList(crewList, crewMaxPages, 10000);
|
netRequest.setRawHeader("Connection", "keep-alive");
|
||||||
emit playerNameUpdated();
|
|
||||||
|
QNetworkReply *netReply = netManager->get(netRequest);
|
||||||
if (threadRunning)
|
|
||||||
{
|
QEventLoop *downloadLoop = new QEventLoop();
|
||||||
QTimer::singleShot(300000, &threadLoop, SLOT(quit()));
|
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
||||||
threadLoop.exec();
|
if (!continueLastCrew) { QObject::connect(this, SIGNAL(threadTerminated()), downloadLoop, SLOT(quit())); }
|
||||||
}
|
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
||||||
}
|
downloadLoop->exec();
|
||||||
}
|
downloadLoop->disconnect();
|
||||||
|
delete downloadLoop;
|
||||||
// void DatabaseThread::scanCrewReference(QStringList crewList, int requestDelay)
|
|
||||||
// {
|
if (netReply->isFinished())
|
||||||
// foreach (const QString &crewID, crewList)
|
{
|
||||||
// {
|
QString crewName;
|
||||||
// if (threadRunning && crewID != "0")
|
QByteArray crewHtml = netReply->readAll();
|
||||||
// {
|
QStringList crewHtmlSplit1 = QString::fromUtf8(crewHtml).split("<title>Rockstar Games Social Club - Crew : ");
|
||||||
// QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
if (crewHtmlSplit1.length() >= 2)
|
||||||
|
{
|
||||||
// QNetworkRequest netRequest(AppEnv::getCrewFetchingUrl(crewID));
|
QStringList crewHtmlSplit2 = QString(crewHtmlSplit1.at(1)).split("</title>");
|
||||||
// netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
if (crewHtmlSplit2.length() >= 1)
|
||||||
// netRequest.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
{
|
||||||
// netRequest.setRawHeader("Accept-Language", "en-US;q=0.5,en;q=0.3");
|
crewName = crewHtmlSplit2.at(0);
|
||||||
// netRequest.setRawHeader("Connection", "keep-alive");
|
}
|
||||||
|
}
|
||||||
// QNetworkReply *netReply = netManager->get(netRequest);
|
if (!crewName.isEmpty())
|
||||||
|
{
|
||||||
// QEventLoop *downloadLoop = new QEventLoop();
|
emit crewNameFound(crewID.toInt(), crewName);
|
||||||
// QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
}
|
||||||
// QObject::connect(this, SIGNAL(threadEndCommited()), downloadLoop, SLOT(quit()));
|
}
|
||||||
// QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
else
|
||||||
// downloadLoop->exec();
|
{
|
||||||
// delete downloadLoop;
|
netReply->abort();
|
||||||
|
}
|
||||||
// if (netReply->isFinished())
|
|
||||||
// {
|
if (threadRunning)
|
||||||
// QByteArray crewJson = netReply->readAll();
|
{
|
||||||
// QJsonDocument crewDocument = QJsonDocument::fromJson(crewJson);
|
QEventLoop *waitingLoop = new QEventLoop();
|
||||||
// QJsonObject crewObject = crewDocument.object();
|
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
||||||
// QVariantMap crewMap = crewObject.toVariantMap();
|
if (!continueLastCrew) { QObject::connect(this, SIGNAL(threadTerminated()), waitingLoop, SLOT(quit())); }
|
||||||
// QString crewName;
|
waitingLoop->exec();
|
||||||
// bool isFound = false;
|
waitingLoop->disconnect();
|
||||||
|
delete waitingLoop;
|
||||||
// if (crewMap.contains("activities"))
|
}
|
||||||
// {
|
|
||||||
// QList<QVariant> activitiesList = crewMap["activities"].toList();
|
delete netReply;
|
||||||
// foreach (const QVariant &activitiesVariant, activitiesList)
|
delete netManager;
|
||||||
// {
|
}
|
||||||
// QMap<QString, QVariant> activityRootMap = activitiesVariant.toMap();
|
}
|
||||||
// foreach(const QVariant &activityRootVariant, activityRootMap)
|
}
|
||||||
// {
|
|
||||||
// QMap<QString, QVariant> activityMap = activityRootVariant.toMap();
|
void DatabaseThread::scanCrewMembersList(const QStringList &crewList, const int &maxPages, const int &requestDelay)
|
||||||
// foreach(const QVariant &activityVariant, activityMap)
|
{
|
||||||
// {
|
for (QString crewID : crewList)
|
||||||
// QMap<QString, QVariant> activityFinalMap = activityVariant.toMap();
|
{
|
||||||
// if (activityFinalMap.contains("id") && activityFinalMap["id"] == crewID)
|
if (threadRunning && crewID != QLatin1String("0"))
|
||||||
// {
|
{
|
||||||
// if (activityFinalMap.contains("name") && isFound == false)
|
int currentFail = 0;
|
||||||
// {
|
int currentPage = 0;
|
||||||
// isFound = true;
|
int foundPlayers = 0;
|
||||||
// crewName = activityFinalMap["name"].toString();
|
int totalPlayers = 1000;
|
||||||
// }
|
|
||||||
// }
|
while(foundPlayers < totalPlayers && currentPage < maxPages && (continueLastCrew ? true : threadRunning))
|
||||||
// }
|
{
|
||||||
// }
|
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
||||||
// }
|
QNetworkRequest netRequest(AppEnv::getPlayerFetchingUrl(crewID, currentPage));
|
||||||
// }
|
#if QT_VERSION >= 0x050600
|
||||||
// if (!crewName.isNull())
|
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
// {
|
#endif
|
||||||
// crewDB->setCrewName(crewID.toInt(), crewName);
|
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||||
// }
|
netRequest.setRawHeader("Accept", "application/json");
|
||||||
// }
|
netRequest.setRawHeader("Accept-Charset", "utf-8");
|
||||||
|
netRequest.setRawHeader("Accept-Language", "en-US,en;q=0.9");
|
||||||
// QEventLoop *waitingLoop = new QEventLoop();
|
netRequest.setRawHeader("Connection", "keep-alive");
|
||||||
// QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
|
||||||
// QObject::connect(this, SIGNAL(threadEndCommited()), waitingLoop, SLOT(quit()));
|
QNetworkReply *netReply = netManager->get(netRequest);
|
||||||
// waitingLoop->exec();
|
|
||||||
// delete waitingLoop;
|
QEventLoop *downloadLoop = new QEventLoop();
|
||||||
|
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
||||||
// delete netReply;
|
if (!continueLastCrew) { QObject::connect(this, SIGNAL(threadTerminated()), downloadLoop, SLOT(quit())); }
|
||||||
// delete netManager;
|
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
||||||
// }
|
downloadLoop->exec();
|
||||||
// }
|
downloadLoop->disconnect();
|
||||||
// }
|
delete downloadLoop;
|
||||||
|
|
||||||
void DatabaseThread::scanCrewReference(QStringList crewList, int requestDelay)
|
if (netReply->isFinished())
|
||||||
{
|
{
|
||||||
foreach (const QString &crewID, crewList)
|
QByteArray crewJson = netReply->readAll();
|
||||||
{
|
QJsonDocument crewDocument = QJsonDocument::fromJson(crewJson);
|
||||||
if (threadRunning && crewID != "0")
|
QJsonObject crewObject = crewDocument.object();
|
||||||
{
|
QVariantMap crewMap = crewObject.toVariantMap();
|
||||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
|
||||||
|
if (crewMap.contains("Total")) { totalPlayers = crewMap["Total"].toInt(); }
|
||||||
QNetworkRequest netRequest(AppEnv::getCrewFetchingUrl(crewID));
|
|
||||||
#if QT_VERSION >= 0x050600
|
if (crewMap.contains("Members"))
|
||||||
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
{
|
||||||
#endif
|
const QList<QVariant> memberList = crewMap["Members"].toList();
|
||||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
for (QVariant memberVariant : memberList)
|
||||||
netRequest.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
{
|
||||||
netRequest.setRawHeader("Accept-Language", "en-US;q=0.5,en;q=0.3");
|
QMap<QString, QVariant> memberMap = memberVariant.toMap();
|
||||||
netRequest.setRawHeader("Connection", "keep-alive");
|
if (memberMap.contains("RockstarId") && memberMap.contains("Name"))
|
||||||
|
{
|
||||||
QNetworkReply *netReply = netManager->get(netRequest);
|
int RockstarId = memberMap["RockstarId"].toInt();
|
||||||
|
QString memberName = memberMap["Name"].toString();
|
||||||
QEventLoop *downloadLoop = new QEventLoop();
|
if (!memberName.isEmpty() && RockstarId != 0)
|
||||||
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
{
|
||||||
QObject::connect(this, SIGNAL(threadEndCommited()), downloadLoop, SLOT(quit()));
|
foundPlayers++;
|
||||||
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
emit playerNameFound(RockstarId, memberName);
|
||||||
downloadLoop->exec();
|
}
|
||||||
delete downloadLoop;
|
}
|
||||||
|
}
|
||||||
if (netReply->isFinished())
|
}
|
||||||
{
|
|
||||||
QString crewName;
|
currentPage++;
|
||||||
QByteArray crewHtml = netReply->readAll();
|
}
|
||||||
QStringList crewHtmlSplit1 = QString::fromUtf8(crewHtml).split("<title>Rockstar Games Social Club - Crew : ");
|
else
|
||||||
if (crewHtmlSplit1.length() >= 2)
|
{
|
||||||
{
|
currentFail++;
|
||||||
QStringList crewHtmlSplit2 = QString(crewHtmlSplit1.at(1)).split("</title>");
|
if (currentFail == maxLoadFails)
|
||||||
if (crewHtmlSplit2.length() >= 1)
|
{
|
||||||
{
|
currentFail = 0;
|
||||||
crewName = crewHtmlSplit2.at(0);
|
currentPage++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!crewName.isEmpty())
|
|
||||||
{
|
delete netReply;
|
||||||
crewDB->setCrewName(crewID.toInt(), crewName);
|
delete netManager;
|
||||||
}
|
|
||||||
}
|
if (foundPlayers < totalPlayers && currentPage < maxPages && (continueLastCrew ? true : threadRunning))
|
||||||
|
{
|
||||||
QEventLoop *waitingLoop = new QEventLoop();
|
QEventLoop *waitingLoop = new QEventLoop();
|
||||||
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
||||||
QObject::connect(this, SIGNAL(threadEndCommited()), waitingLoop, SLOT(quit()));
|
if (!continueLastCrew) { QObject::connect(this, SIGNAL(threadTerminated()), waitingLoop, SLOT(quit())); }
|
||||||
waitingLoop->exec();
|
waitingLoop->exec();
|
||||||
delete waitingLoop;
|
waitingLoop->disconnect();
|
||||||
|
delete waitingLoop;
|
||||||
delete netReply;
|
}
|
||||||
delete netManager;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseThread::scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay)
|
void DatabaseThread::deleteCompatibleCrews(QStringList *crewList)
|
||||||
{
|
{
|
||||||
foreach (const QString &crewID, crewList)
|
for (QString crewNID : *crewList)
|
||||||
{
|
{
|
||||||
if (threadRunning && crewID != "0")
|
if (crewDB->isCompatibleCrew(crewNID))
|
||||||
{
|
{
|
||||||
int currentPage = 0;
|
crewList->removeAll(crewNID);
|
||||||
int foundPlayers = 0;
|
}
|
||||||
int totalPlayers = 1000;
|
}
|
||||||
|
}
|
||||||
while(foundPlayers < totalPlayers && currentPage < maxPages)
|
|
||||||
{
|
QStringList DatabaseThread::deleteCompatibleCrews(const QStringList &crewList)
|
||||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
{
|
||||||
|
QStringList crewListR = crewList;
|
||||||
QNetworkRequest netRequest(AppEnv::getPlayerFetchingUrl(crewID, QString::number(currentPage)));
|
for (QString crewNID : crewListR)
|
||||||
#if QT_VERSION >= 0x050600
|
{
|
||||||
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
if (crewDB->isCompatibleCrew(crewNID))
|
||||||
#endif
|
{
|
||||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
crewListR.removeAll(crewNID);
|
||||||
netRequest.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
}
|
||||||
netRequest.setRawHeader("Accept-Language", "en-US;q=0.5,en;q=0.3");
|
}
|
||||||
netRequest.setRawHeader("Connection", "keep-alive");
|
return crewListR;
|
||||||
|
}
|
||||||
QNetworkReply *netReply = netManager->get(netRequest);
|
|
||||||
|
void DatabaseThread::terminateThread()
|
||||||
QEventLoop *downloadLoop = new QEventLoop();
|
{
|
||||||
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
threadRunning = false;
|
||||||
QObject::connect(this, SIGNAL(threadEndCommited()), downloadLoop, SLOT(quit()));
|
emit threadTerminated();
|
||||||
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
}
|
||||||
downloadLoop->exec();
|
|
||||||
delete downloadLoop;
|
|
||||||
|
|
||||||
if (netReply->isFinished())
|
|
||||||
{
|
|
||||||
QByteArray crewJson = netReply->readAll();
|
|
||||||
QJsonDocument crewDocument = QJsonDocument::fromJson(crewJson);
|
|
||||||
QJsonObject crewObject = crewDocument.object();
|
|
||||||
QVariantMap crewMap = crewObject.toVariantMap();
|
|
||||||
|
|
||||||
if (crewMap.contains("Total")) { totalPlayers = crewMap["Total"].toInt(); }
|
|
||||||
|
|
||||||
if (crewMap.contains("Members"))
|
|
||||||
{
|
|
||||||
QList<QVariant> memberList = crewMap["Members"].toList();
|
|
||||||
foreach (const QVariant &memberVariant, memberList)
|
|
||||||
{
|
|
||||||
QMap<QString, QVariant> memberMap = memberVariant.toMap();
|
|
||||||
foundPlayers++;
|
|
||||||
if (memberMap.contains("RockstarId") && memberMap.contains("Name"))
|
|
||||||
{
|
|
||||||
int RockstarId = memberMap["RockstarId"].toInt();
|
|
||||||
QString memberName = memberMap["Name"].toString();
|
|
||||||
if (memberName != "" && RockstarId != 0)
|
|
||||||
{
|
|
||||||
emit playerNameFound(RockstarId, memberName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QEventLoop *waitingLoop = new QEventLoop();
|
|
||||||
QTimer::singleShot(requestDelay, waitingLoop, SLOT(quit()));
|
|
||||||
QObject::connect(this, SIGNAL(threadEndCommited()), waitingLoop, SLOT(quit()));
|
|
||||||
waitingLoop->exec();
|
|
||||||
delete waitingLoop;
|
|
||||||
|
|
||||||
currentPage++;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete netReply;
|
|
||||||
delete netManager;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DatabaseThread::doEndThread()
|
|
||||||
{
|
|
||||||
threadRunning = false;
|
|
||||||
emit threadEndCommited();
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,52 +1,56 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef DATABASETHREAD_H
|
#ifndef DATABASETHREAD_H
|
||||||
#define DATABASETHREAD_H
|
#define DATABASETHREAD_H
|
||||||
|
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
class DatabaseThread : public QThread
|
class DatabaseThread : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DatabaseThread(CrewDatabase *crewDB, QObject *parent = 0);
|
explicit DatabaseThread(CrewDatabase *crewDB, QObject *parent = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void doEndThread();
|
void terminateThread();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CrewDatabase *crewDB;
|
CrewDatabase *crewDB;
|
||||||
void scanCrewMembersList(QStringList crewList, int maxPages, int requestDelay);
|
void scanCrewMembersList(const QStringList &crewList, const int &maxPages, const int &requestDelay);
|
||||||
void scanCrewReference(QStringList crewList, int requestDelay);
|
void scanCrewReference(const QStringList &crewList, const int &requestDelay);
|
||||||
bool threadRunning;
|
void deleteCompatibleCrews(QStringList *crewList);
|
||||||
int crewMaxPages;
|
QStringList deleteCompatibleCrews(const QStringList &crewList);
|
||||||
int plyrPerReq;
|
bool continueLastCrew;
|
||||||
|
bool threadRunning;
|
||||||
protected:
|
int plyrPerReq;
|
||||||
void run();
|
|
||||||
|
protected:
|
||||||
signals:
|
void run();
|
||||||
void playerNameFound(int playerID, QString playerName);
|
|
||||||
void playerNameUpdated();
|
signals:
|
||||||
void threadEndCommited();
|
void crewNameFound(int crewID, QString crewName);
|
||||||
};
|
void crewNameUpdated();
|
||||||
|
void playerNameFound(int playerID, QString playerName);
|
||||||
#endif // DATABASETHREAD_H
|
void playerNameUpdated();
|
||||||
|
void threadTerminated();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DATABASETHREAD_H
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "ExportDialog.h"
|
#include "ExportDialog.h"
|
||||||
#include "ui_ExportDialog.h"
|
#include "ui_ExportDialog.h"
|
||||||
|
|
||||||
ExportDialog::ExportDialog(QWidget *parent) :
|
ExportDialog::ExportDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::ExportDialog)
|
ui(new Ui::ExportDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportDialog::~ExportDialog()
|
ExportDialog::~ExportDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExportDialog::isSucceeded()
|
bool ExportDialog::isSucceeded()
|
||||||
{
|
{
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportDialog::on_cmdSnapmaticClose_clicked()
|
void ExportDialog::on_cmdSnapmaticClose_clicked()
|
||||||
{
|
{
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportDialog::setupPictureExport()
|
void ExportDialog::setupPictureExport()
|
||||||
{
|
{
|
||||||
ui->swExport->setCurrentWidget(ui->pageSnapmatic);
|
ui->swExport->setCurrentWidget(ui->pageSnapmatic);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef EXPORTDIALOG_H
|
#ifndef EXPORTDIALOG_H
|
||||||
#define EXPORTDIALOG_H
|
#define EXPORTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ExportDialog;
|
class ExportDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExportDialog : public QDialog
|
class ExportDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExportDialog(QWidget *parent = 0);
|
explicit ExportDialog(QWidget *parent = 0);
|
||||||
void setupPictureExport();
|
void setupPictureExport();
|
||||||
bool isSucceeded();
|
bool isSucceeded();
|
||||||
~ExportDialog();
|
~ExportDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cmdSnapmaticClose_clicked();
|
void on_cmdSnapmaticClose_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ExportDialog *ui;
|
Ui::ExportDialog *ui;
|
||||||
bool success;
|
bool success;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EXPORTDIALOG_H
|
#endif // EXPORTDIALOG_H
|
||||||
|
|
|
@ -1,226 +1,226 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ExportDialog</class>
|
<class>ExportDialog</class>
|
||||||
<widget class="QDialog" name="ExportDialog">
|
<widget class="QDialog" name="ExportDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlExport">
|
<layout class="QVBoxLayout" name="vlExport">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="swExport">
|
<widget class="QStackedWidget" name="swExport">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pageSnapmatic">
|
<widget class="QWidget" name="pageSnapmatic">
|
||||||
<layout class="QVBoxLayout" name="vlSnapmatic">
|
<layout class="QVBoxLayout" name="vlSnapmatic">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gbSnapmaticFormat">
|
<widget class="QGroupBox" name="gbSnapmaticFormat">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Export Format</string>
|
<string>Export Format</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbSystemPicture">
|
<widget class="QRadioButton" name="rbSystemPicture">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&JPEG/PNG format</string>
|
<string>&JPEG/PNG format</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbSnapmaticPicture">
|
<widget class="QRadioButton" name="rbSnapmaticPicture">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>GTA &Snapmatic format</string>
|
<string>GTA &Snapmatic format</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gbSnapmaticResolution">
|
<widget class="QGroupBox" name="gbSnapmaticResolution">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Export Size</string>
|
<string>Export Size</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbSnapmaticDefaultSize">
|
<widget class="QRadioButton" name="rbSnapmaticDefaultSize">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Default &Size</string>
|
<string>Default &Size</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbSnapmaticDesktopSize">
|
<widget class="QRadioButton" name="rbSnapmaticDesktopSize">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Desktop Size</string>
|
<string>&Desktop Size</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbSnapmaticCustomSize">
|
<widget class="QRadioButton" name="rbSnapmaticCustomSize">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Custom Size</string>
|
<string>&Custom Size</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="hlSnapmaticResolution">
|
<layout class="QHBoxLayout" name="hlSnapmaticResolution">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labSnapmaticResolutionSize">
|
<widget class="QLabel" name="labSnapmaticResolutionSize">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Custom Size:</string>
|
<string>Custom Size:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="sbSnapmaticResoulutionWidth">
|
<widget class="QSpinBox" name="sbSnapmaticResoulutionWidth">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>3840</number>
|
<number>3840</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>960</number>
|
<number>960</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labSnapmaticResolutionSizeX">
|
<widget class="QLabel" name="labSnapmaticResolutionSizeX">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>x</string>
|
<string>x</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="sbSnapmaticResoulutionHeight">
|
<widget class="QSpinBox" name="sbSnapmaticResoulutionHeight">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>2160</number>
|
<number>2160</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>536</number>
|
<number>536</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hsSnapmaticResolution">
|
<spacer name="hsSnapmaticResolution">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsSnapmatic">
|
<spacer name="vsSnapmatic">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="hlSnapmaticButtons">
|
<layout class="QHBoxLayout" name="hlSnapmaticButtons">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hsSnapmaticButtons">
|
<spacer name="hsSnapmaticButtons">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdSnapmaticExport">
|
<widget class="QPushButton" name="cmdSnapmaticExport">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Export</string>
|
<string>&Export</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdSnapmaticClose">
|
<widget class="QPushButton" name="cmdSnapmaticClose">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Close</string>
|
<string>&Close</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="pageSavegame"/>
|
<widget class="QWidget" name="pageSavegame"/>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -1,184 +1,185 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "ProfileInterface.h"
|
#include "ProfileInterface.h"
|
||||||
#include "PictureExport.h"
|
#include "PictureExport.h"
|
||||||
#include "ProfileWidget.h"
|
#include "ProfileWidget.h"
|
||||||
#include "ExportThread.h"
|
#include "ExportThread.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <QDesktopWidget>
|
#include <QStringBuilder>
|
||||||
#include <QApplication>
|
#include <QDesktopWidget>
|
||||||
#include <QFileInfo>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QFileInfo>
|
||||||
#include <QFile>
|
#include <QDebug>
|
||||||
|
#include <QFile>
|
||||||
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)
|
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)
|
||||||
|
{
|
||||||
}
|
|
||||||
|
}
|
||||||
void ExportThread::run()
|
|
||||||
{
|
void ExportThread::run()
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
{
|
||||||
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
// Picture Settings
|
|
||||||
// Quality Settings
|
// Picture Settings
|
||||||
settings.beginGroup("Pictures");
|
// Quality Settings
|
||||||
int defaultQuality = 100;
|
settings.beginGroup("Pictures");
|
||||||
QSize defExportSize = QSize(960, 536);
|
int defaultQuality = 100;
|
||||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
QSize defExportSize = QSize(960, 536);
|
||||||
if (customQuality < 1 || customQuality > 100)
|
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
||||||
{
|
if (customQuality < 1 || customQuality > 100)
|
||||||
customQuality = 100;
|
{
|
||||||
}
|
customQuality = 100;
|
||||||
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
}
|
||||||
|
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
||||||
// Size Settings
|
|
||||||
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
// Size Settings
|
||||||
if (cusExportSize.width() > 3840)
|
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
||||||
{
|
if (cusExportSize.width() > 3840)
|
||||||
cusExportSize.setWidth(3840);
|
{
|
||||||
}
|
cusExportSize.setWidth(3840);
|
||||||
else if (cusExportSize.height() > 2160)
|
}
|
||||||
{
|
else if (cusExportSize.height() > 2160)
|
||||||
cusExportSize.setHeight(2160);
|
{
|
||||||
}
|
cusExportSize.setHeight(2160);
|
||||||
if (cusExportSize.width() < 1)
|
}
|
||||||
{
|
if (cusExportSize.width() < 1)
|
||||||
cusExportSize.setWidth(1);
|
{
|
||||||
}
|
cusExportSize.setWidth(1);
|
||||||
else if (cusExportSize.height() < 1)
|
}
|
||||||
{
|
else if (cusExportSize.height() < 1)
|
||||||
cusExportSize.setHeight(1);
|
{
|
||||||
}
|
cusExportSize.setHeight(1);
|
||||||
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
}
|
||||||
Qt::AspectRatioMode aspectRatio = (Qt::AspectRatioMode)settings.value("AspectRatio", Qt::KeepAspectRatio).toInt();
|
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
||||||
settings.endGroup();
|
Qt::AspectRatioMode aspectRatio = (Qt::AspectRatioMode)settings.value("AspectRatio", Qt::KeepAspectRatio).toInt();
|
||||||
// End Picture Settings
|
settings.endGroup();
|
||||||
|
// End Picture Settings
|
||||||
int intExportProgress = 0;
|
|
||||||
foreach(ProfileWidget *widget, profileMap.keys())
|
int intExportProgress = 0;
|
||||||
{
|
for (ProfileWidget *widget : profileMap.keys())
|
||||||
if (widget->isSelected())
|
{
|
||||||
{
|
if (widget->isSelected())
|
||||||
if (widget->getWidgetType() == "SnapmaticWidget")
|
{
|
||||||
{
|
if (widget->getWidgetType() == "SnapmaticWidget")
|
||||||
SnapmaticWidget *picWidget = (SnapmaticWidget*)widget;
|
{
|
||||||
SnapmaticPicture *picture = picWidget->getPicture();
|
SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(widget);
|
||||||
|
SnapmaticPicture *picture = picWidget->getPicture();
|
||||||
if (pictureExportEnabled)
|
|
||||||
{
|
if (pictureExportEnabled)
|
||||||
QString exportFileName = PictureExport::getPictureFileName(picture);
|
{
|
||||||
if (exportFileName.right(4) != ".jpg" && exportFileName.right(4) != ".png")
|
QString exportFileName = PictureExport::getPictureFileName(picture);
|
||||||
{
|
if (exportFileName.right(4) != ".jpg" && exportFileName.right(4) != ".png")
|
||||||
exportFileName.append(".jpg");
|
{
|
||||||
}
|
exportFileName += ".jpg";
|
||||||
|
}
|
||||||
intExportProgress++;
|
|
||||||
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
intExportProgress++;
|
||||||
emit exportProgressUpdate(intExportProgress);
|
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
||||||
|
emit exportProgressUpdate(intExportProgress);
|
||||||
// Scale Picture
|
|
||||||
QImage exportPicture = picture->getImage();
|
// Scale Picture
|
||||||
if (sizeMode == "Desktop")
|
QImage exportPicture = picture->getImage();
|
||||||
{
|
if (sizeMode == "Desktop")
|
||||||
QRect desktopResolution = QApplication::desktop()->screenGeometry();
|
{
|
||||||
exportPicture = exportPicture.scaled(desktopResolution.width(), desktopResolution.height(), aspectRatio, Qt::SmoothTransformation);
|
QRect desktopResolution = qApp->desktop()->screenGeometry();
|
||||||
}
|
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);
|
{
|
||||||
}
|
exportPicture = exportPicture.scaled(cusExportSize, aspectRatio, Qt::SmoothTransformation);
|
||||||
|
}
|
||||||
bool isSaved;
|
|
||||||
if (useCustomQuality)
|
bool isSaved;
|
||||||
{
|
if (useCustomQuality)
|
||||||
isSaved = exportPicture.save(exportDirectory + "/" + exportFileName, "JPEG", customQuality);
|
{
|
||||||
}
|
isSaved = exportPicture.save(exportDirectory % "/" % exportFileName, "JPEG", customQuality);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
isSaved = exportPicture.save(exportDirectory + "/" + exportFileName, "JPEG", 100);
|
{
|
||||||
}
|
isSaved = exportPicture.save(exportDirectory % "/" % exportFileName, "JPEG", 100);
|
||||||
|
}
|
||||||
if (!isSaved)
|
|
||||||
{
|
if (!isSaved)
|
||||||
failedExportPictures.append(exportFileName);
|
{
|
||||||
}
|
failedExportPictures += exportFileName;
|
||||||
}
|
}
|
||||||
if (pictureCopyEnabled)
|
}
|
||||||
{
|
if (pictureCopyEnabled)
|
||||||
QString exportFileName = PictureExport::getPictureFileName(picture);
|
{
|
||||||
if (exportFileName.right(4) != ".g5e")
|
QString exportFileName = PictureExport::getPictureFileName(picture);
|
||||||
{
|
if (exportFileName.right(4) != ".g5e")
|
||||||
exportFileName.append(".g5e");
|
{
|
||||||
}
|
exportFileName += ".g5e";
|
||||||
|
}
|
||||||
intExportProgress++;
|
|
||||||
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
intExportProgress++;
|
||||||
emit exportProgressUpdate(intExportProgress);
|
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
||||||
|
emit exportProgressUpdate(intExportProgress);
|
||||||
QString exportFilePath = exportDirectory + "/" + exportFileName;
|
|
||||||
if (QFile::exists(exportFilePath)) {QFile::remove(exportFilePath);}
|
QString exportFilePath = exportDirectory % "/" % exportFileName;
|
||||||
if (!picture->exportPicture(exportDirectory + "/" + exportFileName, "G5E"))
|
if (QFile::exists(exportFilePath)) {QFile::remove(exportFilePath);}
|
||||||
{
|
if (!picture->exportPicture(exportDirectory % "/" % exportFileName, SnapmaticFormat::G5E_Format))
|
||||||
failedCopyPictures.append(exportFileName);
|
{
|
||||||
}
|
failedCopyPictures += exportFileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (widget->getWidgetType() == "SavegameWidget")
|
}
|
||||||
{
|
else if (widget->getWidgetType() == "SavegameWidget")
|
||||||
SavegameWidget *sgdWidget = (SavegameWidget*)widget;
|
{
|
||||||
SavegameData *savegame = sgdWidget->getSavegame();
|
SavegameWidget *sgdWidget = qobject_cast<SavegameWidget*>(widget);
|
||||||
|
SavegameData *savegame = sgdWidget->getSavegame();
|
||||||
QString originalFileName = savegame->getSavegameFileName();
|
|
||||||
QFileInfo originalFileInfo(originalFileName);
|
QString originalFileName = savegame->getSavegameFileName();
|
||||||
QString exportFileName = originalFileInfo.fileName();
|
QFileInfo originalFileInfo(originalFileName);
|
||||||
|
QString exportFileName = originalFileInfo.fileName();
|
||||||
intExportProgress++;
|
|
||||||
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
intExportProgress++;
|
||||||
emit exportProgressUpdate(intExportProgress);
|
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
||||||
|
emit exportProgressUpdate(intExportProgress);
|
||||||
QString exportFilePath = exportDirectory + "/" + exportFileName;
|
|
||||||
if (QFile::exists(exportFilePath)) {QFile::remove(exportFilePath);}
|
QString exportFilePath = exportDirectory % "/" % exportFileName;
|
||||||
if (!QFile::copy(originalFileName, exportFilePath))
|
if (QFile::exists(exportFilePath)) {QFile::remove(exportFilePath);}
|
||||||
{
|
if (!QFile::copy(originalFileName, exportFilePath))
|
||||||
failedSavegames.append(exportFileName);
|
{
|
||||||
}
|
failedSavegames += exportFileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit exportFinished();
|
}
|
||||||
}
|
emit exportFinished();
|
||||||
|
}
|
||||||
QStringList ExportThread::getFailedCopyPictures()
|
|
||||||
{
|
QStringList ExportThread::getFailedCopyPictures()
|
||||||
return failedCopyPictures;
|
{
|
||||||
}
|
return failedCopyPictures;
|
||||||
|
}
|
||||||
QStringList ExportThread::getFailedExportPictures()
|
|
||||||
{
|
QStringList ExportThread::getFailedExportPictures()
|
||||||
return failedExportPictures;
|
{
|
||||||
}
|
return failedExportPictures;
|
||||||
|
}
|
||||||
QStringList ExportThread::getFailedSavegames()
|
|
||||||
{
|
QStringList ExportThread::getFailedSavegames()
|
||||||
return failedSavegames;
|
{
|
||||||
}
|
return failedSavegames;
|
||||||
|
}
|
||||||
|
|
|
@ -1,56 +1,56 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef EXPORTTHREAD_H
|
#ifndef EXPORTTHREAD_H
|
||||||
#define EXPORTTHREAD_H
|
#define EXPORTTHREAD_H
|
||||||
|
|
||||||
#include "SnapmaticWidget.h"
|
#include "SnapmaticWidget.h"
|
||||||
#include "SavegameWidget.h"
|
#include "SavegameWidget.h"
|
||||||
#include "ProfileWidget.h"
|
#include "ProfileWidget.h"
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
class ExportThread : public QThread
|
class ExportThread : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ExportThread(QMap<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent = 0);
|
explicit ExportThread(QMap<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent = 0);
|
||||||
QStringList getFailedSavegames();
|
QStringList getFailedSavegames();
|
||||||
QStringList getFailedCopyPictures();
|
QStringList getFailedCopyPictures();
|
||||||
QStringList getFailedExportPictures();
|
QStringList getFailedExportPictures();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap <ProfileWidget*, QString> profileMap;
|
QMap <ProfileWidget*, QString> profileMap;
|
||||||
QString exportDirectory;
|
QString exportDirectory;
|
||||||
bool pictureCopyEnabled;
|
bool pictureCopyEnabled;
|
||||||
bool pictureExportEnabled;
|
bool pictureExportEnabled;
|
||||||
int exportCount;
|
int exportCount;
|
||||||
QStringList failedSavegames;
|
QStringList failedSavegames;
|
||||||
QStringList failedCopyPictures;
|
QStringList failedCopyPictures;
|
||||||
QStringList failedExportPictures;
|
QStringList failedExportPictures;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void exportStringUpdate(QString currentFileName);
|
void exportStringUpdate(QString currentFileName);
|
||||||
void exportProgressUpdate(int currentProgressValue);
|
void exportProgressUpdate(int currentProgressValue);
|
||||||
void exportFinished();
|
void exportFinished();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EXPORTTHREAD_H
|
#endif // EXPORTTHREAD_H
|
||||||
|
|
|
@ -1,89 +1,78 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2018 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <QLocale>
|
#include "TranslationClass.h"
|
||||||
#include <QSettings>
|
#include "GlobalString.h"
|
||||||
#include <QFileInfo>
|
#include "config.h"
|
||||||
#include <QStringList>
|
#include <QStringBuilder>
|
||||||
#include "GlobalString.h"
|
#include <QStringList>
|
||||||
#include "config.h"
|
#include <QFileInfo>
|
||||||
|
#include <QSettings>
|
||||||
GlobalString::GlobalString()
|
#include <QLocale>
|
||||||
{
|
#include <QDebug>
|
||||||
|
|
||||||
}
|
GlobalString::GlobalString()
|
||||||
|
{
|
||||||
QMap<QString, QString> GlobalString::getGlobalMap()
|
|
||||||
{
|
}
|
||||||
QMap<QString, QString> globalMap;
|
|
||||||
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
QMap<QString, QString> GlobalString::getGlobalMap()
|
||||||
globalFile.setIniCodec("UTF-8");
|
{
|
||||||
globalFile.beginGroup("Global");
|
QMap<QString, QString> globalMap;
|
||||||
QStringList globalStrList = globalFile.childKeys();
|
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
||||||
foreach(const QString &globalStr, globalStrList)
|
globalFile.setIniCodec("UTF-8");
|
||||||
{
|
globalFile.beginGroup("Global");
|
||||||
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
|
for (QString globalStr : globalFile.childKeys())
|
||||||
}
|
{
|
||||||
globalFile.endGroup();
|
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
|
||||||
return globalMap;
|
}
|
||||||
}
|
globalFile.endGroup();
|
||||||
|
return globalMap;
|
||||||
QString GlobalString::getString(QString valueStr, bool *ok)
|
}
|
||||||
{
|
|
||||||
QString globalString = valueStr;
|
QString GlobalString::getString(QString valueStr, bool *ok)
|
||||||
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
{
|
||||||
globalFile.setIniCodec("UTF-8");
|
QString globalString = valueStr;
|
||||||
globalFile.beginGroup("Global");
|
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
|
||||||
QStringList globalStrList = globalFile.childKeys();
|
globalFile.setIniCodec("UTF-8");
|
||||||
if (globalStrList.contains(valueStr))
|
globalFile.beginGroup("Global");
|
||||||
{
|
QStringList globalStrList = globalFile.childKeys();
|
||||||
if (ok != 0) *ok = true;
|
if (globalStrList.contains(valueStr))
|
||||||
globalString = globalFile.value(valueStr, valueStr).toString();
|
{
|
||||||
}
|
if (ok != nullptr) *ok = true;
|
||||||
globalFile.endGroup();
|
globalString = globalFile.value(valueStr, valueStr).toString();
|
||||||
return globalString;
|
}
|
||||||
}
|
globalFile.endGroup();
|
||||||
|
return globalString;
|
||||||
QString GlobalString::getLanguageFile()
|
}
|
||||||
{
|
|
||||||
QString language = getLanguage();
|
QString GlobalString::getLanguageFile()
|
||||||
QString languageFile = ":/global/global." + language + ".ini";
|
{
|
||||||
if (!QFileInfo(languageFile).exists())
|
QString language = getLanguage();
|
||||||
{
|
QString languageFile = ":/global/global." % language % ".ini";
|
||||||
languageFile = ":/global/global.en.ini";
|
if (!QFileInfo(languageFile).exists())
|
||||||
}
|
{
|
||||||
return languageFile;
|
languageFile = ":/global/global.en.ini";
|
||||||
}
|
}
|
||||||
|
return languageFile;
|
||||||
QString GlobalString::getLanguage()
|
}
|
||||||
{
|
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QString GlobalString::getLanguage()
|
||||||
settings.beginGroup("Interface");
|
{
|
||||||
QString language = settings.value("Language","System").toString();
|
return Translator->getCurrentAreaLanguage();
|
||||||
settings.endGroup();
|
}
|
||||||
if (language == "System" || language.trimmed() == "")
|
|
||||||
{
|
|
||||||
QString languageName = QLocale::system().name();
|
|
||||||
QStringList langList = languageName.split("_");
|
|
||||||
if (langList.length() >= 1)
|
|
||||||
{
|
|
||||||
language = langList.at(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef GLOBALSTRING_H
|
#ifndef GLOBALSTRING_H
|
||||||
#define GLOBALSTRING_H
|
#define GLOBALSTRING_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
class GlobalString
|
class GlobalString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GlobalString();
|
GlobalString();
|
||||||
static QString getString(QString valueStr, bool *ok = 0);
|
static QString getString(QString valueStr, bool *ok = nullptr);
|
||||||
static QString getLanguageFile();
|
static QString getLanguageFile();
|
||||||
static QString getLanguage();
|
static QString getLanguage();
|
||||||
static QMap<QString, QString> getGlobalMap();
|
static QMap<QString, QString> getGlobalMap();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLOBALSTRING_H
|
#endif // GLOBALSTRING_H
|
||||||
|
|
|
@ -1,40 +1,50 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "IconLoader.h"
|
#include "IconLoader.h"
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
IconLoader::IconLoader()
|
IconLoader::IconLoader()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon IconLoader::loadingAppIcon()
|
QIcon IconLoader::loadingAppIcon()
|
||||||
{
|
{
|
||||||
QIcon appIcon;
|
QIcon appIcon;
|
||||||
appIcon.addFile(":/img/5sync-16.png", QSize(16, 16));
|
appIcon.addFile(":/img/5sync-16.png", QSize(16, 16));
|
||||||
appIcon.addFile(":/img/5sync-24.png", QSize(24, 24));
|
appIcon.addFile(":/img/5sync-24.png", QSize(24, 24));
|
||||||
appIcon.addFile(":/img/5sync-32.png", QSize(32, 32));
|
appIcon.addFile(":/img/5sync-32.png", QSize(32, 32));
|
||||||
appIcon.addFile(":/img/5sync-40.png", QSize(40, 40));
|
appIcon.addFile(":/img/5sync-40.png", QSize(40, 40));
|
||||||
appIcon.addFile(":/img/5sync-48.png", QSize(48, 48));
|
appIcon.addFile(":/img/5sync-48.png", QSize(48, 48));
|
||||||
appIcon.addFile(":/img/5sync-64.png", QSize(64, 64));
|
appIcon.addFile(":/img/5sync-64.png", QSize(64, 64));
|
||||||
appIcon.addFile(":/img/5sync-96.png", QSize(96, 96));
|
appIcon.addFile(":/img/5sync-96.png", QSize(96, 96));
|
||||||
appIcon.addFile(":/img/5sync-128.png", QSize(128, 128));
|
appIcon.addFile(":/img/5sync-128.png", QSize(128, 128));
|
||||||
appIcon.addFile(":/img/5sync-256.png", QSize(256, 256));
|
appIcon.addFile(":/img/5sync-256.png", QSize(256, 256));
|
||||||
return appIcon;
|
return appIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon IconLoader::loadingPointmakerIcon()
|
||||||
|
{
|
||||||
|
QIcon pointmakerIcon;
|
||||||
|
pointmakerIcon.addFile(":/img/pointmaker-8.png", QSize(8, 8));
|
||||||
|
pointmakerIcon.addFile(":/img/pointmaker-16.png", QSize(16, 16));
|
||||||
|
pointmakerIcon.addFile(":/img/pointmaker-24.png", QSize(24, 24));
|
||||||
|
pointmakerIcon.addFile(":/img/pointmaker-32.png", QSize(32, 32));
|
||||||
|
return pointmakerIcon;
|
||||||
|
}
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef ICONLOADER_H
|
#ifndef ICONLOADER_H
|
||||||
#define ICONLOADER_H
|
#define ICONLOADER_H
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
class IconLoader
|
class IconLoader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IconLoader();
|
IconLoader();
|
||||||
static QIcon loadingAppIcon();
|
static QIcon loadingAppIcon();
|
||||||
};
|
static QIcon loadingPointmakerIcon();
|
||||||
|
};
|
||||||
#endif // ICONLOADER_H
|
|
||||||
|
#endif // ICONLOADER_H
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* Copyright (C) 2016-2017 Syping
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef IMAGEEDITORDIALOG_H
|
||||||
|
#define IMAGEEDITORDIALOG_H
|
||||||
|
|
||||||
|
#include "SnapmaticPicture.h"
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ImageEditorDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ImageEditorDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ImageEditorDialog(SnapmaticPicture *picture, QString profileName, QWidget *parent = 0);
|
||||||
|
~ImageEditorDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_cmdClose_clicked();
|
||||||
|
void on_cmdReplace_clicked();
|
||||||
|
void on_cmdSave_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
SnapmaticPicture *smpic;
|
||||||
|
QString profileName;
|
||||||
|
Ui::ImageEditorDialog *ui;
|
||||||
|
int snapmaticResolutionLW;
|
||||||
|
int snapmaticResolutionLH;
|
||||||
|
bool imageIsChanged;
|
||||||
|
QImage pictureCache;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IMAGEEDITORDIALOG_H
|
|
@ -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>
|
1028
ImportDialog.cpp
1028
ImportDialog.cpp
File diff suppressed because it is too large
Load Diff
146
ImportDialog.h
146
ImportDialog.h
|
@ -1,60 +1,86 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2017 Syping
|
* Copyright (C) 2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef IMPORTDIALOG_H
|
#ifndef IMPORTDIALOG_H
|
||||||
#define IMPORTDIALOG_H
|
#define IMPORTDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QMenu>
|
||||||
namespace Ui {
|
|
||||||
class ImportDialog;
|
namespace Ui {
|
||||||
}
|
class ImportDialog;
|
||||||
|
}
|
||||||
class ImportDialog : public QDialog
|
|
||||||
{
|
class ImportDialog : public QDialog
|
||||||
Q_OBJECT
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
|
||||||
explicit ImportDialog(QWidget *parent = 0);
|
public:
|
||||||
~ImportDialog();
|
explicit ImportDialog(QString profileName, QWidget *parent = 0);
|
||||||
QImage image();
|
~ImportDialog();
|
||||||
QString getImageTitle();
|
QImage image();
|
||||||
void setImage(const QImage &image);
|
QString getImageTitle();
|
||||||
bool isDoImport();
|
void setImage(QImage *image);
|
||||||
|
void lockSettings(bool lock);
|
||||||
private slots:
|
void enableOverwriteMode();
|
||||||
void processImage();
|
bool isImportAgreed();
|
||||||
void on_rbIgnore_clicked();
|
bool areSettingsLocked();
|
||||||
void on_rbKeep_clicked();
|
|
||||||
void on_cbAvatar_clicked();
|
private slots:
|
||||||
void on_cmdCancel_clicked();
|
void processImage();
|
||||||
void on_cmdOK_clicked();
|
void cropPicture();
|
||||||
void on_labPicture_labelPainted();
|
void importNewPicture();
|
||||||
|
void loadImportSettings();
|
||||||
private:
|
void saveImportSettings();
|
||||||
Ui::ImportDialog *ui;
|
void on_cbIgnore_toggled(bool checked);
|
||||||
QImage avatarAreaImage;
|
void on_cbAvatar_toggled(bool checked);
|
||||||
QString imageTitle;
|
void on_cmdCancel_clicked();
|
||||||
QImage workImage;
|
void on_cmdOK_clicked();
|
||||||
QImage newImage;
|
void on_labPicture_labelPainted();
|
||||||
bool doImport;
|
void on_cmdColourChange_clicked();
|
||||||
int snapmaticResolutionLW;
|
void on_cmdBackgroundChange_clicked();
|
||||||
int snapmaticResolutionLH;
|
void on_cmdBackgroundWipe_clicked();
|
||||||
};
|
void on_cbStretch_toggled(bool checked);
|
||||||
|
void on_cbForceAvatarColour_toggled(bool checked);
|
||||||
#endif // IMPORTDIALOG_H
|
void on_cbWatermark_toggled(bool checked);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString profileName;
|
||||||
|
Ui::ImportDialog *ui;
|
||||||
|
QImage avatarAreaImage;
|
||||||
|
QString backgroundPath;
|
||||||
|
QString imageTitle;
|
||||||
|
QImage backImage;
|
||||||
|
QImage workImage;
|
||||||
|
QImage newImage;
|
||||||
|
QColor selectedColour;
|
||||||
|
QMenu *optionsMenu;
|
||||||
|
bool insideAvatarZone;
|
||||||
|
bool watermarkPicture;
|
||||||
|
bool watermarkAvatar;
|
||||||
|
bool watermarkBlock;
|
||||||
|
bool settingsLocked;
|
||||||
|
bool importAgreed;
|
||||||
|
int snapmaticResolutionLW;
|
||||||
|
int snapmaticResolutionLH;
|
||||||
|
void processWatermark(QPainter *snapmaticPainter);
|
||||||
|
void processSettings(QString settingsProfile, bool setDefault = false);
|
||||||
|
void saveSettings(QString settingsProfile);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IMPORTDIALOG_H
|
||||||
|
|
569
ImportDialog.ui
569
ImportDialog.ui
|
@ -1,187 +1,382 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ImportDialog</class>
|
<class>ImportDialog</class>
|
||||||
<widget class="QDialog" name="ImportDialog">
|
<widget class="QDialog" name="ImportDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>430</width>
|
<width>516</width>
|
||||||
<height>380</height>
|
<height>512</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>430</width>
|
<width>516</width>
|
||||||
<height>380</height>
|
<height>512</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="windowTitle">
|
||||||
<size>
|
<string>Import...</string>
|
||||||
<width>430</width>
|
</property>
|
||||||
<height>380</height>
|
<property name="modal">
|
||||||
</size>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<layout class="QVBoxLayout" name="vlImport">
|
||||||
<string>Import...</string>
|
<property name="leftMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="modal">
|
</property>
|
||||||
<bool>true</bool>
|
<property name="topMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<layout class="QVBoxLayout" name="vlImport">
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<item>
|
||||||
<number>0</number>
|
<widget class="UiModLabel" name="labPicture">
|
||||||
</property>
|
<property name="minimumSize">
|
||||||
<property name="bottomMargin">
|
<size>
|
||||||
<number>0</number>
|
<width>516</width>
|
||||||
</property>
|
<height>288</height>
|
||||||
<item>
|
</size>
|
||||||
<widget class="UiModLabel" name="labPicture">
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="text">
|
||||||
<size>
|
<string/>
|
||||||
<width>430</width>
|
</property>
|
||||||
<height>240</height>
|
</widget>
|
||||||
</size>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="text">
|
<widget class="QFrame" name="buttomFrame">
|
||||||
<string/>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||||
</widget>
|
<horstretch>0</horstretch>
|
||||||
</item>
|
<verstretch>0</verstretch>
|
||||||
<item>
|
</sizepolicy>
|
||||||
<widget class="QFrame" name="buttomFrame">
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="frameShape">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<enum>QFrame::NoFrame</enum>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="frameShadow">
|
||||||
</sizepolicy>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="lineWidth">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<layout class="QVBoxLayout" name="vlButtom">
|
||||||
<enum>QFrame::Plain</enum>
|
<property name="leftMargin">
|
||||||
</property>
|
<number>9</number>
|
||||||
<property name="lineWidth">
|
</property>
|
||||||
<number>0</number>
|
<property name="topMargin">
|
||||||
</property>
|
<number>6</number>
|
||||||
<layout class="QVBoxLayout" name="vlButtom">
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="rightMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="bottomMargin">
|
||||||
<number>6</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<item>
|
||||||
<number>9</number>
|
<widget class="QGroupBox" name="gbSettings">
|
||||||
</property>
|
<property name="title">
|
||||||
<property name="bottomMargin">
|
<string>Picture</string>
|
||||||
<number>9</number>
|
</property>
|
||||||
</property>
|
<layout class="QVBoxLayout" name="vlSettings">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gbSettings">
|
<layout class="QHBoxLayout" name="hlCheckboxesTop">
|
||||||
<property name="title">
|
<item>
|
||||||
<string>Settings</string>
|
<widget class="QCheckBox" name="cbAvatar">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<layout class="QGridLayout" name="gdSettings">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<item row="1" column="0">
|
<horstretch>0</horstretch>
|
||||||
<widget class="QRadioButton" name="rbKeep">
|
<verstretch>0</verstretch>
|
||||||
<property name="text">
|
</sizepolicy>
|
||||||
<string>&Keep Aspect Ratio</string>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Avatar</string>
|
||||||
</item>
|
</property>
|
||||||
<item row="1" column="1">
|
</widget>
|
||||||
<widget class="QRadioButton" name="rbIgnore">
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>&Ignore Aspect Ratio</string>
|
<widget class="QCheckBox" name="cbIgnore">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
</widget>
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
</item>
|
<horstretch>0</horstretch>
|
||||||
<item row="0" column="0">
|
<verstretch>0</verstretch>
|
||||||
<widget class="QCheckBox" name="cbAvatar">
|
</sizepolicy>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>&Avatar</string>
|
<property name="text">
|
||||||
</property>
|
<string>Ignore Aspect Ratio</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
</layout>
|
</item>
|
||||||
</widget>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsDialog">
|
<layout class="QHBoxLayout" name="hlCheckboxesButtom">
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Vertical</enum>
|
<widget class="QCheckBox" name="cbWatermark">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<property name="sizeHint" stdset="0">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<size>
|
<horstretch>0</horstretch>
|
||||||
<width>0</width>
|
<verstretch>0</verstretch>
|
||||||
<height>0</height>
|
</sizepolicy>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</spacer>
|
<string>Watermark</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
</widget>
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
</item>
|
||||||
<item>
|
</layout>
|
||||||
<spacer name="hsButtons">
|
</item>
|
||||||
<property name="orientation">
|
</layout>
|
||||||
<enum>Qt::Horizontal</enum>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="sizeHint" stdset="0">
|
<item>
|
||||||
<size>
|
<widget class="QGroupBox" name="gbBackground">
|
||||||
<width>0</width>
|
<property name="title">
|
||||||
<height>0</height>
|
<string>Background</string>
|
||||||
</size>
|
</property>
|
||||||
</property>
|
<layout class="QVBoxLayout" name="vlBackground">
|
||||||
</spacer>
|
<item>
|
||||||
</item>
|
<layout class="QHBoxLayout" name="hlColour">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdOK">
|
<layout class="QHBoxLayout" name="hlColourManage">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<widget class="QLabel" name="labColour">
|
||||||
<horstretch>0</horstretch>
|
<property name="text">
|
||||||
<verstretch>0</verstretch>
|
<string>Background Colour: <span style="color: %1">%1</span></string>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>&OK</string>
|
<item>
|
||||||
</property>
|
<layout class="QHBoxLayout" name="hlColourButton">
|
||||||
</widget>
|
<property name="spacing">
|
||||||
</item>
|
<number>0</number>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QPushButton" name="cmdCancel">
|
<property name="leftMargin">
|
||||||
<property name="sizePolicy">
|
<number>0</number>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
</property>
|
||||||
<horstretch>0</horstretch>
|
<property name="topMargin">
|
||||||
<verstretch>0</verstretch>
|
<number>0</number>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
<property name="rightMargin">
|
||||||
<property name="text">
|
<number>0</number>
|
||||||
<string>&Cancel</string>
|
</property>
|
||||||
</property>
|
<property name="bottomMargin">
|
||||||
</widget>
|
<number>0</number>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<item>
|
||||||
</item>
|
<widget class="QToolButton" name="cmdColourChange">
|
||||||
</layout>
|
<property name="toolTip">
|
||||||
</widget>
|
<string>Select background colour</string>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="text">
|
||||||
</widget>
|
<string>...</string>
|
||||||
<customwidgets>
|
</property>
|
||||||
<customwidget>
|
</widget>
|
||||||
<class>UiModLabel</class>
|
</item>
|
||||||
<extends>QLabel</extends>
|
</layout>
|
||||||
<header>UiModLabel.h</header>
|
</item>
|
||||||
</customwidget>
|
<item>
|
||||||
</customwidgets>
|
<spacer name="hsColour">
|
||||||
<resources/>
|
<property name="orientation">
|
||||||
<connections/>
|
<enum>Qt::Horizontal</enum>
|
||||||
</ui>
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlBackgroundManage">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labBackgroundImage">
|
||||||
|
<property name="text">
|
||||||
|
<string>Background Image:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlBackgroundButton">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<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="QToolButton" name="cmdBackgroundChange">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select background image</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="cmdBackgroundWipe">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remove background image</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>X</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="hsBackgroundImage">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlBackground">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbForceAvatarColour">
|
||||||
|
<property name="text">
|
||||||
|
<string>Force Colour in Avatar Zone</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbStretch">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ignore Aspect Ratio</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="vsInterface">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdOptions">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Import options</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Options</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</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="cmdOK">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Import picture</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdCancel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Discard picture</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>UiModLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>uimod/UiModLabel.h</header>
|
||||||
|
<slots>
|
||||||
|
<signal>mouseMoved()</signal>
|
||||||
|
<signal>mouseReleased()</signal>
|
||||||
|
<signal>mousePressed()</signal>
|
||||||
|
<signal>mouseDoubleClicked()</signal>
|
||||||
|
</slots>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
|
@ -0,0 +1,233 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* 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 "JsonEditorDialog.h"
|
||||||
|
#include "ui_JsonEditorDialog.h"
|
||||||
|
#include "SnapmaticEditor.h"
|
||||||
|
#include "AppEnv.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include <QStringBuilder>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050200
|
||||||
|
#include <QFontDatabase>
|
||||||
|
#include <QDebug>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
|
#include "TelemetryClass.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
|
||||||
|
QDialog(parent), smpic(picture),
|
||||||
|
ui(new Ui::JsonEditorDialog)
|
||||||
|
{
|
||||||
|
// Set Window Flags
|
||||||
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowMinMaxButtonsHint);
|
||||||
|
|
||||||
|
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 Save 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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonCode = picture->getJsonStr();
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050200
|
||||||
|
ui->txtJSON->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
|
#endif
|
||||||
|
QFontMetrics fontMetrics(ui->txtJSON->font());
|
||||||
|
ui->txtJSON->setTabStopWidth(fontMetrics.width(" "));
|
||||||
|
|
||||||
|
QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonCode.toUtf8());
|
||||||
|
ui->txtJSON->setStyleSheet("QPlainTextEdit{background-color: rgb(46, 47, 48); color: rgb(238, 231, 172);}");
|
||||||
|
ui->txtJSON->setPlainText(QString::fromUtf8(jsonDocument.toJson(QJsonDocument::Indented)).trimmed());
|
||||||
|
jsonHl = new JSHighlighter(ui->txtJSON->document());
|
||||||
|
|
||||||
|
// DPI calculation
|
||||||
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
ui->hlButtons->setSpacing(6 * screenRatio);
|
||||||
|
ui->hlButtons->setContentsMargins(9 * screenRatio, 0, 9 * screenRatio, 0);
|
||||||
|
ui->vlInterface->setContentsMargins(0, 0, 0, 9 * screenRatio);
|
||||||
|
#else
|
||||||
|
ui->hlButtons->setSpacing(6 * screenRatio);
|
||||||
|
ui->hlButtons->setContentsMargins(9 * screenRatio, 0, 9 * screenRatio, 0);
|
||||||
|
ui->vlInterface->setContentsMargins(0, 0, 0, 9 * screenRatio);
|
||||||
|
#endif
|
||||||
|
if (screenRatio > 1)
|
||||||
|
{
|
||||||
|
ui->lineJSON->setMinimumHeight(qRound(1 * screenRatio));
|
||||||
|
ui->lineJSON->setMaximumHeight(qRound(1 * screenRatio));
|
||||||
|
ui->lineJSON->setLineWidth(qRound(1 * screenRatio));
|
||||||
|
}
|
||||||
|
resize(450 * screenRatio, 550 * screenRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonEditorDialog::~JsonEditorDialog()
|
||||||
|
{
|
||||||
|
delete jsonHl;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JsonEditorDialog::closeEvent(QCloseEvent *ev)
|
||||||
|
{
|
||||||
|
QString jsonPatched = QString(ui->txtJSON->toPlainText()).replace("\t", " ");
|
||||||
|
QJsonDocument jsonNew = QJsonDocument::fromJson(jsonPatched.toUtf8());
|
||||||
|
QJsonDocument jsonOriginal = QJsonDocument::fromJson(jsonCode.toUtf8());
|
||||||
|
QString originalCode = QString::fromUtf8(jsonOriginal.toJson(QJsonDocument::Compact));
|
||||||
|
QString newCode = QString::fromUtf8(jsonNew.toJson(QJsonDocument::Compact));
|
||||||
|
if (newCode != originalCode)
|
||||||
|
{
|
||||||
|
QMessageBox::StandardButton button = QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("<h4>Unsaved changes detected</h4>You want to save the JSON content before you quit?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||||
|
if (button == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
if (saveJsonContent())
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev->ignore();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (button == QMessageBox::No)
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JsonEditorDialog::saveJsonContent()
|
||||||
|
{
|
||||||
|
QString jsonPatched = QString(ui->txtJSON->toPlainText()).replace("\t", " ");
|
||||||
|
QJsonDocument jsonNew = QJsonDocument::fromJson(jsonPatched.toUtf8());
|
||||||
|
if (!jsonNew.isEmpty())
|
||||||
|
{
|
||||||
|
QJsonDocument jsonOriginal = QJsonDocument::fromJson(jsonCode.toUtf8());
|
||||||
|
QString originalCode = QString::fromUtf8(jsonOriginal.toJson(QJsonDocument::Compact));
|
||||||
|
QString newCode = QString::fromUtf8(jsonNew.toJson(QJsonDocument::Compact));
|
||||||
|
if (newCode != originalCode)
|
||||||
|
{
|
||||||
|
QString currentFilePath = smpic->getPictureFilePath();
|
||||||
|
QString originalFilePath = smpic->getOriginalPictureFilePath();
|
||||||
|
QString backupFileName = originalFilePath % ".bak";
|
||||||
|
if (!QFile::exists(backupFileName))
|
||||||
|
{
|
||||||
|
QFile::copy(currentFilePath, backupFileName);
|
||||||
|
}
|
||||||
|
smpic->setJsonStr(newCode, true);
|
||||||
|
if (!smpic->isJsonOk())
|
||||||
|
{
|
||||||
|
QString lastStep = smpic->getLastStep(false);
|
||||||
|
QString readableError;
|
||||||
|
if (lastStep.contains("JSONINCOMPLETE") && lastStep.contains("JSONERROR"))
|
||||||
|
{
|
||||||
|
readableError = SnapmaticPicture::tr("JSON is incomplete and malformed");
|
||||||
|
}
|
||||||
|
else if (lastStep.contains("JSONINCOMPLETE"))
|
||||||
|
{
|
||||||
|
readableError = SnapmaticPicture::tr("JSON is incomplete");
|
||||||
|
}
|
||||||
|
else if (lastStep.contains("JSONERROR"))
|
||||||
|
{
|
||||||
|
readableError = SnapmaticPicture::tr("JSON is malformed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
readableError = tr("JSON Error");
|
||||||
|
}
|
||||||
|
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of %1").arg(readableError));
|
||||||
|
smpic->setJsonStr(originalCode, true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!smpic->exportPicture(currentFilePath))
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of I/O Error"));
|
||||||
|
smpic->setJsonStr(originalCode, true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
jsonCode = newCode;
|
||||||
|
smpic->updateStrings();
|
||||||
|
smpic->emitUpdate();
|
||||||
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
|
telemetrySettings.endGroup();
|
||||||
|
if (pushUsageData && Telemetry->canPush())
|
||||||
|
{
|
||||||
|
QJsonDocument jsonDocument;
|
||||||
|
QJsonObject jsonObject;
|
||||||
|
jsonObject["Type"] = "JSONEdited";
|
||||||
|
jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
|
||||||
|
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
|
||||||
|
jsonDocument.setObject(jsonObject);
|
||||||
|
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of JSON Error"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JsonEditorDialog::on_cmdClose_clicked()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void JsonEditorDialog::on_cmdSave_clicked()
|
||||||
|
{
|
||||||
|
if (saveJsonContent())
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* 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
|
||||||
|
* 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 JSONEDITORDIALOG_H
|
||||||
|
#define JSONEDITORDIALOG_H
|
||||||
|
|
||||||
|
#include "SnapmaticPicture.h"
|
||||||
|
#include "JSHighlighter.h"
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class JsonEditorDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class JsonEditorDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent = 0);
|
||||||
|
bool saveJsonContent();
|
||||||
|
~JsonEditorDialog();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent *ev);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_cmdClose_clicked();
|
||||||
|
void on_cmdSave_clicked();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void codeUpdated(QString jsonCode);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString jsonCode;
|
||||||
|
JSHighlighter *jsonHl;
|
||||||
|
SnapmaticPicture *smpic;
|
||||||
|
Ui::JsonEditorDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // JSONEDITORDIALOG_H
|
|
@ -0,0 +1,145 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>JsonEditorDialog</class>
|
||||||
|
<widget class="QDialog" name="JsonEditorDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>550</width>
|
||||||
|
<height>450</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Snapmatic JSON Editor</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>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="vlJSON">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<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="QPlainTextEdit" name="txtJSON">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="lineJSON">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QFrame[frameShape="4"]
|
||||||
|
{
|
||||||
|
color: black;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
|
<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="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Apply changes</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdClose">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Discard changes</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
14
LICENSE
14
LICENSE
|
@ -1,7 +1,7 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
|
||||||
state the exclusion of warranty; and each file should have at least
|
state the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
{one line to give the program's name and a brief idea of what it does.}
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
Copyright (C) {year} {name of author}
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
If the program does terminal interaction, make it output a short
|
||||||
notice like this when it starts in an interactive mode:
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
{project} Copyright (C) {year} {fullname}
|
<program> Copyright (C) <year> <name of author>
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
|
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
The GNU General Public License does not permit incorporating your program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
may consider it more useful to permit linking proprietary applications with
|
may consider it more useful to permit linking proprietary applications with
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
@ -620,3 +620,55 @@ copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|
|
@ -1,459 +1,165 @@
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 2.1, February 1999
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
of this license document, but changing it is not allowed.
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
This version of the GNU Lesser General Public License incorporates
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
the version number 2.1.]
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
Preamble
|
0. Additional Definitions.
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
General Public License.
|
||||||
free software--to make sure the software is free for all its users.
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
This license, the Lesser General Public License, applies to some
|
other than an Application or a Combined Work as defined below.
|
||||||
specially designated software packages--typically libraries--of the
|
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
An "Application" is any work that makes use of an interface provided
|
||||||
can use it too, but we suggest you first think carefully about whether
|
by the Library, but which is not otherwise based on the Library.
|
||||||
this license or the ordinary General Public License is the better
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
strategy to use in any particular case, based on the explanations below.
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
Application with the Library. The particular version of the Library
|
||||||
you have the freedom to distribute copies of free software (and charge
|
with which the Combined Work was made is also called the "Linked
|
||||||
for this service if you wish); that you receive source code or can get
|
Version".
|
||||||
it if you want it; that you can change the software and use pieces of
|
|
||||||
it in new free programs; and that you are informed that you can do
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
these things.
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
To protect your rights, we need to make restrictions that forbid
|
based on the Application, and not on the Linked Version.
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
|
||||||
rights. These restrictions translate to certain responsibilities for
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
you if you distribute copies of the library or if you modify it.
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
For example, if you distribute copies of the library, whether gratis
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
|
||||||
you. You must make sure that they, too, receive or can get the source
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
code. If you link other code with the library, you must provide
|
|
||||||
complete object files to the recipients, so that they can relink them
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
with the library after making changes to the library and recompiling
|
without being bound by section 3 of the GNU GPL.
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
|
||||||
library, and (2) we offer you this license, which gives you legal
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
permission to copy, distribute and/or modify the library.
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
To protect each distributor, we want to make it very clear that
|
facility is invoked), then you may convey a copy of the modified
|
||||||
there is no warranty for the free library. Also, if the library is
|
version:
|
||||||
modified by someone else and passed on, the recipients should know
|
|
||||||
that what they have is not the original version, so that the original
|
a) under this License, provided that you make a good faith effort to
|
||||||
author's reputation will not be affected by problems that might be
|
ensure that, in the event an Application does not supply the
|
||||||
introduced by others.
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
effectively restrict the users of a free program by obtaining a
|
this License applicable to that copy.
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
Most GNU software, including some libraries, is covered by the
|
a header file that is part of the Library. You may convey such object
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
code under terms of your choice, provided that, if the incorporated
|
||||||
General Public License, applies to certain designated libraries, and
|
material is not limited to numerical parameters, data structure
|
||||||
is quite different from the ordinary General Public License. We use
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
this license for certain libraries in order to permit linking those
|
(ten or fewer lines in length), you do both of the following:
|
||||||
libraries into non-free programs.
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
When a program is linked with a library, whether statically or using
|
Library is used in it and that the Library and its use are
|
||||||
a shared library, the combination of the two is legally speaking a
|
covered by this License.
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
document.
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
4. Combined Works.
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
You may convey a Combined Work under terms of your choice that,
|
||||||
does Less to protect the user's freedom than the ordinary General
|
taken together, effectively do not restrict modification of the
|
||||||
Public License. It also provides other free software developers Less
|
portions of the Library contained in the Combined Work and reverse
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
engineering for debugging such modifications, if you also do each of
|
||||||
are the reason we use the ordinary General Public License for many
|
the following:
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
For example, on rare occasions, there may be a special need to
|
covered by this License.
|
||||||
encourage the widest possible use of a certain library, so that it becomes
|
|
||||||
a de-facto standard. To achieve this, non-free programs must be
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
allowed to use the library. A more frequent case is that a free
|
document.
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
c) For a Combined Work that displays copyright notices during
|
||||||
software only, so we use the Lesser General Public License.
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
In other cases, permission to use a particular library in non-free
|
copies of the GNU GPL and this license document.
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
d) Do one of the following:
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
system.
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
Although the Lesser General Public License is Less protective of the
|
recombine or relink the Application with a modified version of
|
||||||
users' freedom, it does ensure that the user of a program that is
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
that program using a modified version of the Library.
|
Corresponding Source.
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
modification follow. Pay close attention to the difference between a
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
"work based on the library" and a "work that uses the library". The
|
a copy of the Library already present on the user's computer
|
||||||
former contains code derived from the library, whereas the latter must
|
system, and (b) will operate properly with a modified version
|
||||||
be combined with the library in order to run.
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
0. This License Agreement applies to any software library or other
|
GNU GPL, and only to the extent that such information is
|
||||||
program which contains a notice placed by the copyright holder or
|
necessary to install and execute a modified version of the
|
||||||
other authorized party saying it may be distributed under the terms of
|
Combined Work produced by recombining or relinking the
|
||||||
this Lesser General Public License (also called "this License").
|
Application with a modified version of the Linked Version. (If
|
||||||
Each licensee is addressed as "you".
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
A "library" means a collection of software functions and/or data
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
prepared so as to be conveniently linked with application programs
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
(which use some of those functions and data) to form executables.
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
5. Combined Libraries.
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
You may place library facilities that are a work based on the
|
||||||
copyright law: that is to say, a work containing the Library or a
|
Library side by side in a single library together with other library
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
facilities that are not Applications and are not covered by this
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
License, and convey such a combined library under terms of your
|
||||||
included without limitation in the term "modification".)
|
choice, if you do both of the following:
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
a) Accompany the combined library with a copy of the same work based
|
||||||
making modifications to it. For a library, complete source code means
|
on the Library, uncombined with any other library facilities,
|
||||||
all the source code for all modules it contains, plus any associated
|
conveyed under the terms of this License.
|
||||||
interface definition files, plus the scripts used to control compilation
|
|
||||||
and installation of the library.
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
Activities other than copying, distribution and modification are not
|
accompanying uncombined form of the same work.
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running a program using the Library is not restricted, and output from
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
such a program is covered only if its contents constitute a work based
|
|
||||||
on the Library (independent of the use of the Library in a tool for
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
writing it). Whether that is true depends on what the Library does
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
and what the program that uses the Library does.
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
Each version is given a distinguishing version number. If the
|
||||||
you conspicuously and appropriately publish on each copy an
|
Library as you received it specifies that a certain numbered version
|
||||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
of the GNU Lesser General Public License "or any later version"
|
||||||
all the notices that refer to this License and to the absence of any
|
applies to it, you have the option of following the terms and
|
||||||
warranty; and distribute a copy of this License along with the
|
conditions either of that published version or of any later version
|
||||||
Library.
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
and you may at your option offer warranty protection in exchange for a
|
General Public License ever published by the Free Software Foundation.
|
||||||
fee.
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
of it, thus forming a work based on the Library, and copy and
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
distribute such modifications or work under the terms of Section 1
|
permanent authorization for you to choose that version for the
|
||||||
above, provided that you also meet all of these conditions:
|
Library.
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
|
||||||
charge to all third parties under the terms of this License.
|
|
||||||
|
|
||||||
d) If a facility in the modified Library refers to a function or a
|
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Library,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
|
||||||
License instead of this License to a given copy of the Library. To do
|
|
||||||
this, you must alter all the notices that refer to this License, so
|
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
|
||||||
the Library into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
|
||||||
derivative of it, under Section 2) in object code or executable form
|
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
|
||||||
it with the complete corresponding machine-readable source code, which
|
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
|
||||||
from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place satisfies the requirement to
|
|
||||||
distribute the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
|
||||||
link a "work that uses the Library" with the Library to produce a
|
|
||||||
work containing portions of the Library, and distribute that work
|
|
||||||
under terms of your choice, provided that the terms permit
|
|
||||||
modification of the work for the customer's own use and reverse
|
|
||||||
engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above); and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at
|
|
||||||
least three years, to give the same user the materials
|
|
||||||
specified in Subsection 6a, above, for a charge no more
|
|
||||||
than the cost of performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Library or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Library (or any work based on the
|
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
|
||||||
Library), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
|
||||||
subject to these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties with
|
|
||||||
this License.
|
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Library at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Library by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
|
||||||
particular circumstance, the balance of the section is intended to apply,
|
|
||||||
and the section as a whole is intended to apply in other circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License may add
|
|
||||||
an explicit geographical distribution limitation excluding those countries,
|
|
||||||
so that distribution is permitted only in or among countries not thus
|
|
||||||
excluded. In such case, this License incorporates the limitation as if
|
|
||||||
written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser General Public License from time to time.
|
|
||||||
Such new versions will be similar in spirit to the present version,
|
|
||||||
but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
|
||||||
programs whose distribution conditions are incompatible with these,
|
|
||||||
write to the author to ask for permission. For software which is
|
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
|
||||||
Software Foundation; we sometimes make exceptions for this. Our
|
|
||||||
decision will be guided by the two goals of preserving the free status
|
|
||||||
of all derivatives of our free software and of promoting the sharing
|
|
||||||
and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* 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
|
||||||
|
* 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 "MapLocationDialog.h"
|
||||||
|
#include "ui_MapLocationDialog.h"
|
||||||
|
#include "IconLoader.h"
|
||||||
|
#include "AppEnv.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
|
MapLocationDialog::MapLocationDialog(double x, double y, QWidget *parent) :
|
||||||
|
QDialog(parent), xpos_old(x), ypos_old(y),
|
||||||
|
ui(new Ui::MapLocationDialog)
|
||||||
|
{
|
||||||
|
// Set Window Flags
|
||||||
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->cmdDone->setVisible(false);
|
||||||
|
ui->cmdApply->setVisible(false);
|
||||||
|
ui->cmdRevert->setVisible(false);
|
||||||
|
ui->cmdDone->setCursor(Qt::ArrowCursor);
|
||||||
|
ui->cmdClose->setCursor(Qt::ArrowCursor);
|
||||||
|
|
||||||
|
// DPI calculation
|
||||||
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
int widgetMargin = qRound(3 * screenRatio);
|
||||||
|
ui->hlMapDialog->setContentsMargins(widgetMargin, widgetMargin, widgetMargin, widgetMargin);
|
||||||
|
ui->vlMapDialog->setSpacing(widgetMargin);
|
||||||
|
setMinimumSize(500 * screenRatio, 600 * screenRatio);
|
||||||
|
setMaximumSize(500 * screenRatio, 600 * screenRatio);
|
||||||
|
setFixedSize(500 * screenRatio, 600 * screenRatio);
|
||||||
|
setMouseTracking(true);
|
||||||
|
|
||||||
|
changeMode = false;
|
||||||
|
propUpdate = false;
|
||||||
|
drawPointOnMap(xpos_old, ypos_old);
|
||||||
|
}
|
||||||
|
|
||||||
|
MapLocationDialog::~MapLocationDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::drawPointOnMap(double xpos_d, double ypos_d)
|
||||||
|
{
|
||||||
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
|
int pointMakerSize = 8 * screenRatio * screenRatioPR;
|
||||||
|
QPixmap pointMakerPixmap = IconLoader::loadingPointmakerIcon().pixmap(QSize(pointMakerSize, pointMakerSize));
|
||||||
|
QSize mapPixelSize = QSize(width() * screenRatioPR, height() * screenRatioPR);
|
||||||
|
|
||||||
|
int pointMakerHalfSize = pointMakerSize / 2;
|
||||||
|
long xpos_ms = qRound(xpos_d);
|
||||||
|
long ypos_ms = qRound(ypos_d);
|
||||||
|
double xpos_ma = xpos_ms + 4000;
|
||||||
|
double ypos_ma = ypos_ms + 4000;
|
||||||
|
double xrat = (double)mapPixelSize.width() / 10000;
|
||||||
|
double yrat = (double)mapPixelSize.height() / 12000;
|
||||||
|
long xpos_mp = qRound(xpos_ma * xrat);
|
||||||
|
long ypos_mp = qRound(ypos_ma * yrat);
|
||||||
|
long xpos_pr = xpos_mp - pointMakerHalfSize;
|
||||||
|
long ypos_pr = ypos_mp + pointMakerHalfSize;
|
||||||
|
|
||||||
|
QPixmap mapPixmap(mapPixelSize);
|
||||||
|
QPainter mapPainter(&mapPixmap);
|
||||||
|
mapPainter.drawPixmap(0, 0, mapPixelSize.width(), mapPixelSize.height(), QPixmap(":/img/mappreview.jpg").scaled(mapPixelSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
|
mapPainter.drawPixmap(xpos_pr, mapPixelSize.height() - ypos_pr, pointMakerSize, pointMakerSize, pointMakerPixmap);
|
||||||
|
mapPainter.end();
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
|
mapPixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QPalette backgroundPalette;
|
||||||
|
backgroundPalette.setBrush(backgroundRole(), QBrush(mapPixmap));
|
||||||
|
setPalette(backgroundPalette);
|
||||||
|
|
||||||
|
xpos_new = xpos_d;
|
||||||
|
ypos_new = ypos_d;
|
||||||
|
ui->labPos->setText(tr("X: %1\nY: %2", "X and Y position").arg(QString::number(xpos_d), QString::number(ypos_d)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::on_cmdChange_clicked()
|
||||||
|
{
|
||||||
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
int pointMakerSize = 8 * screenRatio;
|
||||||
|
QPixmap pointMakerPixmap = IconLoader::loadingPointmakerIcon().pixmap(QSize(pointMakerSize, pointMakerSize));
|
||||||
|
QCursor pointMakerCursor(pointMakerPixmap);
|
||||||
|
ui->cmdDone->setVisible(true);
|
||||||
|
ui->cmdApply->setVisible(false);
|
||||||
|
ui->cmdChange->setVisible(false);
|
||||||
|
ui->cmdRevert->setVisible(false);
|
||||||
|
|
||||||
|
setCursor(pointMakerCursor);
|
||||||
|
changeMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::on_cmdDone_clicked()
|
||||||
|
{
|
||||||
|
ui->cmdDone->setVisible(false);
|
||||||
|
ui->cmdChange->setVisible(true);
|
||||||
|
if (xpos_new != xpos_old || ypos_new != ypos_old)
|
||||||
|
{
|
||||||
|
ui->cmdApply->setVisible(true);
|
||||||
|
ui->cmdRevert->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
setCursor(Qt::ArrowCursor);
|
||||||
|
changeMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::updatePosFromEvent(int x, int y)
|
||||||
|
{
|
||||||
|
QSize mapPixelSize = size();
|
||||||
|
int xpos_ad = x;
|
||||||
|
int 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::mouseMoveEvent(QMouseEvent *ev)
|
||||||
|
{
|
||||||
|
if (!changeMode) { ev->ignore(); }
|
||||||
|
else if (ev->buttons() & Qt::LeftButton)
|
||||||
|
{
|
||||||
|
updatePosFromEvent(ev->x(), ev->y());
|
||||||
|
ev->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev->ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
|
{
|
||||||
|
if (!changeMode) { ev->ignore(); }
|
||||||
|
else if (ev->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
updatePosFromEvent(ev->x(), ev->y());
|
||||||
|
ev->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev->ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::on_cmdApply_clicked()
|
||||||
|
{
|
||||||
|
propUpdate = true;
|
||||||
|
xpos_old = xpos_new;
|
||||||
|
ypos_old = ypos_new;
|
||||||
|
ui->cmdApply->setVisible(false);
|
||||||
|
ui->cmdRevert->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::on_cmdRevert_clicked()
|
||||||
|
{
|
||||||
|
drawPointOnMap(xpos_old, ypos_old);
|
||||||
|
ui->cmdApply->setVisible(false);
|
||||||
|
ui->cmdRevert->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MapLocationDialog::propUpdated()
|
||||||
|
{
|
||||||
|
return propUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
double MapLocationDialog::getXpos()
|
||||||
|
{
|
||||||
|
return xpos_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
double MapLocationDialog::getYpos()
|
||||||
|
{
|
||||||
|
return ypos_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapLocationDialog::on_cmdClose_clicked()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* 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
|
||||||
|
* 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 MAPLOCATIONDIALOG_H
|
||||||
|
#define MAPLOCATIONDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MapLocationDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MapLocationDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MapLocationDialog(double x, double y, QWidget *parent = 0);
|
||||||
|
void drawPointOnMap(double x, double y);
|
||||||
|
bool propUpdated();
|
||||||
|
double getXpos();
|
||||||
|
double getYpos();
|
||||||
|
~MapLocationDialog();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mouseMoveEvent(QMouseEvent *ev);
|
||||||
|
void mouseReleaseEvent(QMouseEvent *ev);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_cmdDone_clicked();
|
||||||
|
void on_cmdApply_clicked();
|
||||||
|
void on_cmdChange_clicked();
|
||||||
|
void on_cmdRevert_clicked();
|
||||||
|
void updatePosFromEvent(int x, int y);
|
||||||
|
void on_cmdClose_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
double xpos_old;
|
||||||
|
double ypos_old;
|
||||||
|
double xpos_new;
|
||||||
|
double ypos_new;
|
||||||
|
bool propUpdate;
|
||||||
|
bool changeMode;
|
||||||
|
Ui::MapLocationDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAPLOCATIONDIALOG_H
|
|
@ -0,0 +1,233 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MapLocationDialog</class>
|
||||||
|
<widget class="QDialog" name="MapLocationDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>500</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>600</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>600</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Snapmatic Map Viewer</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vlMapPreview">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<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>
|
||||||
|
<layout class="QHBoxLayout" name="hlMapDialog">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="vlPosLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<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="labPos">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QLabel{
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="vsPosSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="hsMapDialog">
|
||||||
|
<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>
|
||||||
|
<layout class="QVBoxLayout" name="vlMapDialog">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<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="QPushButton" name="cmdClose">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Close viewer</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Close</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="vsMapDialog">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdApply">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Apply new position</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Apply</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdRevert">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Revert old position</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Revert</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdChange">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Select new position</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Select</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdDone">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Quit select position</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Done</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,79 +1,86 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef OPTIONSDIALOG_H
|
#ifndef OPTIONSDIALOG_H
|
||||||
#define OPTIONSDIALOG_H
|
#define OPTIONSDIALOG_H
|
||||||
|
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class OptionsDialog;
|
class OptionsDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class OptionsDialog : public QDialog
|
class OptionsDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OptionsDialog(ProfileDatabase *profileDB, QWidget *parent = 0);
|
explicit OptionsDialog(ProfileDatabase *profileDB, QWidget *parent = 0);
|
||||||
void commitProfiles(QStringList profiles);
|
void commitProfiles(const QStringList &profiles);
|
||||||
~OptionsDialog();
|
~OptionsDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cmdOK_clicked();
|
void on_cmdOK_clicked();
|
||||||
void on_rbPicCustomRes_toggled(bool checked);
|
void on_rbPicCustomRes_toggled(bool checked);
|
||||||
void on_cbPicCustomQuality_toggled(bool checked);
|
void on_cbPicCustomQuality_toggled(bool checked);
|
||||||
void on_hsPicQuality_valueChanged(int value);
|
void on_hsPicQuality_valueChanged(int value);
|
||||||
void on_cbIgnoreAspectRatio_toggled(bool checked);
|
void on_cbIgnoreAspectRatio_toggled(bool checked);
|
||||||
void on_cmdExploreFolder_clicked();
|
void on_cmdExploreFolder_clicked();
|
||||||
|
void on_cbDefaultStyle_toggled(bool checked);
|
||||||
signals:
|
void on_cmdCopyStatsID_clicked();
|
||||||
void settingsApplied(int contentMode, QString language);
|
|
||||||
|
signals:
|
||||||
private:
|
void settingsApplied(int contentMode, bool languageChanged);
|
||||||
ProfileDatabase *profileDB;
|
|
||||||
Ui::OptionsDialog *ui;
|
private:
|
||||||
QList<QTreeWidgetItem*> playerItems;
|
ProfileDatabase *profileDB;
|
||||||
Qt::AspectRatioMode aspectRatio;
|
Ui::OptionsDialog *ui;
|
||||||
QString currentLanguage;
|
QList<QTreeWidgetItem*> playerItems;
|
||||||
QString currentCFolder;
|
Qt::AspectRatioMode aspectRatio;
|
||||||
QString defaultProfile;
|
QString currentAreaLanguage;
|
||||||
QString percentString;
|
QString currentLanguage;
|
||||||
QSettings *settings;
|
QString currentCFolder;
|
||||||
bool currentFFolder;
|
QString defaultProfile;
|
||||||
int contentMode;
|
QString percentString;
|
||||||
int customQuality;
|
QSettings *settings;
|
||||||
int defaultQuality;
|
bool withoutPlayers;
|
||||||
QSize defExportSize;
|
bool currentFFolder;
|
||||||
QSize cusExportSize;
|
int contentMode;
|
||||||
void setupTreeWidget();
|
int customQuality;
|
||||||
void setupLanguageBox();
|
int defaultQuality;
|
||||||
void setupRadioButtons();
|
QSize defExportSize;
|
||||||
void setupDefaultProfile();
|
QSize cusExportSize;
|
||||||
void setupPictureSettings();
|
void setupTreeWidget();
|
||||||
void setupCustomGTAFolder();
|
void setupLanguageBox();
|
||||||
void setupSnapmaticPictureViewer();
|
void setupRadioButtons();
|
||||||
void applySettings();
|
void setupDefaultProfile();
|
||||||
};
|
void setupPictureSettings();
|
||||||
|
void setupCustomGTAFolder();
|
||||||
#endif // OPTIONSDIALOG_H
|
void setupInterfaceSettings();
|
||||||
|
void setupStatisticsSettings();
|
||||||
|
void setupSnapmaticPictureViewer();
|
||||||
|
void setupWindowsGameSettings();
|
||||||
|
void applySettings();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPTIONSDIALOG_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,123 +1,147 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PICTUREDIALOG_H
|
#ifndef PICTUREDIALOG_H
|
||||||
#define PICTUREDIALOG_H
|
#define PICTUREDIALOG_H
|
||||||
|
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QMouseEvent>
|
#include <QResizeEvent>
|
||||||
#include <QDialog>
|
#include <QMouseEvent>
|
||||||
#include <QEvent>
|
#include <QToolBar>
|
||||||
#include <QMenu>
|
#include <QDialog>
|
||||||
|
#include <QEvent>
|
||||||
namespace Ui {
|
#include <QMenu>
|
||||||
class PictureDialog;
|
|
||||||
}
|
#ifdef GTA5SYNC_WIN
|
||||||
|
#if QT_VERSION >= 0x050200
|
||||||
class PictureDialog : public QDialog
|
#ifdef GTA5SYNC_APV
|
||||||
{
|
#include <dwmapi.h>
|
||||||
Q_OBJECT
|
#endif
|
||||||
public:
|
#endif
|
||||||
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
#endif
|
||||||
explicit PictureDialog(QWidget *parent = 0);
|
|
||||||
explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
namespace Ui {
|
||||||
explicit PictureDialog(bool primaryWindow, QWidget *parent = 0);
|
class PictureDialog;
|
||||||
void setupPictureDialog(bool withDatabase);
|
}
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool indexed, int index);
|
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index);
|
class PictureDialog : public QDialog
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
{
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture, int index);
|
Q_OBJECT
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture);
|
public:
|
||||||
void addPreviousNextButtons();
|
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
||||||
void stylizeDialog();
|
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent = 0);
|
||||||
bool isIndexed();
|
explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
|
||||||
int getIndex();
|
explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent = 0);
|
||||||
~PictureDialog();
|
void setupPictureDialog();
|
||||||
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool indexed, int index);
|
||||||
public slots:
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index);
|
||||||
void playerNameUpdated();
|
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk);
|
||||||
void dialogNextPictureRequested();
|
void setSnapmaticPicture(SnapmaticPicture *picture, int index);
|
||||||
void dialogPreviousPictureRequested();
|
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||||
void adaptNewDialogSize(QSize newLabelSize);
|
void addPreviousNextButtons();
|
||||||
void exportCustomContextMenuRequested(const QPoint &pos);
|
void styliseDialog();
|
||||||
|
bool isIndexed();
|
||||||
private slots:
|
int getIndex();
|
||||||
void copySnapmaticPicture();
|
~PictureDialog();
|
||||||
void exportSnapmaticPicture();
|
|
||||||
void triggerFullscreenDoubeClick();
|
public slots:
|
||||||
void on_labPicture_mouseDoubleClicked(Qt::MouseButton button);
|
void crewNameUpdated();
|
||||||
void on_labPicture_customContextMenuRequested(const QPoint &pos);
|
void playerNameUpdated();
|
||||||
void exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen);
|
void dialogNextPictureRequested();
|
||||||
void nextPictureRequestedSlot();
|
void dialogPreviousPictureRequested();
|
||||||
void previousPictureRequestedSlot();
|
void adaptNewDialogSize(QSize newLabelSize);
|
||||||
void renderOverlayPicture();
|
void exportCustomContextMenuRequested(const QPoint &pos);
|
||||||
void renderPicture();
|
|
||||||
|
private slots:
|
||||||
signals:
|
void copySnapmaticPicture();
|
||||||
void nextPictureRequested();
|
void exportSnapmaticPicture();
|
||||||
void previousPictureRequested();
|
void triggerFullscreenDoubeClick();
|
||||||
void newPictureCommited(QImage picture);
|
void on_labPicture_mouseDoubleClicked(Qt::MouseButton button);
|
||||||
void endDatabaseThread();
|
void on_labPicture_customContextMenuRequested(const QPoint &pos);
|
||||||
|
void exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen);
|
||||||
protected:
|
void nextPictureRequestedSlot();
|
||||||
void closeEvent(QCloseEvent *ev);
|
void previousPictureRequestedSlot();
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
void editSnapmaticProperties();
|
||||||
void mousePressEvent(QMouseEvent *ev);
|
void editSnapmaticRawJson();
|
||||||
bool event(QEvent *event);
|
void editSnapmaticImage();
|
||||||
|
void renderOverlayPicture();
|
||||||
private:
|
void renderPicture();
|
||||||
bool primaryWindow;
|
void openPreviewMap();
|
||||||
ProfileDatabase *profileDB;
|
void updated();
|
||||||
CrewDatabase *crewDB;
|
void customSignal(QString signal);
|
||||||
Ui::PictureDialog *ui;
|
|
||||||
QMap<QString, QString> globalMap;
|
signals:
|
||||||
SnapmaticPicture *smpic;
|
void nextPictureRequested();
|
||||||
QWidget *fullscreenWidget;
|
void previousPictureRequested();
|
||||||
QAction *jpegExportAction;
|
void newPictureCommited(QImage picture);
|
||||||
QAction *pgtaExportAction;
|
void endDatabaseThread();
|
||||||
QImage avatarAreaPicture;
|
|
||||||
QImage snapmaticPicture;
|
protected:
|
||||||
QImage overlayTempImage;
|
void closeEvent(QCloseEvent *ev);
|
||||||
QString jsonDrawString;
|
bool eventFilter(QObject *obj, QEvent *ev);
|
||||||
QString windowTitleStr;
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
QStringList plyrsList;
|
bool event(QEvent *event);
|
||||||
QString picAreaStr;
|
#ifdef GTA5SYNC_WIN
|
||||||
QString picArea;
|
#if QT_VERSION >= 0x050200
|
||||||
QString picTitl;
|
#ifdef GTA5SYNC_APV
|
||||||
QString picPath;
|
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
|
||||||
QString created;
|
LRESULT HitTestNCA(HWND hWnd, LPARAM lParam);
|
||||||
QString crewID;
|
void resizeEvent(QResizeEvent *event);
|
||||||
QString locX;
|
#endif
|
||||||
QString locY;
|
#endif
|
||||||
QString locZ;
|
#endif
|
||||||
bool overlayEnabled;
|
|
||||||
bool withDatabase;
|
private:
|
||||||
bool rqFullscreen;
|
QString generateCrewString();
|
||||||
bool naviEnabled;
|
QString generatePlayersString();
|
||||||
bool previewMode;
|
bool primaryWindow;
|
||||||
bool indexed;
|
ProfileDatabase *profileDB;
|
||||||
int index;
|
CrewDatabase *crewDB;
|
||||||
int avatarLocX;
|
QString profileName;
|
||||||
int avatarLocY;
|
Ui::PictureDialog *ui;
|
||||||
int avatarSize;
|
QMap<QString, QString> globalMap;
|
||||||
QMenu *exportMenu;
|
SnapmaticPicture *smpic;
|
||||||
};
|
QWidget *fullscreenWidget;
|
||||||
|
QImage avatarAreaPicture;
|
||||||
#endif // PICTUREDIALOG_H
|
QImage snapmaticPicture;
|
||||||
|
QImage overlayTempImage;
|
||||||
|
QString jsonDrawString;
|
||||||
|
QString windowTitleStr;
|
||||||
|
QString picAreaStr;
|
||||||
|
QString crewStr;
|
||||||
|
bool overlayEnabled;
|
||||||
|
bool rqFullscreen;
|
||||||
|
bool naviEnabled;
|
||||||
|
bool previewMode;
|
||||||
|
bool indexed;
|
||||||
|
int index;
|
||||||
|
int avatarLocX;
|
||||||
|
int avatarLocY;
|
||||||
|
int avatarSize;
|
||||||
|
QMenu *manageMenu;
|
||||||
|
#ifdef GTA5SYNC_WIN
|
||||||
|
#if QT_VERSION >= 0x050200
|
||||||
|
QPoint dragPosition;
|
||||||
|
bool dragStart;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PICTUREDIALOG_H
|
||||||
|
|
|
@ -1,254 +1,249 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>PictureDialog</class>
|
<class>PictureDialog</class>
|
||||||
<widget class="QDialog" name="PictureDialog">
|
<widget class="QDialog" name="PictureDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>960</width>
|
<width>960</width>
|
||||||
<height>602</height>
|
<height>618</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>%1 - Snapmatic Picture Viewer</string>
|
<string>Snapmatic Picture Viewer - %1</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlPictureLayout">
|
<layout class="QVBoxLayout" name="vlPictureLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="UiModLabel" name="labPicture">
|
<widget class="UiModLabel" name="labPicture">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>1</verstretch>
|
<verstretch>1</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="alignment">
|
||||||
<pixmap resource="res/app.qrc">:/img/960x536.png</pixmap>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
</widget>
|
||||||
<set>Qt::AlignCenter</set>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</widget>
|
<spacer name="vsJSONUpper">
|
||||||
</item>
|
<property name="orientation">
|
||||||
<item>
|
<enum>Qt::Vertical</enum>
|
||||||
<spacer name="vsJSONUpper">
|
</property>
|
||||||
<property name="orientation">
|
<property name="sizeHint" stdset="0">
|
||||||
<enum>Qt::Vertical</enum>
|
<size>
|
||||||
</property>
|
<width>0</width>
|
||||||
<property name="sizeHint" stdset="0">
|
<height>0</height>
|
||||||
<size>
|
</size>
|
||||||
<width>0</width>
|
</property>
|
||||||
<height>0</height>
|
</spacer>
|
||||||
</size>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</spacer>
|
<widget class="QFrame" name="jsonFrame">
|
||||||
</item>
|
<property name="frameShape">
|
||||||
<item>
|
<enum>QFrame::NoFrame</enum>
|
||||||
<widget class="QFrame" name="jsonFrame">
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="lineWidth">
|
||||||
<enum>QFrame::Plain</enum>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="lineWidth">
|
<layout class="QHBoxLayout" name="hlJson">
|
||||||
<number>0</number>
|
<property name="spacing">
|
||||||
</property>
|
<number>0</number>
|
||||||
<layout class="QHBoxLayout" name="hlJson">
|
</property>
|
||||||
<property name="spacing">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<item>
|
||||||
<number>0</number>
|
<layout class="QHBoxLayout" name="jsonLayout">
|
||||||
</property>
|
<property name="leftMargin">
|
||||||
<item>
|
<number>4</number>
|
||||||
<layout class="QHBoxLayout" name="jsonLayout">
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="topMargin">
|
||||||
<number>4</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="rightMargin">
|
||||||
<number>10</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="bottomMargin">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<item>
|
||||||
<number>4</number>
|
<widget class="UiModLabel" name="labJSON">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<item>
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<widget class="UiModLabel" name="labJSON">
|
<horstretch>0</horstretch>
|
||||||
<property name="sizePolicy">
|
<verstretch>0</verstretch>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
</sizepolicy>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="text">
|
||||||
</sizepolicy>
|
<string><span style=" font-weight:600;">Title: </span>%6<br/>
|
||||||
</property>
|
<span style=" font-weight:600;">Location: </span>%7 (%1, %2, %3)<br/>
|
||||||
<property name="text">
|
<span style=" font-weight:600;">Players: </span>%4 (Crew %5)<br/>
|
||||||
<string><span style=" font-weight:600;">Title: </span>%6<br/>
|
<span style=" font-weight:600;">Created: </span>%8</string>
|
||||||
<span style=" font-weight:600;">Location: </span>%7 (%1, %2, %3)<br/>
|
</property>
|
||||||
<span style=" font-weight:600;">Players: </span>%4 (Crew %5)<br/>
|
<property name="wordWrap">
|
||||||
<span style=" font-weight:600;">Created: </span>%8</string>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="openExternalLinks">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
<property name="textInteractionFlags">
|
||||||
<bool>true</bool>
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
</widget>
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</widget>
|
<layout class="QVBoxLayout" name="vlButtons">
|
||||||
</item>
|
<property name="spacing">
|
||||||
<item>
|
<number>6</number>
|
||||||
<layout class="QVBoxLayout" name="vlButtons">
|
</property>
|
||||||
<property name="spacing">
|
<property name="rightMargin">
|
||||||
<number>6</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<item>
|
||||||
<number>5</number>
|
<spacer name="vsButtons">
|
||||||
</property>
|
<property name="orientation">
|
||||||
<item>
|
<enum>Qt::Vertical</enum>
|
||||||
<spacer name="vsButtons">
|
</property>
|
||||||
<property name="orientation">
|
<property name="sizeType">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeHint" stdset="0">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<size>
|
||||||
</property>
|
<width>0</width>
|
||||||
<property name="sizeHint" stdset="0">
|
<height>0</height>
|
||||||
<size>
|
</size>
|
||||||
<width>0</width>
|
</property>
|
||||||
<height>0</height>
|
</spacer>
|
||||||
</size>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</spacer>
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
</item>
|
<property name="spacing">
|
||||||
<item>
|
<number>6</number>
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
</property>
|
||||||
<property name="spacing">
|
<item>
|
||||||
<number>6</number>
|
<widget class="QPushButton" name="cmdManage">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<item>
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<widget class="QPushButton" name="cmdExport">
|
<horstretch>0</horstretch>
|
||||||
<property name="sizePolicy">
|
<verstretch>0</verstretch>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
</sizepolicy>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="focusPolicy">
|
||||||
</sizepolicy>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="focusPolicy">
|
<property name="toolTip">
|
||||||
<enum>Qt::NoFocus</enum>
|
<string>Manage picture</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="text">
|
||||||
<string>Export picture</string>
|
<string>&Manage</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="autoDefault">
|
||||||
<string>&Export</string>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
</widget>
|
||||||
<bool>false</bool>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</widget>
|
<widget class="QPushButton" name="cmdClose">
|
||||||
</item>
|
<property name="sizePolicy">
|
||||||
<item>
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<widget class="QPushButton" name="cmdClose">
|
<horstretch>0</horstretch>
|
||||||
<property name="sizePolicy">
|
<verstretch>0</verstretch>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
</sizepolicy>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="focusPolicy">
|
||||||
</sizepolicy>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="focusPolicy">
|
<property name="toolTip">
|
||||||
<enum>Qt::NoFocus</enum>
|
<string>Close viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="text">
|
||||||
<string>Close</string>
|
<string>&Close</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="autoDefault">
|
||||||
<string>&Close</string>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
</widget>
|
||||||
<bool>false</bool>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
</layout>
|
||||||
</layout>
|
</item>
|
||||||
</item>
|
</layout>
|
||||||
</layout>
|
</item>
|
||||||
</item>
|
</layout>
|
||||||
</layout>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
<customwidgets>
|
||||||
</layout>
|
<customwidget>
|
||||||
</widget>
|
<class>UiModLabel</class>
|
||||||
<customwidgets>
|
<extends>QLabel</extends>
|
||||||
<customwidget>
|
<header>uimod/UiModLabel.h</header>
|
||||||
<class>UiModLabel</class>
|
<slots>
|
||||||
<extends>QLabel</extends>
|
<signal>mouseMoved()</signal>
|
||||||
<header>uimod/UiModLabel.h</header>
|
<signal>mouseReleased()</signal>
|
||||||
<slots>
|
<signal>mousePressed()</signal>
|
||||||
<signal>mouseMoved()</signal>
|
<signal>mouseDoubleClicked()</signal>
|
||||||
<signal>mouseReleased()</signal>
|
</slots>
|
||||||
<signal>mousePressed()</signal>
|
</customwidget>
|
||||||
<signal>mouseDoubleClicked()</signal>
|
</customwidgets>
|
||||||
</slots>
|
<resources/>
|
||||||
</customwidget>
|
<connections>
|
||||||
</customwidgets>
|
<connection>
|
||||||
<resources>
|
<sender>cmdClose</sender>
|
||||||
<include location="res/app.qrc"/>
|
<signal>clicked()</signal>
|
||||||
</resources>
|
<receiver>PictureDialog</receiver>
|
||||||
<connections>
|
<slot>close()</slot>
|
||||||
<connection>
|
<hints>
|
||||||
<sender>cmdClose</sender>
|
<hint type="sourcelabel">
|
||||||
<signal>clicked()</signal>
|
<x>912</x>
|
||||||
<receiver>PictureDialog</receiver>
|
<y>514</y>
|
||||||
<slot>close()</slot>
|
</hint>
|
||||||
<hints>
|
<hint type="destinationlabel">
|
||||||
<hint type="sourcelabel">
|
<x>479</x>
|
||||||
<x>912</x>
|
<y>267</y>
|
||||||
<y>514</y>
|
</hint>
|
||||||
</hint>
|
</hints>
|
||||||
<hint type="destinationlabel">
|
</connection>
|
||||||
<x>479</x>
|
</connections>
|
||||||
<y>267</y>
|
</ui>
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
||||||
|
|
|
@ -1,310 +1,329 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "PictureExport.h"
|
#include "PictureExport.h"
|
||||||
#include "PictureDialog.h"
|
#include "PictureDialog.h"
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "SidebarGenerator.h"
|
#include "SidebarGenerator.h"
|
||||||
#include <QDesktopWidget>
|
#include <QStringBuilder>
|
||||||
#include <QApplication>
|
#include <QDesktopWidget>
|
||||||
#include <QMessageBox>
|
#include <QApplication>
|
||||||
#include <QFileDialog>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QFileDialog>
|
||||||
#include <QDebug>
|
#include <QSettings>
|
||||||
|
#include <QRegExp>
|
||||||
PictureExport::PictureExport()
|
#include <QDebug>
|
||||||
{
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
}
|
#include <QSaveFile>
|
||||||
|
#endif
|
||||||
void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
|
||||||
{
|
PictureExport::PictureExport()
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
{
|
||||||
|
|
||||||
// Picture Settings
|
}
|
||||||
// Quality Settings
|
|
||||||
settings.beginGroup("Pictures");
|
void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
||||||
int defaultQuality = 100;
|
{
|
||||||
QSize defExportSize = QSize(960, 536);
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
|
||||||
if (customQuality < 1 || customQuality > 100)
|
// Picture Settings
|
||||||
{
|
// Quality Settings
|
||||||
customQuality = 100;
|
settings.beginGroup("Pictures");
|
||||||
}
|
int defaultQuality = 100;
|
||||||
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
QSize defExportSize = QSize(960, 536);
|
||||||
|
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
||||||
// Size Settings
|
if (customQuality < 1 || customQuality > 100)
|
||||||
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
{
|
||||||
if (cusExportSize.width() > 3840)
|
customQuality = 100;
|
||||||
{
|
}
|
||||||
cusExportSize.setWidth(3840);
|
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
||||||
}
|
|
||||||
else if (cusExportSize.height() > 2160)
|
// Size Settings
|
||||||
{
|
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
||||||
cusExportSize.setHeight(2160);
|
if (cusExportSize.width() > 3840)
|
||||||
}
|
{
|
||||||
if (cusExportSize.width() < 1)
|
cusExportSize.setWidth(3840);
|
||||||
{
|
}
|
||||||
cusExportSize.setWidth(1);
|
else if (cusExportSize.height() > 2160)
|
||||||
}
|
{
|
||||||
else if (cusExportSize.height() < 1)
|
cusExportSize.setHeight(2160);
|
||||||
{
|
}
|
||||||
cusExportSize.setHeight(1);
|
if (cusExportSize.width() < 1)
|
||||||
}
|
{
|
||||||
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
cusExportSize.setWidth(1);
|
||||||
Qt::AspectRatioMode aspectRatio = (Qt::AspectRatioMode)settings.value("AspectRatio", Qt::KeepAspectRatio).toInt();
|
}
|
||||||
QString defaultExportFormat = settings.value("DefaultExportFormat", ".jpg").toString();
|
else if (cusExportSize.height() < 1)
|
||||||
settings.endGroup();
|
{
|
||||||
// End Picture Settings
|
cusExportSize.setHeight(1);
|
||||||
|
}
|
||||||
settings.beginGroup("FileDialogs");
|
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
||||||
settings.beginGroup("ExportAsPicture");
|
Qt::AspectRatioMode aspectRatio = (Qt::AspectRatioMode)settings.value("AspectRatio", Qt::KeepAspectRatio).toInt();
|
||||||
|
QString defaultExportFormat = settings.value("DefaultExportFormat", ".jpg").toString();
|
||||||
fileDialogPreSave: //Work?
|
settings.endGroup();
|
||||||
QFileDialog fileDialog(parent);
|
// End Picture Settings
|
||||||
fileDialog.setFileMode(QFileDialog::AnyFile);
|
|
||||||
fileDialog.setViewMode(QFileDialog::Detail);
|
settings.beginGroup("FileDialogs");
|
||||||
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
|
||||||
fileDialog.setOption(QFileDialog::DontUseNativeDialog, false);
|
settings.beginGroup("ExportAsPicture");
|
||||||
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
|
||||||
fileDialog.setDefaultSuffix("suffix");
|
fileDialogPreSave: //Work?
|
||||||
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
QFileDialog fileDialog(parent);
|
||||||
fileDialog.setWindowTitle(PictureDialog::tr("Export as JPG picture..."));
|
fileDialog.setFileMode(QFileDialog::AnyFile);
|
||||||
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
fileDialog.setViewMode(QFileDialog::Detail);
|
||||||
|
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
QStringList filters;
|
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
||||||
filters << PictureDialog::tr("JPEG picture (*.jpg)");
|
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
||||||
filters << PictureDialog::tr("Portable Network Graphics (*.png)");
|
fileDialog.setDefaultSuffix("suffix");
|
||||||
fileDialog.setNameFilters(filters);
|
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
|
fileDialog.setWindowTitle(PictureDialog::tr("Export as Picture..."));
|
||||||
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
|
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
||||||
|
|
||||||
fileDialog.setSidebarUrls(sidebarUrls);
|
QStringList filters;
|
||||||
fileDialog.setDirectory(settings.value("Directory", StandardPaths::picturesLocation()).toString());
|
filters << PictureDialog::tr("JPEG Graphics (*.jpg *.jpeg)");
|
||||||
fileDialog.restoreGeometry(settings.value(parent->objectName() + "+Geomtery", "").toByteArray());
|
filters << PictureDialog::tr("Portable Network Graphics (*.png)");
|
||||||
|
fileDialog.setNameFilters(filters);
|
||||||
QString newPictureFileName = getPictureFileName(picture) + defaultExportFormat;
|
|
||||||
fileDialog.selectFile(newPictureFileName);
|
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
|
||||||
|
|
||||||
if (fileDialog.exec())
|
fileDialog.setSidebarUrls(sidebarUrls);
|
||||||
{
|
fileDialog.setDirectory(settings.value("Directory", StandardPaths::picturesLocation()).toString());
|
||||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
|
||||||
if (selectedFiles.length() == 1)
|
|
||||||
{
|
QString newPictureFileName = getPictureFileName(picture) % defaultExportFormat;
|
||||||
QString saveFileFormat;
|
fileDialog.selectFile(newPictureFileName);
|
||||||
QString selectedFile = selectedFiles.at(0);
|
|
||||||
|
if (fileDialog.exec())
|
||||||
if (selectedFile.right(4) == ".jpg")
|
{
|
||||||
{
|
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||||
saveFileFormat = "JPEG";
|
if (selectedFiles.length() == 1)
|
||||||
}
|
{
|
||||||
else if (selectedFile.right(4) == ".jpeg")
|
QString saveFileFormat;
|
||||||
{
|
QString selectedFile = selectedFiles.at(0);
|
||||||
saveFileFormat = "JPEG";
|
|
||||||
}
|
if (selectedFile.right(4) == ".jpg")
|
||||||
else if (selectedFile.right(4) == ".png")
|
{
|
||||||
{
|
saveFileFormat = "JPEG";
|
||||||
saveFileFormat = "PNG";
|
}
|
||||||
}
|
else if (selectedFile.right(4) == ".jpeg")
|
||||||
else if (selectedFile.right(7) == ".suffix")
|
{
|
||||||
{
|
saveFileFormat = "JPEG";
|
||||||
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)")
|
}
|
||||||
{
|
else if (selectedFile.right(4) == ".png")
|
||||||
selectedFile.replace(".suffix", ".jpg");
|
{
|
||||||
}
|
saveFileFormat = "PNG";
|
||||||
else if (fileDialog.selectedNameFilter() == "Portable Network Graphics (*.png)")
|
}
|
||||||
{
|
else if (selectedFile.right(7) == ".suffix")
|
||||||
selectedFile.replace(".suffix", ".png");
|
{
|
||||||
}
|
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)")
|
||||||
else
|
{
|
||||||
{
|
selectedFile.replace(".suffix", ".jpg");
|
||||||
selectedFile.replace(".suffix", ".jpg");
|
}
|
||||||
}
|
else if (fileDialog.selectedNameFilter() == "Portable Network Graphics (*.png)")
|
||||||
}
|
{
|
||||||
|
selectedFile.replace(".suffix", ".png");
|
||||||
if (QFile::exists(selectedFile))
|
}
|
||||||
{
|
else
|
||||||
if (QMessageBox::Yes == QMessageBox::warning(parent, PictureDialog::tr("Export as JPG picture"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
{
|
||||||
{
|
selectedFile.replace(".suffix", ".jpg");
|
||||||
if (!QFile::remove(selectedFile))
|
}
|
||||||
{
|
}
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as JPG picture"), PictureDialog::tr("Failed to overwrite %1 with current Snapmatic picture").arg("\""+selectedFile+"\""));
|
|
||||||
goto fileDialogPreSave; //Work?
|
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))
|
||||||
else
|
{
|
||||||
{
|
goto fileDialogPreSave; //Work?
|
||||||
goto fileDialogPreSave; //Work?
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Scale Picture
|
||||||
// Scale Picture
|
QImage exportPicture = picture->getImage();
|
||||||
QImage exportPicture = picture->getImage();
|
if (sizeMode == "Desktop")
|
||||||
if (sizeMode == "Desktop")
|
{
|
||||||
{
|
QRect desktopResolution = QApplication::desktop()->screenGeometry();
|
||||||
QRect desktopResolution = QApplication::desktop()->screenGeometry();
|
exportPicture = exportPicture.scaled(desktopResolution.width(), desktopResolution.height(), 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);
|
||||||
exportPicture = exportPicture.scaled(cusExportSize, aspectRatio, Qt::SmoothTransformation);
|
}
|
||||||
}
|
|
||||||
|
int errorId = 0;
|
||||||
bool isSaved;
|
bool isSaved = false;
|
||||||
if (useCustomQuality)
|
#if QT_VERSION >= 0x050000
|
||||||
{
|
QSaveFile *picFile = new QSaveFile(selectedFile);
|
||||||
isSaved = exportPicture.save(selectedFile, saveFileFormat.toStdString().c_str(), customQuality);
|
#else
|
||||||
}
|
QFile *picFile = new QFile(selectedFile);
|
||||||
else
|
#endif
|
||||||
{
|
if (picFile->open(QIODevice::WriteOnly))
|
||||||
isSaved = exportPicture.save(selectedFile, saveFileFormat.toStdString().c_str(), 100);
|
{
|
||||||
}
|
isSaved = exportPicture.save(picFile, saveFileFormat.toStdString().c_str(), useCustomQuality ? customQuality : defaultQuality);
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
if (!isSaved)
|
if (isSaved)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as JPG picture"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
isSaved = picFile->commit();
|
||||||
goto fileDialogPreSave; //Work?
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
else
|
errorId = 1;
|
||||||
{
|
}
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as JPG picture"), PictureDialog::tr("No valid file is selected"));
|
#else
|
||||||
goto fileDialogPreSave; //Work?
|
picFile->close();
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
else
|
||||||
settings.setValue(parent->objectName() + "+Geometry", fileDialog.saveGeometry());
|
{
|
||||||
settings.setValue("Directory", fileDialog.directory().absolutePath());
|
errorId = 2;
|
||||||
settings.endGroup();
|
}
|
||||||
settings.endGroup();
|
delete picFile;
|
||||||
}
|
|
||||||
|
if (!isSaved)
|
||||||
void PictureExport::exportAsSnapmatic(QWidget *parent, SnapmaticPicture *picture)
|
{
|
||||||
{
|
switch (errorId)
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
{
|
||||||
settings.beginGroup("FileDialogs");
|
case 0:
|
||||||
settings.beginGroup("ExportAsSnapmatic");
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Failed to export the picture because the system occurred a write failure"));
|
||||||
|
break;
|
||||||
QString adjustedPicPath = picture->getPictureFileName();
|
case 1:
|
||||||
if (adjustedPicPath.right(7) == ".hidden") // for the hidden file system
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Failed to export the picture because the format detection failures"));
|
||||||
{
|
break;
|
||||||
adjustedPicPath.remove(adjustedPicPath.length() - 7, 7);
|
case 2:
|
||||||
}
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Failed to export the picture because the file can't be written"));
|
||||||
|
break;
|
||||||
fileDialogPreSave: //Work?
|
default:
|
||||||
QFileInfo sgdFileInfo(adjustedPicPath);
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Failed to export the picture because of an unknown reason"));
|
||||||
QFileDialog fileDialog(parent);
|
}
|
||||||
fileDialog.setFileMode(QFileDialog::AnyFile);
|
goto fileDialogPreSave; //Work?
|
||||||
fileDialog.setViewMode(QFileDialog::Detail);
|
}
|
||||||
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
}
|
||||||
fileDialog.setOption(QFileDialog::DontUseNativeDialog, false);
|
else
|
||||||
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
{
|
||||||
fileDialog.setDefaultSuffix(".rem");
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("No valid file is selected"));
|
||||||
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
goto fileDialogPreSave; //Work?
|
||||||
fileDialog.setWindowTitle(PictureDialog::tr("Export as GTA Snapmatic..."));
|
}
|
||||||
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
}
|
||||||
|
|
||||||
QStringList filters;
|
settings.setValue(parent->objectName() % "+Geometry", fileDialog.saveGeometry());
|
||||||
filters << PictureDialog::tr("GTA V Export (*.g5e)");
|
settings.setValue("Directory", fileDialog.directory().absolutePath());
|
||||||
filters << PictureDialog::tr("GTA V Raw Export (*.auto)");
|
settings.endGroup();
|
||||||
filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
|
settings.endGroup();
|
||||||
fileDialog.setNameFilters(filters);
|
}
|
||||||
|
|
||||||
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
|
void PictureExport::exportAsSnapmatic(QWidget *parent, SnapmaticPicture *picture)
|
||||||
|
{
|
||||||
fileDialog.setSidebarUrls(sidebarUrls);
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
fileDialog.setDirectory(settings.value("Directory", StandardPaths::documentsLocation()).toString());
|
settings.beginGroup("FileDialogs");
|
||||||
fileDialog.selectFile(QString(picture->getExportPictureFileName() + ".g5e"));
|
bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
|
||||||
fileDialog.restoreGeometry(settings.value(parent->objectName() + "+Geomtery", "").toByteArray());
|
settings.beginGroup("ExportAsSnapmatic");
|
||||||
|
|
||||||
|
QString adjustedPicPath = picture->getOriginalPictureFileName();
|
||||||
if (fileDialog.exec())
|
|
||||||
{
|
fileDialogPreSave: //Work?
|
||||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
QFileInfo sgdFileInfo(adjustedPicPath);
|
||||||
if (selectedFiles.length() == 1)
|
QFileDialog fileDialog(parent);
|
||||||
{
|
fileDialog.setFileMode(QFileDialog::AnyFile);
|
||||||
QString selectedFile = selectedFiles.at(0);
|
fileDialog.setViewMode(QFileDialog::Detail);
|
||||||
|
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
if (QFile::exists(selectedFile))
|
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
||||||
{
|
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
||||||
if (QMessageBox::Yes == QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
fileDialog.setDefaultSuffix(".rem");
|
||||||
{
|
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
if (!QFile::remove(selectedFile))
|
fileDialog.setWindowTitle(PictureDialog::tr("Export as Snapmatic..."));
|
||||||
{
|
fileDialog.setLabelText(QFileDialog::Accept, PictureDialog::tr("Export"));
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Failed to overwrite %1 with current Snapmatic picture").arg("\""+selectedFile+"\""));
|
|
||||||
goto fileDialogPreSave; //Work?
|
QStringList filters;
|
||||||
}
|
filters << PictureDialog::tr("GTA V Export (*.g5e)");
|
||||||
}
|
filters << PictureDialog::tr("GTA V Raw Export (*.auto)");
|
||||||
else
|
filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
|
||||||
{
|
fileDialog.setNameFilters(filters);
|
||||||
goto fileDialogPreSave; //Work?
|
|
||||||
}
|
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
|
||||||
}
|
|
||||||
|
fileDialog.setSidebarUrls(sidebarUrls);
|
||||||
if (selectedFile.right(4) == ".g5e")
|
fileDialog.setDirectory(settings.value("Directory", StandardPaths::documentsLocation()).toString());
|
||||||
{
|
fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
|
||||||
bool isExported = picture->exportPicture(selectedFile, "G5E");
|
fileDialog.selectFile(QString(picture->getExportPictureFileName() % ".g5e"));
|
||||||
if (!isExported)
|
|
||||||
{
|
if (fileDialog.exec())
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
{
|
||||||
goto fileDialogPreSave; //Work?
|
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||||
}
|
if (selectedFiles.length() == 1)
|
||||||
}
|
{
|
||||||
else
|
QString selectedFile = selectedFiles.at(0);
|
||||||
{
|
bool isAutoExt = false;
|
||||||
bool isAutoExt = false;
|
if (selectedFile.right(5) == ".auto")
|
||||||
if (selectedFile.right(5) == ".auto")
|
{
|
||||||
{
|
isAutoExt = true;
|
||||||
isAutoExt = true;
|
QString dirPath = QFileInfo(selectedFile).dir().path();
|
||||||
QString dirPath = QFileInfo(selectedFile).dir().path();
|
QString stockFileName = sgdFileInfo.fileName();
|
||||||
QString stockFileName = sgdFileInfo.fileName();
|
selectedFile = dirPath % "/" % stockFileName;
|
||||||
selectedFile = dirPath + "/" + stockFileName;
|
}
|
||||||
}
|
else if (selectedFile.right(4) == ".rem")
|
||||||
else if (selectedFile.right(4) == ".rem")
|
{
|
||||||
{
|
selectedFile.remove(selectedFile.length() - 4, 4);
|
||||||
selectedFile.remove(".rem");
|
}
|
||||||
}
|
|
||||||
bool isCopied = picture->exportPicture(selectedFile, "PGTA");
|
if (QFile::exists(selectedFile))
|
||||||
if (!isCopied)
|
{
|
||||||
{
|
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))
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
{
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
if (isAutoExt) QMessageBox::information(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("Exported Snapmatic to \"%1\" because of using the .auto extension.").arg(selectedFile));
|
if (selectedFile.right(4) == ".g5e")
|
||||||
}
|
{
|
||||||
}
|
bool isExported = picture->exportPicture(selectedFile, SnapmaticFormat::G5E_Format);
|
||||||
}
|
if (!isExported)
|
||||||
else
|
{
|
||||||
{
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as GTA Snapmatic"), PictureDialog::tr("No valid file is selected"));
|
goto fileDialogPreSave; //Work?
|
||||||
goto fileDialogPreSave; //Work?
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
settings.setValue(parent->objectName() + "+Geometry", fileDialog.saveGeometry());
|
bool isCopied = picture->exportPicture(selectedFile, SnapmaticFormat::PGTA_Format);
|
||||||
settings.setValue("Directory", fileDialog.directory().absolutePath());
|
if (!isCopied)
|
||||||
settings.endGroup();
|
{
|
||||||
}
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
||||||
|
goto fileDialogPreSave; //Work?
|
||||||
QString PictureExport::getPictureFileName(SnapmaticPicture *picture)
|
}
|
||||||
{
|
else
|
||||||
return picture->getExportPictureFileName();
|
{
|
||||||
}
|
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
|
||||||
|
{
|
||||||
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("No valid file is selected"));
|
||||||
|
goto fileDialogPreSave; //Work?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings.setValue(parent->objectName() % "+Geometry", fileDialog.saveGeometry());
|
||||||
|
settings.setValue("Directory", fileDialog.directory().absolutePath());
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PictureExport::getPictureFileName(SnapmaticPicture *picture)
|
||||||
|
{
|
||||||
|
return picture->getExportPictureFileName();
|
||||||
|
}
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PICTUREEXPORT_H
|
#ifndef PICTUREEXPORT_H
|
||||||
#define PICTUREEXPORT_H
|
#define PICTUREEXPORT_H
|
||||||
|
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class PictureExport
|
class PictureExport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PictureExport();
|
PictureExport();
|
||||||
static void exportAsPicture(QWidget *parent, SnapmaticPicture *picture);
|
static void exportAsPicture(QWidget *parent, SnapmaticPicture *picture);
|
||||||
static void exportAsSnapmatic(QWidget *parent, SnapmaticPicture *picture);
|
static void exportAsSnapmatic(QWidget *parent, SnapmaticPicture *picture);
|
||||||
static QString getPictureFileName(SnapmaticPicture *picture);
|
static QString getPictureFileName(SnapmaticPicture *picture);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PICTUREEXPORT_H
|
#endif // PICTUREEXPORT_H
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
@ -0,0 +1,221 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* 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
|
||||||
|
* 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 "PlayerListDialog.h"
|
||||||
|
#include "ui_PlayerListDialog.h"
|
||||||
|
#include "AppEnv.h"
|
||||||
|
#include <QFontMetrics>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
|
QDialog(parent), players(players), profileDB(profileDB),
|
||||||
|
ui(new Ui::PlayerListDialog)
|
||||||
|
{
|
||||||
|
// Set Window Flags
|
||||||
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
|
listUpdated = false;
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->cmdCancel->setDefault(true);
|
||||||
|
ui->cmdCancel->setFocus();
|
||||||
|
|
||||||
|
// Set Icon for Apply Button
|
||||||
|
if (QIcon::hasThemeIcon("dialog-ok-apply"))
|
||||||
|
{
|
||||||
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply"));
|
||||||
|
}
|
||||||
|
else if (QIcon::hasThemeIcon("dialog-apply"))
|
||||||
|
{
|
||||||
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply"));
|
||||||
|
}
|
||||||
|
else if (QIcon::hasThemeIcon("gtk-apply"))
|
||||||
|
{
|
||||||
|
ui->cmdApply->setIcon(QIcon::fromTheme("gtk-apply"));
|
||||||
|
}
|
||||||
|
else if (QIcon::hasThemeIcon("dialog-ok"))
|
||||||
|
{
|
||||||
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||||
|
}
|
||||||
|
else if (QIcon::hasThemeIcon("gtk-ok"))
|
||||||
|
{
|
||||||
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Icon for Cancel Button
|
||||||
|
if (QIcon::hasThemeIcon("dialog-cancel"))
|
||||||
|
{
|
||||||
|
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
|
||||||
|
}
|
||||||
|
else if (QIcon::hasThemeIcon("gtk-cancel"))
|
||||||
|
{
|
||||||
|
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Icon for Manage Buttons
|
||||||
|
if (QIcon::hasThemeIcon("go-previous") && QIcon::hasThemeIcon("go-next") && QIcon::hasThemeIcon("list-add"))
|
||||||
|
{
|
||||||
|
ui->cmdMakeAv->setIcon(QIcon::fromTheme("go-previous"));
|
||||||
|
ui->cmdMakeSe->setIcon(QIcon::fromTheme("go-next"));
|
||||||
|
ui->cmdMakeAd->setIcon(QIcon::fromTheme("list-add"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->cmdMakeAv->setIcon(QIcon(":/img/back.svgz"));
|
||||||
|
ui->cmdMakeSe->setIcon(QIcon(":/img/next.svgz"));
|
||||||
|
ui->cmdMakeAd->setIcon(QIcon(":/img/add.svgz"));
|
||||||
|
}
|
||||||
|
buildInterface();
|
||||||
|
|
||||||
|
// DPI calculation
|
||||||
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
resize(500 * screenRatio, 350 * screenRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerListDialog::~PlayerListDialog()
|
||||||
|
{
|
||||||
|
for (QObject *object : ui->listAvPlayers->children())
|
||||||
|
{
|
||||||
|
delete object;
|
||||||
|
}
|
||||||
|
for (QObject *object : ui->listSePlayers->children())
|
||||||
|
{
|
||||||
|
delete object;
|
||||||
|
}
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerListDialog::on_cmdCancel_clicked()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerListDialog::buildInterface()
|
||||||
|
{
|
||||||
|
const QStringList dbPlayers = profileDB->getPlayers();
|
||||||
|
for (QString sePlayer : players)
|
||||||
|
{
|
||||||
|
QListWidgetItem *playerItem = new QListWidgetItem(profileDB->getPlayerName(sePlayer));
|
||||||
|
playerItem->setData(Qt::UserRole, sePlayer);
|
||||||
|
ui->listSePlayers->addItem(playerItem);
|
||||||
|
}
|
||||||
|
for (QString dbPlayer : dbPlayers)
|
||||||
|
{
|
||||||
|
if (!players.contains(dbPlayer))
|
||||||
|
{
|
||||||
|
QListWidgetItem *playerItem = new QListWidgetItem(profileDB->getPlayerName(dbPlayer));
|
||||||
|
playerItem->setData(Qt::UserRole, dbPlayer);
|
||||||
|
ui->listAvPlayers->addItem(playerItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->listAvPlayers->sortItems(Qt::AscendingOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerListDialog::on_cmdMakeAv_clicked()
|
||||||
|
{
|
||||||
|
for (QListWidgetItem *item : ui->listSePlayers->selectedItems())
|
||||||
|
{
|
||||||
|
QString playerName = item->text();
|
||||||
|
int playerID = item->data(Qt::UserRole).toInt();
|
||||||
|
delete item;
|
||||||
|
QListWidgetItem *playerItem = new QListWidgetItem(playerName);
|
||||||
|
playerItem->setData(Qt::UserRole, playerID);
|
||||||
|
ui->listAvPlayers->addItem(playerItem);
|
||||||
|
ui->listAvPlayers->sortItems(Qt::AscendingOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerListDialog::on_cmdMakeSe_clicked()
|
||||||
|
{
|
||||||
|
int maxPlayers = 30;
|
||||||
|
if (maxPlayers < ui->listSePlayers->count() + ui->listAvPlayers->selectedItems().count())
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Add Players..."), tr("Failed to add more Players because the limit of Players are %1!").arg(QString::number(maxPlayers)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (QListWidgetItem *item : ui->listAvPlayers->selectedItems())
|
||||||
|
{
|
||||||
|
QString playerName = item->text();
|
||||||
|
int playerID = item->data(Qt::UserRole).toInt();
|
||||||
|
delete item;
|
||||||
|
QListWidgetItem *playerItem = new QListWidgetItem(playerName);
|
||||||
|
playerItem->setData(Qt::UserRole, playerID);
|
||||||
|
ui->listSePlayers->addItem(playerItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerListDialog::on_cmdMakeAd_clicked()
|
||||||
|
{
|
||||||
|
bool playerOk;
|
||||||
|
int playerID = QInputDialog::getInt(this, tr("Add Player..."), tr("Enter Social Club Player ID"), 1, 1, 214783647, 1, &playerOk, windowFlags());
|
||||||
|
if (playerOk)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ui->listAvPlayers->count(); ++i)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = ui->listAvPlayers->item(i);
|
||||||
|
QString itemPlayerName = item->text();
|
||||||
|
int itemPlayerID = item->data(Qt::UserRole).toInt();
|
||||||
|
if (itemPlayerID == playerID)
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
QListWidgetItem *playerItem = new QListWidgetItem(itemPlayerName);
|
||||||
|
playerItem->setData(Qt::UserRole, playerID);
|
||||||
|
ui->listSePlayers->addItem(playerItem);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < ui->listSePlayers->count(); ++i)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = ui->listSePlayers->item(i);
|
||||||
|
int itemPlayerID = item->data(Qt::UserRole).toInt();
|
||||||
|
if (itemPlayerID == playerID)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, tr("Add Player..."), tr("Failed to add Player %1 because Player %1 is already added!").arg(QString::number(playerID)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QListWidgetItem *playerItem = new QListWidgetItem(QString::number(playerID));
|
||||||
|
playerItem->setData(Qt::UserRole, playerID);
|
||||||
|
ui->listSePlayers->addItem(playerItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerListDialog::on_cmdApply_clicked()
|
||||||
|
{
|
||||||
|
players.clear();
|
||||||
|
for (int i = 0; i < ui->listSePlayers->count(); ++i)
|
||||||
|
{
|
||||||
|
players += ui->listSePlayers->item(i)->data(Qt::UserRole).toString();
|
||||||
|
}
|
||||||
|
emit playerListUpdated(players);
|
||||||
|
listUpdated = true;
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList PlayerListDialog::getPlayerList() const
|
||||||
|
{
|
||||||
|
return players;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayerListDialog::isListUpdated()
|
||||||
|
{
|
||||||
|
return listUpdated;
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* Copyright (C) 2016-2017 Syping
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef PLAYERLISTDIALOG_H
|
||||||
|
#define PLAYERLISTDIALOG_H
|
||||||
|
|
||||||
|
#include "ProfileDatabase.h"
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class PlayerListDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PlayerListDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PlayerListDialog(QStringList players, ProfileDatabase *profileDB, QWidget *parent = 0);
|
||||||
|
QStringList getPlayerList() const;
|
||||||
|
bool isListUpdated();
|
||||||
|
~PlayerListDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_cmdCancel_clicked();
|
||||||
|
void on_cmdMakeAv_clicked();
|
||||||
|
void on_cmdMakeSe_clicked();
|
||||||
|
void on_cmdMakeAd_clicked();
|
||||||
|
void on_cmdApply_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStringList players;
|
||||||
|
ProfileDatabase *profileDB;
|
||||||
|
Ui::PlayerListDialog *ui;
|
||||||
|
bool listUpdated;
|
||||||
|
void buildInterface();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void playerListUpdated(QStringList playerList);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PLAYERLISTDIALOG_H
|
|
@ -0,0 +1,173 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PlayerListDialog</class>
|
||||||
|
<widget class="QDialog" name="PlayerListDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>500</width>
|
||||||
|
<height>350</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Edit Players...</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vlInterface">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlPlayers">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="vlAvPlayers">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labAvPlayers">
|
||||||
|
<property name="text">
|
||||||
|
<string>Available Players:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listAvPlayers">
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="vlButtons">
|
||||||
|
<item>
|
||||||
|
<spacer name="vsButtons1">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdMakeSe">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdMakeAv">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdMakeAd">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="vsButtons2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="vlSePlayers">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labSePlayers">
|
||||||
|
<property name="text">
|
||||||
|
<string>Selected Players:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listSePlayers">
|
||||||
|
<property name="dragDropMode">
|
||||||
|
<enum>QAbstractItemView::InternalMove</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
|
<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="cmdApply">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Apply</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdCancel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -1,61 +1,85 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <QFile>
|
#include <QStringBuilder>
|
||||||
#include <QDir>
|
#include <QMutexLocker>
|
||||||
|
#include <QDebug>
|
||||||
ProfileDatabase::ProfileDatabase(QObject *parent) : QObject(parent)
|
#include <QFile>
|
||||||
{
|
#include <QDir>
|
||||||
QDir dir;
|
|
||||||
dir.mkpath(StandardPaths::dataLocation());
|
ProfileDatabase::ProfileDatabase(QObject *parent) : QObject(parent)
|
||||||
dir.setPath(StandardPaths::dataLocation());
|
{
|
||||||
QString dirPath = dir.absolutePath();
|
QDir dir;
|
||||||
QString defaultConfPath = dirPath + QDir::separator() + "players.ini";
|
dir.mkpath(StandardPaths::dataLocation());
|
||||||
|
dir.setPath(StandardPaths::dataLocation());
|
||||||
QSettings confPathSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QString dirPath = dir.absolutePath();
|
||||||
confPathSettings.beginGroup("Database");
|
QString defaultConfPath = dirPath % "/players.ini";
|
||||||
QString confPathFile = confPathSettings.value("Players", defaultConfPath).toString();
|
|
||||||
confPathSettings.endGroup();
|
QSettings confPathSettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
confPathSettings.beginGroup("Database");
|
||||||
profileDB = new QSettings(confPathFile, QSettings::IniFormat);
|
QString confPathFile = confPathSettings.value("Players", defaultConfPath).toString();
|
||||||
profileDB->beginGroup("Players");
|
confPathSettings.endGroup();
|
||||||
}
|
|
||||||
|
profileDB = new QSettings(confPathFile, QSettings::IniFormat);
|
||||||
ProfileDatabase::~ProfileDatabase()
|
profileDB->beginGroup("Players");
|
||||||
{
|
}
|
||||||
profileDB->endGroup();
|
|
||||||
delete profileDB;
|
ProfileDatabase::~ProfileDatabase()
|
||||||
}
|
{
|
||||||
|
profileDB->endGroup();
|
||||||
QStringList ProfileDatabase::getPlayers()
|
delete profileDB;
|
||||||
{
|
}
|
||||||
return profileDB->childKeys();
|
|
||||||
}
|
QStringList ProfileDatabase::getPlayers()
|
||||||
|
{
|
||||||
QString ProfileDatabase::getPlayerName(int playerID)
|
QMutexLocker locker(&mutex);
|
||||||
{
|
#ifdef GTA5SYNC_DEBUG
|
||||||
return profileDB->value(QString::number(playerID), playerID).toString();
|
qDebug() << "getPlayers";
|
||||||
}
|
#endif
|
||||||
|
return profileDB->childKeys();
|
||||||
void ProfileDatabase::setPlayerName(int playerID, QString playerName)
|
}
|
||||||
{
|
|
||||||
profileDB->setValue(QString::number(playerID), playerName);
|
QString ProfileDatabase::getPlayerName(QString playerID)
|
||||||
}
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "getPlayerName" << playerID;
|
||||||
|
#endif
|
||||||
|
return profileDB->value(playerID, playerID).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProfileDatabase::getPlayerName(int playerID)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "getPlayerName" << playerID;
|
||||||
|
#endif
|
||||||
|
return profileDB->value(QString::number(playerID), playerID).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileDatabase::setPlayerName(int playerID, QString playerName)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "setPlayerName" << playerID << playerName;
|
||||||
|
#endif
|
||||||
|
profileDB->setValue(QString::number(playerID), playerName);
|
||||||
|
}
|
||||||
|
|
|
@ -1,43 +1,46 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PROFILEDATABASE_H
|
#ifndef PROFILEDATABASE_H
|
||||||
#define PROFILEDATABASE_H
|
#define PROFILEDATABASE_H
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMap>
|
#include <QMutex>
|
||||||
|
#include <QMap>
|
||||||
class ProfileDatabase : public QObject
|
|
||||||
{
|
class ProfileDatabase : public QObject
|
||||||
Q_OBJECT
|
{
|
||||||
public:
|
Q_OBJECT
|
||||||
explicit ProfileDatabase(QObject *parent = 0);
|
public:
|
||||||
QString getPlayerName(int playerID);
|
explicit ProfileDatabase(QObject *parent = 0);
|
||||||
QStringList getPlayers();
|
QString getPlayerName(QString playerID);
|
||||||
~ProfileDatabase();
|
QString getPlayerName(int playerID);
|
||||||
|
QStringList getPlayers();
|
||||||
private:
|
~ProfileDatabase();
|
||||||
QSettings *profileDB;
|
|
||||||
|
private:
|
||||||
public slots:
|
mutable QMutex mutex;
|
||||||
void setPlayerName(int playerID, QString playerName);
|
QSettings *profileDB;
|
||||||
|
|
||||||
};
|
public slots:
|
||||||
|
void setPlayerName(int playerID, QString playerName);
|
||||||
#endif // PROFILEDATABASE_H
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROFILEDATABASE_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,114 +1,137 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PROFILEINTERFACE_H
|
#ifndef PROFILEINTERFACE_H
|
||||||
#define PROFILEINTERFACE_H
|
#define PROFILEINTERFACE_H
|
||||||
|
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "SnapmaticWidget.h"
|
#include "SnapmaticWidget.h"
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
#include "DatabaseThread.h"
|
#include "DatabaseThread.h"
|
||||||
#include "SavegameWidget.h"
|
#include "SavegameWidget.h"
|
||||||
#include "ProfileLoader.h"
|
#include "ProfileLoader.h"
|
||||||
#include "ProfileWidget.h"
|
#include "ProfileWidget.h"
|
||||||
#include "ExportThread.h"
|
#include "ExportThread.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QProgressDialog>
|
#include "pcg_basic.h"
|
||||||
#include <QSpacerItem>
|
#include <QProgressDialog>
|
||||||
#include <QWidget>
|
#include <QSpacerItem>
|
||||||
#include <QList>
|
#include <QDateTime>
|
||||||
#include <QMap>
|
#include <QWidget>
|
||||||
|
#include <QList>
|
||||||
namespace Ui {
|
#include <QMap>
|
||||||
class ProfileInterface;
|
|
||||||
}
|
namespace Ui {
|
||||||
|
class ProfileInterface;
|
||||||
class ProfileInterface : public QWidget
|
}
|
||||||
{
|
|
||||||
Q_OBJECT
|
enum class MassTool : int { Qualify = 0, Players = 1, Crew = 2, Title = 3 };
|
||||||
public:
|
|
||||||
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
class ProfileInterface : public QWidget
|
||||||
void setProfileFolder(QString folder, QString profile);
|
{
|
||||||
void settingsApplied(int contentMode, QString language);
|
Q_OBJECT
|
||||||
void setupProfileInterface();
|
public:
|
||||||
void disableSelected();
|
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||||
void enableSelected();
|
void setProfileFolder(QString folder, QString profile);
|
||||||
int selectedWidgets();
|
void settingsApplied(int contentMode, bool languageChanged);
|
||||||
~ProfileInterface();
|
void setupProfileInterface();
|
||||||
|
void massTool(MassTool tool);
|
||||||
public slots:
|
void disableSelected();
|
||||||
void contextMenuTriggeredPIC(QContextMenuEvent* ev);
|
void enableSelected();
|
||||||
void contextMenuTriggeredSGD(QContextMenuEvent* ev);
|
int selectedWidgets();
|
||||||
void selectAllWidgets();
|
void retranslateUi();
|
||||||
void deselectAllWidgets();
|
~ProfileInterface();
|
||||||
void exportSelected();
|
|
||||||
void deleteSelected();
|
public slots:
|
||||||
void importFiles();
|
void contextMenuTriggeredPIC(QContextMenuEvent* ev);
|
||||||
|
void contextMenuTriggeredSGD(QContextMenuEvent* ev);
|
||||||
private slots:
|
void hoverProfileWidgetCheck();
|
||||||
void on_cmdCloseProfile_clicked();
|
void selectAllWidgets();
|
||||||
void on_cmdImport_clicked();
|
void deselectAllWidgets();
|
||||||
void pictureLoaded_event(SnapmaticPicture *picture);
|
void exportSelected();
|
||||||
void savegameLoaded_event(SavegameData *savegame, QString savegamePath);
|
void deleteSelected();
|
||||||
void loadingProgress(int value, int maximum);
|
void updatePalette();
|
||||||
void pictureDeleted_event();
|
void importFiles();
|
||||||
void savegameDeleted_event();
|
|
||||||
void profileLoaded_p();
|
private slots:
|
||||||
void profileWidgetSelected();
|
void on_cmdCloseProfile_clicked();
|
||||||
void profileWidgetDeselected();
|
void on_cmdImport_clicked();
|
||||||
void dialogNextPictureRequested(QWidget *dialog);
|
void pictureLoaded_event(SnapmaticPicture *picture);
|
||||||
void dialogPreviousPictureRequested(QWidget *dialog);
|
void pictureFixed_event(SnapmaticPicture *picture);
|
||||||
void on_saProfileContent_dropped(const QMimeData *mimeData);
|
void savegameLoaded_event(SavegameData *savegame, QString savegamePath);
|
||||||
|
void loadingProgress(int value, int maximum);
|
||||||
private:
|
void pictureDeleted_event();
|
||||||
ProfileDatabase *profileDB;
|
void savegameDeleted_event();
|
||||||
CrewDatabase *crewDB;
|
void profileLoaded_p();
|
||||||
DatabaseThread *threadDB;
|
void profileWidgetSelected();
|
||||||
Ui::ProfileInterface *ui;
|
void profileWidgetDeselected();
|
||||||
|
void dialogNextPictureRequested(QWidget *dialog);
|
||||||
ProfileLoader *profileLoader;
|
void dialogPreviousPictureRequested(QWidget *dialog);
|
||||||
QList<SavegameData*> savegames;
|
void on_saProfileContent_dropped(const QMimeData *mimeData);
|
||||||
QList<SnapmaticPicture*> pictures;
|
|
||||||
QMap<ProfileWidget*,QString> widgets;
|
protected:
|
||||||
QSpacerItem *saSpacerItem;
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
QString enabledPicStr;
|
|
||||||
QString profileFolder;
|
private:
|
||||||
QString profileName;
|
ProfileDatabase *profileDB;
|
||||||
QString loadingStr;
|
CrewDatabase *crewDB;
|
||||||
int selectedWidgts;
|
DatabaseThread *threadDB;
|
||||||
int contentMode;
|
Ui::ProfileInterface *ui;
|
||||||
|
|
||||||
bool importFile(QString selectedFile, bool notMultiple);
|
ProfileLoader *profileLoader;
|
||||||
void importFilesProgress(QStringList selectedFiles);
|
ProfileWidget *previousWidget;
|
||||||
bool importSnapmaticPicture(SnapmaticPicture *picture, bool warn = true);
|
QList<SavegameData*> savegames;
|
||||||
bool importSavegameData(SavegameData *savegame, QString sgdPath, bool warn = true);
|
QList<SnapmaticPicture*> pictures;
|
||||||
void pictureLoaded(SnapmaticPicture *picture, bool inserted);
|
QMap<ProfileWidget*,QString> widgets;
|
||||||
void savegameLoaded(SavegameData *savegame, QString savegamePath, bool inserted);
|
QSpacerItem *saSpacerItem;
|
||||||
void savegameDeleted(SavegameWidget *sgdWidget, bool isRemoteEmited = false);
|
QStringList fixedPictures;
|
||||||
void pictureDeleted(SnapmaticWidget *picWidget, bool isRemoteEmited = false);
|
QString enabledPicStr;
|
||||||
void insertSnapmaticIPI(QWidget *widget);
|
QString profileFolder;
|
||||||
void insertSavegameIPI(QWidget *widget);
|
QString profileName;
|
||||||
void sortingProfileInterface();
|
QString loadingStr;
|
||||||
|
QString language;
|
||||||
signals:
|
pcg32_random_t rng;
|
||||||
void profileLoaded();
|
bool contextMenuOpened;
|
||||||
void profileClosed();
|
bool isProfileLoaded;
|
||||||
};
|
int selectedWidgts;
|
||||||
|
int contentMode;
|
||||||
#endif // PROFILEINTERFACE_H
|
|
||||||
|
bool isSupportedImageFile(QString selectedFileName);
|
||||||
|
bool importFile(QString selectedFile, QDateTime importDateTime, bool notMultiple);
|
||||||
|
bool importUrls(const QMimeData *mimeData);
|
||||||
|
bool importRemote(QUrl remoteUrl);
|
||||||
|
bool importImage(QImage *snapmaticImage, QDateTime importDateTime);
|
||||||
|
bool importFilesProgress(QStringList selectedFiles);
|
||||||
|
bool importSnapmaticPicture(SnapmaticPicture *picture, bool warn = true);
|
||||||
|
bool importSavegameData(SavegameData *savegame, QString sgdPath, bool warn = true);
|
||||||
|
void pictureLoaded(SnapmaticPicture *picture, bool inserted);
|
||||||
|
void savegameLoaded(SavegameData *savegame, QString savegamePath, bool inserted);
|
||||||
|
void savegameDeleted(SavegameWidget *sgdWidget, bool isRemoteEmited = false);
|
||||||
|
void pictureDeleted(SnapmaticWidget *picWidget, bool isRemoteEmited = false);
|
||||||
|
void insertSnapmaticIPI(QWidget *widget);
|
||||||
|
void insertSavegameIPI(QWidget *widget);
|
||||||
|
void sortingProfileInterface();
|
||||||
|
int getRandomUid();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void profileLoaded();
|
||||||
|
void profileClosed();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROFILEINTERFACE_H
|
||||||
|
|
|
@ -1,244 +1,244 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ProfileInterface</class>
|
<class>ProfileInterface</class>
|
||||||
<widget class="QWidget" name="ProfileInterface">
|
<widget class="QWidget" name="ProfileInterface">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Profile Interface</string>
|
<string>Profile Interface</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlProfileInterface">
|
<layout class="QVBoxLayout" name="vlProfileInterface">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="swProfile">
|
<widget class="QStackedWidget" name="swProfile">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pageLoading">
|
<widget class="QWidget" name="pageLoading">
|
||||||
<layout class="QVBoxLayout" name="vlLoadingPage">
|
<layout class="QVBoxLayout" name="vlLoadingPage">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsLoading1">
|
<spacer name="vsLoading1">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labProfileLoading">
|
<widget class="QLabel" name="labProfileLoading">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Loading file %1 of %2 files</string>
|
<string>Loading file %1 of %2 files</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="pbPictureLoading">
|
<widget class="QProgressBar" name="pbPictureLoading">
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="textVisible">
|
<property name="textVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsLoading2">
|
<spacer name="vsLoading2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="pageProfile">
|
<widget class="QWidget" name="pageProfile">
|
||||||
<layout class="QVBoxLayout" name="vlProfilePage">
|
<layout class="QVBoxLayout" name="vlProfilePage">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="saProfile">
|
<widget class="QScrollArea" name="saProfile">
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="UiModWidget" name="saProfileContent">
|
<widget class="UiModWidget" name="saProfileContent">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>398</width>
|
<width>398</width>
|
||||||
<height>257</height>
|
<height>257</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlProfile">
|
<layout class="QVBoxLayout" name="vlProfile">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="vlContent">
|
<layout class="QVBoxLayout" name="vlContent">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="vlSavegame"/>
|
<layout class="QVBoxLayout" name="vlSavegame"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="vlSnapmatic"/>
|
<layout class="QVBoxLayout" name="vlSnapmatic"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labVersion">
|
<widget class="QLabel" name="labVersion">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>%1 %2</string>
|
<string>%1 %2</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hsProfile">
|
<spacer name="hsProfile">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdImport">
|
<widget class="QPushButton" name="cmdImport">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Import exported file</string>
|
<string>Import file</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Import...</string>
|
<string>&Import...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
<property name="autoDefault">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdCloseProfile">
|
<widget class="QPushButton" name="cmdCloseProfile">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Close profile</string>
|
<string>Close profile</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Close</string>
|
<string>&Close</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
<property name="autoDefault">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>UiModWidget</class>
|
<class>UiModWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>UiModWidget.h</header>
|
<header>UiModWidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
<slots>
|
<slots>
|
||||||
<signal>dropped(QMimeData*)</signal>
|
<signal>dropped(QMimeData*)</signal>
|
||||||
</slots>
|
</slots>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -1,103 +1,116 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "ProfileLoader.h"
|
#include "ProfileLoader.h"
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QStringList>
|
#include <QStringBuilder>
|
||||||
#include <QString>
|
#include <QStringList>
|
||||||
#include <QFile>
|
#include <QString>
|
||||||
#include <QDir>
|
#include <QThread>
|
||||||
|
#include <QList>
|
||||||
ProfileLoader::ProfileLoader(QString profileFolder, CrewDatabase *crewDB, QObject *parent) : QThread(parent), profileFolder(profileFolder), crewDB(crewDB)
|
#include <QFile>
|
||||||
{
|
#include <QDir>
|
||||||
|
|
||||||
}
|
ProfileLoader::ProfileLoader(QString profileFolder, CrewDatabase *crewDB, QObject *parent) : QThread(parent), profileFolder(profileFolder), crewDB(crewDB)
|
||||||
|
{
|
||||||
void ProfileLoader::run()
|
|
||||||
{
|
}
|
||||||
int curFile = 1;
|
|
||||||
QDir profileDir;
|
void ProfileLoader::run()
|
||||||
QList<int> crewList;
|
{
|
||||||
profileDir.setPath(profileFolder);
|
int curFile = 1;
|
||||||
|
QDir profileDir;
|
||||||
// Seek pictures and savegames
|
QList<int> crewList;
|
||||||
profileDir.setNameFilters(QStringList("SGTA*"));
|
profileDir.setPath(profileFolder);
|
||||||
QStringList SavegameFiles = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
|
|
||||||
QStringList BackupFiles = SavegameFiles.filter(".bak", Qt::CaseInsensitive);
|
// Seek pictures and savegames
|
||||||
profileDir.setNameFilters(QStringList("PGTA*"));
|
profileDir.setNameFilters(QStringList("SGTA*"));
|
||||||
QStringList SnapmaticPics = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
|
QStringList SavegameFiles = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
|
||||||
BackupFiles.append(SnapmaticPics.filter(".bak", Qt::CaseInsensitive));
|
QStringList BackupFiles = SavegameFiles.filter(".bak", Qt::CaseInsensitive);
|
||||||
|
profileDir.setNameFilters(QStringList("PGTA*"));
|
||||||
SavegameFiles.removeDuplicates();
|
QStringList SnapmaticPics = profileDir.entryList(QDir::Files | QDir::NoDot, QDir::NoSort);
|
||||||
SnapmaticPics.removeDuplicates();
|
BackupFiles += SnapmaticPics.filter(".bak", Qt::CaseInsensitive);
|
||||||
foreach(const QString &BackupFile, BackupFiles)
|
|
||||||
{
|
SavegameFiles.removeDuplicates();
|
||||||
SavegameFiles.removeAll(BackupFile);
|
SnapmaticPics.removeDuplicates();
|
||||||
SnapmaticPics.removeAll(BackupFile);
|
for (QString BackupFile : BackupFiles)
|
||||||
}
|
{
|
||||||
|
SavegameFiles.removeAll(BackupFile);
|
||||||
int maximumV = SavegameFiles.length() + SnapmaticPics.length();
|
SnapmaticPics.removeAll(BackupFile);
|
||||||
|
}
|
||||||
// Loading pictures and savegames
|
|
||||||
emit loadingProgress(curFile, maximumV);
|
int maximumV = SavegameFiles.length() + SnapmaticPics.length();
|
||||||
foreach(const QString &SavegameFile, SavegameFiles)
|
|
||||||
{
|
// Loading pictures and savegames
|
||||||
emit loadingProgress(curFile, maximumV);
|
emit loadingProgress(curFile, maximumV);
|
||||||
QString sgdPath = profileFolder + QDir::separator() + SavegameFile;
|
for (QString SavegameFile : SavegameFiles)
|
||||||
SavegameData *savegame = new SavegameData(sgdPath);
|
{
|
||||||
if (savegame->readingSavegame())
|
emit loadingProgress(curFile, maximumV);
|
||||||
{
|
QString sgdPath = profileFolder % "/" % SavegameFile;
|
||||||
emit savegameLoaded(savegame, sgdPath);
|
SavegameData *savegame = new SavegameData(sgdPath);
|
||||||
}
|
if (savegame->readingSavegame())
|
||||||
curFile++;
|
{
|
||||||
}
|
emit savegameLoaded(savegame, sgdPath);
|
||||||
foreach(const QString &SnapmaticPic, SnapmaticPics)
|
}
|
||||||
{
|
curFile++;
|
||||||
emit loadingProgress(curFile, maximumV);
|
}
|
||||||
QString picturePath = profileFolder + QDir::separator() + SnapmaticPic;
|
for (QString SnapmaticPic : SnapmaticPics)
|
||||||
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
|
{
|
||||||
if (picture->readingPicture(true, true, true))
|
emit loadingProgress(curFile, maximumV);
|
||||||
{
|
QString picturePath = profileFolder % "/" % SnapmaticPic;
|
||||||
emit pictureLoaded(picture);
|
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
|
||||||
int crewNumber = picture->getSnapmaticProperties().crewID;
|
if (picture->readingPicture(true, true, true))
|
||||||
if (!crewList.contains(crewNumber))
|
{
|
||||||
{
|
if (picture->isFormatSwitched())
|
||||||
crewList.append(crewNumber);
|
{
|
||||||
}
|
picture->setSnapmaticFormat(SnapmaticFormat::PGTA_Format);
|
||||||
}
|
if (picture->exportPicture(picturePath, SnapmaticFormat::PGTA_Format))
|
||||||
curFile++;
|
{
|
||||||
}
|
emit pictureFixed(picture);
|
||||||
|
}
|
||||||
// adding found crews
|
}
|
||||||
foreach(int crewID, crewList)
|
emit pictureLoaded(picture);
|
||||||
{
|
int crewNumber = picture->getSnapmaticProperties().crewID;
|
||||||
crewDB->addCrew(crewID);
|
if (!crewList.contains(crewNumber))
|
||||||
}
|
{
|
||||||
}
|
crewList += crewNumber;
|
||||||
|
}
|
||||||
void ProfileLoader::preloaded()
|
}
|
||||||
{
|
curFile++;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
// adding found crews
|
||||||
void ProfileLoader::loaded()
|
crewDB->setAddingCrews(true);
|
||||||
{
|
for (int crewID : crewList)
|
||||||
|
{
|
||||||
}
|
crewDB->addCrew(crewID);
|
||||||
|
}
|
||||||
|
crewDB->setAddingCrews(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileLoader::preloaded()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileLoader::loaded()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,52 +1,53 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PROFILELOADER_H
|
#ifndef PROFILELOADER_H
|
||||||
#define PROFILELOADER_H
|
#define PROFILELOADER_H
|
||||||
|
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
class ProfileLoader : public QThread
|
class ProfileLoader : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ProfileLoader(QString profileFolder, CrewDatabase *crewDB, QObject *parent = 0);
|
explicit ProfileLoader(QString profileFolder, CrewDatabase *crewDB, QObject *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString profileFolder;
|
QString profileFolder;
|
||||||
CrewDatabase *crewDB;
|
CrewDatabase *crewDB;
|
||||||
ProfileLoader *profileLoader;
|
ProfileLoader *profileLoader;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void preloaded();
|
void preloaded();
|
||||||
void loaded();
|
void loaded();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void pictureLoaded(SnapmaticPicture *picture);
|
void pictureLoaded(SnapmaticPicture *picture);
|
||||||
void savegameLoaded(SavegameData *savegame, QString savegamePath);
|
void pictureFixed(SnapmaticPicture *picture);
|
||||||
void loadingProgress(int value, int maximum);
|
void savegameLoaded(SavegameData *savegame, QString savegamePath);
|
||||||
};
|
void loadingProgress(int value, int maximum);
|
||||||
|
};
|
||||||
#endif // PROFILELOADER_H
|
|
||||||
|
#endif // PROFILELOADER_H
|
||||||
|
|
|
@ -1,61 +1,66 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "ProfileWidget.h"
|
#include "ProfileWidget.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
ProfileWidget::ProfileWidget(QWidget *parent) : QWidget(parent)
|
ProfileWidget::ProfileWidget(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
contentMode = 0;
|
contentMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileWidget::~ProfileWidget()
|
ProfileWidget::~ProfileWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProfileWidget::isSelected()
|
void ProfileWidget::retranslate()
|
||||||
{
|
{
|
||||||
qDebug() << "ProfileWidget::isSelected got used without overwrite";
|
qDebug() << "ProfileWidget::retranslate got used without overwrite";
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
bool ProfileWidget::isSelected()
|
||||||
void ProfileWidget::setSelected(bool isSelected)
|
{
|
||||||
{
|
qDebug() << "ProfileWidget::isSelected got used without overwrite";
|
||||||
qDebug() << "ProfileWidget::setSelected got used without overwrite, result" << isSelected;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget::setSelectionMode(bool selectionMode)
|
void ProfileWidget::setSelected(bool isSelected)
|
||||||
{
|
{
|
||||||
qDebug() << "ProfileWidget::setSelectionMode got used without overwrite, result:" << selectionMode;
|
qDebug() << "ProfileWidget::setSelected got used without overwrite, result" << isSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProfileWidget::getWidgetType()
|
void ProfileWidget::setSelectionMode(bool selectionMode)
|
||||||
{
|
{
|
||||||
qDebug() << "ProfileWidget::getWidgetType got used without overwrite";
|
qDebug() << "ProfileWidget::setSelectionMode got used without overwrite, result:" << selectionMode;
|
||||||
return "ProfileWidget";
|
}
|
||||||
}
|
|
||||||
|
QString ProfileWidget::getWidgetType()
|
||||||
int ProfileWidget::getContentMode()
|
{
|
||||||
{
|
qDebug() << "ProfileWidget::getWidgetType got used without overwrite";
|
||||||
return contentMode;
|
return "ProfileWidget";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget::setContentMode(int _contentMode)
|
int ProfileWidget::getContentMode()
|
||||||
{
|
{
|
||||||
contentMode = _contentMode;
|
return contentMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileWidget::setContentMode(int _contentMode)
|
||||||
|
{
|
||||||
|
contentMode = _contentMode;
|
||||||
|
}
|
||||||
|
|
|
@ -1,45 +1,46 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PROFILEWIDGET_H
|
#ifndef PROFILEWIDGET_H
|
||||||
#define PROFILEWIDGET_H
|
#define PROFILEWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class ProfileWidget : public QWidget
|
class ProfileWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ProfileWidget(QWidget *parent = 0);
|
explicit ProfileWidget(QWidget *parent = 0);
|
||||||
virtual void setSelectionMode(bool selectionMode);
|
virtual void setSelectionMode(bool selectionMode);
|
||||||
virtual void setContentMode(int contentMode);
|
virtual void setContentMode(int contentMode);
|
||||||
virtual void setSelected(bool isSelected);
|
virtual void setSelected(bool isSelected);
|
||||||
virtual bool isSelected();
|
virtual bool isSelected();
|
||||||
virtual QString getWidgetType();
|
virtual QString getWidgetType();
|
||||||
virtual int getContentMode();
|
virtual int getContentMode();
|
||||||
~ProfileWidget();
|
virtual void retranslate();
|
||||||
|
~ProfileWidget();
|
||||||
private:
|
|
||||||
int contentMode;
|
private:
|
||||||
|
int contentMode;
|
||||||
signals:
|
|
||||||
|
signals:
|
||||||
public slots:
|
|
||||||
};
|
public slots:
|
||||||
|
};
|
||||||
#endif // PROFILEWIDGET_H
|
|
||||||
|
#endif // PROFILEWIDGET_H
|
||||||
|
|
62
README.md
62
README.md
|
@ -1,31 +1,53 @@
|
||||||
## gta5view
|
## gta5view
|
||||||
Grand Theft Auto V Savegame and Snapmatic viewer
|
Grand Theft Auto V Savegame and Snapmatic viewer/editor
|
||||||
|
|
||||||
- Viewing Snapmatics and giving the ability to disable them in-game
|
- View Snapmatics with the ability to disable them in-game
|
||||||
- Import/Export Snapmatics and Savegames
|
- Edit Snapmatic pictures and properties in multiple ways
|
||||||
- Choosing between multiple Social Club accounts as GTA V profiles IDs
|
- Import/Export Snapmatics, Savegames and pictures
|
||||||
|
- Let choose between multiple Social Club accounts as GTA V profiles IDs
|
||||||
|
|
||||||
#### Screenshots
|
#### Screenshots
|
||||||
<img src="https://i.imgur.com/ncMtWjR.png"/>
|
![Snapmatic Picture Viewer](res/src/picture.png)
|
||||||
<img src="https://i.imgur.com/4THtwb1.png"/>
|
![User Interface](res/src/mainui.png)
|
||||||
<img src="https://i.imgur.com/STkRl6j.png"/>
|
![Snapmatic Properties](res/src/prop.png)
|
||||||
|
|
||||||
#### Build gta5view Debian/Ubuntu
|
#### Build gta5view for Windows
|
||||||
|
|
||||||
apt-get install git gcc g++ qtbase5-dev qt5-qmake make checkinstall
|
# Note: Install Docker Community Edition and Git before continuing
|
||||||
git clone https://github.com/SyDevTeam/gta5view
|
git clone https://gitlab.com/Syping/gta5view && cd gta5view
|
||||||
mkdir build && cd build
|
docker pull syping/qt5-static-mingw
|
||||||
qmake -qt=5 ../gta5view.pro # or just qmake ../gta5view.pro
|
docker run --rm -v ${PWD}:/gta5view -it syping/qt5-static-mingw
|
||||||
make
|
cd /gta5view && mkdir -p build && cd build
|
||||||
INSTALL_ROOT=/usr checkinstall --pkgname=gta5view --pkggroup=utility --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5
|
qmake-static ../gta5view.pro
|
||||||
|
make depend
|
||||||
|
make -j $(nproc --all)
|
||||||
|
|
||||||
#### Build gta5view Windows
|
#### Build gta5view for Debian/Ubuntu
|
||||||
|
|
||||||
Downloading <a href="https://www.qt.io/">Qt Framework</a> and install it.<br>
|
sudo apt-get install git gcc g++ qtbase5-dev qttranslations5-l10n qt5-qmake make
|
||||||
Take the Online Installer and choose the MinGW version or install Microsoft Visual Studio 2013/2015 Community<br>
|
git clone https://gitlab.com/Syping/gta5view && cd gta5view
|
||||||
Downloading Source Code over GitHub or with your Git client.<br>
|
mkdir -p build && cd build
|
||||||
Open the gta5view.pro file with Qt Creator and build it over Qt Creator.<br>
|
../configure --prefix=/opt/gta5view
|
||||||
|
make depend
|
||||||
|
make -j $(nproc --all)
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
#### Build gta5view for Fedora
|
||||||
|
|
||||||
|
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
|
||||||
|
../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
|
#### Download Binary Releases
|
||||||
|
|
||||||
Go to <a href="https://github.com/SyDevTeam/gta5view/releases">gta5view release</a> and download the .exe file for Windows, .deb file for Debian/Ubuntu and .dmg file for OS X
|
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.
|
||||||
|
|
|
@ -1,100 +1,108 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "SidebarGenerator.h"
|
#include "SidebarGenerator.h"
|
||||||
#include "SavegameWidget.h"
|
#include "SavegameWidget.h"
|
||||||
#include "SavegameCopy.h"
|
#include "StandardPaths.h"
|
||||||
#include "config.h"
|
#include "SavegameCopy.h"
|
||||||
#include <QMessageBox>
|
#include "config.h"
|
||||||
#include <QFileDialog>
|
#include <QStringBuilder>
|
||||||
#include <QSettings>
|
#include <QMessageBox>
|
||||||
|
#include <QFileDialog>
|
||||||
SavegameCopy::SavegameCopy()
|
#include <QSettings>
|
||||||
{
|
|
||||||
|
SavegameCopy::SavegameCopy()
|
||||||
}
|
{
|
||||||
|
|
||||||
void SavegameCopy::copySavegame(QWidget *parent, QString sgdPath)
|
}
|
||||||
{
|
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
void SavegameCopy::copySavegame(QWidget *parent, QString sgdPath)
|
||||||
settings.beginGroup("FileDialogs");
|
{
|
||||||
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
fileDialogPreSave: //Work?
|
|
||||||
QFileInfo sgdFileInfo(sgdPath);
|
settings.beginGroup("FileDialogs");
|
||||||
QFileDialog fileDialog(parent);
|
bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
|
||||||
fileDialog.setFileMode(QFileDialog::AnyFile);
|
settings.beginGroup("SavegameCopy");
|
||||||
fileDialog.setViewMode(QFileDialog::Detail);
|
|
||||||
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
fileDialogPreSave: //Work?
|
||||||
fileDialog.setOption(QFileDialog::DontUseNativeDialog, false);
|
QFileInfo sgdFileInfo(sgdPath);
|
||||||
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
QFileDialog fileDialog(parent);
|
||||||
fileDialog.setDefaultSuffix("");
|
fileDialog.setFileMode(QFileDialog::AnyFile);
|
||||||
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
fileDialog.setViewMode(QFileDialog::Detail);
|
||||||
fileDialog.setWindowTitle(SavegameWidget::tr(("Export Savegame...")));
|
fileDialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
fileDialog.setLabelText(QFileDialog::Accept, SavegameWidget::tr("Export"));
|
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
||||||
|
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
||||||
QStringList filters;
|
fileDialog.setDefaultSuffix("");
|
||||||
filters << SavegameWidget::tr("Savegame files (SGTA*)");
|
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
filters << SavegameWidget::tr("All files (**)");
|
fileDialog.setWindowTitle(SavegameWidget::tr(("Export Savegame...")));
|
||||||
fileDialog.setNameFilters(filters);
|
fileDialog.setLabelText(QFileDialog::Accept, SavegameWidget::tr("Export"));
|
||||||
|
|
||||||
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
|
QStringList filters;
|
||||||
|
filters << SavegameWidget::tr("Savegame files (SGTA*)");
|
||||||
fileDialog.setSidebarUrls(sidebarUrls);
|
filters << SavegameWidget::tr("All files (**)");
|
||||||
fileDialog.restoreState(settings.value("CopySavegame","").toByteArray());
|
fileDialog.setNameFilters(filters);
|
||||||
fileDialog.selectFile(sgdFileInfo.fileName());
|
|
||||||
|
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
|
||||||
if (fileDialog.exec())
|
|
||||||
{
|
fileDialog.setSidebarUrls(sidebarUrls);
|
||||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
fileDialog.setDirectory(settings.value("Directory", StandardPaths::picturesLocation()).toString());
|
||||||
if (selectedFiles.length() == 1)
|
fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
|
||||||
{
|
fileDialog.selectFile(sgdFileInfo.fileName());
|
||||||
QString selectedFile = selectedFiles.at(0);
|
|
||||||
|
if (fileDialog.exec())
|
||||||
if (QFile::exists(selectedFile))
|
{
|
||||||
{
|
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||||
if (QMessageBox::Yes == QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Overwrite %1 with current Savegame?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
if (selectedFiles.length() == 1)
|
||||||
{
|
{
|
||||||
if (!QFile::remove(selectedFile))
|
QString selectedFile = selectedFiles.at(0);
|
||||||
{
|
|
||||||
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Failed to overwrite %1 with current Savegame").arg("\""+selectedFile+"\""));
|
if (QFile::exists(selectedFile))
|
||||||
goto fileDialogPreSave; //Work?
|
{
|
||||||
}
|
if (QMessageBox::Yes == QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Overwrite %1 with current Savegame?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
||||||
}
|
{
|
||||||
else
|
if (!QFile::remove(selectedFile))
|
||||||
{
|
{
|
||||||
goto fileDialogPreSave; //Work?
|
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Failed to overwrite %1 with current Savegame").arg("\""+selectedFile+"\""));
|
||||||
}
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bool isCopied = QFile::copy(sgdPath, selectedFile);
|
else
|
||||||
if (!isCopied)
|
{
|
||||||
{
|
goto fileDialogPreSave; //Work?
|
||||||
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Failed to export current Savegame"));
|
}
|
||||||
goto fileDialogPreSave; //Work?
|
}
|
||||||
}
|
|
||||||
}
|
bool isCopied = QFile::copy(sgdPath, selectedFile);
|
||||||
else
|
if (!isCopied)
|
||||||
{
|
{
|
||||||
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("No valid file is selected"));
|
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Failed to export current Savegame"));
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
settings.setValue("CopySavegame", fileDialog.saveState());
|
{
|
||||||
settings.endGroup();
|
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("No valid file is selected"));
|
||||||
}
|
goto fileDialogPreSave; //Work?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings.setValue(parent->objectName() % "+Geometry", fileDialog.saveGeometry());
|
||||||
|
settings.setValue("Directory", fileDialog.directory().absolutePath());
|
||||||
|
settings.endGroup();
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SAVEGAMECOPY_H
|
#ifndef SAVEGAMECOPY_H
|
||||||
#define SAVEGAMECOPY_H
|
#define SAVEGAMECOPY_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class SavegameCopy
|
class SavegameCopy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SavegameCopy();
|
SavegameCopy();
|
||||||
static void copySavegame(QWidget *parent, QString sgdPath);
|
static void copySavegame(QWidget *parent, QString sgdPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SAVEGAMECOPY_H
|
#endif // SAVEGAMECOPY_H
|
||||||
|
|
|
@ -1,119 +1,121 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "StringParser.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "SavegameData.h"
|
#include "StringParser.h"
|
||||||
#include <QTextCodec>
|
#include "SavegameData.h"
|
||||||
#include <QByteArray>
|
#include <QStringBuilder>
|
||||||
#include <QDebug>
|
#include <QTextCodec>
|
||||||
#include <QFile>
|
#include <QByteArray>
|
||||||
|
#include <QDebug>
|
||||||
#define savegameHeaderLength 260
|
#include <QFile>
|
||||||
#define verificationValue QByteArray::fromHex("00000001")
|
|
||||||
|
#define savegameHeaderLength 260
|
||||||
SavegameData::SavegameData(const QString &fileName, QObject *parent) : QObject(parent), savegameFileName(fileName)
|
#define verificationValue QByteArray::fromHex("00000001")
|
||||||
{
|
|
||||||
// INIT SAVEGAME
|
SavegameData::SavegameData(const QString &fileName, QObject *parent) : QObject(parent), savegameFileName(fileName)
|
||||||
savegameStr = "";
|
{
|
||||||
savegameOk = 0;
|
// INIT SAVEGAME
|
||||||
}
|
savegameStr = "";
|
||||||
|
savegameOk = 0;
|
||||||
bool SavegameData::readingSavegame()
|
}
|
||||||
{
|
|
||||||
// Start opening file
|
bool SavegameData::readingSavegame()
|
||||||
// lastStep is like currentStep
|
{
|
||||||
|
// Start opening file
|
||||||
QFile *saveFile = new QFile(savegameFileName);
|
// lastStep is like currentStep
|
||||||
if (!saveFile->open(QFile::ReadOnly))
|
|
||||||
{
|
QFile *saveFile = new QFile(savegameFileName);
|
||||||
lastStep = "1;/1,OpenFile," + StringParser::convertDrawStringForLog(savegameFileName);
|
if (!saveFile->open(QFile::ReadOnly))
|
||||||
saveFile->deleteLater();
|
{
|
||||||
delete saveFile;
|
lastStep = "1;/1,OpenFile," % SnapmaticPicture::convertDrawStringForLog(savegameFileName);
|
||||||
return false;
|
saveFile->deleteLater();
|
||||||
}
|
delete saveFile;
|
||||||
|
return false;
|
||||||
// Reading Savegame Header
|
}
|
||||||
if (!saveFile->isReadable())
|
|
||||||
{
|
// Reading Savegame Header
|
||||||
lastStep = "2;/3,ReadingFile," + StringParser::convertDrawStringForLog(savegameFileName) + ",1,NOHEADER";
|
if (!saveFile->isReadable())
|
||||||
saveFile->close();
|
{
|
||||||
saveFile->deleteLater();
|
lastStep = "2;/3,ReadingFile," % SnapmaticPicture::convertDrawStringForLog(savegameFileName) % ",1,NOHEADER";
|
||||||
delete saveFile;
|
saveFile->close();
|
||||||
return false;
|
saveFile->deleteLater();
|
||||||
}
|
delete saveFile;
|
||||||
QByteArray savegameHeaderLine = saveFile->read(savegameHeaderLength);
|
return false;
|
||||||
if (savegameHeaderLine.left(4) == verificationValue)
|
}
|
||||||
{
|
QByteArray savegameHeaderLine = saveFile->read(savegameHeaderLength);
|
||||||
savegameStr = getSavegameDataString(savegameHeaderLine);
|
if (savegameHeaderLine.left(4) == verificationValue)
|
||||||
if (savegameStr.length() >= 1)
|
{
|
||||||
{
|
savegameStr = getSavegameDataString(savegameHeaderLine);
|
||||||
savegameOk = true;
|
if (savegameStr.length() >= 1)
|
||||||
}
|
{
|
||||||
}
|
savegameOk = true;
|
||||||
saveFile->close();
|
}
|
||||||
saveFile->deleteLater();
|
}
|
||||||
delete saveFile;
|
saveFile->close();
|
||||||
return savegameOk;
|
saveFile->deleteLater();
|
||||||
}
|
delete saveFile;
|
||||||
|
return savegameOk;
|
||||||
QString SavegameData::getSavegameDataString(const QByteArray &savegameHeader)
|
}
|
||||||
{
|
|
||||||
QByteArray savegameBytes = savegameHeader.left(savegameHeaderLength);
|
QString SavegameData::getSavegameDataString(const QByteArray &savegameHeader)
|
||||||
QList<QByteArray> savegameBytesList = savegameBytes.split(char(0x01));
|
{
|
||||||
savegameBytes = savegameBytesList.at(1);
|
QByteArray savegameBytes = savegameHeader.left(savegameHeaderLength);
|
||||||
savegameBytesList.clear();
|
QList<QByteArray> savegameBytesList = savegameBytes.split(char(0x01));
|
||||||
return StringParser::parseTitleString(savegameBytes, savegameBytes.length());
|
savegameBytes = savegameBytesList.at(1);
|
||||||
}
|
savegameBytesList.clear();
|
||||||
|
return SnapmaticPicture::parseTitleString(savegameBytes, savegameBytes.length());
|
||||||
bool SavegameData::readingSavegameFromFile(const QString &fileName)
|
}
|
||||||
{
|
|
||||||
if (fileName != "")
|
bool SavegameData::readingSavegameFromFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
savegameFileName = fileName;
|
if (fileName != "")
|
||||||
return readingSavegame();
|
{
|
||||||
}
|
savegameFileName = fileName;
|
||||||
else
|
return readingSavegame();
|
||||||
{
|
}
|
||||||
return false;
|
else
|
||||||
}
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
bool SavegameData::isSavegameOk()
|
}
|
||||||
{
|
|
||||||
return savegameOk;
|
bool SavegameData::isSavegameOk()
|
||||||
}
|
{
|
||||||
|
return savegameOk;
|
||||||
QString SavegameData::getSavegameFileName()
|
}
|
||||||
{
|
|
||||||
return savegameFileName;
|
QString SavegameData::getSavegameFileName()
|
||||||
}
|
{
|
||||||
|
return savegameFileName;
|
||||||
QString SavegameData::getSavegameStr()
|
}
|
||||||
{
|
|
||||||
return savegameStr;
|
QString SavegameData::getSavegameStr()
|
||||||
}
|
{
|
||||||
|
return savegameStr;
|
||||||
QString SavegameData::getLastStep()
|
}
|
||||||
{
|
|
||||||
return lastStep;
|
QString SavegameData::getLastStep()
|
||||||
}
|
{
|
||||||
|
return lastStep;
|
||||||
void SavegameData::setSavegameFileName(QString savegameFileName_)
|
}
|
||||||
{
|
|
||||||
savegameFileName = savegameFileName_;
|
void SavegameData::setSavegameFileName(QString savegameFileName_)
|
||||||
}
|
{
|
||||||
|
savegameFileName = savegameFileName_;
|
||||||
|
}
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SAVEGAMEDATA_H
|
#ifndef SAVEGAMEDATA_H
|
||||||
#define SAVEGAMEDATA_H
|
#define SAVEGAMEDATA_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class SavegameData : public QObject
|
class SavegameData : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SavegameData(const QString &fileName = "", QObject *parent = 0);
|
explicit SavegameData(const QString &fileName = "", QObject *parent = 0);
|
||||||
bool readingSavegameFromFile(const QString &fileName);
|
bool readingSavegameFromFile(const QString &fileName);
|
||||||
bool readingSavegame();
|
bool readingSavegame();
|
||||||
bool isSavegameOk();
|
bool isSavegameOk();
|
||||||
QString getLastStep();
|
QString getLastStep();
|
||||||
QString getSavegameStr();
|
QString getSavegameStr();
|
||||||
QString getSavegameFileName();
|
QString getSavegameFileName();
|
||||||
void setSavegameFileName(QString savegameFileName);
|
void setSavegameFileName(QString savegameFileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getSavegameDataString(const QByteArray &savegameHeader);
|
QString getSavegameDataString(const QByteArray &savegameHeader);
|
||||||
QString savegameFileName;
|
QString savegameFileName;
|
||||||
QString savegameStr;
|
QString savegameStr;
|
||||||
QString lastStep;
|
QString lastStep;
|
||||||
bool savegameOk;
|
bool savegameOk;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SAVEGAMEDATA_H
|
#endif // SAVEGAMEDATA_H
|
||||||
|
|
|
@ -1,53 +1,100 @@
|
||||||
#include "SavegameDialog.h"
|
/*****************************************************************************
|
||||||
#include "ui_SavegameDialog.h"
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
#include "SavegameCopy.h"
|
* Copyright (C) 2016-2018 Syping
|
||||||
#include "AppEnv.h"
|
*
|
||||||
#include <QMessageBox>
|
* 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
|
||||||
SavegameDialog::SavegameDialog(QWidget *parent) :
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
QDialog(parent),
|
* (at your option) any later version.
|
||||||
ui(new Ui::SavegameDialog)
|
*
|
||||||
{
|
* This program is distributed in the hope that it will be useful,
|
||||||
// Set Window Flags
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
// Setup User Interface
|
*
|
||||||
ui->setupUi(this);
|
* You should have received a copy of the GNU General Public License
|
||||||
savegameLabStr = ui->labSavegameText->text();
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*****************************************************************************/
|
||||||
if (QIcon::hasThemeIcon("dialog-close"))
|
|
||||||
{
|
#include "SavegameDialog.h"
|
||||||
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
#include "ui_SavegameDialog.h"
|
||||||
}
|
#include "SavegameCopy.h"
|
||||||
|
#include "AppEnv.h"
|
||||||
// DPI calculation
|
#include <QMessageBox>
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
#include <QDebug>
|
||||||
resize(400 * screenRatio, 105 * screenRatio);
|
|
||||||
}
|
SavegameDialog::SavegameDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
SavegameDialog::~SavegameDialog()
|
ui(new Ui::SavegameDialog)
|
||||||
{
|
{
|
||||||
delete ui;
|
// Set Window Flags
|
||||||
}
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
void SavegameDialog::setSavegameData(SavegameData *savegame, QString savegamePath, bool readOk)
|
// Setup User Interface
|
||||||
{
|
ui->setupUi(this);
|
||||||
// Showing error if reading error
|
ui->cmdClose->setFocus();
|
||||||
if (!readOk)
|
savegameLabStr = ui->labSavegameText->text();
|
||||||
{
|
|
||||||
QMessageBox::warning(this,tr("Savegame Viewer"),tr("Failed at %1").arg(savegame->getLastStep()));
|
// Set Icon for Close Button
|
||||||
return;
|
if (QIcon::hasThemeIcon("dialog-close"))
|
||||||
}
|
{
|
||||||
sgdPath = savegamePath;
|
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
|
||||||
ui->labSavegameText->setText(savegameLabStr.arg(savegame->getSavegameStr()));
|
}
|
||||||
}
|
else if (QIcon::hasThemeIcon("gtk-close"))
|
||||||
|
{
|
||||||
void SavegameDialog::on_cmdClose_clicked()
|
ui->cmdClose->setIcon(QIcon::fromTheme("gtk-close"));
|
||||||
{
|
}
|
||||||
this->close();
|
|
||||||
}
|
// Set Icon for Export Button
|
||||||
|
if (QIcon::hasThemeIcon("document-export"))
|
||||||
void SavegameDialog::on_cmdCopy_clicked()
|
{
|
||||||
{
|
ui->cmdCopy->setIcon(QIcon::fromTheme("document-export"));
|
||||||
SavegameCopy::copySavegame(this, sgdPath);
|
}
|
||||||
}
|
else if (QIcon::hasThemeIcon("document-save"))
|
||||||
|
{
|
||||||
|
ui->cmdCopy->setIcon(QIcon::fromTheme("document-save"));
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshWindowSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
SavegameDialog::~SavegameDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavegameDialog::refreshWindowSize()
|
||||||
|
{
|
||||||
|
// DPI calculation
|
||||||
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
int dpiWindowWidth = 400 * screenRatio;
|
||||||
|
int dpiWindowHeight = 105 * screenRatio;
|
||||||
|
if (dpiWindowHeight < heightForWidth(dpiWindowWidth))
|
||||||
|
{
|
||||||
|
dpiWindowHeight = heightForWidth(dpiWindowWidth);
|
||||||
|
}
|
||||||
|
resize(dpiWindowWidth, dpiWindowHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavegameDialog::setSavegameData(SavegameData *savegame, QString savegamePath, bool readOk)
|
||||||
|
{
|
||||||
|
// Showing error if reading error
|
||||||
|
if (!readOk)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this,tr("Savegame Viewer"),tr("Failed at %1").arg(savegame->getLastStep()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sgdPath = savegamePath;
|
||||||
|
ui->labSavegameText->setText(savegameLabStr.arg(savegame->getSavegameStr()));
|
||||||
|
refreshWindowSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavegameDialog::on_cmdClose_clicked()
|
||||||
|
{
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavegameDialog::on_cmdCopy_clicked()
|
||||||
|
{
|
||||||
|
SavegameCopy::copySavegame(this, sgdPath);
|
||||||
|
}
|
||||||
|
|
|
@ -1,29 +1,48 @@
|
||||||
#ifndef SAVEGAMEDIALOG_H
|
/*****************************************************************************
|
||||||
#define SAVEGAMEDIALOG_H
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
|
* Copyright (C) 2016-2018 Syping
|
||||||
#include "SavegameData.h"
|
*
|
||||||
#include <QDialog>
|
* 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
|
||||||
namespace Ui {
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
class SavegameDialog;
|
* (at your option) any later version.
|
||||||
}
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
class SavegameDialog : public QDialog
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
{
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
Q_OBJECT
|
* GNU General Public License for more details.
|
||||||
public:
|
*
|
||||||
explicit SavegameDialog(QWidget *parent = 0);
|
* You should have received a copy of the GNU General Public License
|
||||||
void setSavegameData(SavegameData *savegame, QString sgdPath, bool readOk);
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
~SavegameDialog();
|
*****************************************************************************/
|
||||||
|
|
||||||
private slots:
|
#ifndef SAVEGAMEDIALOG_H
|
||||||
void on_cmdClose_clicked();
|
#define SAVEGAMEDIALOG_H
|
||||||
void on_cmdCopy_clicked();
|
|
||||||
|
#include "SavegameData.h"
|
||||||
private:
|
#include <QDialog>
|
||||||
Ui::SavegameDialog *ui;
|
|
||||||
QString savegameLabStr;
|
namespace Ui {
|
||||||
QString sgdPath;
|
class SavegameDialog;
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif // SAVEGAMEDIALOG_H
|
class SavegameDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit SavegameDialog(QWidget *parent = 0);
|
||||||
|
void setSavegameData(SavegameData *savegame, QString sgdPath, bool readOk);
|
||||||
|
~SavegameDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_cmdClose_clicked();
|
||||||
|
void on_cmdCopy_clicked();
|
||||||
|
void refreshWindowSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::SavegameDialog *ui;
|
||||||
|
QString savegameLabStr;
|
||||||
|
QString sgdPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SAVEGAMEDIALOG_H
|
||||||
|
|
|
@ -1,86 +1,93 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>SavegameDialog</class>
|
<class>SavegameDialog</class>
|
||||||
<widget class="QDialog" name="SavegameDialog">
|
<widget class="QDialog" name="SavegameDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>105</height>
|
<height>105</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Savegame Viewer</string>
|
<string>Savegame Viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlSavegameDialog">
|
<layout class="QVBoxLayout" name="vlSavegameDialog">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labSavegameText">
|
<widget class="QLabel" name="labSavegameText">
|
||||||
<property name="sizePolicy">
|
<property name="text">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<string><span style=" font-weight:600;">Savegame</span><br><br>%1</string>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="alignment">
|
||||||
</sizepolicy>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="wordWrap">
|
||||||
<string><span style=" font-weight:600;">Savegame</span><br><br>%1</string>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
</widget>
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="wordWrap">
|
<spacer name="vsSavegame">
|
||||||
<bool>true</bool>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Vertical</enum>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="sizeHint" stdset="0">
|
||||||
<item>
|
<size>
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
<width>0</width>
|
||||||
<item>
|
<height>0</height>
|
||||||
<spacer name="hsButtons">
|
</size>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Horizontal</enum>
|
</spacer>
|
||||||
</property>
|
</item>
|
||||||
<property name="sizeHint" stdset="0">
|
<item>
|
||||||
<size>
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
<width>0</width>
|
<item>
|
||||||
<height>0</height>
|
<spacer name="hsButtons">
|
||||||
</size>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Horizontal</enum>
|
||||||
</spacer>
|
</property>
|
||||||
</item>
|
<property name="sizeHint" stdset="0">
|
||||||
<item>
|
<size>
|
||||||
<widget class="QPushButton" name="cmdCopy">
|
<width>0</width>
|
||||||
<property name="sizePolicy">
|
<height>0</height>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
</size>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
</spacer>
|
||||||
</sizepolicy>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="text">
|
<widget class="QPushButton" name="cmdCopy">
|
||||||
<string>&Export</string>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
</widget>
|
<horstretch>0</horstretch>
|
||||||
</item>
|
<verstretch>0</verstretch>
|
||||||
<item>
|
</sizepolicy>
|
||||||
<widget class="QPushButton" name="cmdClose">
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="text">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<string>&Export</string>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
</widget>
|
||||||
</sizepolicy>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="text">
|
<widget class="QPushButton" name="cmdClose">
|
||||||
<string>&Close</string>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
</widget>
|
<horstretch>0</horstretch>
|
||||||
</item>
|
<verstretch>0</verstretch>
|
||||||
</layout>
|
</sizepolicy>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="text">
|
||||||
</widget>
|
<string>&Close</string>
|
||||||
<resources/>
|
</property>
|
||||||
<connections/>
|
</widget>
|
||||||
</ui>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
|
@ -1,261 +1,303 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2018 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "SavegameWidget.h"
|
#include "SavegameWidget.h"
|
||||||
#include "ui_SavegameWidget.h"
|
#include "ui_SavegameWidget.h"
|
||||||
#include "SidebarGenerator.h"
|
#include "SidebarGenerator.h"
|
||||||
#include "SavegameDialog.h"
|
#include "SavegameDialog.h"
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include "SavegameCopy.h"
|
#include "SavegameCopy.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include <QFileDialog>
|
#include "config.h"
|
||||||
#include <QMessageBox>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
#include <QMessageBox>
|
||||||
#include <QFileInfo>
|
#include <QSettings>
|
||||||
#include <QPalette>
|
#include <QFileInfo>
|
||||||
#include <QColor>
|
#include <QPalette>
|
||||||
#include <QBrush>
|
#include <QColor>
|
||||||
#include <QTimer>
|
#include <QBrush>
|
||||||
#include <QDebug>
|
#include <QTimer>
|
||||||
#include <QFile>
|
#include <QDebug>
|
||||||
#include <QMenu>
|
#include <QFile>
|
||||||
#include <QUrl>
|
#include <QMenu>
|
||||||
|
#include <QUrl>
|
||||||
SavegameWidget::SavegameWidget(QWidget *parent) :
|
|
||||||
ProfileWidget(parent),
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
ui(new Ui::SavegameWidget)
|
#include "TelemetryClass.h"
|
||||||
{
|
#include <QJsonDocument>
|
||||||
ui->setupUi(this);
|
#include <QJsonObject>
|
||||||
ui->cmdCopy->setVisible(false);
|
#include <QDateTime>
|
||||||
ui->cmdView->setVisible(false);
|
#endif
|
||||||
ui->cmdDelete->setVisible(false);
|
|
||||||
ui->cbSelected->setVisible(false);
|
SavegameWidget::SavegameWidget(QWidget *parent) :
|
||||||
|
ProfileWidget(parent),
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
ui(new Ui::SavegameWidget)
|
||||||
ui->labSavegamePic->setFixedSize(48 * screenRatio, 27 * screenRatio);
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
QPixmap savegamePixmap(":/img/savegame.png");
|
ui->cmdCopy->setVisible(false);
|
||||||
if (screenRatio != 1) savegamePixmap = savegamePixmap.scaledToHeight(ui->labSavegamePic->height(), Qt::SmoothTransformation);
|
ui->cmdView->setVisible(false);
|
||||||
ui->labSavegamePic->setPixmap(savegamePixmap);
|
ui->cmdDelete->setVisible(false);
|
||||||
|
ui->cbSelected->setVisible(false);
|
||||||
QString exportSavegameStr = tr("Export Savegame...");
|
|
||||||
Q_UNUSED(exportSavegameStr)
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
|
ui->labSavegamePic->setFixedSize(48 * screenRatio, 27 * screenRatio);
|
||||||
QPalette palette;
|
|
||||||
highlightBackColor = palette.highlight().color();
|
ui->labSavegamePic->setScaledContents(true);
|
||||||
highlightTextColor = palette.highlightedText().color();
|
ui->labSavegamePic->setPixmap(QPixmap(":/img/savegame.svgz"));
|
||||||
|
|
||||||
labelAutosaveStr = tr("AUTOSAVE - %1\n%2");
|
QString exportSavegameStr = tr("Export Savegame...");
|
||||||
labelSaveStr = tr("SAVE %3 - %1\n%2");
|
Q_UNUSED(exportSavegameStr)
|
||||||
snwgt = parent;
|
|
||||||
sgdPath = "";
|
labelAutosaveStr = tr("AUTOSAVE - %1\n%2");
|
||||||
sgdStr = "";
|
labelSaveStr = tr("SAVE %3 - %1\n%2");
|
||||||
sgdata = 0;
|
|
||||||
|
ui->SavegameFrame->setMouseTracking(true);
|
||||||
installEventFilter(this);
|
ui->labSavegamePic->setMouseTracking(true);
|
||||||
}
|
ui->labSavegameStr->setMouseTracking(true);
|
||||||
|
ui->cbSelected->setMouseTracking(true);
|
||||||
SavegameWidget::~SavegameWidget()
|
sgdata = nullptr;
|
||||||
{
|
}
|
||||||
delete ui;
|
|
||||||
}
|
SavegameWidget::~SavegameWidget()
|
||||||
|
{
|
||||||
bool SavegameWidget::eventFilter(QObject *obj, QEvent *ev)
|
delete ui;
|
||||||
{
|
}
|
||||||
if (obj == this)
|
|
||||||
{
|
void SavegameWidget::setSavegameData(SavegameData *savegame, QString savegamePath)
|
||||||
if (ev->type() == QEvent::Enter)
|
{
|
||||||
{
|
// BETA CODE
|
||||||
setStyleSheet(QString("QFrame#SavegameFrame{background-color: rgb(%1, %2, %3)}QLabel#labSavegameStr{color: rgb(%4, %5, %6)}").arg(QString::number(highlightBackColor.red()), QString::number(highlightBackColor.green()), QString::number(highlightBackColor.blue()), QString::number(highlightTextColor.red()), QString::number(highlightTextColor.green()), QString::number(highlightTextColor.blue())));
|
QString savegameString = savegame->getSavegameStr();
|
||||||
return true;
|
QString fileName = QFileInfo(savegame->getSavegameFileName()).fileName();
|
||||||
}
|
renderString(savegameString, fileName);
|
||||||
else if(ev->type() == QEvent::Leave)
|
sgdStr = savegameString;
|
||||||
{
|
sgdPath = savegamePath;
|
||||||
setStyleSheet("");
|
sgdata = savegame;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
void SavegameWidget::renderString(const QString &savegameString, const QString &fileName)
|
||||||
return false;
|
{
|
||||||
}
|
bool validNumber;
|
||||||
|
QString savegameName = tr("WRONG FORMAT");
|
||||||
void SavegameWidget::setSavegameData(SavegameData *savegame, QString savegamePath)
|
QString savegameDate = tr("WRONG FORMAT");
|
||||||
{
|
QStringList savegameNDL = QString(savegameString).split(" - ");
|
||||||
// BETA CODE
|
if (savegameNDL.length() >= 2)
|
||||||
bool validNumber;
|
{
|
||||||
QString savegameName = tr("WRONG FORMAT");
|
savegameDate = savegameNDL.at(savegameNDL.length() - 1);
|
||||||
QString savegameDate = tr("WRONG FORMAT");
|
savegameName = QString(savegameString).remove(savegameString.length() - savegameDate.length() - 3, savegameDate.length() + 3);
|
||||||
QString savegameString = savegame->getSavegameStr();
|
}
|
||||||
QString fileName = QFileInfo(savegame->getSavegameFileName()).fileName();
|
int savegameNumber = QString(fileName).remove(0,5).toInt(&validNumber) + 1;
|
||||||
QStringList savegameNDL = QString(savegameString).split(" - ");
|
if (validNumber)
|
||||||
if (savegameNDL.length() >= 2)
|
{
|
||||||
{
|
if (savegameNumber == 16)
|
||||||
savegameDate = savegameNDL.at(savegameNDL.length() - 1);
|
{
|
||||||
savegameName = QString(savegameString).remove(savegameString.length() - savegameDate.length() - 3, savegameDate.length() + 3);
|
ui->labSavegameStr->setText(labelAutosaveStr.arg(savegameDate, savegameName));
|
||||||
}
|
}
|
||||||
int savegameNumber = QString(fileName).remove(0,5).toInt(&validNumber) + 1;
|
else
|
||||||
if (validNumber)
|
{
|
||||||
{
|
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, QString::number(savegameNumber)));
|
||||||
if (savegameNumber == 16)
|
}
|
||||||
{
|
}
|
||||||
ui->labSavegameStr->setText(labelAutosaveStr.arg(savegameDate, savegameName));
|
else
|
||||||
}
|
{
|
||||||
else
|
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, tr("UNKNOWN")));
|
||||||
{
|
}
|
||||||
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, QString::number(savegameNumber)));
|
}
|
||||||
}
|
|
||||||
}
|
void SavegameWidget::retranslate()
|
||||||
else
|
{
|
||||||
{
|
labelAutosaveStr = tr("AUTOSAVE - %1\n%2");
|
||||||
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, tr("UNKNOWN")));
|
labelSaveStr = tr("SAVE %3 - %1\n%2");
|
||||||
}
|
|
||||||
sgdStr = savegameString;
|
QString fileName = QFileInfo(sgdata->getSavegameFileName()).fileName();
|
||||||
sgdPath = savegamePath;
|
renderString(sgdStr, fileName);
|
||||||
sgdata = savegame;
|
}
|
||||||
}
|
|
||||||
|
void SavegameWidget::on_cmdCopy_clicked()
|
||||||
void SavegameWidget::on_cmdCopy_clicked()
|
{
|
||||||
{
|
SavegameCopy::copySavegame(this, sgdPath);
|
||||||
SavegameCopy::copySavegame(this, sgdPath);
|
}
|
||||||
}
|
|
||||||
|
void SavegameWidget::on_cmdDelete_clicked()
|
||||||
void SavegameWidget::on_cmdDelete_clicked()
|
{
|
||||||
{
|
int uchoice = QMessageBox::question(this, tr("Delete Savegame"), tr("Are you sure to delete %1 from your savegames?").arg("\""+sgdStr+"\""), QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
|
||||||
int uchoice = QMessageBox::question(this, tr("Delete savegame"), tr("Are you sure to delete %1 from your savegames?").arg("\""+sgdStr+"\""), QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
|
if (uchoice == QMessageBox::Yes)
|
||||||
if (uchoice == QMessageBox::Yes)
|
{
|
||||||
{
|
if (!QFile::exists(sgdPath))
|
||||||
if (!QFile::exists(sgdPath))
|
{
|
||||||
{
|
emit savegameDeleted();
|
||||||
emit savegameDeleted();
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
}
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
else if(QFile::remove(sgdPath))
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
{
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
emit savegameDeleted();
|
telemetrySettings.endGroup();
|
||||||
}
|
if (pushUsageData && Telemetry->canPush())
|
||||||
else
|
{
|
||||||
{
|
QJsonDocument jsonDocument;
|
||||||
QMessageBox::warning(this, tr("Delete savegame"), tr("Failed at deleting %1 from your savegames").arg("\""+sgdStr+"\""));
|
QJsonObject jsonObject;
|
||||||
}
|
jsonObject["Type"] = "DeleteSuccess";
|
||||||
}
|
jsonObject["ExtraFlags"] = "Savegame";
|
||||||
}
|
jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
|
||||||
|
jsonDocument.setObject(jsonObject);
|
||||||
void SavegameWidget::on_cmdView_clicked()
|
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
|
||||||
{
|
}
|
||||||
SavegameDialog *savegameDialog = new SavegameDialog(this);
|
#endif
|
||||||
savegameDialog->setSavegameData(sgdata, sgdPath, true);
|
}
|
||||||
savegameDialog->setModal(true);
|
else if (QFile::remove(sgdPath))
|
||||||
#ifdef Q_OS_ANDROID
|
{
|
||||||
// Android ...
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
savegameDialog->showMaximized();
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
#else
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
savegameDialog->show();
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
#endif
|
telemetrySettings.endGroup();
|
||||||
savegameDialog->exec();
|
if (pushUsageData && Telemetry->canPush())
|
||||||
delete savegameDialog;
|
{
|
||||||
}
|
QJsonDocument jsonDocument;
|
||||||
|
QJsonObject jsonObject;
|
||||||
void SavegameWidget::mousePressEvent(QMouseEvent *ev)
|
jsonObject["Type"] = "DeleteSuccess";
|
||||||
{
|
jsonObject["ExtraFlags"] = "Savegame";
|
||||||
ProfileWidget::mousePressEvent(ev);
|
jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
|
||||||
}
|
jsonDocument.setObject(jsonObject);
|
||||||
|
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
|
||||||
void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
}
|
||||||
{
|
#endif
|
||||||
ProfileWidget::mouseReleaseEvent(ev);
|
emit savegameDeleted();
|
||||||
if (ui->cbSelected->isVisible())
|
}
|
||||||
{
|
else
|
||||||
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
{
|
||||||
{
|
QMessageBox::warning(this, tr("Delete Savegame"), tr("Failed at deleting %1 from your savegames").arg("\""+sgdStr+"\""));
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
void SavegameWidget::on_cmdView_clicked()
|
||||||
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
{
|
||||||
{
|
SavegameDialog *savegameDialog = new SavegameDialog(this);
|
||||||
on_cmdView_clicked();
|
savegameDialog->setSavegameData(sgdata, sgdPath, true);
|
||||||
}
|
savegameDialog->setModal(true);
|
||||||
}
|
#ifdef Q_OS_ANDROID
|
||||||
}
|
// Android ...
|
||||||
|
savegameDialog->showMaximized();
|
||||||
void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
#else
|
||||||
{
|
savegameDialog->show();
|
||||||
ProfileWidget::mouseDoubleClickEvent(ev);
|
#endif
|
||||||
|
savegameDialog->exec();
|
||||||
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
delete savegameDialog;
|
||||||
{
|
}
|
||||||
on_cmdView_clicked();
|
|
||||||
}
|
void SavegameWidget::mousePressEvent(QMouseEvent *ev)
|
||||||
}
|
{
|
||||||
|
ProfileWidget::mousePressEvent(ev);
|
||||||
void SavegameWidget::setSelected(bool isSelected)
|
}
|
||||||
{
|
|
||||||
ui->cbSelected->setChecked(isSelected);
|
void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
}
|
{
|
||||||
|
ProfileWidget::mouseReleaseEvent(ev);
|
||||||
void SavegameWidget::savegameSelected()
|
if (ui->cbSelected->isVisible())
|
||||||
{
|
{
|
||||||
setSelected(!ui->cbSelected->isChecked());
|
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
}
|
{
|
||||||
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
void SavegameWidget::contextMenuEvent(QContextMenuEvent *ev)
|
}
|
||||||
{
|
}
|
||||||
emit contextMenuTriggered(ev);
|
else
|
||||||
}
|
{
|
||||||
|
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
void SavegameWidget::on_cbSelected_stateChanged(int arg1)
|
{
|
||||||
{
|
if (ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
if (arg1 == Qt::Checked)
|
{
|
||||||
{
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
emit widgetSelected();
|
}
|
||||||
}
|
else
|
||||||
else if (arg1 == Qt::Unchecked)
|
{
|
||||||
{
|
on_cmdView_clicked();
|
||||||
emit widgetDeselected();
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
|
{
|
||||||
bool SavegameWidget::isSelected()
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
{
|
}
|
||||||
return ui->cbSelected->isChecked();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavegameWidget::setSelectionMode(bool selectionMode)
|
void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
ui->cbSelected->setVisible(selectionMode);
|
ProfileWidget::mouseDoubleClickEvent(ev);
|
||||||
}
|
|
||||||
|
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
||||||
void SavegameWidget::selectAllWidgets()
|
{
|
||||||
{
|
on_cmdView_clicked();
|
||||||
emit allWidgetsSelected();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavegameWidget::deselectAllWidgets()
|
void SavegameWidget::setSelected(bool isSelected)
|
||||||
{
|
{
|
||||||
emit allWidgetsDeselected();
|
ui->cbSelected->setChecked(isSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
SavegameData* SavegameWidget::getSavegame()
|
void SavegameWidget::savegameSelected()
|
||||||
{
|
{
|
||||||
return sgdata;
|
setSelected(!ui->cbSelected->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SavegameWidget::getWidgetType()
|
void SavegameWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
return "SavegameWidget";
|
emit contextMenuTriggered(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SavegameWidget::on_cbSelected_stateChanged(int arg1)
|
||||||
|
{
|
||||||
|
if (arg1 == Qt::Checked)
|
||||||
|
{
|
||||||
|
emit widgetSelected();
|
||||||
|
}
|
||||||
|
else if (arg1 == Qt::Unchecked)
|
||||||
|
{
|
||||||
|
emit widgetDeselected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SavegameWidget::isSelected()
|
||||||
|
{
|
||||||
|
return ui->cbSelected->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavegameWidget::setSelectionMode(bool selectionMode)
|
||||||
|
{
|
||||||
|
ui->cbSelected->setVisible(selectionMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavegameWidget::selectAllWidgets()
|
||||||
|
{
|
||||||
|
emit allWidgetsSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SavegameWidget::deselectAllWidgets()
|
||||||
|
{
|
||||||
|
emit allWidgetsDeselected();
|
||||||
|
}
|
||||||
|
|
||||||
|
SavegameData* SavegameWidget::getSavegame()
|
||||||
|
{
|
||||||
|
return sgdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SavegameWidget::getWidgetType()
|
||||||
|
{
|
||||||
|
return "SavegameWidget";
|
||||||
|
}
|
||||||
|
|
|
@ -1,82 +1,80 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SAVEGAMEWIDGET_H
|
#ifndef SAVEGAMEWIDGET_H
|
||||||
#define SAVEGAMEWIDGET_H
|
#define SAVEGAMEWIDGET_H
|
||||||
#include "ProfileWidget.h"
|
#include "ProfileWidget.h"
|
||||||
#include "SavegameData.h"
|
#include "SavegameData.h"
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SavegameWidget;
|
class SavegameWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SavegameWidget : public ProfileWidget
|
class SavegameWidget : public ProfileWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SavegameWidget(QWidget *parent = 0);
|
SavegameWidget(QWidget *parent = 0);
|
||||||
void setSavegameData(SavegameData *savegame, QString savegamePath);
|
void setSavegameData(SavegameData *savegame, QString savegamePath);
|
||||||
void setSelectionMode(bool selectionMode);
|
void setSelectionMode(bool selectionMode);
|
||||||
void setSelected(bool isSelected);
|
void setSelected(bool isSelected);
|
||||||
SavegameData* getSavegame();
|
SavegameData* getSavegame();
|
||||||
QString getWidgetType();
|
QString getWidgetType();
|
||||||
bool isSelected();
|
bool isSelected();
|
||||||
~SavegameWidget();
|
void retranslate();
|
||||||
|
~SavegameWidget();
|
||||||
private slots:
|
|
||||||
void on_cmdView_clicked();
|
private slots:
|
||||||
void on_cmdCopy_clicked();
|
void on_cmdView_clicked();
|
||||||
void on_cmdDelete_clicked();
|
void on_cmdCopy_clicked();
|
||||||
void on_cbSelected_stateChanged(int arg1);
|
void on_cmdDelete_clicked();
|
||||||
void savegameSelected();
|
void on_cbSelected_stateChanged(int arg1);
|
||||||
void selectAllWidgets();
|
void savegameSelected();
|
||||||
void deselectAllWidgets();
|
void selectAllWidgets();
|
||||||
|
void deselectAllWidgets();
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
protected:
|
||||||
void mouseDoubleClickEvent(QMouseEvent *ev);
|
void mouseDoubleClickEvent(QMouseEvent *ev);
|
||||||
void mouseReleaseEvent(QMouseEvent *ev);
|
void mouseReleaseEvent(QMouseEvent *ev);
|
||||||
void mousePressEvent(QMouseEvent *ev);
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SavegameWidget *ui;
|
Ui::SavegameWidget *ui;
|
||||||
SavegameData *sgdata;
|
SavegameData *sgdata;
|
||||||
QColor highlightBackColor;
|
QString labelAutosaveStr;
|
||||||
QColor highlightTextColor;
|
QString labelSaveStr;
|
||||||
QString labelAutosaveStr;
|
QString sgdPath;
|
||||||
QString labelSaveStr;
|
QString sgdStr;
|
||||||
QString sgdPath;
|
void renderString(const QString &savegameString, const QString &fileName);
|
||||||
QString sgdStr;
|
|
||||||
QWidget *snwgt;
|
signals:
|
||||||
|
void savegameDeleted();
|
||||||
signals:
|
void widgetSelected();
|
||||||
void savegameDeleted();
|
void widgetDeselected();
|
||||||
void widgetSelected();
|
void allWidgetsSelected();
|
||||||
void widgetDeselected();
|
void allWidgetsDeselected();
|
||||||
void allWidgetsSelected();
|
void contextMenuTriggered(QContextMenuEvent *ev);
|
||||||
void allWidgetsDeselected();
|
};
|
||||||
void contextMenuTriggered(QContextMenuEvent *ev);
|
|
||||||
};
|
#endif // SAVEGAMEWIDGET_H
|
||||||
|
|
||||||
#endif // SAVEGAMEWIDGET_H
|
|
||||||
|
|
|
@ -1,135 +1,135 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>SavegameWidget</class>
|
<class>SavegameWidget</class>
|
||||||
<widget class="QWidget" name="SavegameWidget">
|
<widget class="QWidget" name="SavegameWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>405</width>
|
<width>405</width>
|
||||||
<height>46</height>
|
<height>46</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Savegame Widget</string>
|
<string>Savegame Widget</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hlSavegameContent">
|
<layout class="QHBoxLayout" name="hlSavegameContent">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="SavegameFrame">
|
<widget class="QFrame" name="SavegameFrame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Plain</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="lineWidth">
|
<property name="lineWidth">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hlSavegame">
|
<layout class="QHBoxLayout" name="hlSavegame">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cbSelected">
|
<widget class="QCheckBox" name="cbSelected">
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labSavegamePic">
|
<widget class="QLabel" name="labSavegamePic">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labSavegameStr">
|
<widget class="QLabel" name="labSavegameStr">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>SAVE %3 - %1<br>%2</string>
|
<string>SAVE %3 - %1<br>%2</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdView">
|
<widget class="QPushButton" name="cmdView">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>View savegame</string>
|
<string>View savegame</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>View</string>
|
<string>View</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdCopy">
|
<widget class="QPushButton" name="cmdCopy">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Copy savegame</string>
|
<string>Copy savegame</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Export</string>
|
<string>Export</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
<property name="autoDefault">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cmdDelete">
|
<widget class="QPushButton" name="cmdDelete">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Delete savegame</string>
|
<string>Delete savegame</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete</string>
|
<string>Delete</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
<property name="autoDefault">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -1,61 +1,61 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "SidebarGenerator.h"
|
#include "SidebarGenerator.h"
|
||||||
#include "StandardPaths.h"
|
#include "StandardPaths.h"
|
||||||
#include "AppEnv.h"
|
#include "AppEnv.h"
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
SidebarGenerator::SidebarGenerator()
|
SidebarGenerator::SidebarGenerator()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QUrl> SidebarGenerator::generateSidebarUrls(QList<QUrl> sidebarUrls)
|
QList<QUrl> SidebarGenerator::generateSidebarUrls(QList<QUrl> sidebarUrls)
|
||||||
{
|
{
|
||||||
QDir dir;
|
QDir dir;
|
||||||
|
|
||||||
dir.setPath(StandardPaths::picturesLocation());
|
dir.setPath(StandardPaths::picturesLocation());
|
||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
{
|
{
|
||||||
sidebarUrls << QUrl::fromLocalFile(dir.absolutePath());
|
sidebarUrls += QUrl::fromLocalFile(dir.absolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
dir.setPath(StandardPaths::documentsLocation());
|
dir.setPath(StandardPaths::documentsLocation());
|
||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
{
|
{
|
||||||
sidebarUrls << QUrl::fromLocalFile(dir.absolutePath());
|
sidebarUrls += QUrl::fromLocalFile(dir.absolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gameFolderExists;
|
bool gameFolderExists;
|
||||||
QString gameFolder = AppEnv::getGameFolder(&gameFolderExists);
|
QString gameFolder = AppEnv::getGameFolder(&gameFolderExists);
|
||||||
if (gameFolderExists)
|
if (gameFolderExists)
|
||||||
{
|
{
|
||||||
sidebarUrls << QUrl::fromLocalFile(gameFolder);
|
sidebarUrls += QUrl::fromLocalFile(gameFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
dir.setPath(StandardPaths::desktopLocation());
|
dir.setPath(StandardPaths::desktopLocation());
|
||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
{
|
{
|
||||||
sidebarUrls << QUrl::fromLocalFile(dir.absolutePath());
|
sidebarUrls += QUrl::fromLocalFile(dir.absolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
return sidebarUrls;
|
return sidebarUrls;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SIDEBARGENERATOR_H
|
#ifndef SIDEBARGENERATOR_H
|
||||||
#define SIDEBARGENERATOR_H
|
#define SIDEBARGENERATOR_H
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
class SidebarGenerator
|
class SidebarGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SidebarGenerator();
|
SidebarGenerator();
|
||||||
static QList<QUrl> generateSidebarUrls(QList<QUrl> sidebarUrls);
|
static QList<QUrl> generateSidebarUrls(QList<QUrl> sidebarUrls);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SIDEBARGENERATOR_H
|
#endif // SIDEBARGENERATOR_H
|
||||||
|
|
|
@ -1,340 +1,469 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2018 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "SnapmaticEditor.h"
|
#include "SnapmaticEditor.h"
|
||||||
#include "ui_SnapmaticEditor.h"
|
#include "ui_SnapmaticEditor.h"
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "StringParser.h"
|
#include "PlayerListDialog.h"
|
||||||
#include "AppEnv.h"
|
#include "StringParser.h"
|
||||||
#include <QStringBuilder>
|
#include "AppEnv.h"
|
||||||
#include <QTextDocument>
|
#include "config.h"
|
||||||
#include <QInputDialog>
|
#include <QStringListIterator>
|
||||||
#include <QMessageBox>
|
#include <QStringBuilder>
|
||||||
#include <QDebug>
|
#include <QTextDocument>
|
||||||
#include <QFile>
|
#include <QInputDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, QWidget *parent) :
|
#include <QDebug>
|
||||||
QDialog(parent), crewDB(crewDB),
|
#include <QFile>
|
||||||
ui(new Ui::SnapmaticEditor)
|
|
||||||
{
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
ui->setupUi(this);
|
#include "TelemetryClass.h"
|
||||||
ui->cmdApply->setDefault(true);
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
if (QIcon::hasThemeIcon("dialog-apply"))
|
#endif
|
||||||
{
|
|
||||||
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply"));
|
SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
}
|
QDialog(parent), crewDB(crewDB), profileDB(profileDB),
|
||||||
if (QIcon::hasThemeIcon("dialog-cancel"))
|
ui(new Ui::SnapmaticEditor)
|
||||||
{
|
{
|
||||||
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
|
// Set Window Flags
|
||||||
}
|
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
snapmaticTitle = "";
|
ui->setupUi(this);
|
||||||
smpic = 0;
|
ui->cmdCancel->setDefault(true);
|
||||||
|
ui->cmdCancel->setFocus();
|
||||||
// DPI calculation
|
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
// Set Icon for Apply Button
|
||||||
resize(400 * screenRatio, 360 * screenRatio);
|
if (QIcon::hasThemeIcon("dialog-ok-apply"))
|
||||||
}
|
{
|
||||||
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok-apply"));
|
||||||
SnapmaticEditor::~SnapmaticEditor()
|
}
|
||||||
{
|
else if (QIcon::hasThemeIcon("dialog-apply"))
|
||||||
delete ui;
|
{
|
||||||
}
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-apply"));
|
||||||
|
}
|
||||||
void SnapmaticEditor::selfie_toggled(bool checked)
|
else if (QIcon::hasThemeIcon("gtk-apply"))
|
||||||
{
|
{
|
||||||
if (checked)
|
ui->cmdApply->setIcon(QIcon::fromTheme("gtk-apply"));
|
||||||
{
|
}
|
||||||
isSelfie = true;
|
else if (QIcon::hasThemeIcon("dialog-ok"))
|
||||||
}
|
{
|
||||||
else
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||||
{
|
}
|
||||||
isSelfie = false;
|
else if (QIcon::hasThemeIcon("gtk-ok"))
|
||||||
}
|
{
|
||||||
}
|
ui->cmdApply->setIcon(QIcon::fromTheme("dialog-ok"));
|
||||||
|
}
|
||||||
|
|
||||||
void SnapmaticEditor::mugshot_toggled(bool checked)
|
// Set Icon for Cancel Button
|
||||||
{
|
if (QIcon::hasThemeIcon("dialog-cancel"))
|
||||||
if (checked)
|
{
|
||||||
{
|
ui->cmdCancel->setIcon(QIcon::fromTheme("dialog-cancel"));
|
||||||
isMugshot = true;
|
}
|
||||||
ui->cbDirector->setEnabled(false);
|
else if (QIcon::hasThemeIcon("gtk-cancel"))
|
||||||
ui->cbDirector->setChecked(false);
|
{
|
||||||
}
|
ui->cmdCancel->setIcon(QIcon::fromTheme("gtk-cancel"));
|
||||||
else
|
}
|
||||||
{
|
|
||||||
isMugshot = false;
|
snapmaticTitle = QString();
|
||||||
ui->cbDirector->setEnabled(true);
|
smpic = 0;
|
||||||
}
|
|
||||||
}
|
#ifndef Q_OS_ANDROID
|
||||||
|
// DPI calculation
|
||||||
void SnapmaticEditor::editor_toggled(bool checked)
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
{
|
resize(400 * screenRatio, 360 * screenRatio);
|
||||||
if (checked)
|
#endif
|
||||||
{
|
}
|
||||||
isEditor = true;
|
|
||||||
ui->cbDirector->setEnabled(false);
|
SnapmaticEditor::~SnapmaticEditor()
|
||||||
ui->cbDirector->setChecked(false);
|
{
|
||||||
}
|
delete ui;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
isEditor = false;
|
void SnapmaticEditor::selfie_toggled(bool checked)
|
||||||
ui->cbDirector->setEnabled(true);
|
{
|
||||||
}
|
if (checked)
|
||||||
}
|
{
|
||||||
|
isSelfie = true;
|
||||||
void SnapmaticEditor::on_rbSelfie_toggled(bool checked)
|
}
|
||||||
{
|
else
|
||||||
if (checked)
|
{
|
||||||
{
|
isSelfie = false;
|
||||||
mugshot_toggled(false);
|
}
|
||||||
editor_toggled(false);
|
}
|
||||||
selfie_toggled(true);
|
|
||||||
}
|
|
||||||
}
|
void SnapmaticEditor::mugshot_toggled(bool checked)
|
||||||
|
{
|
||||||
void SnapmaticEditor::on_rbMugshot_toggled(bool checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
isMugshot = true;
|
||||||
{
|
ui->cbDirector->setEnabled(false);
|
||||||
selfie_toggled(false);
|
ui->cbDirector->setChecked(false);
|
||||||
editor_toggled(false);
|
}
|
||||||
mugshot_toggled(true);
|
else
|
||||||
}
|
{
|
||||||
}
|
isMugshot = false;
|
||||||
|
ui->cbDirector->setEnabled(true);
|
||||||
void SnapmaticEditor::on_rbEditor_toggled(bool checked)
|
}
|
||||||
{
|
}
|
||||||
if (checked)
|
|
||||||
{
|
void SnapmaticEditor::editor_toggled(bool checked)
|
||||||
selfie_toggled(false);
|
{
|
||||||
mugshot_toggled(false);
|
if (checked)
|
||||||
editor_toggled(true);
|
{
|
||||||
}
|
isEditor = true;
|
||||||
}
|
ui->cbDirector->setEnabled(false);
|
||||||
|
ui->cbDirector->setChecked(false);
|
||||||
void SnapmaticEditor::on_rbCustom_toggled(bool checked)
|
}
|
||||||
{
|
else
|
||||||
if (checked)
|
{
|
||||||
{
|
isEditor = false;
|
||||||
selfie_toggled(false);
|
ui->cbDirector->setEnabled(true);
|
||||||
mugshot_toggled(false);
|
}
|
||||||
editor_toggled(false);
|
}
|
||||||
}
|
|
||||||
}
|
void SnapmaticEditor::on_rbSelfie_toggled(bool checked)
|
||||||
|
{
|
||||||
void SnapmaticEditor::setSnapmaticPicture(SnapmaticPicture *picture)
|
if (checked)
|
||||||
{
|
{
|
||||||
smpic = picture;
|
mugshot_toggled(false);
|
||||||
localSpJson = smpic->getSnapmaticProperties();
|
editor_toggled(false);
|
||||||
ui->rbCustom->setChecked(true);
|
selfie_toggled(true);
|
||||||
crewID = localSpJson.crewID;
|
}
|
||||||
isSelfie = localSpJson.isSelfie;
|
}
|
||||||
isMugshot = localSpJson.isMug;
|
|
||||||
isEditor = localSpJson.isFromRSEditor;
|
void SnapmaticEditor::on_rbMugshot_toggled(bool checked)
|
||||||
ui->cbDirector->setChecked(localSpJson.isFromDirector);
|
{
|
||||||
ui->cbMeme->setChecked(localSpJson.isMeme);
|
if (checked)
|
||||||
if (isSelfie)
|
{
|
||||||
{
|
selfie_toggled(false);
|
||||||
ui->rbSelfie->setChecked(true);
|
editor_toggled(false);
|
||||||
}
|
mugshot_toggled(true);
|
||||||
else if (isMugshot)
|
}
|
||||||
{
|
}
|
||||||
ui->rbMugshot->setChecked(true);
|
|
||||||
}
|
void SnapmaticEditor::on_rbEditor_toggled(bool checked)
|
||||||
else if (isEditor)
|
{
|
||||||
{
|
if (checked)
|
||||||
ui->rbEditor->setChecked(true);
|
{
|
||||||
}
|
selfie_toggled(false);
|
||||||
else
|
mugshot_toggled(false);
|
||||||
{
|
editor_toggled(true);
|
||||||
ui->rbCustom->setChecked(true);
|
}
|
||||||
}
|
}
|
||||||
setSnapmaticCrew(returnCrewName(crewID));
|
|
||||||
setSnapmaticTitle(picture->getPictureTitle());
|
void SnapmaticEditor::on_rbCustom_toggled(bool checked)
|
||||||
}
|
{
|
||||||
|
if (checked)
|
||||||
void SnapmaticEditor::setSnapmaticTitle(const QString &title)
|
{
|
||||||
{
|
selfie_toggled(false);
|
||||||
if (title.length() > 39)
|
mugshot_toggled(false);
|
||||||
{
|
editor_toggled(false);
|
||||||
snapmaticTitle = title.left(39);
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
void SnapmaticEditor::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
snapmaticTitle = title;
|
{
|
||||||
}
|
smpic = picture;
|
||||||
QString editStr = QString("<a href=\"g5e://edittitle\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
|
snapmaticProperties = smpic->getSnapmaticProperties();
|
||||||
QString titleStr = tr("Title: %1 (%2)").arg(StringParser::escapeString(snapmaticTitle), editStr);
|
ui->rbCustom->setChecked(true);
|
||||||
ui->labTitle->setText(titleStr);
|
crewID = snapmaticProperties.crewID;
|
||||||
if (SnapmaticPicture::verifyTitle(snapmaticTitle))
|
isSelfie = snapmaticProperties.isSelfie;
|
||||||
{
|
isMugshot = snapmaticProperties.isMug;
|
||||||
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: green\">%1</a>").arg(tr("Yes", "Yes, should work fine"))));
|
isEditor = snapmaticProperties.isFromRSEditor;
|
||||||
}
|
playersList = snapmaticProperties.playersList;
|
||||||
else
|
ui->cbDirector->setChecked(snapmaticProperties.isFromDirector);
|
||||||
{
|
ui->cbMeme->setChecked(snapmaticProperties.isMeme);
|
||||||
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</a>").arg(tr("No", "No, could lead to issues"))));
|
if (isSelfie)
|
||||||
}
|
{
|
||||||
}
|
ui->rbSelfie->setChecked(true);
|
||||||
|
}
|
||||||
void SnapmaticEditor::setSnapmaticCrew(const QString &crew)
|
else if (isMugshot)
|
||||||
{
|
{
|
||||||
QString editStr = QString("<a href=\"g5e://editcrew\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
|
ui->rbMugshot->setChecked(true);
|
||||||
QString crewStr = tr("Crew: %1 (%2)").arg(StringParser::escapeString(crew), editStr);
|
}
|
||||||
ui->labCrew->setText(crewStr);
|
else if (isEditor)
|
||||||
}
|
{
|
||||||
|
ui->rbEditor->setChecked(true);
|
||||||
QString SnapmaticEditor::returnCrewName(int crewID_)
|
}
|
||||||
{
|
else
|
||||||
return crewDB->getCrewName(crewID_);
|
{
|
||||||
}
|
ui->rbCustom->setChecked(true);
|
||||||
|
}
|
||||||
void SnapmaticEditor::on_cmdCancel_clicked()
|
setSnapmaticCrew(returnCrewName(crewID));
|
||||||
{
|
setSnapmaticTitle(picture->getPictureTitle());
|
||||||
close();
|
setSnapmaticPlayers(insertPlayerNames(playersList));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticEditor::on_cmdApply_clicked()
|
void SnapmaticEditor::insertPlayerNames(QStringList *players)
|
||||||
{
|
{
|
||||||
if (ui->cbQualify->isChecked())
|
for (int i = 0; i < players->size(); ++i)
|
||||||
{
|
{
|
||||||
qualifyAvatar();
|
players->replace(i, profileDB->getPlayerName(players->at(i)));
|
||||||
}
|
}
|
||||||
localSpJson.crewID = crewID;
|
}
|
||||||
localSpJson.isSelfie = isSelfie;
|
|
||||||
localSpJson.isMug = isMugshot;
|
QStringList SnapmaticEditor::insertPlayerNames(const QStringList &players)
|
||||||
localSpJson.isFromRSEditor = isEditor;
|
{
|
||||||
localSpJson.isFromDirector = ui->cbDirector->isChecked();
|
QStringList playersWI = players;
|
||||||
localSpJson.isMeme = ui->cbMeme->isChecked();
|
insertPlayerNames(&playersWI);
|
||||||
if (smpic)
|
return playersWI;
|
||||||
{
|
}
|
||||||
QString originalFileName = smpic->getPictureFilePath();
|
|
||||||
QString adjustedFileName = originalFileName;
|
void SnapmaticEditor::setSnapmaticPlayers(const QStringList &players)
|
||||||
if (adjustedFileName.right(7) == ".hidden") // for the hidden file system
|
{
|
||||||
{
|
QString editStr = QString("<a href=\"g5e://editplayers\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
|
||||||
adjustedFileName.remove(adjustedFileName.length() - 7, 7);
|
QString playersStr;
|
||||||
}
|
if (players.length() != 1)
|
||||||
QString backupFileName = adjustedFileName % ".bak";
|
{
|
||||||
if (!QFile::exists(backupFileName))
|
playersStr = tr("Players: %1 (%2)", "Multiple Player are inserted here");
|
||||||
{
|
}
|
||||||
QFile::copy(adjustedFileName, backupFileName);
|
else
|
||||||
}
|
{
|
||||||
SnapmaticProperties fallbackProperties = smpic->getSnapmaticProperties();
|
playersStr = tr("Player: %1 (%2)", "One Player is inserted here");
|
||||||
QString fallbackTitle = smpic->getPictureTitle();
|
}
|
||||||
smpic->setSnapmaticProperties(localSpJson);
|
if (players.length() != 0)
|
||||||
smpic->setPictureTitle(snapmaticTitle);
|
{
|
||||||
if (!smpic->exportPicture(originalFileName))
|
ui->labPlayers->setText(playersStr.arg(players.join(", "), editStr));
|
||||||
{
|
}
|
||||||
QMessageBox::warning(this, tr("Snapmatic Properties"), tr("Patching of Snapmatic Properties failed because of I/O Error"));
|
else
|
||||||
smpic->setSnapmaticProperties(fallbackProperties);
|
{
|
||||||
smpic->setPictureTitle(fallbackTitle);
|
ui->labPlayers->setText(playersStr.arg(QApplication::translate("PictureDialog", "No Players"), editStr));
|
||||||
}
|
}
|
||||||
else
|
#ifndef Q_OS_ANDROID
|
||||||
{
|
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
|
||||||
smpic->emitUpdate();
|
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
|
||||||
}
|
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
|
||||||
}
|
#endif
|
||||||
close();
|
}
|
||||||
}
|
|
||||||
|
void SnapmaticEditor::setSnapmaticTitle(const QString &title)
|
||||||
void SnapmaticEditor::qualifyAvatar()
|
{
|
||||||
{
|
if (title.length() > 39)
|
||||||
ui->rbSelfie->setChecked(true);
|
{
|
||||||
ui->cbDirector->setChecked(false);
|
snapmaticTitle = title.left(39);
|
||||||
ui->cbMeme->setChecked(false);
|
}
|
||||||
ui->cmdApply->setDefault(true);
|
else
|
||||||
}
|
{
|
||||||
|
snapmaticTitle = title;
|
||||||
void SnapmaticEditor::on_cbQualify_toggled(bool checked)
|
}
|
||||||
{
|
QString editStr = QString("<a href=\"g5e://edittitle\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
|
||||||
if (checked)
|
QString titleStr = tr("Title: %1 (%2)").arg(StringParser::escapeString(snapmaticTitle), editStr);
|
||||||
{
|
ui->labTitle->setText(titleStr);
|
||||||
ui->cbMeme->setEnabled(false);
|
if (SnapmaticPicture::verifyTitle(snapmaticTitle))
|
||||||
ui->cbDirector->setEnabled(false);
|
{
|
||||||
ui->rbCustom->setEnabled(false);
|
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes", "Yes, should work fine"))));
|
||||||
ui->rbSelfie->setEnabled(false);
|
}
|
||||||
ui->rbEditor->setEnabled(false);
|
else
|
||||||
ui->rbMugshot->setEnabled(false);
|
{
|
||||||
}
|
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No", "No, could lead to issues"))));
|
||||||
else
|
}
|
||||||
{
|
#ifndef Q_OS_ANDROID
|
||||||
ui->cbMeme->setEnabled(true);
|
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
|
||||||
ui->rbCustom->setEnabled(true);
|
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
|
||||||
ui->rbSelfie->setEnabled(true);
|
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
|
||||||
ui->rbEditor->setEnabled(true);
|
#endif
|
||||||
ui->rbMugshot->setEnabled(true);
|
}
|
||||||
if (ui->rbSelfie->isChecked() || ui->rbCustom->isChecked())
|
|
||||||
{
|
void SnapmaticEditor::setSnapmaticCrew(const QString &crew)
|
||||||
ui->cbDirector->setEnabled(true);
|
{
|
||||||
}
|
QString editStr = QString("<a href=\"g5e://editcrew\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
|
||||||
}
|
QString crewStr = tr("Crew: %1 (%2)").arg(StringParser::escapeString(crew), editStr);
|
||||||
}
|
ui->labCrew->setText(crewStr);
|
||||||
|
#ifndef Q_OS_ANDROID
|
||||||
void SnapmaticEditor::on_labTitle_linkActivated(const QString &link)
|
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
|
||||||
{
|
ui->frameWidget->resize(ui->gbValues->width(), ui->frameWidget->heightForWidth(ui->frameWidget->width()));
|
||||||
if (link == "g5e://edittitle")
|
if (heightForWidth(width()) > height()) { resize(width(), heightForWidth(width())); }
|
||||||
{
|
#endif
|
||||||
bool ok;
|
}
|
||||||
QString newTitle = QInputDialog::getText(this, tr("Snapmatic Title"), tr("New Snapmatic title:"), QLineEdit::Normal, snapmaticTitle, &ok, windowFlags());
|
|
||||||
if (ok && !newTitle.isEmpty())
|
QString SnapmaticEditor::returnCrewName(int crewID_)
|
||||||
{
|
{
|
||||||
setSnapmaticTitle(newTitle);
|
return crewDB->getCrewName(crewID_);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
void SnapmaticEditor::on_cmdCancel_clicked()
|
||||||
|
{
|
||||||
void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
|
close();
|
||||||
{
|
}
|
||||||
if (link == "g5e://editcrew")
|
|
||||||
{
|
void SnapmaticEditor::on_cmdApply_clicked()
|
||||||
bool ok;
|
{
|
||||||
int indexNum = 0;
|
if (ui->cbQualify->isChecked())
|
||||||
QStringList itemList;
|
{
|
||||||
QStringList crewList = crewDB->getCrews();
|
qualifyAvatar();
|
||||||
if (!crewList.contains(QLatin1String("0")))
|
}
|
||||||
{
|
snapmaticProperties.crewID = crewID;
|
||||||
crewList.append(QLatin1String("0"));
|
snapmaticProperties.isSelfie = isSelfie;
|
||||||
}
|
snapmaticProperties.isMug = isMugshot;
|
||||||
crewList.sort();
|
snapmaticProperties.isFromRSEditor = isEditor;
|
||||||
foreach(const QString &crew, crewList)
|
snapmaticProperties.isFromDirector = ui->cbDirector->isChecked();
|
||||||
{
|
snapmaticProperties.isMeme = ui->cbMeme->isChecked();
|
||||||
itemList.append(QString("%1 (%2)").arg(crew, returnCrewName(crew.toInt())));
|
snapmaticProperties.playersList = playersList;
|
||||||
}
|
if (smpic)
|
||||||
if (crewList.contains(QString::number(crewID)))
|
{
|
||||||
{
|
QString currentFilePath = smpic->getPictureFilePath();
|
||||||
indexNum = crewList.indexOf(QRegExp(QString::number(crewID)));
|
QString originalFilePath = smpic->getOriginalPictureFilePath();
|
||||||
}
|
QString backupFileName = originalFilePath % ".bak";
|
||||||
QString newCrew = QInputDialog::getItem(this, tr("Snapmatic Crew"), tr("New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags());
|
if (!QFile::exists(backupFileName))
|
||||||
if (ok && !newCrew.isEmpty())
|
{
|
||||||
{
|
QFile::copy(currentFilePath, backupFileName);
|
||||||
if (newCrew.contains(" ")) newCrew = newCrew.split(" ").at(0);
|
}
|
||||||
if (newCrew.length() > 10) return;
|
SnapmaticProperties fallbackProperties = smpic->getSnapmaticProperties();
|
||||||
foreach (const QChar &crewChar, newCrew)
|
QString fallbackTitle = smpic->getPictureTitle();
|
||||||
{
|
smpic->setSnapmaticProperties(snapmaticProperties);
|
||||||
if (!crewChar.isNumber())
|
smpic->setPictureTitle(snapmaticTitle);
|
||||||
{
|
if (!smpic->exportPicture(currentFilePath))
|
||||||
return;
|
{
|
||||||
}
|
QMessageBox::warning(this, tr("Snapmatic Properties"), tr("Patching of Snapmatic Properties failed because of I/O Error"));
|
||||||
}
|
smpic->setSnapmaticProperties(fallbackProperties);
|
||||||
crewID = newCrew.toInt();
|
smpic->setPictureTitle(fallbackTitle);
|
||||||
setSnapmaticCrew(returnCrewName(crewID));
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
smpic->updateStrings();
|
||||||
|
smpic->emitUpdate();
|
||||||
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
|
telemetrySettings.endGroup();
|
||||||
|
if (pushUsageData && Telemetry->canPush())
|
||||||
|
{
|
||||||
|
QJsonDocument jsonDocument;
|
||||||
|
QJsonObject jsonObject;
|
||||||
|
jsonObject["Type"] = "PropertyEdited";
|
||||||
|
jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
|
||||||
|
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
|
||||||
|
jsonDocument.setObject(jsonObject);
|
||||||
|
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticEditor::qualifyAvatar()
|
||||||
|
{
|
||||||
|
ui->rbSelfie->setChecked(true);
|
||||||
|
ui->cbDirector->setChecked(false);
|
||||||
|
ui->cbMeme->setChecked(false);
|
||||||
|
ui->cmdApply->setDefault(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticEditor::on_cbQualify_toggled(bool checked)
|
||||||
|
{
|
||||||
|
if (checked)
|
||||||
|
{
|
||||||
|
ui->cbMeme->setEnabled(false);
|
||||||
|
ui->cbDirector->setEnabled(false);
|
||||||
|
ui->rbCustom->setEnabled(false);
|
||||||
|
ui->rbSelfie->setEnabled(false);
|
||||||
|
ui->rbEditor->setEnabled(false);
|
||||||
|
ui->rbMugshot->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->cbMeme->setEnabled(true);
|
||||||
|
ui->rbCustom->setEnabled(true);
|
||||||
|
ui->rbSelfie->setEnabled(true);
|
||||||
|
ui->rbEditor->setEnabled(true);
|
||||||
|
ui->rbMugshot->setEnabled(true);
|
||||||
|
if (ui->rbSelfie->isChecked() || ui->rbCustom->isChecked())
|
||||||
|
{
|
||||||
|
ui->cbDirector->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticEditor::on_labPlayers_linkActivated(const QString &link)
|
||||||
|
{
|
||||||
|
if (link == "g5e://editplayers")
|
||||||
|
{
|
||||||
|
PlayerListDialog *playerListDialog = new PlayerListDialog(playersList, profileDB, this);
|
||||||
|
connect(playerListDialog, SIGNAL(playerListUpdated(QStringList)), this, SLOT(playerListUpdated(QStringList)));
|
||||||
|
playerListDialog->setModal(true);
|
||||||
|
playerListDialog->show();
|
||||||
|
playerListDialog->exec();
|
||||||
|
delete playerListDialog;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticEditor::on_labTitle_linkActivated(const QString &link)
|
||||||
|
{
|
||||||
|
if (link == "g5e://edittitle")
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QString newTitle = QInputDialog::getText(this, tr("Snapmatic Title"), tr("New Snapmatic title:"), QLineEdit::Normal, snapmaticTitle, &ok, windowFlags());
|
||||||
|
if (ok && !newTitle.isEmpty())
|
||||||
|
{
|
||||||
|
setSnapmaticTitle(newTitle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
|
||||||
|
{
|
||||||
|
if (link == "g5e://editcrew")
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
int indexNum = 0;
|
||||||
|
QStringList itemList;
|
||||||
|
QStringList crewList = crewDB->getCrews();
|
||||||
|
if (!crewList.contains(QLatin1String("0")))
|
||||||
|
{
|
||||||
|
crewList += QLatin1String("0");
|
||||||
|
}
|
||||||
|
crewList.sort();
|
||||||
|
for (QString crew : crewList)
|
||||||
|
{
|
||||||
|
itemList += QString("%1 (%2)").arg(crew, returnCrewName(crew.toInt()));
|
||||||
|
}
|
||||||
|
if (crewList.contains(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())
|
||||||
|
{
|
||||||
|
if (newCrew.contains(" ")) newCrew = newCrew.split(" ").at(0);
|
||||||
|
if (newCrew.length() > 10) return;
|
||||||
|
for (QChar crewChar : newCrew)
|
||||||
|
{
|
||||||
|
if (!crewChar.isNumber())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!crewList.contains(newCrew))
|
||||||
|
{
|
||||||
|
crewDB->addCrew(crewID);
|
||||||
|
}
|
||||||
|
crewID = newCrew.toInt();
|
||||||
|
setSnapmaticCrew(returnCrewName(crewID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticEditor::playerListUpdated(QStringList playerList)
|
||||||
|
{
|
||||||
|
playersList = playerList;
|
||||||
|
setSnapmaticPlayers(insertPlayerNames(playerList));
|
||||||
|
}
|
||||||
|
|
|
@ -1,69 +1,77 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SNAPMATICEDITOR_H
|
#ifndef SNAPMATICEDITOR_H
|
||||||
#define SNAPMATICEDITOR_H
|
#define SNAPMATICEDITOR_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include "SnapmaticPicture.h"
|
#include "ProfileDatabase.h"
|
||||||
|
#include "SnapmaticPicture.h"
|
||||||
namespace Ui {
|
|
||||||
class SnapmaticEditor;
|
namespace Ui {
|
||||||
}
|
class SnapmaticEditor;
|
||||||
|
}
|
||||||
class SnapmaticEditor : public QDialog
|
|
||||||
{
|
class SnapmaticEditor : public QDialog
|
||||||
Q_OBJECT
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
|
||||||
explicit SnapmaticEditor(CrewDatabase *crewDB, QWidget *parent = 0);
|
public:
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture);
|
explicit SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileDB, QWidget *parent = 0);
|
||||||
void setSnapmaticTitle(const QString &title);
|
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||||
void setSnapmaticCrew(const QString &crew = "");
|
void setSnapmaticPlayers(const QStringList &players);
|
||||||
QString returnCrewName(int crewID);
|
void setSnapmaticTitle(const QString &title);
|
||||||
~SnapmaticEditor();
|
void setSnapmaticCrew(const QString &crew = "");
|
||||||
|
QString returnCrewName(int crewID);
|
||||||
private slots:
|
~SnapmaticEditor();
|
||||||
void on_rbSelfie_toggled(bool checked);
|
|
||||||
void on_rbMugshot_toggled(bool checked);
|
private slots:
|
||||||
void on_rbEditor_toggled(bool checked);
|
void on_rbSelfie_toggled(bool checked);
|
||||||
void on_rbCustom_toggled(bool checked);
|
void on_rbMugshot_toggled(bool checked);
|
||||||
void on_cmdCancel_clicked();
|
void on_rbEditor_toggled(bool checked);
|
||||||
void on_cmdApply_clicked();
|
void on_rbCustom_toggled(bool checked);
|
||||||
void on_cbQualify_toggled(bool checked);
|
void on_cmdCancel_clicked();
|
||||||
void on_labTitle_linkActivated(const QString &link);
|
void on_cmdApply_clicked();
|
||||||
void on_labCrew_linkActivated(const QString &link);
|
void on_cbQualify_toggled(bool checked);
|
||||||
|
void on_labPlayers_linkActivated(const QString &link);
|
||||||
private:
|
void on_labTitle_linkActivated(const QString &link);
|
||||||
CrewDatabase *crewDB;
|
void on_labCrew_linkActivated(const QString &link);
|
||||||
Ui::SnapmaticEditor *ui;
|
void playerListUpdated(QStringList playerList);
|
||||||
SnapmaticProperties localSpJson;
|
|
||||||
SnapmaticPicture *smpic;
|
private:
|
||||||
QString snapmaticTitle;
|
CrewDatabase *crewDB;
|
||||||
int crewID;
|
ProfileDatabase *profileDB;
|
||||||
bool isSelfie;
|
Ui::SnapmaticEditor *ui;
|
||||||
bool isMugshot;
|
SnapmaticProperties snapmaticProperties;
|
||||||
bool isEditor;
|
SnapmaticPicture *smpic;
|
||||||
void selfie_toggled(bool checked);
|
QStringList playersList;
|
||||||
void mugshot_toggled(bool checked);
|
QString snapmaticTitle;
|
||||||
void editor_toggled(bool checked);
|
int crewID;
|
||||||
void qualifyAvatar();
|
bool isSelfie;
|
||||||
};
|
bool isMugshot;
|
||||||
|
bool isEditor;
|
||||||
#endif // SNAPMATICEDITOR_H
|
void selfie_toggled(bool checked);
|
||||||
|
void mugshot_toggled(bool checked);
|
||||||
|
void editor_toggled(bool checked);
|
||||||
|
void qualifyAvatar();
|
||||||
|
void insertPlayerNames(QStringList *players);
|
||||||
|
QStringList insertPlayerNames(const QStringList &players);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SNAPMATICEDITOR_H
|
||||||
|
|
|
@ -1,248 +1,276 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>SnapmaticEditor</class>
|
<class>SnapmaticEditor</class>
|
||||||
<widget class="QDialog" name="SnapmaticEditor">
|
<widget class="QDialog" name="SnapmaticEditor">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>362</height>
|
<height>381</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Snapmatic Properties</string>
|
<string>Snapmatic Properties</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlEditor">
|
<layout class="QVBoxLayout" name="vlEditor">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="frameWidget" native="true">
|
<widget class="QWidget" name="frameWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlFrame">
|
<layout class="QVBoxLayout" name="vlFrame">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gbMode">
|
<widget class="QGroupBox" name="gbMode">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Snapmatic Type</string>
|
<string>Snapmatic Type</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gdType">
|
<layout class="QGridLayout" name="gdType">
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QRadioButton" name="rbEditor">
|
<widget class="QRadioButton" name="rbEditor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Editor</string>
|
<string>Editor</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QRadioButton" name="rbSelfie">
|
<widget class="QRadioButton" name="rbSelfie">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Selfie</string>
|
<string>Selfie</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QRadioButton" name="rbCustom">
|
<widget class="QRadioButton" name="rbCustom">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Regular</string>
|
<string>Regular</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QRadioButton" name="rbMugshot">
|
<widget class="QRadioButton" name="rbMugshot">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mugshot</string>
|
<string>Mugshot</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gbProperties">
|
<widget class="QGroupBox" name="gbProperties">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Snapmatic Properties</string>
|
<string>Snapmatic Properties</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gdProperties">
|
<layout class="QGridLayout" name="gdProperties">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QCheckBox" name="cbMeme">
|
<widget class="QCheckBox" name="cbMeme">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Meme</string>
|
<string>Meme</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QCheckBox" name="cbDirector">
|
<widget class="QCheckBox" name="cbDirector">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Director</string>
|
<string>Director</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gbValues">
|
<widget class="QGroupBox" name="gbValues">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Snapmatic Values</string>
|
<string>Snapmatic Values</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vlTitle">
|
<layout class="QVBoxLayout" name="vlTitle">
|
||||||
<item>
|
<item>
|
||||||
<widget class="UiModLabel" name="labCrew">
|
<widget class="UiModLabel" name="labPlayers">
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::NoContextMenu</enum>
|
<enum>Qt::NoContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Crew: %1 (%2)</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="textInteractionFlags">
|
||||||
</item>
|
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||||
<item>
|
</property>
|
||||||
<widget class="UiModLabel" name="labTitle">
|
</widget>
|
||||||
<property name="contextMenuPolicy">
|
</item>
|
||||||
<enum>Qt::NoContextMenu</enum>
|
<item>
|
||||||
</property>
|
<widget class="UiModLabel" name="labCrew">
|
||||||
<property name="text">
|
<property name="contextMenuPolicy">
|
||||||
<string>Title: %1 (%2)</string>
|
<enum>Qt::NoContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="text">
|
||||||
<bool>true</bool>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="wordWrap">
|
||||||
</item>
|
<bool>true</bool>
|
||||||
<item>
|
</property>
|
||||||
<widget class="UiModLabel" name="labAppropriate">
|
<property name="textInteractionFlags">
|
||||||
<property name="text">
|
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||||
<string>Appropriate: %1</string>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="wordWrap">
|
</item>
|
||||||
<bool>true</bool>
|
<item>
|
||||||
</property>
|
<widget class="UiModLabel" name="labTitle">
|
||||||
</widget>
|
<property name="contextMenuPolicy">
|
||||||
</item>
|
<enum>Qt::NoContextMenu</enum>
|
||||||
</layout>
|
</property>
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string/>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QGroupBox" name="gbExtras">
|
<property name="wordWrap">
|
||||||
<property name="title">
|
<bool>true</bool>
|
||||||
<string>Extras</string>
|
</property>
|
||||||
</property>
|
<property name="textInteractionFlags">
|
||||||
<layout class="QVBoxLayout" name="vlExtras">
|
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QCheckBox" name="cbQualify">
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>Qualify as Avatar automatically at apply</string>
|
<item>
|
||||||
</property>
|
<widget class="UiModLabel" name="labAppropriate">
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string/>
|
||||||
<item>
|
</property>
|
||||||
<widget class="UiModLabel" name="labQualify">
|
<property name="wordWrap">
|
||||||
<property name="sizePolicy">
|
<bool>true</bool>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
</property>
|
||||||
<horstretch>0</horstretch>
|
</widget>
|
||||||
<verstretch>0</verstretch>
|
</item>
|
||||||
</sizepolicy>
|
</layout>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>Qualify as Avatar allows you to use this Snapmatic as a Social Club profile picture</string>
|
<item>
|
||||||
</property>
|
<widget class="QGroupBox" name="gbExtras">
|
||||||
<property name="wordWrap">
|
<property name="title">
|
||||||
<bool>true</bool>
|
<string>Extras</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<layout class="QVBoxLayout" name="vlExtras">
|
||||||
</item>
|
<item>
|
||||||
</layout>
|
<widget class="QCheckBox" name="cbQualify">
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string>Qualify as Avatar automatically at apply</string>
|
||||||
</layout>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsEditor">
|
<widget class="UiModLabel" name="labQualify">
|
||||||
<property name="orientation">
|
<property name="sizePolicy">
|
||||||
<enum>Qt::Vertical</enum>
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
</property>
|
<horstretch>0</horstretch>
|
||||||
<property name="sizeHint" stdset="0">
|
<verstretch>0</verstretch>
|
||||||
<size>
|
</sizepolicy>
|
||||||
<width>0</width>
|
</property>
|
||||||
<height>0</height>
|
<property name="text">
|
||||||
</size>
|
<string>Qualify as Avatar allows you to use this Snapmatic as a Social Club profile picture</string>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="wordWrap">
|
||||||
</item>
|
<bool>true</bool>
|
||||||
<item>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hlButtons">
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<spacer name="hsButtons">
|
</layout>
|
||||||
<property name="orientation">
|
</widget>
|
||||||
<enum>Qt::Horizontal</enum>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
</item>
|
||||||
<width>0</width>
|
<item>
|
||||||
<height>0</height>
|
<spacer name="vsEditor">
|
||||||
</size>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Vertical</enum>
|
||||||
</spacer>
|
</property>
|
||||||
</item>
|
<property name="sizeHint" stdset="0">
|
||||||
<item>
|
<size>
|
||||||
<widget class="QPushButton" name="cmdApply">
|
<width>0</width>
|
||||||
<property name="sizePolicy">
|
<height>0</height>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
</size>
|
||||||
<horstretch>0</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
</spacer>
|
||||||
</sizepolicy>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="text">
|
<layout class="QHBoxLayout" name="hlButtons">
|
||||||
<string>&Apply</string>
|
<item>
|
||||||
</property>
|
<spacer name="hsButtons">
|
||||||
</widget>
|
<property name="orientation">
|
||||||
</item>
|
<enum>Qt::Horizontal</enum>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QPushButton" name="cmdCancel">
|
<property name="sizeHint" stdset="0">
|
||||||
<property name="sizePolicy">
|
<size>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<width>0</width>
|
||||||
<horstretch>0</horstretch>
|
<height>0</height>
|
||||||
<verstretch>0</verstretch>
|
</size>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
</spacer>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>&Cancel</string>
|
<item>
|
||||||
</property>
|
<widget class="QPushButton" name="cmdApply">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
</item>
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
</layout>
|
<horstretch>0</horstretch>
|
||||||
</item>
|
<verstretch>0</verstretch>
|
||||||
</layout>
|
</sizepolicy>
|
||||||
</widget>
|
</property>
|
||||||
<customwidgets>
|
<property name="toolTip">
|
||||||
<customwidget>
|
<string>Apply changes</string>
|
||||||
<class>UiModLabel</class>
|
</property>
|
||||||
<extends>QLabel</extends>
|
<property name="text">
|
||||||
<header>UiModLabel.h</header>
|
<string>&Apply</string>
|
||||||
</customwidget>
|
</property>
|
||||||
</customwidgets>
|
</widget>
|
||||||
<resources/>
|
</item>
|
||||||
<connections/>
|
<item>
|
||||||
</ui>
|
<widget class="QPushButton" name="cmdCancel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Discard changes</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>UiModLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>UiModLabel.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,150 +1,189 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync-spv Grand Theft Auto Snapmatic Picture Viewer
|
* gta5spv Grand Theft Auto Snapmatic Picture Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2018 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SNAPMATICPICTURE_H
|
#ifndef SNAPMATICPICTURE_H
|
||||||
#define SNAPMATICPICTURE_H
|
#define SNAPMATICPICTURE_H
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
struct SnapmaticProperties {
|
enum class SnapmaticFormat : int { Auto_Format = 0, PGTA_Format = 1, JPEG_Format = 2, G5E_Format = 3 };
|
||||||
struct SnapmaticLocation {
|
|
||||||
QString area;
|
struct SnapmaticProperties {
|
||||||
double x;
|
struct SnapmaticLocation {
|
||||||
double y;
|
QString area;
|
||||||
double z;
|
double x;
|
||||||
};
|
double y;
|
||||||
int uid;
|
double z;
|
||||||
int crewID;
|
};
|
||||||
QStringList playersList;
|
int uid;
|
||||||
uint createdTimestamp;
|
int crewID;
|
||||||
QDateTime createdDateTime;
|
int streetID;
|
||||||
bool isMeme;
|
QStringList playersList;
|
||||||
bool isMug;
|
uint createdTimestamp;
|
||||||
bool isSelfie;
|
QDateTime createdDateTime;
|
||||||
bool isFromDirector;
|
bool isMeme;
|
||||||
bool isFromRSEditor;
|
bool isMug;
|
||||||
SnapmaticLocation location;
|
bool isSelfie;
|
||||||
};
|
bool isFromDirector;
|
||||||
|
bool isFromRSEditor;
|
||||||
class SnapmaticPicture : public QObject
|
SnapmaticLocation location;
|
||||||
{
|
};
|
||||||
Q_OBJECT
|
|
||||||
public:
|
class SnapmaticPicture : public QObject
|
||||||
explicit SnapmaticPicture(const QString &fileName = "", QObject *parent = 0);
|
{
|
||||||
~SnapmaticPicture();
|
Q_OBJECT
|
||||||
void reset();
|
public:
|
||||||
bool preloadFile();
|
explicit SnapmaticPicture(const QString &fileName = "", QObject *parent = 0);
|
||||||
bool readingPictureFromFile(const QString &fileName, bool writeEnabled = true, bool cacheEnabled = false, bool fastLoad = true, bool lowRamMode = false);
|
~SnapmaticPicture();
|
||||||
bool readingPicture(bool writeEnabled = true, bool cacheEnabled = false, bool fastLoad = true, bool lowRamMode = false);
|
void reset();
|
||||||
bool isPicOk();
|
bool preloadFile();
|
||||||
void clearCache();
|
bool readingPictureFromFile(const QString &fileName, bool writeEnabled = true, bool cacheEnabled = false, bool fastLoad = true, bool lowRamMode = false);
|
||||||
QImage getImage();
|
bool readingPicture(bool writeEnabled = true, bool cacheEnabled = false, bool fastLoad = true, bool lowRamMode = false);
|
||||||
QString getLastStep();
|
bool isPicOk(); // Please use isPictureOk instead
|
||||||
QString getPictureStr();
|
void clearCache();
|
||||||
QString getPictureHead();
|
QImage getImage(bool fastLoad = false);
|
||||||
QString getPictureTitl();
|
QByteArray getPictureStream();
|
||||||
QString getPictureDesc();
|
QString getLastStep(bool readable = true);
|
||||||
QString getPictureSortStr();
|
QString getPictureStr();
|
||||||
QString getPictureFileName();
|
QString getPictureHead();
|
||||||
QString getPictureFilePath();
|
QString getPictureTitl();
|
||||||
QString getExportPictureFileName();
|
QString getPictureDesc();
|
||||||
int getContentMaxLength();
|
QString getPictureSortStr();
|
||||||
bool setImage(const QImage &picture);
|
QString getPictureFileName();
|
||||||
bool setPictureTitl(const QString &newTitle);
|
QString getPictureFilePath();
|
||||||
bool setPictureStream(const QByteArray &picByteArray);
|
QString getExportPictureFileName();
|
||||||
void updateStrings();
|
QString getOriginalPictureFileName();
|
||||||
void emitUpdate();
|
QString getOriginalPictureFilePath();
|
||||||
|
int getContentMaxLength();
|
||||||
// FILE MANAGEMENT
|
bool setImage(const QImage &picture);
|
||||||
bool exportPicture(const QString &fileName, const QString format = "PGTA");
|
bool setPictureTitl(const QString &newTitle); // Please use setPictureTitle instead
|
||||||
void setPicFileName(const QString &picFileName);
|
bool setPictureStream(const QByteArray &streamArray);
|
||||||
void setPicFilePath(const QString &picFilePath);
|
void updateStrings();
|
||||||
bool deletePicFile();
|
void emitUpdate();
|
||||||
|
void emitCustomSignal(const QString &signal);
|
||||||
// ALTERNATIVES
|
|
||||||
QString getPictureTitle() { return getPictureTitl(); }
|
// FILE MANAGEMENT
|
||||||
QString getPictureString() { return getPictureStr(); }
|
bool exportPicture(const QString &fileName, SnapmaticFormat format = SnapmaticFormat::Auto_Format);
|
||||||
QString getPictureDescription() { return getPictureDesc(); }
|
void setPicFileName(const QString &picFileName); // Please use setPictureFileName instead
|
||||||
bool setPictureTitle(const QString &newTitle) { return setPictureTitl(newTitle); }
|
void setPicFilePath(const QString &picFilePath); // Please use setPictureFilePath instead
|
||||||
|
bool deletePicFile(); // Please use deletePictureFile instead
|
||||||
// JSON
|
|
||||||
bool isJsonOk();
|
// JSON
|
||||||
QString getJsonStr();
|
bool isJsonOk();
|
||||||
SnapmaticProperties getSnapmaticProperties();
|
QString getJsonStr(); // Please use getPictureJson instead
|
||||||
bool setSnapmaticProperties(SnapmaticProperties newSpJson);
|
SnapmaticProperties getSnapmaticProperties();
|
||||||
|
bool setSnapmaticProperties(SnapmaticProperties properties);
|
||||||
// VISIBILITY
|
bool setJsonStr(const QString &jsonStr, bool updateProperties = false); // Please use setPictureJson instead
|
||||||
bool isHidden();
|
|
||||||
bool setPictureHidden();
|
// VISIBILITY
|
||||||
bool setPictureVisible();
|
bool isHidden(); // Please use isPictureHidden instead
|
||||||
|
bool isVisible(); // Please use isPictureVisible instead
|
||||||
// PREDEFINED PROPERTIES
|
bool setPictureHidden();
|
||||||
QSize getSnapmaticResolution();
|
bool setPictureVisible();
|
||||||
|
|
||||||
// VERIFY CONTENT
|
// ALTERNATIVES (MORE DEVELOPER FRIENDLY FUNCTION CALLS)
|
||||||
static bool verifyTitle(const QString &title);
|
QString getJsonString() { return getJsonStr(); } // Please use getPictureJson instead
|
||||||
|
QString getPictureJson() { return getJsonStr(); }
|
||||||
private:
|
QString getPictureTitle() { return getPictureTitl(); }
|
||||||
QString getSnapmaticHeaderString(const QByteArray &snapmaticHeader);
|
QString getPictureString() { return getPictureStr(); }
|
||||||
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
QString getPictureDescription() { return getPictureDesc(); }
|
||||||
QString getSnapmaticTIDEString(const QByteArray &tideBytes);
|
bool setJsonString(const QString &jsonString, bool updateProperties = false) { return setJsonStr(jsonString, updateProperties); } // Please use setPictureJson instead
|
||||||
QImage cachePicture;
|
bool setPictureJson(const QString &json, bool updateProperties = false) { return setJsonStr(json, updateProperties); }
|
||||||
QString picExportFileName;
|
bool setPictureTitle(const QString &title) { return setPictureTitl(title); }
|
||||||
QString picFileName;
|
void setPictureFileName(const QString &fileName) { return setPicFileName(fileName); }
|
||||||
QString picFilePath;
|
void setPictureFilePath(const QString &filePath) { return setPicFilePath(filePath); }
|
||||||
QString pictureHead;
|
bool deletePictureFile() { return deletePicFile(); }
|
||||||
QString pictureStr;
|
bool isPictureOk() { return isPicOk(); }
|
||||||
QString lastStep;
|
bool isPictureHidden() { return isHidden(); }
|
||||||
QString sortStr;
|
bool isPictureVisible() { return isVisible(); }
|
||||||
QString titlStr;
|
bool setHidden() { return setPictureHidden(); } // Please use setPictureHidden instead
|
||||||
QString descStr;
|
bool setVisible() { return setPictureVisible(); } // Please use setPictureVisible instead
|
||||||
bool picOk;
|
|
||||||
bool lowRamMode;
|
// PREDEFINED PROPERTIES
|
||||||
bool writeEnabled;
|
QSize getSnapmaticResolution();
|
||||||
bool cacheEnabled;
|
|
||||||
bool isLoadedInRAM;
|
// SNAPMATIC DEFAULTS
|
||||||
bool isCustomFormat;
|
bool isSnapmaticDefaultsEnforced();
|
||||||
int jpegRawContentSize;
|
void setSnapmaticDefaultsEnforced(bool enforced);
|
||||||
int jpegRawContentSizeE;
|
|
||||||
|
// SNAPMATIC FORMAT
|
||||||
// PICTURE STREAM
|
SnapmaticFormat getSnapmaticFormat();
|
||||||
QByteArray rawPicContent;
|
void setSnapmaticFormat(SnapmaticFormat format);
|
||||||
|
bool isFormatSwitched();
|
||||||
// JSON
|
|
||||||
void parseJsonContent();
|
// VERIFY CONTENT
|
||||||
bool jsonOk;
|
static bool verifyTitle(const QString &title);
|
||||||
QString jsonStr;
|
|
||||||
SnapmaticProperties localSpJson;
|
// STRING OPERATIONS
|
||||||
|
static QString parseTitleString(const QByteArray &commitBytes, int maxLength);
|
||||||
// VERIFY CONTENT
|
static QString convertDrawStringForLog(const QString &inputStr);
|
||||||
static bool verifyTitleChar(const QChar &titleChar);
|
static QString convertLogStringForDraw(const QString &inputStr);
|
||||||
|
|
||||||
signals:
|
private:
|
||||||
void preloaded();
|
QString getSnapmaticHeaderString(const QByteArray &snapmaticHeader);
|
||||||
void updated();
|
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
||||||
void loaded();
|
QString getSnapmaticTIDEString(const QByteArray &tideBytes);
|
||||||
|
QImage cachePicture;
|
||||||
public slots:
|
QString picExportFileName;
|
||||||
};
|
QString picFileName;
|
||||||
|
QString picFilePath;
|
||||||
#endif // SNAPMATICPICTURE_H
|
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);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void customSignal(QString signal);
|
||||||
|
void preloaded();
|
||||||
|
void updated();
|
||||||
|
void loaded();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SNAPMATICPICTURE_H
|
||||||
|
|
|
@ -1,345 +1,499 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2019 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "SnapmaticWidget.h"
|
#include "SnapmaticWidget.h"
|
||||||
#include "ui_SnapmaticWidget.h"
|
#include "ui_SnapmaticWidget.h"
|
||||||
#include "SnapmaticPicture.h"
|
#include "ImageEditorDialog.h"
|
||||||
#include "SnapmaticEditor.h"
|
#include "MapLocationDialog.h"
|
||||||
#include "DatabaseThread.h"
|
#include "JsonEditorDialog.h"
|
||||||
#include "PictureDialog.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "PictureExport.h"
|
#include "SnapmaticEditor.h"
|
||||||
#include "StringParser.h"
|
#include "DatabaseThread.h"
|
||||||
#include "AppEnv.h"
|
#include "PictureDialog.h"
|
||||||
#include "config.h"
|
#include "PictureExport.h"
|
||||||
#include <QMessageBox>
|
#include "StringParser.h"
|
||||||
#include <QPixmap>
|
#include "ImportDialog.h"
|
||||||
#include <QTimer>
|
#include "AppEnv.h"
|
||||||
#include <QDebug>
|
#include "config.h"
|
||||||
#include <QMenu>
|
#include <QStringBuilder>
|
||||||
#include <QFile>
|
#include <QMessageBox>
|
||||||
|
#include <QPixmap>
|
||||||
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
|
#include <QTimer>
|
||||||
ProfileWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
|
#include <QDebug>
|
||||||
ui(new Ui::SnapmaticWidget)
|
#include <QMenu>
|
||||||
{
|
#include <QFile>
|
||||||
ui->setupUi(this);
|
|
||||||
ui->cmdView->setVisible(false);
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
ui->cmdCopy->setVisible(false);
|
#include "TelemetryClass.h"
|
||||||
ui->cmdExport->setVisible(false);
|
#include <QJsonDocument>
|
||||||
ui->cmdDelete->setVisible(false);
|
#include <QJsonObject>
|
||||||
ui->cbSelected->setVisible(false);
|
#endif
|
||||||
|
|
||||||
QPalette palette;
|
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QString profileName, QWidget *parent) :
|
||||||
highlightBackColor = palette.highlight().color();
|
ProfileWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), profileName(profileName),
|
||||||
highlightTextColor = palette.highlightedText().color();
|
ui(new Ui::SnapmaticWidget)
|
||||||
palette.setCurrentColorGroup(QPalette::Disabled);
|
{
|
||||||
highlightHiddenColor = palette.text().color();
|
ui->setupUi(this);
|
||||||
|
ui->cmdView->setVisible(false);
|
||||||
picPath = "";
|
ui->cmdCopy->setVisible(false);
|
||||||
picStr = "";
|
ui->cmdExport->setVisible(false);
|
||||||
smpic = 0;
|
ui->cmdDelete->setVisible(false);
|
||||||
|
ui->cbSelected->setVisible(false);
|
||||||
installEventFilter(this);
|
|
||||||
}
|
QPalette palette;
|
||||||
|
palette.setCurrentColorGroup(QPalette::Disabled);
|
||||||
SnapmaticWidget::~SnapmaticWidget()
|
highlightHiddenColor = palette.text().color();
|
||||||
{
|
|
||||||
delete ui;
|
ui->SnapmaticFrame->setMouseTracking(true);
|
||||||
}
|
ui->labPicture->setMouseTracking(true);
|
||||||
|
ui->labPicStr->setMouseTracking(true);
|
||||||
bool SnapmaticWidget::eventFilter(QObject *obj, QEvent *ev)
|
ui->cbSelected->setMouseTracking(true);
|
||||||
{
|
smpic = nullptr;
|
||||||
if (obj == this)
|
}
|
||||||
{
|
|
||||||
if (ev->type() == QEvent::Enter)
|
SnapmaticWidget::~SnapmaticWidget()
|
||||||
{
|
{
|
||||||
setStyleSheet(QString("QFrame#SnapmaticFrame{background-color: rgb(%1, %2, %3)}QLabel#labPicStr{color: rgb(%4, %5, %6)}").arg(QString::number(highlightBackColor.red()), QString::number(highlightBackColor.green()), QString::number(highlightBackColor.blue()), QString::number(highlightTextColor.red()), QString::number(highlightTextColor.green()), QString::number(highlightTextColor.blue())));
|
delete ui;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
else if(ev->type() == QEvent::Leave)
|
void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
{
|
{
|
||||||
setStyleSheet("");
|
smpic = picture;
|
||||||
return true;
|
QObject::connect(picture, SIGNAL(updated()), this, SLOT(snapmaticUpdated()));
|
||||||
}
|
QObject::connect(picture, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
||||||
}
|
|
||||||
return false;
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
}
|
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
|
ui->labPicture->setFixedSize(48 * screenRatio, 27 * screenRatio);
|
||||||
void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
|
|
||||||
{
|
ui->labPicture->setScaledContents(true);
|
||||||
smpic = picture;
|
|
||||||
picPath = picture->getPictureFilePath();
|
QPixmap SnapmaticPixmap = QPixmap::fromImage(picture->getImage().scaled(ui->labPicture->width() * screenRatioPR, ui->labPicture->height() * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
||||||
picTitl = picture->getPictureTitl();
|
#if QT_VERSION >= 0x050600
|
||||||
picStr = picture->getPictureStr();
|
SnapmaticPixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
QObject::connect(picture, SIGNAL(updated()), this, SLOT(snapmaticUpdated()));
|
#endif
|
||||||
|
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
|
||||||
ui->labPicture->setFixedSize(48 * screenRatio, 27 * screenRatio);
|
ui->labPicture->setPixmap(SnapmaticPixmap);
|
||||||
|
|
||||||
QPixmap SnapmaticPixmap = QPixmap::fromImage(picture->getImage().scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
picture->clearCache();
|
||||||
ui->labPicStr->setText(picStr + "\n" + picTitl + "");
|
|
||||||
ui->labPicture->setPixmap(SnapmaticPixmap);
|
adjustTextColor();
|
||||||
|
}
|
||||||
picture->clearCache();
|
|
||||||
|
void SnapmaticWidget::snapmaticUpdated()
|
||||||
adjustTextColor();
|
{
|
||||||
}
|
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
|
||||||
|
}
|
||||||
void SnapmaticWidget::snapmaticUpdated()
|
|
||||||
{
|
void SnapmaticWidget::customSignal(QString signal)
|
||||||
// Current only strings get updated
|
{
|
||||||
picPath = smpic->getPictureFilePath();
|
if (signal == "PictureUpdated")
|
||||||
picTitl = smpic->getPictureTitl();
|
{
|
||||||
picStr = smpic->getPictureStr();
|
QPixmap SnapmaticPixmap = QPixmap::fromImage(smpic->getImage().scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
||||||
ui->labPicStr->setText(picStr + "\n" + picTitl + "");
|
ui->labPicture->setPixmap(SnapmaticPixmap);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void SnapmaticWidget::on_cmdView_clicked()
|
|
||||||
{
|
void SnapmaticWidget::retranslate()
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
{
|
||||||
settings.beginGroup("Interface");
|
smpic->updateStrings();
|
||||||
bool navigationBar = settings.value("NavigationBar", false).toBool();
|
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
|
||||||
settings.endGroup();
|
}
|
||||||
|
|
||||||
PictureDialog *picDialog = new PictureDialog(profileDB, crewDB, this);
|
void SnapmaticWidget::on_cmdView_clicked()
|
||||||
picDialog->setSnapmaticPicture(smpic, true);
|
{
|
||||||
picDialog->setModal(true);
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
settings.beginGroup("Interface");
|
||||||
// be ready for playerName updated
|
bool navigationBar = settings.value("NavigationBar", true).toBool();
|
||||||
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), picDialog, SLOT(playerNameUpdated()));
|
settings.endGroup();
|
||||||
QObject::connect(picDialog, SIGNAL(nextPictureRequested()), this, SLOT(dialogNextPictureRequested()));
|
|
||||||
QObject::connect(picDialog, SIGNAL(previousPictureRequested()), this, SLOT(dialogPreviousPictureRequested()));
|
PictureDialog *picDialog = new PictureDialog(profileDB, crewDB, profileName, this);
|
||||||
|
picDialog->setSnapmaticPicture(smpic, true);
|
||||||
// add previous next buttons
|
picDialog->setModal(true);
|
||||||
if (navigationBar) picDialog->addPreviousNextButtons();
|
|
||||||
|
// be ready for crewName and playerName updated
|
||||||
// show picture dialog
|
QObject::connect(threadDB, SIGNAL(crewNameUpdated()), picDialog, SLOT(crewNameUpdated()));
|
||||||
#ifdef Q_OS_ANDROID
|
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), picDialog, SLOT(playerNameUpdated()));
|
||||||
// Android ...
|
QObject::connect(picDialog, SIGNAL(nextPictureRequested()), this, SLOT(dialogNextPictureRequested()));
|
||||||
picDialog->showMaximized();
|
QObject::connect(picDialog, SIGNAL(previousPictureRequested()), this, SLOT(dialogPreviousPictureRequested()));
|
||||||
#else
|
|
||||||
picDialog->show();
|
// add previous next buttons
|
||||||
if (navigationBar) picDialog->stylizeDialog();
|
if (navigationBar) picDialog->addPreviousNextButtons();
|
||||||
//picDialog->adaptNewDialogSize();
|
|
||||||
picDialog->setMinimumSize(picDialog->size());
|
// show picture dialog
|
||||||
picDialog->setMaximumSize(picDialog->size());
|
#ifdef Q_OS_ANDROID
|
||||||
#endif
|
// Android ...
|
||||||
picDialog->exec();
|
picDialog->showMaximized();
|
||||||
delete picDialog;
|
#else
|
||||||
}
|
picDialog->show();
|
||||||
|
if (navigationBar) picDialog->styliseDialog();
|
||||||
void SnapmaticWidget::on_cmdCopy_clicked()
|
//picDialog->adaptNewDialogSize();
|
||||||
{
|
picDialog->setMinimumSize(picDialog->size());
|
||||||
PictureExport::exportAsSnapmatic(this, smpic);
|
picDialog->setMaximumSize(picDialog->size());
|
||||||
}
|
#endif
|
||||||
|
picDialog->exec();
|
||||||
void SnapmaticWidget::on_cmdExport_clicked()
|
delete picDialog;
|
||||||
{
|
}
|
||||||
PictureExport::exportAsPicture(this, smpic);
|
|
||||||
}
|
void SnapmaticWidget::on_cmdCopy_clicked()
|
||||||
|
{
|
||||||
void SnapmaticWidget::on_cmdDelete_clicked()
|
PictureExport::exportAsSnapmatic(this, smpic);
|
||||||
{
|
}
|
||||||
if (deletePicture()) emit pictureDeleted();
|
|
||||||
}
|
void SnapmaticWidget::on_cmdExport_clicked()
|
||||||
|
{
|
||||||
bool SnapmaticWidget::deletePicture()
|
PictureExport::exportAsPicture(this, smpic);
|
||||||
{
|
}
|
||||||
int uchoice = QMessageBox::question(this, tr("Delete picture"), tr("Are you sure to delete %1 from your Snapmatic pictures?").arg("\""+picStr+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
|
||||||
if (uchoice == QMessageBox::Yes)
|
void SnapmaticWidget::on_cmdDelete_clicked()
|
||||||
{
|
{
|
||||||
if (smpic->deletePicFile())
|
if (deletePicture()) emit pictureDeleted();
|
||||||
{
|
}
|
||||||
return true;
|
|
||||||
}
|
bool SnapmaticWidget::deletePicture()
|
||||||
else
|
{
|
||||||
{
|
int uchoice = QMessageBox::question(this, tr("Delete picture"), tr("Are you sure to delete %1 from your Snapmatic pictures?").arg("\""+smpic->getPictureTitle()+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
QMessageBox::warning(this, tr("Delete picture"), tr("Failed at deleting %1 from your Snapmatic pictures").arg("\""+picStr+"\""));
|
if (uchoice == QMessageBox::Yes)
|
||||||
}
|
{
|
||||||
}
|
if (smpic->deletePictureFile())
|
||||||
return false;
|
{
|
||||||
}
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
void SnapmaticWidget::mousePressEvent(QMouseEvent *ev)
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
{
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
ProfileWidget::mousePressEvent(ev);
|
telemetrySettings.endGroup();
|
||||||
}
|
if (pushUsageData && Telemetry->canPush())
|
||||||
|
{
|
||||||
void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
|
QJsonDocument jsonDocument;
|
||||||
{
|
QJsonObject jsonObject;
|
||||||
ProfileWidget::mouseReleaseEvent(ev);
|
jsonObject["Type"] = "DeleteSuccess";
|
||||||
if (ui->cbSelected->isVisible())
|
jsonObject["ExtraFlags"] = "Snapmatic";
|
||||||
{
|
jsonObject["DeletedSize"] = QString::number(smpic->getContentMaxLength());
|
||||||
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
|
||||||
{
|
jsonDocument.setObject(jsonObject);
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
else
|
return true;
|
||||||
{
|
}
|
||||||
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
else
|
||||||
{
|
{
|
||||||
on_cmdView_clicked();
|
QMessageBox::warning(this, tr("Delete picture"), tr("Failed at deleting %1 from your Snapmatic pictures").arg("\""+smpic->getPictureTitle()+"\""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
void SnapmaticWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
|
||||||
{
|
void SnapmaticWidget::mousePressEvent(QMouseEvent *ev)
|
||||||
ProfileWidget::mouseDoubleClickEvent(ev);
|
{
|
||||||
|
ProfileWidget::mousePressEvent(ev);
|
||||||
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
}
|
||||||
{
|
|
||||||
on_cmdView_clicked();
|
void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
}
|
{
|
||||||
}
|
ProfileWidget::mouseReleaseEvent(ev);
|
||||||
|
if (ui->cbSelected->isVisible())
|
||||||
void SnapmaticWidget::setSelected(bool isSelected)
|
{
|
||||||
{
|
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
ui->cbSelected->setChecked(isSelected);
|
{
|
||||||
}
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
|
}
|
||||||
void SnapmaticWidget::pictureSelected()
|
}
|
||||||
{
|
else
|
||||||
setSelected(!ui->cbSelected->isChecked());
|
{
|
||||||
}
|
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
void SnapmaticWidget::contextMenuEvent(QContextMenuEvent *ev)
|
if (ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
{
|
{
|
||||||
emit contextMenuTriggered(ev);
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
void SnapmaticWidget::dialogNextPictureRequested()
|
{
|
||||||
{
|
on_cmdView_clicked();
|
||||||
emit nextPictureRequested((QWidget*)sender());
|
}
|
||||||
}
|
}
|
||||||
|
else if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
void SnapmaticWidget::dialogPreviousPictureRequested()
|
{
|
||||||
{
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
emit previousPictureRequested((QWidget*)sender());
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void SnapmaticWidget::on_cbSelected_stateChanged(int arg1)
|
|
||||||
{
|
void SnapmaticWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
if (arg1 == Qt::Checked)
|
{
|
||||||
{
|
ProfileWidget::mouseDoubleClickEvent(ev);
|
||||||
emit widgetSelected();
|
|
||||||
}
|
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
|
||||||
else if (arg1 == Qt::Unchecked)
|
{
|
||||||
{
|
on_cmdView_clicked();
|
||||||
emit widgetDeselected();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void SnapmaticWidget::setSelected(bool isSelected)
|
||||||
void SnapmaticWidget::adjustTextColor()
|
{
|
||||||
{
|
ui->cbSelected->setChecked(isSelected);
|
||||||
if (isHidden())
|
}
|
||||||
{
|
|
||||||
ui->labPicStr->setStyleSheet(QString("QLabel{color: rgb(%1, %2, %3);}").arg(QString::number(highlightHiddenColor.red()), QString::number(highlightHiddenColor.green()), QString::number(highlightHiddenColor.blue())));
|
void SnapmaticWidget::pictureSelected()
|
||||||
}
|
{
|
||||||
else
|
setSelected(!ui->cbSelected->isChecked());
|
||||||
{
|
}
|
||||||
ui->labPicStr->setStyleSheet("");
|
|
||||||
}
|
void SnapmaticWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
}
|
{
|
||||||
|
emit contextMenuTriggered(ev);
|
||||||
bool SnapmaticWidget::makePictureHidden()
|
}
|
||||||
{
|
|
||||||
if (smpic->setPictureHidden())
|
void SnapmaticWidget::dialogNextPictureRequested()
|
||||||
{
|
{
|
||||||
picPath = smpic->getPictureFilePath();
|
emit nextPictureRequested((QWidget*)sender());
|
||||||
adjustTextColor();
|
}
|
||||||
return true;
|
|
||||||
}
|
void SnapmaticWidget::dialogPreviousPictureRequested()
|
||||||
return false;
|
{
|
||||||
}
|
emit previousPictureRequested((QWidget*)sender());
|
||||||
|
}
|
||||||
bool SnapmaticWidget::makePictureVisible()
|
|
||||||
{
|
void SnapmaticWidget::on_cbSelected_stateChanged(int arg1)
|
||||||
if (smpic->setPictureVisible())
|
{
|
||||||
{
|
if (arg1 == Qt::Checked)
|
||||||
picPath = smpic->getPictureFilePath();
|
{
|
||||||
adjustTextColor();
|
emit widgetSelected();
|
||||||
return true;
|
}
|
||||||
}
|
else if (arg1 == Qt::Unchecked)
|
||||||
return false;
|
{
|
||||||
}
|
emit widgetDeselected();
|
||||||
|
}
|
||||||
void SnapmaticWidget::makePictureHiddenSlot()
|
}
|
||||||
{
|
|
||||||
makePictureHidden();
|
void SnapmaticWidget::adjustTextColor()
|
||||||
}
|
{
|
||||||
|
if (isHidden())
|
||||||
void SnapmaticWidget::makePictureVisibleSlot()
|
{
|
||||||
{
|
ui->labPicStr->setStyleSheet(QString("QLabel{color: rgb(%1, %2, %3);}").arg(QString::number(highlightHiddenColor.red()), QString::number(highlightHiddenColor.green()), QString::number(highlightHiddenColor.blue())));
|
||||||
makePictureVisible();
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
void SnapmaticWidget::editSnapmaticProperties()
|
ui->labPicStr->setStyleSheet("");
|
||||||
{
|
}
|
||||||
SnapmaticEditor *snapmaticEditor = new SnapmaticEditor(crewDB, this);
|
}
|
||||||
snapmaticEditor->setWindowFlags(snapmaticEditor->windowFlags()^Qt::WindowContextHelpButtonHint);
|
|
||||||
snapmaticEditor->setSnapmaticPicture(smpic);
|
bool SnapmaticWidget::makePictureHidden()
|
||||||
snapmaticEditor->setModal(true);
|
{
|
||||||
snapmaticEditor->exec();
|
if (smpic->setPictureHidden())
|
||||||
delete snapmaticEditor;
|
{
|
||||||
}
|
adjustTextColor();
|
||||||
|
return true;
|
||||||
bool SnapmaticWidget::isSelected()
|
}
|
||||||
{
|
return false;
|
||||||
return ui->cbSelected->isChecked();
|
}
|
||||||
}
|
|
||||||
|
bool SnapmaticWidget::makePictureVisible()
|
||||||
bool SnapmaticWidget::isHidden()
|
{
|
||||||
{
|
if (smpic->setPictureVisible())
|
||||||
if (picPath.right(7) == ".hidden")
|
{
|
||||||
{
|
adjustTextColor();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::setSelectionMode(bool selectionMode)
|
void SnapmaticWidget::makePictureHiddenSlot()
|
||||||
{
|
{
|
||||||
ui->cbSelected->setVisible(selectionMode);
|
if (!makePictureHidden())
|
||||||
}
|
{
|
||||||
|
QMessageBox::warning(this, QApplication::translate("UserInterface", "Hide In-game"), QApplication::translate("SnapmaticWidget", "Failed to hide %1 In-game from your Snapmatic pictures").arg("\""+smpic->getPictureTitle()+"\""));
|
||||||
void SnapmaticWidget::selectAllWidgets()
|
}
|
||||||
{
|
}
|
||||||
emit allWidgetsSelected();
|
|
||||||
}
|
void SnapmaticWidget::makePictureVisibleSlot()
|
||||||
|
{
|
||||||
void SnapmaticWidget::deselectAllWidgets()
|
if (!makePictureVisible())
|
||||||
{
|
{
|
||||||
emit allWidgetsDeselected();
|
QMessageBox::warning(this, QApplication::translate("UserInterface", "Show In-game"), QApplication::translate("SnapmaticWidget", "Failed to show %1 In-game from your Snapmatic pictures").arg("\""+smpic->getPictureTitle()+"\""));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
SnapmaticPicture* SnapmaticWidget::getPicture()
|
|
||||||
{
|
void SnapmaticWidget::editSnapmaticProperties()
|
||||||
return smpic;
|
{
|
||||||
}
|
SnapmaticEditor *snapmaticEditor = new SnapmaticEditor(crewDB, profileDB, this);
|
||||||
|
snapmaticEditor->setSnapmaticPicture(smpic);
|
||||||
QString SnapmaticWidget::getPicturePath()
|
snapmaticEditor->setModal(true);
|
||||||
{
|
snapmaticEditor->show();
|
||||||
return picPath;
|
snapmaticEditor->exec();
|
||||||
}
|
delete snapmaticEditor;
|
||||||
|
}
|
||||||
QString SnapmaticWidget::getWidgetType()
|
|
||||||
{
|
void SnapmaticWidget::editSnapmaticRawJson()
|
||||||
return "SnapmaticWidget";
|
{
|
||||||
}
|
JsonEditorDialog *jsonEditor = new JsonEditorDialog(smpic, this);
|
||||||
|
jsonEditor->setModal(true);
|
||||||
|
jsonEditor->show();
|
||||||
|
jsonEditor->exec();
|
||||||
|
delete jsonEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticWidget::editSnapmaticImage()
|
||||||
|
{
|
||||||
|
QImage *currentImage = new QImage(smpic->getImage());
|
||||||
|
ImportDialog *importDialog = new ImportDialog(profileName, this);
|
||||||
|
importDialog->setImage(currentImage);
|
||||||
|
importDialog->enableOverwriteMode();
|
||||||
|
importDialog->setModal(true);
|
||||||
|
importDialog->exec();
|
||||||
|
if (importDialog->isImportAgreed())
|
||||||
|
{
|
||||||
|
const QByteArray previousPicture = smpic->getPictureStream();
|
||||||
|
bool success = smpic->setImage(importDialog->image());
|
||||||
|
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, QApplication::translate("ImageEditorDialog", "Snapmatic Image Editor"), QApplication::translate("ImageEditorDialog", "Patching of Snapmatic Image failed because of I/O Error"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
smpic->emitCustomSignal("PictureUpdated");
|
||||||
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
|
telemetrySettings.endGroup();
|
||||||
|
if (pushUsageData && Telemetry->canPush())
|
||||||
|
{
|
||||||
|
QJsonDocument jsonDocument;
|
||||||
|
QJsonObject jsonObject;
|
||||||
|
jsonObject["Type"] = "ImageEdited";
|
||||||
|
jsonObject["ExtraFlags"] = "Interface";
|
||||||
|
jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
|
||||||
|
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
|
||||||
|
jsonDocument.setObject(jsonObject);
|
||||||
|
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, QApplication::translate("ImageEditorDialog", "Snapmatic Image Editor"), QApplication::translate("ImageEditorDialog", "Patching of Snapmatic Image failed because of Image Error"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete importDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticWidget::openMapViewer()
|
||||||
|
{
|
||||||
|
SnapmaticPicture *picture = smpic;
|
||||||
|
MapLocationDialog *mapLocDialog = new MapLocationDialog(picture->getSnapmaticProperties().location.x, picture->getSnapmaticProperties().location.y, this);
|
||||||
|
mapLocDialog->setModal(true);
|
||||||
|
mapLocDialog->show();
|
||||||
|
mapLocDialog->exec();
|
||||||
|
if (mapLocDialog->propUpdated())
|
||||||
|
{
|
||||||
|
// Update Snapmatic Properties
|
||||||
|
SnapmaticProperties localSpJson = picture->getSnapmaticProperties();
|
||||||
|
localSpJson.location.x = mapLocDialog->getXpos();
|
||||||
|
localSpJson.location.y = mapLocDialog->getYpos();
|
||||||
|
localSpJson.location.z = 0;
|
||||||
|
|
||||||
|
// Update Snapmatic Picture
|
||||||
|
QString currentFilePath = picture->getPictureFilePath();
|
||||||
|
QString originalFilePath = picture->getOriginalPictureFilePath();
|
||||||
|
QString backupFileName = originalFilePath % ".bak";
|
||||||
|
if (!QFile::exists(backupFileName))
|
||||||
|
{
|
||||||
|
QFile::copy(currentFilePath, backupFileName);
|
||||||
|
}
|
||||||
|
SnapmaticProperties fallbackProperties = picture->getSnapmaticProperties();
|
||||||
|
picture->setSnapmaticProperties(localSpJson);
|
||||||
|
if (!picture->exportPicture(currentFilePath))
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of I/O Error"));
|
||||||
|
picture->setSnapmaticProperties(fallbackProperties);
|
||||||
|
}
|
||||||
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
|
telemetrySettings.endGroup();
|
||||||
|
if (pushUsageData && Telemetry->canPush())
|
||||||
|
{
|
||||||
|
QJsonDocument jsonDocument;
|
||||||
|
QJsonObject jsonObject;
|
||||||
|
jsonObject["Type"] = "LocationEdited";
|
||||||
|
jsonObject["ExtraFlags"] = "Interface";
|
||||||
|
jsonObject["EditedSize"] = QString::number(picture->getContentMaxLength());
|
||||||
|
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
|
||||||
|
jsonDocument.setObject(jsonObject);
|
||||||
|
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
delete mapLocDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SnapmaticWidget::isSelected()
|
||||||
|
{
|
||||||
|
return ui->cbSelected->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SnapmaticWidget::isHidden()
|
||||||
|
{
|
||||||
|
return smpic->isHidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticWidget::setSelectionMode(bool selectionMode)
|
||||||
|
{
|
||||||
|
ui->cbSelected->setVisible(selectionMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticWidget::selectAllWidgets()
|
||||||
|
{
|
||||||
|
emit allWidgetsSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnapmaticWidget::deselectAllWidgets()
|
||||||
|
{
|
||||||
|
emit allWidgetsDeselected();
|
||||||
|
}
|
||||||
|
|
||||||
|
SnapmaticPicture* SnapmaticWidget::getPicture()
|
||||||
|
{
|
||||||
|
return smpic;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SnapmaticWidget::getPicturePath()
|
||||||
|
{
|
||||||
|
return smpic->getPictureFilePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SnapmaticWidget::getWidgetType()
|
||||||
|
{
|
||||||
|
return "SnapmaticWidget";
|
||||||
|
}
|
||||||
|
|
|
@ -1,104 +1,103 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5sync GRAND THEFT AUTO V SYNC
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2017 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SNAPMATICWIDGET_H
|
#ifndef SNAPMATICWIDGET_H
|
||||||
#define SNAPMATICWIDGET_H
|
#define SNAPMATICWIDGET_H
|
||||||
|
|
||||||
#include "SnapmaticPicture.h"
|
#include "SnapmaticPicture.h"
|
||||||
#include "ProfileDatabase.h"
|
#include "ProfileDatabase.h"
|
||||||
#include "DatabaseThread.h"
|
#include "DatabaseThread.h"
|
||||||
#include "ProfileWidget.h"
|
#include "ProfileWidget.h"
|
||||||
#include "CrewDatabase.h"
|
#include "CrewDatabase.h"
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SnapmaticWidget;
|
class SnapmaticWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SnapmaticWidget : public ProfileWidget
|
class SnapmaticWidget : public ProfileWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QString profileName, QWidget *parent = 0);
|
||||||
void setSnapmaticPicture(SnapmaticPicture *picture);
|
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||||
void setSelectionMode(bool selectionMode);
|
void setSelectionMode(bool selectionMode);
|
||||||
void setSelected(bool isSelected);
|
void setSelected(bool isSelected);
|
||||||
bool deletePicture();
|
bool deletePicture();
|
||||||
bool makePictureVisible();
|
bool makePictureVisible();
|
||||||
bool makePictureHidden();
|
bool makePictureHidden();
|
||||||
SnapmaticPicture *getPicture();
|
SnapmaticPicture *getPicture();
|
||||||
QString getPicturePath();
|
QString getPicturePath();
|
||||||
QString getWidgetType();
|
QString getWidgetType();
|
||||||
bool isSelected();
|
bool isSelected();
|
||||||
bool isHidden();
|
bool isHidden();
|
||||||
~SnapmaticWidget();
|
void retranslate();
|
||||||
|
~SnapmaticWidget();
|
||||||
private slots:
|
|
||||||
void on_cmdView_clicked();
|
private slots:
|
||||||
void on_cmdCopy_clicked();
|
void on_cmdView_clicked();
|
||||||
void on_cmdExport_clicked();
|
void on_cmdCopy_clicked();
|
||||||
void on_cmdDelete_clicked();
|
void on_cmdExport_clicked();
|
||||||
void on_cbSelected_stateChanged(int arg1);
|
void on_cmdDelete_clicked();
|
||||||
void adjustTextColor();
|
void on_cbSelected_stateChanged(int arg1);
|
||||||
void pictureSelected();
|
void adjustTextColor();
|
||||||
void selectAllWidgets();
|
void pictureSelected();
|
||||||
void deselectAllWidgets();
|
void selectAllWidgets();
|
||||||
void dialogNextPictureRequested();
|
void deselectAllWidgets();
|
||||||
void dialogPreviousPictureRequested();
|
void dialogNextPictureRequested();
|
||||||
void makePictureVisibleSlot();
|
void dialogPreviousPictureRequested();
|
||||||
void makePictureHiddenSlot();
|
void makePictureVisibleSlot();
|
||||||
void editSnapmaticProperties();
|
void makePictureHiddenSlot();
|
||||||
void snapmaticUpdated();
|
void editSnapmaticProperties();
|
||||||
|
void editSnapmaticRawJson();
|
||||||
protected:
|
void editSnapmaticImage();
|
||||||
bool eventFilter(QObject *obj, QEvent *ev);
|
void openMapViewer();
|
||||||
void mouseDoubleClickEvent(QMouseEvent *ev);
|
void snapmaticUpdated();
|
||||||
void mouseReleaseEvent(QMouseEvent *ev);
|
void customSignal(QString signal);
|
||||||
void mousePressEvent(QMouseEvent *ev);
|
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
protected:
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent *ev);
|
||||||
private:
|
void mouseReleaseEvent(QMouseEvent *ev);
|
||||||
ProfileDatabase *profileDB;
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
CrewDatabase *crewDB;
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
DatabaseThread *threadDB;
|
|
||||||
Ui::SnapmaticWidget *ui;
|
private:
|
||||||
SnapmaticPicture *smpic;
|
ProfileDatabase *profileDB;
|
||||||
QColor highlightBackColor;
|
CrewDatabase *crewDB;
|
||||||
QColor highlightTextColor;
|
DatabaseThread *threadDB;
|
||||||
QColor highlightHiddenColor;
|
QString profileName;
|
||||||
QString picPath;
|
Ui::SnapmaticWidget *ui;
|
||||||
QString picTitl;
|
SnapmaticPicture *smpic;
|
||||||
QString picStr;
|
QColor highlightHiddenColor;
|
||||||
QWidget *snwgt;
|
|
||||||
|
signals:
|
||||||
signals:
|
void pictureDeleted();
|
||||||
void pictureDeleted();
|
void widgetSelected();
|
||||||
void widgetSelected();
|
void widgetDeselected();
|
||||||
void widgetDeselected();
|
void allWidgetsSelected();
|
||||||
void allWidgetsSelected();
|
void allWidgetsDeselected();
|
||||||
void allWidgetsDeselected();
|
void nextPictureRequested(QWidget *dialog);
|
||||||
void nextPictureRequested(QWidget *dialog);
|
void previousPictureRequested(QWidget *dialog);
|
||||||
void previousPictureRequested(QWidget *dialog);
|
void contextMenuTriggered(QContextMenuEvent *ev);
|
||||||
void contextMenuTriggered(QContextMenuEvent *ev);
|
};
|
||||||
};
|
|
||||||
|
#endif // SNAPMATICWIDGET_H
|
||||||
#endif // SNAPMATICWIDGET_H
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue