diff --git a/.ci/app.rc b/.ci/app.rc deleted file mode 100644 index f247bab..0000000 --- a/.ci/app.rc +++ /dev/null @@ -1,33 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "5sync.ico" -#define RT_MANIFEST 24 -#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest" -#include -VS_VERSION_INFO VERSIONINFO -FILEVERSION MAJOR_VER, MINOR_VER, PATCH_VER, INT_BUILD_VER -PRODUCTVERSION MAJOR_VER, MINOR_VER, PATCH_VER, INT_BUILD_VER -FILEFLAGSMASK 0x3fL -FILEFLAGS 0 -FILEOS VOS_NT_WINDOWS32 -FILETYPE VFT_APP -FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0809, 1200 - END - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Syping" - VALUE "FileDescription", "gta5view" - VALUE "FileVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER" - VALUE "InternalName", "gta5view" - VALUE "LegalCopyright", "Copyright © 2016-2022 Syping" - VALUE "OriginalFilename", "gta5view.exe" - VALUE "ProductName", "gta5view" - VALUE "ProductVersion", "MAJOR_VER.MINOR_VER.PATCH_VERSTR_BUILD_VER" - END - END -END diff --git a/.ci/ci.sh b/.ci/ci.sh deleted file mode 100755 index 8cc49f6..0000000 --- a/.ci/ci.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env 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} - -export APPLICATION_MAJOR_VERSION=$(cut -d. -f1 <<< $APPLICATION_VERSION) -export APPLICATION_MINOR_VERSION=$(cut -d. -f2 <<< $APPLICATION_VERSION) -export APPLICATION_PATCH_VERSION=$(cut -d. -f3 <<< $APPLICATION_VERSION) - -if [ "${PACKAGE_BUILD}" == "" ]; then - export PACKAGE_BUILD=1 -else - export APPLICATION_BUILD_INT_VERSION=$(grep -oE '[1-9]*$' <<< $PACKAGE_BUILD) - export APPLICATION_BUILD_STR_VERSION=-${PACKAGE_BUILD} -fi - -cat ".ci/app.rc" | sed \ - -e "s/MAJOR_VER/$APPLICATION_MAJOR_VERSION/g" \ - -e "s/MINOR_VER/$APPLICATION_MINOR_VERSION/g" \ - -e "s/PATCH_VER/$APPLICATION_PATCH_VERSION/g" \ - -e "s/INT_BUILD_VER/0/g" \ - -e "s/STR_BUILD_VER/$APPLICATION_BUILD_STR_VERSION/g" \ - -e "s/STR_BUILD_VER/$APPLICATION_BUILD_STR_VERSION/g" \ - > "res/app.rc" - -if [ "${BUILD_TYPE}" == "ALPHA" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Alpha" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Alpha\\\\\\\"" -elif [ "${BUILD_TYPE}" == "Alpha" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Alpha" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Alpha\\\\\\\"" -elif [ "${BUILD_TYPE}" == "BETA" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Beta" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Beta\\\\\\\"" -elif [ "${BUILD_TYPE}" == "Beta" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Beta" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Beta\\\\\\\"" -elif [ "${BUILD_TYPE}" == "DEV" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Developer" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Developer\\\\\\\"" -elif [ "${BUILD_TYPE}" == "Development" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Developer" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Developer\\\\\\\"" -elif [ "${BUILD_TYPE}" == "DAILY" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Daily Build" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Daily Build\\\\\\\"" -elif [ "${BUILD_TYPE}" == "Daily" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Daily Build" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Daily Build\\\\\\\"" -elif [ "${BUILD_TYPE}" == "RC" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Release Candidate" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Release Candidate\\\\\\\"" -elif [ "${BUILD_TYPE}" == "Release Candidate" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Release Candidate" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Release Candidate\\\\\\\"" -elif [ "${BUILD_TYPE}" == "REL" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Release" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Release\\\\\\\"" -elif [ "${BUILD_TYPE}" == "Release" ]; then - export CMAKE_BUILD_TYPE="-DGTA5VIEW_BUILDTYPE=Release" - export QMAKE_BUILD_TYPE="DEFINES+=GTA5SYNC_BUILDTYPE=\\\\\\\"Release\\\\\\\"" -fi - -export PROJECT_DIR=$(pwd) - -.ci/${BUILD_SCRIPT} diff --git a/.ci/debian_build.sh b/.ci/debian_build.sh deleted file mode 100755 index 57aa9c9..0000000 --- a/.ci/debian_build.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env 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/*.desktop res/*gta5view*.png && \ -cd build && \ -mkdir -p qt5 && \ -cd qt5 && \ -echo "Grand Theft Auto V Snapmatic and Savegame viewer/editor" > ./description-pak && \ -cd .. && \ - -# Set compiler -export CC=clang && \ -export CXX=clang++ && \ - -# Prepare checkinstall step -mkdir -p /usr/share/gta5view && \ - -# Starting build -cd qt5 && \ -cmake \ - "-DCMAKE_INSTALL_PREFIX=/usr" \ - "${CMAKE_BUILD_TYPE}" \ - "-DFORCE_QT_VERSION=5" \ - "-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \ - "-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \ - "-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \ - "-DWITH_DONATE=ON" \ - "-DWITH_TELEMETRY=ON" \ - "-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \ - "-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \ - "-DQCONF_BUILD=ON" \ - ../../ && \ -make -j 4 && \ -checkinstall -D --default --nodoc --install=no --pkgname=gta5view --pkgversion=${PACKAGE_VERSION} --pkgrelease=${PACKAGE_BUILD} --pkggroup=utility --maintainer="Syping \" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5svg5,libqt5widgets5,qttranslations5-l10n --conflicts=gta5view-qt4,gta5view-qt5 --replaces=gta5view-qt4,gta5view-qt5 --pakdir=${PROJECT_DIR}/assets diff --git a/.ci/debian_ci.sh b/.ci/debian_ci.sh deleted file mode 100755 index bc14a86..0000000 --- a/.ci/debian_ci.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# Install packages -.ci/debian_install.sh && \ - -# Build gta5view -.ci/debian_build.sh && \ -cd ${PROJECT_DIR} diff --git a/.ci/debian_docker.sh b/.ci/debian_docker.sh deleted file mode 100755 index 80f6c42..0000000 --- a/.ci/debian_docker.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env 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 CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/debian_install.sh && .ci/debian_build.sh" diff --git a/.ci/debian_install.sh b/.ci/debian_install.sh deleted file mode 100755 index 12356e9..0000000 --- a/.ci/debian_install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Source OS Release -source /etc/os-release - -# When Debian add backports -if [ "${ID}" == "debian" ]; then - echo "deb http://deb.debian.org/debian ${VERSION_CODENAME}-backports main" >> /etc/apt/sources.list -fi - -# Install packages -apt-get update -qq && \ -apt-get install -qq ${APT_INSTALL} checkinstall cmake dpkg-dev fakeroot g++ gcc qtbase5-dev qt5-qmake qttranslations5-l10n libqt5svg5-dev diff --git a/.ci/dropbox_uploader.sh b/.ci/dropbox_uploader.sh deleted file mode 100755 index ca8ee36..0000000 --- a/.ci/dropbox_uploader.sh +++ /dev/null @@ -1,1763 +0,0 @@ -#!/usr/bin/env bash -# -# Dropbox Uploader -# -# Copyright (C) 2010-2017 Andrea Fabrizi -# -# 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 2 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -#Default configuration file -CONFIG_FILE=~/.dropbox_uploader - -#Default chunk size in Mb for the upload process -#It is recommended to increase this value only if you have enough free space on your /tmp partition -#Lower values may increase the number of http requests -CHUNK_SIZE=50 - -#Curl location -#If not set, curl will be searched into the $PATH -#CURL_BIN="/usr/bin/curl" - -#Default values -TMP_DIR="/tmp" -DEBUG=0 -QUIET=0 -SHOW_PROGRESSBAR=0 -SKIP_EXISTING_FILES=0 -ERROR_STATUS=0 -EXCLUDE=() - -#Don't edit these... -API_LONGPOLL_FOLDER="https://notify.dropboxapi.com/2/files/list_folder/longpoll" -API_CHUNKED_UPLOAD_START_URL="https://content.dropboxapi.com/2/files/upload_session/start" -API_CHUNKED_UPLOAD_FINISH_URL="https://content.dropboxapi.com/2/files/upload_session/finish" -API_CHUNKED_UPLOAD_APPEND_URL="https://content.dropboxapi.com/2/files/upload_session/append_v2" -API_UPLOAD_URL="https://content.dropboxapi.com/2/files/upload" -API_DOWNLOAD_URL="https://content.dropboxapi.com/2/files/download" -API_DELETE_URL="https://api.dropboxapi.com/2/files/delete" -API_MOVE_URL="https://api.dropboxapi.com/2/files/move" -API_COPY_URL="https://api.dropboxapi.com/2/files/copy" -API_METADATA_URL="https://api.dropboxapi.com/2/files/get_metadata" -API_LIST_FOLDER_URL="https://api.dropboxapi.com/2/files/list_folder" -API_LIST_FOLDER_CONTINUE_URL="https://api.dropboxapi.com/2/files/list_folder/continue" -API_ACCOUNT_INFO_URL="https://api.dropboxapi.com/2/users/get_current_account" -API_ACCOUNT_SPACE_URL="https://api.dropboxapi.com/2/users/get_space_usage" -API_MKDIR_URL="https://api.dropboxapi.com/2/files/create_folder" -API_SHARE_URL="https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings" -API_SHARE_LIST="https://api.dropboxapi.com/2/sharing/list_shared_links" -API_SAVEURL_URL="https://api.dropboxapi.com/2/files/save_url" -API_SAVEURL_JOBSTATUS_URL="https://api.dropboxapi.com/2/files/save_url/check_job_status" -API_SEARCH_URL="https://api.dropboxapi.com/2/files/search" -APP_CREATE_URL="https://www.dropbox.com/developers/apps" -RESPONSE_FILE="$TMP_DIR/du_resp_$RANDOM" -CHUNK_FILE="$TMP_DIR/du_chunk_$RANDOM" -TEMP_FILE="$TMP_DIR/du_tmp_$RANDOM" -BIN_DEPS="sed basename date grep stat dd mkdir" -VERSION="1.0" - -umask 077 - -#Check the shell -if [ -z "$BASH_VERSION" ]; then - echo -e "Error: this script requires the BASH shell!" - exit 1 -fi - -shopt -s nullglob #Bash allows filename patterns which match no files to expand to a null string, rather than themselves -shopt -s dotglob #Bash includes filenames beginning with a "." in the results of filename expansion - -#Check temp folder -if [[ ! -d "$TMP_DIR" ]]; then - echo -e "Error: the temporary folder $TMP_DIR doesn't exists!" - echo -e "Please edit this script and set the TMP_DIR variable to a valid temporary folder to use." - exit 1 -fi - -#Look for optional config file parameter -while getopts ":qpskdhf:x:" opt; do - case $opt in - - f) - CONFIG_FILE=$OPTARG - ;; - - d) - DEBUG=1 - ;; - - q) - QUIET=1 - ;; - - p) - SHOW_PROGRESSBAR=1 - ;; - - k) - CURL_ACCEPT_CERTIFICATES="-k" - ;; - - s) - SKIP_EXISTING_FILES=1 - ;; - - h) - HUMAN_READABLE_SIZE=1 - ;; - - x) - EXCLUDE+=( $OPTARG ) - ;; - - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 - ;; - - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - - esac -done - -if [[ $DEBUG != 0 ]]; then - echo $VERSION - uname -a 2> /dev/null - cat /etc/issue 2> /dev/null - set -x - RESPONSE_FILE="$TMP_DIR/du_resp_debug" -fi - -if [[ $CURL_BIN == "" ]]; then - BIN_DEPS="$BIN_DEPS curl" - CURL_BIN="curl" -fi - -#Dependencies check -which $BIN_DEPS > /dev/null -if [[ $? != 0 ]]; then - for i in $BIN_DEPS; do - which $i > /dev/null || - NOT_FOUND="$i $NOT_FOUND" - done - echo -e "Error: Required program could not be found: $NOT_FOUND" - exit 1 -fi - -#Check if readlink is installed and supports the -m option -#It's not necessary, so no problem if it's not installed -which readlink > /dev/null -if [[ $? == 0 && $(readlink -m "//test" 2> /dev/null) == "/test" ]]; then - HAVE_READLINK=1 -else - HAVE_READLINK=0 -fi - -#Forcing to use the builtin printf, if it's present, because it's better -#otherwise the external printf program will be used -#Note that the external printf command can cause character encoding issues! -builtin printf "" 2> /dev/null -if [[ $? == 0 ]]; then - PRINTF="builtin printf" - PRINTF_OPT="-v o" -else - PRINTF=$(which printf) - if [[ $? != 0 ]]; then - echo -e "Error: Required program could not be found: printf" - fi - PRINTF_OPT="" -fi - -#Print the message based on $QUIET variable -function print -{ - if [[ $QUIET == 0 ]]; then - echo -ne "$1"; - fi -} - -#Returns unix timestamp -function utime -{ - date '+%s' -} - -#Remove temporary files -function remove_temp_files -{ - if [[ $DEBUG == 0 ]]; then - rm -fr "$RESPONSE_FILE" - rm -fr "$CHUNK_FILE" - rm -fr "$TEMP_FILE" - fi -} - -#Converts bytes to human readable format -function convert_bytes -{ - if [[ $HUMAN_READABLE_SIZE == 1 && "$1" != "" ]]; then - if (($1 > 1073741824));then - echo $(($1/1073741824)).$(($1%1073741824/100000000))"G"; - elif (($1 > 1048576));then - echo $(($1/1048576)).$(($1%1048576/100000))"M"; - elif (($1 > 1024));then - echo $(($1/1024)).$(($1%1024/100))"K"; - else - echo $1; - fi - else - echo $1; - fi -} - -#Returns the file size in bytes -function file_size -{ - #Generic GNU - SIZE=$(stat --format="%s" "$1" 2> /dev/null) - if [ $? -eq 0 ]; then - echo $SIZE - return - fi - - #Some embedded linux devices - SIZE=$(stat -c "%s" "$1" 2> /dev/null) - if [ $? -eq 0 ]; then - echo $SIZE - return - fi - - #BSD, OSX and other OSs - SIZE=$(stat -f "%z" "$1" 2> /dev/null) - if [ $? -eq 0 ]; then - echo $SIZE - return - fi - - echo "0" -} - - -#Usage -function usage -{ - echo -e "Dropbox Uploader v$VERSION" - echo -e "Andrea Fabrizi - andrea.fabrizi@gmail.com\n" - echo -e "Usage: $0 [PARAMETERS] COMMAND..." - echo -e "\nCommands:" - - echo -e "\t upload " - echo -e "\t download [LOCAL_FILE/DIR]" - echo -e "\t delete " - echo -e "\t move " - echo -e "\t copy " - echo -e "\t mkdir " - echo -e "\t list [REMOTE_DIR]" - echo -e "\t monitor [REMOTE_DIR] [TIMEOUT]" - echo -e "\t share " - echo -e "\t saveurl " - echo -e "\t search " - echo -e "\t info" - echo -e "\t space" - echo -e "\t unlink" - - echo -e "\nOptional parameters:" - echo -e "\t-f Load the configuration file from a specific file" - echo -e "\t-s Skip already existing files when download/upload. Default: Overwrite" - echo -e "\t-d Enable DEBUG mode" - echo -e "\t-q Quiet mode. Don't show messages" - echo -e "\t-h Show file sizes in human readable format" - echo -e "\t-p Show cURL progress meter" - echo -e "\t-k Doesn't check for SSL certificates (insecure)" - echo -e "\t-x Ignores/excludes directories or files from syncing. -x filename -x directoryname. example: -x .git" - - echo -en "\nFor more info and examples, please see the README file.\n\n" - remove_temp_files - exit 1 -} - -#Check the curl exit code -function check_http_response -{ - CODE=$? - - #Checking curl exit code - case $CODE in - - #OK - 0) - - ;; - - #Proxy error - 5) - print "\nError: Couldn't resolve proxy. The given proxy host could not be resolved.\n" - - remove_temp_files - exit 1 - ;; - - #Missing CA certificates - 60|58|77) - print "\nError: cURL is not able to performs peer SSL certificate verification.\n" - print "Please, install the default ca-certificates bundle.\n" - print "To do this in a Debian/Ubuntu based system, try:\n" - print " sudo apt-get install ca-certificates\n\n" - print "If the problem persists, try to use the -k option (insecure).\n" - - remove_temp_files - exit 1 - ;; - - 6) - print "\nError: Couldn't resolve host.\n" - - remove_temp_files - exit 1 - ;; - - 7) - print "\nError: Couldn't connect to host.\n" - - remove_temp_files - exit 1 - ;; - - esac - - #Checking response file for generic errors - if grep -q "HTTP/1.1 400" "$RESPONSE_FILE"; then - ERROR_MSG=$(sed -n -e 's/{"error": "\([^"]*\)"}/\1/p' "$RESPONSE_FILE") - - case $ERROR_MSG in - *access?attempt?failed?because?this?app?is?not?configured?to?have*) - echo -e "\nError: The Permission type/Access level configured doesn't match the DropBox App settings!\nPlease run \"$0 unlink\" and try again." - exit 1 - ;; - esac - - fi - -} - -#Urlencode -function urlencode -{ - #The printf is necessary to correctly decode unicode sequences - local string=$($PRINTF "${1}") - local strlen=${#string} - local encoded="" - - for (( pos=0 ; pos /dev/null - check_http_response - - local TYPE=$(sed -n 's/{".tag": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - - case $TYPE in - - file) - echo "FILE" - ;; - - folder) - echo "DIR" - ;; - - deleted) - echo "ERR" - ;; - - *) - echo "ERR" - ;; - - esac -} - -#Generic upload wrapper around db_upload_file and db_upload_dir functions -#$1 = Local source file/dir -#$2 = Remote destination file/dir -function db_upload -{ - local SRC=$(normalize_path "$1") - local DST=$(normalize_path "$2") - - for j in "${EXCLUDE[@]}" - do : - if [[ $(echo "$SRC" | grep "$j" | wc -l) -gt 0 ]]; then - print "Skipping excluded file/dir: "$j - return - fi - done - - #Checking if the file/dir exists - if [[ ! -e $SRC && ! -d $SRC ]]; then - print " > No such file or directory: $SRC\n" - ERROR_STATUS=1 - return - fi - - #Checking if the file/dir has read permissions - if [[ ! -r $SRC ]]; then - print " > Error reading file $SRC: permission denied\n" - ERROR_STATUS=1 - return - fi - - TYPE=$(db_stat "$DST") - - #If DST it's a file, do nothing, it's the default behaviour - if [[ $TYPE == "FILE" ]]; then - DST="$DST" - - #if DST doesn't exists and doesn't ends with a /, it will be the destination file name - elif [[ $TYPE == "ERR" && "${DST: -1}" != "/" ]]; then - DST="$DST" - - #if DST doesn't exists and ends with a /, it will be the destination folder - elif [[ $TYPE == "ERR" && "${DST: -1}" == "/" ]]; then - local filename=$(basename "$SRC") - DST="$DST/$filename" - - #If DST it's a directory, it will be the destination folder - elif [[ $TYPE == "DIR" ]]; then - local filename=$(basename "$SRC") - DST="$DST/$filename" - fi - - #It's a directory - if [[ -d $SRC ]]; then - db_upload_dir "$SRC" "$DST" - - #It's a file - elif [[ -e $SRC ]]; then - db_upload_file "$SRC" "$DST" - - #Unsupported object... - else - print " > Skipping not regular file \"$SRC\"\n" - fi -} - -#Generic upload wrapper around db_chunked_upload_file and db_simple_upload_file -#The final upload function will be choosen based on the file size -#$1 = Local source file -#$2 = Remote destination file -function db_upload_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - shopt -s nocasematch - - #Checking not allowed file names - basefile_dst=$(basename "$FILE_DST") - if [[ $basefile_dst == "thumbs.db" || \ - $basefile_dst == "desktop.ini" || \ - $basefile_dst == ".ds_store" || \ - $basefile_dst == "icon\r" || \ - $basefile_dst == ".dropbox" || \ - $basefile_dst == ".dropbox.attr" \ - ]]; then - print " > Skipping not allowed file name \"$FILE_DST\"\n" - return - fi - - shopt -u nocasematch - - #Checking file size - FILE_SIZE=$(file_size "$FILE_SRC") - - #Checking if the file already exists - TYPE=$(db_stat "$FILE_DST") - if [[ $TYPE != "ERR" && $SKIP_EXISTING_FILES == 1 ]]; then - print " > Skipping already existing file \"$FILE_DST\"\n" - return - fi - - # Checking if the file has the correct check sum - if [[ $TYPE != "ERR" ]]; then - sha_src=$(db_sha_local "$FILE_SRC") - sha_dst=$(db_sha "$FILE_DST") - if [[ $sha_src == $sha_dst && $sha_src != "ERR" ]]; then - print "> Skipping file \"$FILE_SRC\", file exists with the same hash\n" - return - fi - fi - - if [[ $FILE_SIZE -gt 157286000 ]]; then - #If the file is greater than 150Mb, the chunked_upload API will be used - db_chunked_upload_file "$FILE_SRC" "$FILE_DST" - else - db_simple_upload_file "$FILE_SRC" "$FILE_DST" - fi - -} - -#Simple file upload -#$1 = Local source file -#$2 = Remote destination file -function db_simple_upload_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then - CURL_PARAMETERS="--progress-bar" - LINE_CR="\n" - else - CURL_PARAMETERS="-L -s" - LINE_CR="" - fi - - print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS -X POST -i --globoff -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Dropbox-API-Arg: {\"path\": \"$FILE_DST\",\"mode\": \"overwrite\",\"autorename\": true,\"mute\": false}" --header "Content-Type: application/octet-stream" --data-binary @"$FILE_SRC" "$API_UPLOAD_URL" - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - print "An error occurred requesting /upload\n" - ERROR_STATUS=1 - fi -} - -#Chunked file upload -#$1 = Local source file -#$2 = Remote destination file -function db_chunked_upload_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - - if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then - VERBOSE=1 - CURL_PARAMETERS="--progress-bar" - else - VERBOSE=0 - CURL_PARAMETERS="-L -s" - fi - - - - local FILE_SIZE=$(file_size "$FILE_SRC") - local OFFSET=0 - local UPLOAD_ID="" - local UPLOAD_ERROR=0 - local CHUNK_PARAMS="" - - ## Ceil division - let NUMBEROFCHUNK=($FILE_SIZE/1024/1024+$CHUNK_SIZE-1)/$CHUNK_SIZE - - if [[ $VERBOSE == 1 ]]; then - print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\" by $NUMBEROFCHUNK chunks ...\n" - else - print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\" by $NUMBEROFCHUNK chunks " - fi - - #Starting a new upload session - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Dropbox-API-Arg: {\"close\": false}" --header "Content-Type: application/octet-stream" --data-binary @/dev/null "$API_CHUNKED_UPLOAD_START_URL" 2> /dev/null - check_http_response - - SESSION_ID=$(sed -n 's/{"session_id": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - - chunkNumber=1 - #Uploading chunks... - while ([[ $OFFSET != "$FILE_SIZE" ]]); do - - let OFFSET_MB=$OFFSET/1024/1024 - - #Create the chunk - dd if="$FILE_SRC" of="$CHUNK_FILE" bs=1048576 skip=$OFFSET_MB count=$CHUNK_SIZE 2> /dev/null - local CHUNK_REAL_SIZE=$(file_size "$CHUNK_FILE") - - if [[ $VERBOSE == 1 ]]; then - print " >> Uploading chunk $chunkNumber of $NUMBEROFCHUNK\n" - fi - - #Uploading the chunk... - echo > "$RESPONSE_FILE" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST $CURL_PARAMETERS --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Dropbox-API-Arg: {\"cursor\": {\"session_id\": \"$SESSION_ID\",\"offset\": $OFFSET},\"close\": false}" --header "Content-Type: application/octet-stream" --data-binary @"$CHUNK_FILE" "$API_CHUNKED_UPLOAD_APPEND_URL" - #check_http_response not needed, because we have to retry the request in case of error - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - let OFFSET=$OFFSET+$CHUNK_REAL_SIZE - UPLOAD_ERROR=0 - if [[ $VERBOSE != 1 ]]; then - print "." - fi - ((chunkNumber=chunkNumber+1)) - else - if [[ $VERBOSE != 1 ]]; then - print "*" - fi - let UPLOAD_ERROR=$UPLOAD_ERROR+1 - - #On error, the upload is retried for max 3 times - if [[ $UPLOAD_ERROR -gt 2 ]]; then - print " FAILED\n" - print "An error occurred requesting /chunked_upload\n" - ERROR_STATUS=1 - return - fi - fi - - done - - UPLOAD_ERROR=0 - - #Commit the upload - while (true); do - - echo > "$RESPONSE_FILE" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Dropbox-API-Arg: {\"cursor\": {\"session_id\": \"$SESSION_ID\",\"offset\": $OFFSET},\"commit\": {\"path\": \"$FILE_DST\",\"mode\": \"overwrite\",\"autorename\": true,\"mute\": false}}" --header "Content-Type: application/octet-stream" --data-binary @/dev/null "$API_CHUNKED_UPLOAD_FINISH_URL" 2> /dev/null - #check_http_response not needed, because we have to retry the request in case of error - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - UPLOAD_ERROR=0 - break - else - print "*" - let UPLOAD_ERROR=$UPLOAD_ERROR+1 - - #On error, the commit is retried for max 3 times - if [[ $UPLOAD_ERROR -gt 2 ]]; then - print " FAILED\n" - print "An error occurred requesting /commit_chunked_upload\n" - ERROR_STATUS=1 - return - fi - fi - - done - - print " DONE\n" -} - -#Directory upload -#$1 = Local source dir -#$2 = Remote destination dir -function db_upload_dir -{ - local DIR_SRC=$(normalize_path "$1") - local DIR_DST=$(normalize_path "$2") - - #Creatig remote directory - db_mkdir "$DIR_DST" - - for file in "$DIR_SRC/"*; do - db_upload "$file" "$DIR_DST" - done -} - -#Generic download wrapper -#$1 = Remote source file/dir -#$2 = Local destination file/dir -function db_download -{ - local SRC=$(normalize_path "$1") - local DST=$(normalize_path "$2") - - TYPE=$(db_stat "$SRC") - - #It's a directory - if [[ $TYPE == "DIR" ]]; then - - #If the DST folder is not specified, I assume that is the current directory - if [[ $DST == "" ]]; then - DST="." - fi - - #Checking if the destination directory exists - if [[ ! -d $DST ]]; then - local basedir="" - else - local basedir=$(basename "$SRC") - fi - - local DEST_DIR=$(normalize_path "$DST/$basedir") - print " > Downloading folder \"$SRC\" to \"$DEST_DIR\"... \n" - - if [[ ! -d "$DEST_DIR" ]]; then - print " > Creating local directory \"$DEST_DIR\"... " - mkdir -p "$DEST_DIR" - - #Check - if [[ $? == 0 ]]; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - return - fi - fi - - if [[ $SRC == "/" ]]; then - SRC_REQ="" - else - SRC_REQ="$SRC" - fi - - OUT_FILE=$(db_list_outfile "$SRC_REQ") - if [ $? -ne 0 ]; then - # When db_list_outfile fail, the error message is OUT_FILE - print "$OUT_FILE\n" - ERROR_STATUS=1 - return - fi - - #For each entry... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - #Removing unneeded / - FILE=${FILE##*/} - - if [[ $TYPE == "file" ]]; then - db_download_file "$SRC/$FILE" "$DEST_DIR/$FILE" - elif [[ $TYPE == "folder" ]]; then - db_download "$SRC/$FILE" "$DEST_DIR" - fi - - done < $OUT_FILE - - rm -fr $OUT_FILE - - #It's a file - elif [[ $TYPE == "FILE" ]]; then - - #Checking DST - if [[ $DST == "" ]]; then - DST=$(basename "$SRC") - fi - - #If the destination is a directory, the file will be download into - if [[ -d $DST ]]; then - DST="$DST/$SRC" - fi - - db_download_file "$SRC" "$DST" - - #Doesn't exists - else - print " > No such file or directory: $SRC\n" - ERROR_STATUS=1 - return - fi -} - -#Simple file download -#$1 = Remote source file -#$2 = Local destination file -function db_download_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then - CURL_PARAMETERS="-L --progress-bar" - LINE_CR="\n" - else - CURL_PARAMETERS="-L -s" - LINE_CR="" - fi - - #Checking if the file already exists - if [[ -e $FILE_DST && $SKIP_EXISTING_FILES == 1 ]]; then - print " > Skipping already existing file \"$FILE_DST\"\n" - return - fi - - # Checking if the file has the correct check sum - if [[ $TYPE != "ERR" ]]; then - sha_src=$(db_sha "$FILE_SRC") - sha_dst=$(db_sha_local "$FILE_DST") - if [[ $sha_src == $sha_dst && $sha_src != "ERR" ]]; then - print "> Skipping file \"$FILE_SRC\", file exists with the same hash\n" - return - fi - fi - - #Creating the empty file, that for two reasons: - #1) In this way I can check if the destination file is writable or not - #2) Curl doesn't automatically creates files with 0 bytes size - dd if=/dev/zero of="$FILE_DST" count=0 2> /dev/null - if [[ $? != 0 ]]; then - print " > Error writing file $FILE_DST: permission denied\n" - ERROR_STATUS=1 - return - fi - - print " > Downloading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS -X POST --globoff -D "$RESPONSE_FILE" -o "$FILE_DST" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Dropbox-API-Arg: {\"path\": \"$FILE_SRC\"}" "$API_DOWNLOAD_URL" - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - rm -fr "$FILE_DST" - ERROR_STATUS=1 - return - fi -} - -#Saveurl -#$1 = URL -#$2 = Remote file destination -function db_saveurl -{ - local URL="$1" - local FILE_DST=$(normalize_path "$2") - local FILE_NAME=$(basename "$URL") - - print " > Downloading \"$URL\" to \"$FILE_DST\"..." - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$FILE_DST/$FILE_NAME\", \"url\": \"$URL\"}" "$API_SAVEURL_URL" 2> /dev/null - check_http_response - - JOB_ID=$(sed -n 's/.*"async_job_id": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - if [[ $JOB_ID == "" ]]; then - print " > Error getting the job id\n" - return - fi - - #Checking the status - while (true); do - - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"async_job_id\": \"$JOB_ID\"}" "$API_SAVEURL_JOBSTATUS_URL" 2> /dev/null - check_http_response - - STATUS=$(sed -n 's/{".tag": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - case $STATUS in - - in_progress) - print "+" - ;; - - complete) - print " DONE\n" - break - ;; - - failed) - print " ERROR\n" - MESSAGE=$(sed -n 's/.*"error_summary": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - print " > Error: $MESSAGE\n" - break - ;; - - esac - - sleep 2 - - done -} - -#Prints account info -function db_account_info -{ - print "Dropbox Uploader v$VERSION\n\n" - print " > Getting info... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" "$API_ACCOUNT_INFO_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - - name=$(sed -n 's/.*"display_name": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo -e "\n\nName:\t\t$name" - - uid=$(sed -n 's/.*"account_id": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo -e "UID:\t\t$uid" - - email=$(sed -n 's/.*"email": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo -e "Email:\t\t$email" - - country=$(sed -n 's/.*"country": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo -e "Country:\t$country" - - echo "" - - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Prints account space usage info -function db_account_space -{ - print "Dropbox Uploader v$VERSION\n\n" - print " > Getting space usage info... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" "$API_ACCOUNT_SPACE_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - - quota=$(sed -n 's/.*"allocated": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") - let quota_mb=$quota/1024/1024 - echo -e "\n\nQuota:\t$quota_mb Mb" - - used=$(sed -n 's/.*"used": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") - let used_mb=$used/1024/1024 - echo -e "Used:\t$used_mb Mb" - - let free_mb=$((quota-used))/1024/1024 - echo -e "Free:\t$free_mb Mb" - - echo "" - - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Account unlink -function db_unlink -{ - echo -ne "Are you sure you want unlink this script from your Dropbox account? [y/n]" - read -r answer - if [[ $answer == "y" ]]; then - rm -fr "$CONFIG_FILE" - echo -ne "DONE\n" - fi -} - -#Delete a remote file -#$1 = Remote file to delete -function db_delete -{ - local FILE_DST=$(normalize_path "$1") - - print " > Deleting \"$FILE_DST\"... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$FILE_DST\"}" "$API_DELETE_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Move/Rename a remote file -#$1 = Remote file to rename or move -#$2 = New file name or location -function db_move -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - TYPE=$(db_stat "$FILE_DST") - - #If the destination it's a directory, the source will be moved into it - if [[ $TYPE == "DIR" ]]; then - local filename=$(basename "$FILE_SRC") - FILE_DST=$(normalize_path "$FILE_DST/$filename") - fi - - print " > Moving \"$FILE_SRC\" to \"$FILE_DST\" ... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"from_path\": \"$FILE_SRC\", \"to_path\": \"$FILE_DST\"}" "$API_MOVE_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Copy a remote file to a remote location -#$1 = Remote file to rename or move -#$2 = New file name or location -function db_copy -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - TYPE=$(db_stat "$FILE_DST") - - #If the destination it's a directory, the source will be copied into it - if [[ $TYPE == "DIR" ]]; then - local filename=$(basename "$FILE_SRC") - FILE_DST=$(normalize_path "$FILE_DST/$filename") - fi - - print " > Copying \"$FILE_SRC\" to \"$FILE_DST\" ... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"from_path\": \"$FILE_SRC\", \"to_path\": \"$FILE_DST\"}" "$API_COPY_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Create a new directory -#$1 = Remote directory to create -function db_mkdir -{ - local DIR_DST=$(normalize_path "$1") - - print " > Creating Directory \"$DIR_DST\"... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$DIR_DST\"}" "$API_MKDIR_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - elif grep -q "^HTTP/1.1 403 Forbidden" "$RESPONSE_FILE"; then - print "ALREADY EXISTS\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#List a remote folder and returns the path to the file containing the output -#$1 = Remote directory -#$2 = Cursor (Optional) -function db_list_outfile -{ - - local DIR_DST="$1" - local HAS_MORE="false" - local CURSOR="" - - if [[ -n "$2" ]]; then - CURSOR="$2" - HAS_MORE="true" - fi - - OUT_FILE="$TMP_DIR/du_tmp_out_$RANDOM" - - while (true); do - - if [[ $HAS_MORE == "true" ]]; then - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"cursor\": \"$CURSOR\"}" "$API_LIST_FOLDER_CONTINUE_URL" 2> /dev/null - else - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$DIR_DST\",\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false}" "$API_LIST_FOLDER_URL" 2> /dev/null - fi - - check_http_response - - HAS_MORE=$(sed -n 's/.*"has_more": *\([a-z]*\).*/\1/p' "$RESPONSE_FILE") - CURSOR=$(sed -n 's/.*"cursor": *"\([^"]*\)".*/\1/p' "$RESPONSE_FILE") - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - - #Extracting directory content [...] - #and replacing "}, {" with "}\n{" - #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... - local DIR_CONTENT=$(sed -n 's/.*: \[{\(.*\)/\1/p' "$RESPONSE_FILE" | sed 's/}, *{/}\ - {/g') - - #Converting escaped quotes to unicode format - echo "$DIR_CONTENT" | sed 's/\\"/\\u0022/' > "$TEMP_FILE" - - #Extracting files and subfolders - while read -r line; do - - local FILE=$(echo "$line" | sed -n 's/.*"path_display": *"\([^"]*\)".*/\1/p') - local TYPE=$(echo "$line" | sed -n 's/.*".tag": *"\([^"]*\).*/\1/p') - local SIZE=$(convert_bytes $(echo "$line" | sed -n 's/.*"size": *\([0-9]*\).*/\1/p')) - - echo -e "$FILE:$TYPE;$SIZE" >> "$OUT_FILE" - - done < "$TEMP_FILE" - - if [[ $HAS_MORE == "false" ]]; then - break - fi - - else - return - fi - - done - - echo $OUT_FILE -} - -#List remote directory -#$1 = Remote directory -function db_list -{ - local DIR_DST=$(normalize_path "$1") - - print " > Listing \"$DIR_DST\"... " - - if [[ "$DIR_DST" == "/" ]]; then - DIR_DST="" - fi - - OUT_FILE=$(db_list_outfile "$DIR_DST") - if [ -z "$OUT_FILE" ]; then - print "FAILED\n" - ERROR_STATUS=1 - return - else - print "DONE\n" - fi - - #Looking for the biggest file size - #to calculate the padding to use - local padding=0 - while read -r line; do - local FILE=${line%:*} - local META=${line##*:} - local SIZE=${META#*;} - - if [[ ${#SIZE} -gt $padding ]]; then - padding=${#SIZE} - fi - done < "$OUT_FILE" - - #For each entry, printing directories... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - #Removing unneeded / - FILE=${FILE##*/} - - if [[ $TYPE == "folder" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [D] %-${padding}s %s\n" "$SIZE" "$FILE" - fi - - done < "$OUT_FILE" - - #For each entry, printing files... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - #Removing unneeded / - FILE=${FILE##*/} - - if [[ $TYPE == "file" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [F] %-${padding}s %s\n" "$SIZE" "$FILE" - fi - - done < "$OUT_FILE" - - rm -fr "$OUT_FILE" -} - -#Longpoll remote directory only once -#$1 = Timeout -#$2 = Remote directory -function db_monitor_nonblock -{ - local TIMEOUT=$1 - local DIR_DST=$(normalize_path "$2") - - if [[ "$DIR_DST" == "/" ]]; then - DIR_DST="" - fi - - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$DIR_DST\",\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false}" "$API_LIST_FOLDER_URL" 2> /dev/null - check_http_response - - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - - local CURSOR=$(sed -n 's/.*"cursor": *"\([^"]*\)".*/\1/p' "$RESPONSE_FILE") - - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Content-Type: application/json" --data "{\"cursor\": \"$CURSOR\",\"timeout\": ${TIMEOUT}}" "$API_LONGPOLL_FOLDER" 2> /dev/null - check_http_response - - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - local CHANGES=$(sed -n 's/.*"changes" *: *\([a-z]*\).*/\1/p' "$RESPONSE_FILE") - else - ERROR_MSG=$(grep "Error in call" "$RESPONSE_FILE") - print "FAILED to longpoll (http error): $ERROR_MSG\n" - ERROR_STATUS=1 - return 1 - fi - - if [[ -z "$CHANGES" ]]; then - print "FAILED to longpoll (unexpected response)\n" - ERROR_STATUS=1 - return 1 - fi - - if [ "$CHANGES" == "true" ]; then - - OUT_FILE=$(db_list_outfile "$DIR_DST" "$CURSOR") - - if [ -z "$OUT_FILE" ]; then - print "FAILED to list changes\n" - ERROR_STATUS=1 - return - fi - - #For each entry, printing directories... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - #Removing unneeded / - FILE=${FILE##*/} - - if [[ $TYPE == "folder" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [D] %s\n" "$FILE" - elif [[ $TYPE == "file" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [F] %s %s\n" "$SIZE" "$FILE" - elif [[ $TYPE == "deleted" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [-] %s\n" "$FILE" - fi - - done < "$OUT_FILE" - - rm -fr "$OUT_FILE" - fi - - else - ERROR_STATUS=1 - return 1 - fi - -} - -#Longpoll continuously remote directory -#$1 = Timeout -#$2 = Remote directory -function db_monitor -{ - local TIMEOUT=$1 - local DIR_DST=$(normalize_path "$2") - - while (true); do - db_monitor_nonblock "$TIMEOUT" "$2" - done -} - -#Share remote file -#$1 = Remote file -function db_share -{ - local FILE_DST=$(normalize_path "$1") - - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$FILE_DST\",\"settings\": {\"requested_visibility\": \"public\"}}" "$API_SHARE_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print " > Share link: " - SHARE_LINK=$(sed -n 's/.*"url": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo "$SHARE_LINK" - else - get_Share "$FILE_DST" - fi -} - -#Query existing shared link -#$1 = Remote file -function get_Share -{ - local FILE_DST=$(normalize_path "$1") - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$FILE_DST\",\"direct_only\": true}" "$API_SHARE_LIST" - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print " > Share link: " - SHARE_LINK=$(sed -n 's/.*"url": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo "$SHARE_LINK" - else - print "FAILED\n" - MESSAGE=$(sed -n 's/.*"error_summary": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - print " > Error: $MESSAGE\n" - ERROR_STATUS=1 - fi -} - -#Search on Dropbox -#$1 = query -function db_search -{ - local QUERY="$1" - - print " > Searching for \"$QUERY\"... " - - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"\",\"query\": \"$QUERY\",\"start\": 0,\"max_results\": 1000,\"mode\": \"filename\"}" "$API_SEARCH_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi - - #Extracting directory content [...] - #and replacing "}, {" with "}\n{" - #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... - local DIR_CONTENT=$(sed 's/}, *{/}\ -{/g' "$RESPONSE_FILE") - - #Converting escaped quotes to unicode format - echo "$DIR_CONTENT" | sed 's/\\"/\\u0022/' > "$TEMP_FILE" - - #Extracting files and subfolders - rm -fr "$RESPONSE_FILE" - while read -r line; do - - local FILE=$(echo "$line" | sed -n 's/.*"path_display": *"\([^"]*\)".*/\1/p') - local TYPE=$(echo "$line" | sed -n 's/.*".tag": *"\([^"]*\).*/\1/p') - local SIZE=$(convert_bytes $(echo "$line" | sed -n 's/.*"size": *\([0-9]*\).*/\1/p')) - - echo -e "$FILE:$TYPE;$SIZE" >> "$RESPONSE_FILE" - - done < "$TEMP_FILE" - - #Looking for the biggest file size - #to calculate the padding to use - local padding=0 - while read -r line; do - local FILE=${line%:*} - local META=${line##*:} - local SIZE=${META#*;} - - if [[ ${#SIZE} -gt $padding ]]; then - padding=${#SIZE} - fi - done < "$RESPONSE_FILE" - - #For each entry, printing directories... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - if [[ $TYPE == "folder" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [D] %-${padding}s %s\n" "$SIZE" "$FILE" - fi - - done < "$RESPONSE_FILE" - - #For each entry, printing files... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - if [[ $TYPE == "file" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [F] %-${padding}s %s\n" "$SIZE" "$FILE" - fi - - done < "$RESPONSE_FILE" - -} - -#Query the sha256-dropbox-sum of a remote file -#see https://www.dropbox.com/developers/reference/content-hash for more information -#$1 = Remote file -function db_sha -{ - local FILE=$(normalize_path "$1") - - if [[ $FILE == "/" ]]; then - echo "ERR" - return - fi - - #Checking if it's a file or a directory and get the sha-sum - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -X POST -L -s --show-error --globoff -i -o "$RESPONSE_FILE" --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" --header "Content-Type: application/json" --data "{\"path\": \"$FILE\"}" "$API_METADATA_URL" 2> /dev/null - check_http_response - - local TYPE=$(sed -n 's/{".tag": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - if [[ $TYPE == "folder" ]]; then - echo "ERR" - return - fi - - local SHA256=$(sed -n 's/.*"content_hash": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo "$SHA256" -} - -#Query the sha256-dropbox-sum of a local file -#see https://www.dropbox.com/developers/reference/content-hash for more information -#$1 = Local file -function db_sha_local -{ - local FILE=$(normalize_path "$1") - local FILE_SIZE=$(file_size "$FILE") - local OFFSET=0 - local SKIP=0 - local SHA_CONCAT="" - - which shasum > /dev/null - if [[ $? != 0 ]]; then - echo "ERR" - return - fi - - while ([[ $OFFSET -lt "$FILE_SIZE" ]]); do - dd if="$FILE" of="$CHUNK_FILE" bs=4194304 skip=$SKIP count=1 2> /dev/null - local SHA=$(shasum -a 256 "$CHUNK_FILE" | awk '{print $1}') - SHA_CONCAT="${SHA_CONCAT}${SHA}" - - let OFFSET=$OFFSET+4194304 - let SKIP=$SKIP+1 - done - - shaHex=$(echo $SHA_CONCAT | sed 's/\([0-9A-F]\{2\}\)/\\x\1/gI') - echo -ne $shaHex | shasum -a 256 | awk '{print $1}' -} - -################ -#### SETUP #### -################ - -#CHECKING FOR AUTH FILE -if [[ -e $CONFIG_FILE ]]; then - - #Loading data... and change old format config if necesary. - source "$CONFIG_FILE" 2>/dev/null || { - sed -i'' 's/:/=/' "$CONFIG_FILE" && source "$CONFIG_FILE" 2>/dev/null - } - - #Checking if it's still a v1 API configuration file - if [[ $APPKEY != "" || $APPSECRET != "" ]]; then - echo -ne "The config file contains the old deprecated v1 oauth tokens.\n" - echo -ne "Please run again the script and follow the configuration wizard. The old configuration file has been backed up to $CONFIG_FILE.old\n" - mv "$CONFIG_FILE" "$CONFIG_FILE".old - exit 1 - fi - - #Checking loaded data - if [[ $OAUTH_ACCESS_TOKEN = "" ]]; then - echo -ne "Error loading data from $CONFIG_FILE...\n" - echo -ne "It is recommended to run $0 unlink\n" - remove_temp_files - exit 1 - fi - -#NEW SETUP... -else - - echo -ne "\n This is the first time you run this script, please follow the instructions:\n\n" - echo -ne " 1) Open the following URL in your Browser, and log in using your account: $APP_CREATE_URL\n" - echo -ne " 2) Click on \"Create App\", then select \"Dropbox API app\"\n" - echo -ne " 3) Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder\n" - echo -ne " 4) Enter the \"App Name\" that you prefer (e.g. MyUploader$RANDOM$RANDOM$RANDOM)\n\n" - - echo -ne " Now, click on the \"Create App\" button.\n\n" - - echo -ne " When your new App is successfully created, please click on the Generate button\n" - echo -ne " under the 'Generated access token' section, then copy and paste the new access token here:\n\n" - - echo -ne " # Access token: " - read -r OAUTH_ACCESS_TOKEN - - echo -ne "\n > The access token is $OAUTH_ACCESS_TOKEN. Looks ok? [y/N]: " - read -r answer - if [[ $answer != "y" ]]; then - remove_temp_files - exit 1 - fi - - echo "OAUTH_ACCESS_TOKEN=$OAUTH_ACCESS_TOKEN" > "$CONFIG_FILE" - echo " The configuration has been saved." - - remove_temp_files - exit 0 -fi - -################ -#### START #### -################ - -COMMAND="${*:$OPTIND:1}" -ARG1="${*:$OPTIND+1:1}" -ARG2="${*:$OPTIND+2:1}" - -let argnum=$#-$OPTIND - -#CHECKING PARAMS VALUES -case $COMMAND in - - upload) - - if [[ $argnum -lt 2 ]]; then - usage - fi - - FILE_DST="${*:$#:1}" - - for (( i=OPTIND+1; i<$#; i++ )); do - FILE_SRC="${*:$i:1}" - db_upload "$FILE_SRC" "/$FILE_DST" - done - - ;; - - download) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - FILE_SRC="$ARG1" - FILE_DST="$ARG2" - - db_download "/$FILE_SRC" "$FILE_DST" - - ;; - - saveurl) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - URL=$ARG1 - FILE_DST="$ARG2" - - db_saveurl "$URL" "/$FILE_DST" - - ;; - - share) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - FILE_DST="$ARG1" - - db_share "/$FILE_DST" - - ;; - - info) - - db_account_info - - ;; - - space) - - db_account_space - - ;; - - delete|remove) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - FILE_DST="$ARG1" - - db_delete "/$FILE_DST" - - ;; - - move|rename) - - if [[ $argnum -lt 2 ]]; then - usage - fi - - FILE_SRC="$ARG1" - FILE_DST="$ARG2" - - db_move "/$FILE_SRC" "/$FILE_DST" - - ;; - - copy) - - if [[ $argnum -lt 2 ]]; then - usage - fi - - FILE_SRC="$ARG1" - FILE_DST="$ARG2" - - db_copy "/$FILE_SRC" "/$FILE_DST" - - ;; - - mkdir) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - DIR_DST="$ARG1" - - db_mkdir "/$DIR_DST" - - ;; - - search) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - QUERY=$ARG1 - - db_search "$QUERY" - - ;; - - list) - - DIR_DST="$ARG1" - - #Checking DIR_DST - if [[ $DIR_DST == "" ]]; then - DIR_DST="/" - fi - - db_list "/$DIR_DST" - - ;; - - monitor) - - DIR_DST="$ARG1" - TIMEOUT=$ARG2 - - #Checking DIR_DST - if [[ $DIR_DST == "" ]]; then - DIR_DST="/" - fi - - print " > Monitoring \"$DIR_DST\" for changes...\n" - - if [[ -n $TIMEOUT ]]; then - db_monitor_nonblock $TIMEOUT "/$DIR_DST" - else - db_monitor 60 "/$DIR_DST" - fi - - ;; - - unlink) - - db_unlink - - ;; - - *) - - if [[ $COMMAND != "" ]]; then - print "Error: Unknown command: $COMMAND\n\n" - ERROR_STATUS=1 - fi - usage - - ;; - -esac - -remove_temp_files - -if [[ $ERROR_STATUS -ne 0 ]]; then - echo "Some error occured. Please check the log." -fi - -exit $ERROR_STATUS diff --git a/.ci/gta5view.nsi b/.ci/gta5view.nsi deleted file mode 100644 index 56ea8fa..0000000 --- a/.ci/gta5view.nsi +++ /dev/null @@ -1,364 +0,0 @@ -###################################################################### - -!define APP_NAME "gta5view" -!define APP_EXT ".g5e" -!define COMP_NAME "Syping" -!define WEB_SITE "https://gta5view.syping.de/" -!define VERSION "1.10.1.1" -!define COPYRIGHT "Copyright © 2016-2022 Syping" -!define DESCRIPTION "Open Source Snapmatic and Savegame viewer/editor for GTA V" -!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/gta5view.exe" -File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libc++.dll" -File "/opt/llvm-mingw/x86_64-w64-mingw32/bin/libunwind.dll" -File "/usr/local/lib/x86_64-w64-mingw32/openssl/bin/libcrypto-1_1-x64.dll" -File "/usr/local/lib/x86_64-w64-mingw32/openssl/bin/libssl-1_1-x64.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Core.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Gui.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Network.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Svg.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/bin/Qt5Widgets.dll" -SetOutPath "$INSTDIR\lang" -File "../build/gta5sync_en_US.qm" -File "../build/gta5sync_de.qm" -File "../build/gta5sync_fr.qm" -File "../build/gta5sync_ko.qm" -File "../build/gta5sync_ru.qm" -File "../build/gta5sync_uk.qm" -File "../build/gta5sync_zh_TW.qm" -File "../build/qtbase_en_GB.qm" -File "../res/qt5/qtbase_de.qm" -File "../res/qt5/qtbase_fr.qm" -File "../res/qt5/qtbase_ko.qm" -File "../res/qt5/qtbase_ru.qm" -File "../res/qt5/qtbase_uk.qm" -File "../res/qt5/qtbase_zh_TW.qm" -SetOutPath "$INSTDIR\resources" -File "../res/add.svgz" -File "../res/avatararea.png" -File "../res/avatarareaimport.png" -File "../res/back.svgz" -File "../res/flag-de.png" -File "../res/flag-fr.png" -File "../res/flag-gb.png" -File "../res/flag-kr.png" -File "../res/flag-ru.png" -File "../res/flag-tw.png" -File "../res/flag-ua.png" -File "../res/flag-us.png" -File "../res/gta5view-16.png" -File "../res/gta5view-24.png" -File "../res/gta5view-32.png" -File "../res/gta5view-40.png" -File "../res/gta5view-48.png" -File "../res/gta5view-64.png" -File "../res/gta5view-96.png" -File "../res/gta5view-128.png" -File "../res/gta5view-256.png" -File "../res/mapcayoperico.jpg" -File "../res/mappreview.jpg" -File "../res/next.svgz" -File "../res/pointmaker-8.png" -File "../res/pointmaker-16.png" -File "../res/pointmaker-24.png" -File "../res/pointmaker-32.png" -File "../res/savegame.svgz" -File "../res/watermark_1b.png" -File "../res/watermark_2b.png" -File "../res/watermark_2r.png" -SetOutPath "$INSTDIR\imageformats" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qgif.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qicns.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qico.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qjpeg.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qsvg.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtga.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qtiff.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwbmp.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/imageformats/qwebp.dll" -SetOutPath "$INSTDIR\platforms" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/platforms/qwindows.dll" -SetOutPath "$INSTDIR\styles" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qcleanlooksstyle.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qplastiquestyle.dll" -File "/usr/local/lib/x86_64-w64-mingw32/qt5/plugins/styles/qwindowsvistastyle.dll" -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 -ShellAssoc -WriteRegStr ${REG_ROOT} "Software\Classes\${APP_NAME}\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},0" -WriteRegStr ${REG_ROOT} "Software\Classes\${APP_NAME}\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' -WriteRegStr ${REG_ROOT} "Software\Classes\${APP_EXT}" "" "${APP_NAME}" -WriteRegStr ${REG_ROOT} "Software\Classes\${APP_EXT}" "Content Type" "application/x-gta5view-export" -System::Call 'SHELL32::SHChangeNotify(i0x8000000,i0,p0,p0)' -SectionEnd - -###################################################################### - -Section -un.ShellAssoc -ClearErrors -ReadRegStr $0 ${REG_ROOT} "Software\Classes\${APP_EXT}" "" -DeleteRegKey ${REG_ROOT} "Software\Classes\${APP_NAME}" -${IfNot} ${Errors} -${AndIf} $0 == "${APP_NAME}" -DeleteRegValue ${REG_ROOT} "Software\Classes\${APP_EXT}" "" -DeleteRegKey /IfEmpty ${REG_ROOT} "Software\Classes\${APP_EXT}" -${EndIf} -System::Call 'SHELL32::SHChangeNotify(i0x8000000,i0,p0,p0)' -SectionEnd - -###################################################################### - -Section Uninstall -${INSTALL_TYPE} -Delete "$INSTDIR\gta5view.exe" -Delete "$INSTDIR\libc++.dll" -Delete "$INSTDIR\libunwind.dll" -Delete "$INSTDIR\libcrypto-1_1-x64.dll" -Delete "$INSTDIR\libssl-1_1-x64.dll" -Delete "$INSTDIR\Qt5Core.dll" -Delete "$INSTDIR\Qt5Gui.dll" -Delete "$INSTDIR\Qt5Network.dll" -Delete "$INSTDIR\Qt5Svg.dll" -Delete "$INSTDIR\Qt5Widgets.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\resources\add.svgz" -Delete "$INSTDIR\resources\avatararea.png" -Delete "$INSTDIR\resources\avatarareaimport.png" -Delete "$INSTDIR\resources\back.svgz" -Delete "$INSTDIR\resources\flag-de.png" -Delete "$INSTDIR\resources\flag-fr.png" -Delete "$INSTDIR\resources\flag-gb.png" -Delete "$INSTDIR\resources\flag-kr.png" -Delete "$INSTDIR\resources\flag-ru.png" -Delete "$INSTDIR\resources\flag-tw.png" -Delete "$INSTDIR\resources\flag-ua.png" -Delete "$INSTDIR\resources\flag-us.png" -Delete "$INSTDIR\resources\gta5view-16.png" -Delete "$INSTDIR\resources\gta5view-24.png" -Delete "$INSTDIR\resources\gta5view-32.png" -Delete "$INSTDIR\resources\gta5view-40.png" -Delete "$INSTDIR\resources\gta5view-48.png" -Delete "$INSTDIR\resources\gta5view-64.png" -Delete "$INSTDIR\resources\gta5view-96.png" -Delete "$INSTDIR\resources\gta5view-128.png" -Delete "$INSTDIR\resources\gta5view-256.png" -Delete "$INSTDIR\resources\mapcayoperico.jpg" -Delete "$INSTDIR\resources\mappreview.jpg" -Delete "$INSTDIR\resources\next.svgz" -Delete "$INSTDIR\resources\pointmaker-8.png" -Delete "$INSTDIR\resources\pointmaker-16.png" -Delete "$INSTDIR\resources\pointmaker-24.png" -Delete "$INSTDIR\resources\pointmaker-32.png" -Delete "$INSTDIR\resources\savegame.svgz" -Delete "$INSTDIR\resources\watermark_1b.png" -Delete "$INSTDIR\resources\watermark_2b.png" -Delete "$INSTDIR\resources\watermark_2r.png" -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 - -###################################################################### diff --git a/.ci/osx_build.sh b/.ci/osx_build.sh deleted file mode 100755 index c8545c4..0000000 --- a/.ci/osx_build.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env 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/bin/cmake \ - "-DCMAKE_PREFIX_PATH=/usr/local/opt/qt" \ - "${CMAKE_BUILD_TYPE}" \ - "-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \ - "-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \ - "-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \ - "-DWITH_DONATE=ON" \ - "-DWITH_TELEMETRY=ON" \ - "-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \ - "-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \ - ../ && \ -make -j 4 && \ -/usr/local/opt/qt/bin/macdeployqt gta5view.app -dmg && \ -cp -Rf gta5view.dmg ../assets/gta5view-osx_${APPLICATION_VERSION}.dmg diff --git a/.ci/osx_ci.sh b/.ci/osx_ci.sh deleted file mode 100755 index 59a722e..0000000 --- a/.ci/osx_ci.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# Install packages -.ci/osx_install.sh && \ - -# Build gta5view -.ci/osx_build.sh && \ -cd ${PROJECT_DIR} diff --git a/.ci/osx_install.sh b/.ci/osx_install.sh deleted file mode 100755 index 9c5c5f3..0000000 --- a/.ci/osx_install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# Install packages -brew upgrade cmake qt diff --git a/.ci/windows_build.sh b/.ci/windows_build.sh deleted file mode 100755 index 4b85c38..0000000 --- a/.ci/windows_build.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env 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 && \ -mingw64-qt-cmake \ - "${CMAKE_BUILD_TYPE}" \ - "-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \ - "-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \ - "-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \ - "-DWITH_DONATE=ON" \ - "-DWITH_TELEMETRY=ON" \ - "-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \ - "-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \ - .. && \ -make -j 4 && \ -x86_64-w64-mingw32-strip -s gta5view.exe && \ -cp -Rf *.exe ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} && \ -cd ${PROJECT_DIR}/assets diff --git a/.ci/windows_docker.sh b/.ci/windows_docker.sh deleted file mode 100755 index 54862f1..0000000 --- a/.ci/windows_docker.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -DOCKER_IMAGE=sypingauto/gta5view-build:1.10-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 CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/windows_build.sh" && \ - -# 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} -elif [ "${PACKAGE_CODE}" == "gtainside" ]; then - ${PROJECT_DIR}/.ci/dropbox_uploader.sh mkdir gtainside/${PACKAGE_VERSION} - ${PROJECT_DIR}/.ci/dropbox_uploader.sh upload ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} gtainside/${PACKAGE_VERSION}/${GTA5VIEW_EXECUTABLE} && \ - rm -rf ${GTA5VIEW_EXECUTABLE} -fi diff --git a/.ci/wininstall_build.sh b/.ci/wininstall_build.sh deleted file mode 100755 index 8ecbe4e..0000000 --- a/.ci/wininstall_build.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -# Creating folders -cd ${PROJECT_DIR} && \ -echo "gta5view build version is ${APPLICATION_VERSION}" && \ -mkdir -p build && \ -mkdir -p assets && \ - -# Starting build -cd build && \ -mingw64-qt-cmake \ - "${CMAKE_BUILD_TYPE}" \ - "-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \ - "-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \ - "-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \ - "-DWITH_DONATE=ON" \ - "-DWITH_TELEMETRY=ON" \ - "-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \ - "-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \ - "-DQCONF_BUILD=ON" \ - "-DGTA5VIEW_INLANG=RUNDIR:SEPARATOR:lang" \ - "-DGTA5VIEW_LANG=RUNDIR:SEPARATOR:lang" \ - "-DGTA5VIEW_PLUG=RUNDIR:SEPARATOR:plugins" \ - .. && \ -make -j 4 && \ -x86_64-w64-mingw32-strip -s gta5view.exe && \ -cd ${PROJECT_DIR}/assets && \ -makensis "-XTarget amd64-unicode" -NOCD ${PROJECT_DIR}/.ci/gta5view.nsi && \ -mv -f gta5view_setup.exe gta5view-${EXECUTABLE_VERSION}_setup.exe diff --git a/.ci/wininstall_docker.sh b/.ci/wininstall_docker.sh deleted file mode 100755 index 7a51180..0000000 --- a/.ci/wininstall_docker.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -DOCKER_IMAGE=sypingauto/gta5view-build:1.10-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 CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && export QMAKE_BUILD_TYPE=${QMAKE_BUILD_TYPE} && export PACKAGE_VERSION=${PACKAGE_VERSION} && export PACKAGE_BUILD=${PACKAGE_BUILD} && export PACKAGE_CODE=${PACKAGE_CODE} && export EXECUTABLE_VERSION=${EXECUTABLE_VERSION} && export EXECUTABLE_ARCH=${EXECUTABLE_ARCH} && cd ${PROJECT_DIR_DOCKER} && .ci/wininstall_build.sh" diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index ba4a1c5..0000000 --- a/.drone.yml +++ /dev/null @@ -1,36 +0,0 @@ -kind: pipeline -type: docker - -environment: - BUILD_TYPE: "REL" - -steps: -- name: Windows Installer - image: sypingauto/gta5view-build:1.10-shared - environment: - BUILD_SCRIPT: "wininstall_build.sh" - QT_SELECT: "qt5-x86_64-w64-mingw32" - TCA_PASS: - from_secret: tca_pass - commands: - - .drone/drone.sh - volumes: - - name: gta5view - path: /srv/gta5view -- name: Windows Portable - image: sypingauto/gta5view-build:1.10-static - environment: - BUILD_SCRIPT: "windows_build.sh" - QT_SELECT: "qt5-x86_64-w64-mingw32" - TCA_PASS: - from_secret: tca_pass - commands: - - .drone/drone.sh - volumes: - - name: gta5view - path: /srv/gta5view - -volumes: -- name: gta5view - host: - path: /srv/gta5view diff --git a/.drone/TelemetryClassAuthenticator.cpp.enc b/.drone/TelemetryClassAuthenticator.cpp.enc deleted file mode 100644 index e905d2f..0000000 Binary files a/.drone/TelemetryClassAuthenticator.cpp.enc and /dev/null differ diff --git a/.drone/drone.sh b/.drone/drone.sh deleted file mode 100755 index b489e12..0000000 --- a/.drone/drone.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# Cleanup previous Drone build -if [ -d "assets" ]; then - rm -rf assets -fi -if [ -d "build" ]; then - rm -rf build -fi - -# Decrypt Telemetry Authenticator -rm -rf tmext/TelemetryClassAuthenticator.cpp && \ -openssl aes-256-cbc -k ${TCA_PASS} -in .drone/TelemetryClassAuthenticator.cpp.enc -out tmext/TelemetryClassAuthenticator.cpp -d -pbkdf2 - -# Check if build is not tagged -if [ "${DRONE_TAG}" == "" ]; then - export EXECUTABLE_TAG=-$(git rev-parse --short HEAD) -else - export EXECUTABLE_TAG= -fi - -# Check if package code is not set -if [ "${PACKAGE_CODE}" == "" ]; then - export PACKAGE_CODE=Drone -fi - -# Init Application Commit Hash -export APPLICATION_COMMIT=$(git rev-parse --short HEAD) - -# Start CI script and copying assets into gta5view directory -.ci/ci.sh && \ -mkdir -p /srv/gta5view/${APPLICATION_COMMIT} && \ -cp -Rf assets/* /srv/gta5view/${APPLICATION_COMMIT}/ diff --git a/.flatpak/de.syping.gta5view.yaml b/.flatpak/de.syping.gta5view.yaml deleted file mode 100644 index c9a9775..0000000 --- a/.flatpak/de.syping.gta5view.yaml +++ /dev/null @@ -1,22 +0,0 @@ -app-id: de.syping.gta5view -runtime: org.kde.Platform -runtime-version: '5.15-21.08' -sdk: org.kde.Sdk -command: gta5view -finish-args: - - --share=network - - --share=ipc - - --socket=fallback-x11 - - --socket=wayland - - --device=dri -modules: - - name: gta5view - buildsystem: cmake-ninja - config-opts: - - -DFLATPAK_BUILD=ON - - -DQCONF_BUILD=ON - - -DGTA5VIEW_BUILDCODE=Flatpak - - -DGTA5VIEW_BUILDTYPE=Release - sources: - - type: dir - path: ../ diff --git a/.gitignore b/.gitignore index fcd678b..5da3ae5 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,8 @@ *.out *.app -# Qt project user file +# Qt project user files +CMakeLists.txt.user *.pro.user # Gettext translation files diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 72ea2e6..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -stages: - - build - -variables: - BUILD_TYPE: "REL" - -Windows Installer: - stage: build - image: sypingauto/gta5view-build:1.10-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.10-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" diff --git a/.gitlab/TelemetryClassAuthenticator.cpp.enc b/.gitlab/TelemetryClassAuthenticator.cpp.enc deleted file mode 100644 index 3c7445b..0000000 Binary files a/.gitlab/TelemetryClassAuthenticator.cpp.enc and /dev/null differ diff --git a/.gitlab/gitlab.sh b/.gitlab/gitlab.sh deleted file mode 100755 index 87d2078..0000000 --- a/.gitlab/gitlab.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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/* ./ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8dee407..0000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -dist: bionic -sudo: required - -language: cpp - -services: - - docker - -env: - global: - - BUILD_TYPE=REL - -matrix: - include: - - env: - - BUILD_SCRIPT=debian_docker.sh - - RELEASE_LABEL="Debian 64-Bit Package" - - DEBIAN_VERSION=buster - - 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=wininstall_docker.sh - - QT_SELECT=qt5-x86_64-w64-mingw32 - - RELEASE_LABEL="Windows 64-Bit Installer" - - os: osx - osx_image: xcode12.2 - env: - - BUILD_SCRIPT=osx_ci.sh - - RELEASE_LABEL="Mac OS X 64-Bit Disk Image" - -before_install: - - ".travis/source.sh" - -script: - - ".travis/travis.sh" - -deploy: - provider: releases - api_key: - secure: o7VneEz1aHfdVwZvOZLfopf6uJWNrFsZaBvunTmXFzpmNFhlNS1qwqgMUkIA2yBRbZ3wIzVs4vfwIHv7W9yE/PqK+AYL+R8+AwKGrwlgT4HqJNuk6VM/LNJ6GwT/qkQuaoOVw29bUjmzzgIRdHmw53SlJv6Hh1VE8HphlTT//aex6nCfcFhUZ0BETdZDWz5FSHwL3NalUoqfKfQrJeky5RXzCyCANQC2tKt0bV46GaWIgWrDo2KCTNqPtRWWf5GDmnkXE5IYRMQ3mXvO9iYh0v5Y2jo4PiXGUiFUU6Z3aAWFAiPdGclrBO697cf3lCTzDMhuCETR153qFYsLShUlFf61ITAmCeHAWETjZDri0lmPONo3GoNB6alGfYEA51qw14kXakrTpICtTJj7gw/gtUYOabW6hrzmieNzMBIy62RikDPjyakFnuwW2qNHRlD65e0jYv+6nCpb6E+OV16Ysh1zhV2vTfpfzVmSuyu2J+ELqXD3OZCXRSPpDIih9UQ8335p8FBji6jHORcgym/TRgdgRmENibh8tLzWp+UjpWHuWfcpvZgOskjfwU0iDMCayMJ7tDpOhXHcAhDRnd6XRIiOJ5YZCzflj2nEwmt3YUd7DwXS/AU+WHOmcNQBjXBxF/FJa35XXcy3HKJM5TTKqtph3medo30us5yXHeG6NNg= - label: ${RELEASE_LABEL} - file_glob: true - file: assets/* - skip_cleanup: true - on: - tags: true diff --git a/.travis/TelemetryClassAuthenticator.cpp.enc b/.travis/TelemetryClassAuthenticator.cpp.enc deleted file mode 100644 index 498ad86..0000000 Binary files a/.travis/TelemetryClassAuthenticator.cpp.enc and /dev/null differ diff --git a/.travis/dropbox_uploader.enc b/.travis/dropbox_uploader.enc deleted file mode 100644 index 60a77f9..0000000 --- a/.travis/dropbox_uploader.enc +++ /dev/null @@ -1 +0,0 @@ -Po§èQƒŠN×<ì1x£%™{ ¬Èw|RtZvö[kÎçòéAZãå2Á›øŸÎ«`ïJÑ,4vÖÏ¥@€®¦eÊ¥~U$+‡žóP€÷|ˆy<à±&–Hê¤ \ No newline at end of file diff --git a/.travis/source.sh b/.travis/source.sh deleted file mode 100755 index 833e125..0000000 --- a/.travis/source.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/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 diff --git a/.travis/travis.sh b/.travis/travis.sh deleted file mode 100755 index 94154d5..0000000 --- a/.travis/travis.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 diff --git a/.travis/ubuntu_travis.sh b/.travis/ubuntu_travis.sh deleted file mode 100755 index d93bcbd..0000000 --- a/.travis/ubuntu_travis.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Install packages -sudo .ci/debian_install.sh && \ - -# Build gta5view -sudo .ci/debian_build.sh && \ -cd ${PROJECT_DIR} diff --git a/CMakeLists.txt b/CMakeLists.txt index cbb26a5..73d6c73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.7) -project(gta5view LANGUAGES C CXX) +project(gta5view VERSION 1.11.0 LANGUAGES C CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -38,7 +38,7 @@ if(APPLE) res/gta5view.icns ) set(MACOSX_BUNDLE_BUNDLE_NAME gta5view) - set(MACOSX_BUNDLE_BUNDLE_VERSION 1.10.1) + set(MACOSX_BUNDLE_BUNDLE_VERSION ${gta5view_VERSION}) set(MACOSX_BUNDLE_ICON_FILE gta5view.icns) set(MACOSX_BUNDLE_GUI_IDENTIFIER de.syping.gta5view) set_source_files_properties(res/gta5view.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") @@ -50,111 +50,112 @@ list(APPEND GTA5VIEW_DEFINES ) set(GTA5VIEW_SOURCES - main.cpp - AboutDialog.cpp - AppEnv.cpp - CrewDatabase.cpp - DatabaseThread.cpp - ExportDialog.cpp - ExportThread.cpp - GlobalString.cpp - IconLoader.cpp - ImportDialog.cpp - JsonEditorDialog.cpp - MapLocationDialog.cpp - OptionsDialog.cpp - PictureDialog.cpp - PictureExport.cpp - PictureWidget.cpp - PlayerListDialog.cpp - ProfileDatabase.cpp - ProfileInterface.cpp - ProfileLoader.cpp - ProfileWidget.cpp - RagePhoto.cpp - SavegameCopy.cpp - SavegameData.cpp - SavegameDialog.cpp - SavegameWidget.cpp - SidebarGenerator.cpp - SnapmaticEditor.cpp - SnapmaticPicture.cpp - SnapmaticWidget.cpp - StandardPaths.cpp - StringParser.cpp - TranslationClass.cpp - UserInterface.cpp - anpro/imagecropper.cpp - pcg/pcg_basic.c - uimod/JSHighlighter.cpp - uimod/UiModLabel.cpp - uimod/UiModWidget.cpp + src/main.cpp + src/AboutDialog.cpp + src/AppEnv.cpp + src/CrewDatabase.cpp + src/DatabaseThread.cpp + src/ExportDialog.cpp + src/ExportThread.cpp + src/GlobalString.cpp + src/IconLoader.cpp + src/ImportDialog.cpp + src/JsonEditorDialog.cpp + src/MapLocationDialog.cpp + src/OptionsDialog.cpp + src/PictureDialog.cpp + src/PictureExport.cpp + src/PictureWidget.cpp + src/PlayerListDialog.cpp + src/ProfileDatabase.cpp + src/ProfileInterface.cpp + src/ProfileLoader.cpp + src/ProfileWidget.cpp + src/RagePhoto.cpp + src/SavegameCopy.cpp + src/SavegameData.cpp + src/SavegameDialog.cpp + src/SavegameWidget.cpp + src/SidebarGenerator.cpp + src/SnapmaticEditor.cpp + src/SnapmaticPicture.cpp + src/SnapmaticWidget.cpp + src/StandardPaths.cpp + src/StringParser.cpp + src/TranslationClass.cpp + src/UserInterface.cpp + src/anpro/imagecropper.cpp + src/pcg/pcg_basic.c + src/uimod/JSHighlighter.cpp + src/uimod/UiModLabel.cpp + src/uimod/UiModWidget.cpp ) set(GTA5VIEW_HEADERS - config.h - wrapper.h - AboutDialog.h - AppEnv.h - CrewDatabase.h - DatabaseThread.h - ExportDialog.h - ExportThread.h - GlobalString.h - IconLoader.h - ImportDialog.h - JsonEditorDialog.h - MapLocationDialog.h - OptionsDialog.h - PictureDialog.h - PictureExport.h - PictureWidget.h - PlayerListDialog.h - ProfileDatabase.h - ProfileInterface.h - ProfileLoader.h - ProfileWidget.h - RagePhoto.h - SavegameCopy.h - SavegameData.h - SavegameDialog.h - SavegameWidget.h - SidebarGenerator.h - SnapmaticEditor.h - SnapmaticPicture.h - SnapmaticWidget.h - StandardPaths.h - StringParser.h - TranslationClass.h - UserInterface.h - anpro/imagecropper.h - pcg/pcg_basic.h - uimod/JSHighlighter.h - uimod/UiModLabel.h - uimod/UiModWidget.h + src/config.h + src/wrapper.h + src/AboutDialog.h + src/AppEnv.h + src/CrewDatabase.h + src/DatabaseThread.h + src/ExportDialog.h + src/ExportThread.h + src/GlobalString.h + src/IconLoader.h + src/ImportDialog.h + src/JsonEditorDialog.h + src/MapLocationDialog.h + src/OptionsDialog.h + src/PictureDialog.h + src/PictureExport.h + src/PictureWidget.h + src/PlayerListDialog.h + src/ProfileDatabase.h + src/ProfileInterface.h + src/ProfileLoader.h + src/ProfileWidget.h + src/RagePhoto.h + src/SavegameCopy.h + src/SavegameData.h + src/SavegameDialog.h + src/SavegameWidget.h + src/SidebarGenerator.h + src/SnapmaticEditor.h + src/SnapmaticPicture.h + src/SnapmaticWidget.h + src/StandardPaths.h + src/StringParser.h + src/TranslationClass.h + src/UserInterface.h + src/anpro/imagecropper.h + src/pcg/pcg_basic.h + src/uimod/JSHighlighter.h + src/uimod/UiModLabel.h + src/uimod/UiModWidget.h ) set(GTA5VIEW_INCLUDEDIR - anpro - pcg - uimod + src + src/anpro + src/pcg + src/uimod ) set(GTA5VIEW_FORMS - AboutDialog.ui - ExportDialog.ui - ImportDialog.ui - JsonEditorDialog.ui - MapLocationDialog.ui - OptionsDialog.ui - PictureDialog.ui - PlayerListDialog.ui - ProfileInterface.ui - SavegameDialog.ui - SavegameWidget.ui - SnapmaticEditor.ui - SnapmaticWidget.ui - UserInterface.ui + src/AboutDialog.ui + src/ExportDialog.ui + src/ImportDialog.ui + src/JsonEditorDialog.ui + src/MapLocationDialog.ui + src/OptionsDialog.ui + src/PictureDialog.ui + src/PlayerListDialog.ui + src/ProfileInterface.ui + src/SavegameDialog.ui + src/SavegameWidget.ui + src/SnapmaticEditor.ui + src/SnapmaticWidget.ui + src/UserInterface.ui ) set(GTA5VIEW_TRANSLATIONS @@ -222,10 +223,10 @@ option(WITH_DONATE "Donate menu option and donation dialog" OFF) if(WITH_DONATE) set(DONATE_ADDRESSES "" CACHE STRING "Donation addresses") list(APPEND GTA5VIEW_HEADERS - anpro/QrCode.h + src/anpro/QrCode.h ) list(APPEND GTA5VIEW_SOURCES - anpro/QrCode.cpp + src/anpro/QrCode.cpp ) list(APPEND GTA5VIEW_DEFINES -DGTA5SYNC_DONATE @@ -244,10 +245,10 @@ option(WITH_MOTD "Developer message system directed to users" OFF) if(WITH_MOTD) set(MOTD_WEBURL "" CACHE STRING "Messages WebURL") list(APPEND GTA5VIEW_HEADERS - MessageThread.h + src/MessageThread.h ) list(APPEND GTA5VIEW_SOURCES - MessageThread.cpp + src/MessageThread.cpp ) list(APPEND GTA5VIEW_DEFINES -DGTA5SYNC_MOTD @@ -267,15 +268,15 @@ if(WITH_TELEMETRY) set(TELEMETRY_REGURL "" CACHE STRING "Telemetry RegURL") set(TELEMETRY_WEBURL "" CACHE STRING "Telemetry WebURL") list(APPEND GTA5VIEW_HEADERS - TelemetryClass.h - tmext/TelemetryClassAuthenticator.h + src/TelemetryClass.h + src/tmext/TelemetryClassAuthenticator.h ) list(APPEND GTA5VIEW_SOURCES - TelemetryClass.cpp - tmext/TelemetryClassAuthenticator.cpp + src/TelemetryClass.cpp + src/tmext/TelemetryClassAuthenticator.cpp ) list(APPEND GTA5VIEW_INCLUDEDIR - tmext + src/tmext ) list(APPEND GTA5VIEW_DEFINES -DGTA5SYNC_TELEMETRY @@ -351,7 +352,7 @@ if(LINGUIST_FOUND AND QCONF_BUILD) endif() if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0") - target_precompile_headers(gta5view PRIVATE config.h) + target_precompile_headers(gta5view PRIVATE src/config.h) endif() if(Qt5Core_VERSION VERSION_GREATER_EQUAL "5.14.0") diff --git a/gta5view.pro b/gta5view.pro deleted file mode 100644 index 9326210..0000000 --- a/gta5view.pro +++ /dev/null @@ -1,285 +0,0 @@ -#/***************************************************************************** -#* gta5view Grand Theft Auto V Profile Viewer -#* Copyright (C) 2015-2021 Syping -#* -#* This program is free software: you can redistribute it and/or modify -#* it under the terms of the GNU General Public License as published by -#* the Free Software Foundation, either version 3 of the License, or -#* (at your option) any later version. -#* -#* This program is distributed in the hope that it will be useful, -#* but WITHOUT ANY WARRANTY; without even the implied warranty of -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#* GNU General Public License for more details. -#* -#* You should have received a copy of the GNU General Public License -#* along with this program. If not, see . -#*****************************************************************************/ - -QT += core gui network svg - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -greaterThan(QT_MAJOR_VERSION, 4): win32: LIBS += -ldwmapi - -DEPLOYMENT.display_name = gta5view -TARGET = gta5view -TEMPLATE = app - -HEADERS += config.h \ - wrapper.h -PRECOMPILED_HEADER += config.h - -SOURCES += main.cpp \ - AboutDialog.cpp \ - AppEnv.cpp \ - CrewDatabase.cpp \ - DatabaseThread.cpp \ - ExportDialog.cpp \ - ExportThread.cpp \ - GlobalString.cpp \ - IconLoader.cpp \ - ImportDialog.cpp \ - JsonEditorDialog.cpp \ - MapLocationDialog.cpp \ - MessageThread.cpp \ - OptionsDialog.cpp \ - PictureDialog.cpp \ - PictureExport.cpp \ - PictureWidget.cpp \ - PlayerListDialog.cpp \ - ProfileDatabase.cpp \ - ProfileInterface.cpp \ - ProfileLoader.cpp \ - ProfileWidget.cpp \ - RagePhoto.cpp \ - SavegameCopy.cpp \ - SavegameData.cpp \ - SavegameDialog.cpp \ - SavegameWidget.cpp \ - SidebarGenerator.cpp \ - SnapmaticEditor.cpp \ - SnapmaticPicture.cpp \ - SnapmaticWidget.cpp \ - StandardPaths.cpp \ - StringParser.cpp \ - TelemetryClass.cpp \ - TranslationClass.cpp \ - UserInterface.cpp \ - anpro/imagecropper.cpp \ - pcg/pcg_basic.c \ - tmext/TelemetryClassAuthenticator.cpp \ - uimod/JSHighlighter.cpp \ - uimod/UiModLabel.cpp \ - uimod/UiModWidget.cpp - -HEADERS += \ - AboutDialog.h \ - AppEnv.h \ - CrewDatabase.h \ - DatabaseThread.h \ - ExportDialog.h \ - ExportThread.h \ - GlobalString.h \ - IconLoader.h \ - ImportDialog.h \ - JsonEditorDialog.h \ - MapLocationDialog.h \ - MessageThread.h \ - OptionsDialog.h \ - PictureDialog.h \ - PictureExport.h \ - PictureWidget.h \ - PlayerListDialog.h \ - ProfileDatabase.h \ - ProfileInterface.h \ - ProfileLoader.h \ - ProfileWidget.h \ - RagePhoto.h \ - SavegameCopy.h \ - SavegameData.h \ - SavegameDialog.h \ - SavegameWidget.h \ - SidebarGenerator.h \ - SnapmaticEditor.h \ - SnapmaticPicture.h \ - SnapmaticWidget.h \ - StandardPaths.h \ - StringParser.h \ - TelemetryClass.h \ - TranslationClass.h \ - UserInterface.h \ - anpro/imagecropper.h \ - anpro/imagecropper_e.h \ - anpro/imagecropper_p.h \ - pcg/pcg_basic.h \ - tmext/TelemetryClassAuthenticator.h \ - uimod/JSHighlighter.h \ - uimod/UiModLabel.h \ - uimod/UiModWidget.h - -FORMS += \ - AboutDialog.ui \ - ExportDialog.ui \ - ImportDialog.ui \ - JsonEditorDialog.ui \ - MapLocationDialog.ui \ - OptionsDialog.ui \ - PictureDialog.ui \ - PlayerListDialog.ui \ - ProfileInterface.ui \ - SavegameDialog.ui \ - SavegameWidget.ui \ - SnapmaticEditor.ui \ - SnapmaticWidget.ui \ - UserInterface.ui - -TRANSLATIONS += \ - res/gta5sync.ts \ - res/gta5sync_de.ts \ - res/gta5sync_en_US.ts \ - res/gta5sync_fr.ts \ - res/gta5sync_ko.ts \ - res/gta5sync_ru.ts \ - res/gta5sync_uk.ts \ - res/gta5sync_zh_TW.ts - -RESOURCES += \ - res/img.qrc \ - res/template.qrc \ - res/tr_g5p.qrc - -DISTFILES += \ - res/gta5view-16.png \ - res/gta5view-24.png \ - res/gta5view-32.png \ - res/gta5view-40.png \ - res/gta5view-48.png \ - res/gta5view-64.png \ - res/gta5view-96.png \ - res/gta5view-128.png \ - res/gta5view-256.png \ - res/gta5view-512.png \ - res/app.rc \ - res/de.syping.gta5view.desktop \ - res/de.syping.gta5view.png \ - res/gta5sync_de.ts \ - res/gta5sync_en_US.ts \ - res/gta5sync_fr.ts \ - res/gta5sync_ko.ts \ - res/gta5sync_ru.ts \ - res/gta5sync_uk.ts \ - res/gta5sync_zh_TW.ts \ - res/gta5view.exe.manifest \ - res/gta5view.png \ - lang/README.txt - -INCLUDEPATH += ./anpro ./pcg ./tmext ./uimod - -# GTA5SYNC/GTA5VIEW ONLY - -DEFINES += GTA5SYNC_QMAKE # We using qmake do we? -DEFINES += GTA5SYNC_PROJECT # Enable exclusive gta5sync/gta5view functions - -# WINDOWS ONLY - -win32: RC_FILE += res/app.rc -win32: CONFIG -= embed_manifest_exe -contains(DEFINES, GTA5SYNC_TELEMETRY): win32: LIBS += -ld3d9 # Required for getting information about GPU - -# MAC OS X ONLY -macx: ICON = res/gta5view.icns - -# QT4 ONLY STUFF - -isEqual(QT_MAJOR_VERSION, 4): INCLUDEPATH += ./qjson4 -isEqual(QT_MAJOR_VERSION, 4): HEADERS += qjson4/QJsonArray.h \ - qjson4/QJsonDocument.h \ - qjson4/QJsonObject.h \ - qjson4/QJsonParseError.h \ - qjson4/QJsonValue.h \ - qjson4/QJsonValueRef.h \ - qjson4/QJsonParser.h \ - qjson4/QJsonRoot.h - -isEqual(QT_MAJOR_VERSION, 4): SOURCES += qjson4/QJsonArray.cpp \ - qjson4/QJsonDocument.cpp \ - qjson4/QJsonObject.cpp \ - qjson4/QJsonParseError.cpp \ - qjson4/QJsonValue.cpp \ - qjson4/QJsonValueRef.cpp \ - qjson4/QJsonParser.cpp - -isEqual(QT_MAJOR_VERSION, 4): RESOURCES += res/qt4/tr_qt.qrc -isEqual(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_INSTALL_BINS]/rcc - -# QT5 ONLY STUFF - -isEqual(QT_MAJOR_VERSION, 5): RESOURCES += res/qt5/tr_qt.qrc - -# QT5+ ONLY STUFF - -greaterThan(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc - -# QT6 ONLY STUFF - -isEqual(QT_MAJOR_VERSION, 6): RESOURCES += res/qt6/tr_qt.qrc - -# RESOURCE COMPILATION - -system($$GTA5SYNC_RCC -threshold 0 -compress 9 $$PWD/res/global.qrc -o $$OUT_PWD/qrc_global.cpp) { - SOURCES += $$OUT_PWD/qrc_global.cpp -} else { - message("Failed to generate qrc_global.cpp") -} - -# PROJECT INSTALLATION - -isEmpty(GTA5SYNC_PREFIX): GTA5SYNC_PREFIX = /usr/local - -appfiles.path = $$GTA5SYNC_PREFIX/share/applications -appfiles.files = $$PWD/res/de.syping.gta5view.desktop -pixmaps.path = $$GTA5SYNC_PREFIX/share/pixmaps -pixmaps.files = $$PWD/res/de.syping.gta5view.png -target.path = $$GTA5SYNC_PREFIX/bin -INSTALLS += target pixmaps appfiles - -# QCONF BASED BUILD STUFF - -contains(DEFINES, GTA5SYNC_QCONF) { - isEqual(QT_MAJOR_VERSION, 4): RESOURCES -= res/qt4/tr_qt.qrc - isEqual(QT_MAJOR_VERSION, 5): RESOURCES -= res/qt5/tr_qt.qrc - isEqual(QT_MAJOR_VERSION, 6): RESOURCES -= res/qt6/tr_qt.qrc - !contains(DEFINES, GTA5SYNC_QCONF_IN) { - RESOURCES -= res/tr_g5p.qrc - langfiles.path = $$GTA5SYNC_PREFIX/share/gta5view/translations - langfiles.files = $$PWD/res/gta5sync_en_US.qm $$PWD/res/gta5sync_de.qm $$PWD/res/gta5sync_fr.qm $$PWD/res/gta5sync_ko.qm $$PWD/res/gta5sync_ru.qm $$PWD/res/gta5sync_uk.qm $$PWD/res/gta5sync_zh_TW.qm $$PWD/res/qtbase_en_GB.qm - INSTALLS += langfiles - } -} - -# TELEMETRY BASED STUFF - -!contains(DEFINES, GTA5SYNC_TELEMETRY) { - SOURCES -= TelemetryClass.cpp \ - tmext/TelemetryClassAuthenticator.cpp - HEADERS -= TelemetryClass.h \ - tmext/TelemetryClassAuthenticator.h -} - -!contains(DEFINES, GTA5SYNC_MOTD) { - SOURCES -= MessageThread.cpp - HEADERS -= MessageThread.h -} else { - lessThan(QT_MAJOR_VERSION, 5) { - SOURCES -= MessageThread.cpp - HEADERS -= MessageThread.h - DEFINES -= GTA5SYNC_MOTD - message("Messages require Qt5 or newer!") - } -} - -# CMAKE BASED STUFF - -greaterThan(QT_MAJOR_VERSION, 4) { - message("Building gta5view with QMake is deprecated, please use CMake instead!") -} diff --git a/lang/README.txt b/lang/README.txt deleted file mode 100644 index fd72055..0000000 --- a/lang/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -Community translation files - -They get loaded in ApplicationPathExecFileFolder/lang - -You can help translate with using Qt Linguist, after you've translated you'll need to send me a pull request on https://github.com/SyDevTeam/gta5view diff --git a/qjson4/QJsonArray b/qjson4/QJsonArray deleted file mode 100644 index 89dbf4e..0000000 --- a/qjson4/QJsonArray +++ /dev/null @@ -1 +0,0 @@ -#include "QJsonArray.h" diff --git a/qjson4/QJsonArray.cpp b/qjson4/QJsonArray.cpp deleted file mode 100644 index ad8a82b..0000000 --- a/qjson4/QJsonArray.cpp +++ /dev/null @@ -1,410 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#include "QJsonArray.h" -#include "QJsonValueRef.h" -#include "QJsonValue.h" -#include - -#if QT_VERSION < 0x050000 - -//------------------------------------------------------------------------------ -// Name: QJsonArray -// Desc: default constructor -//------------------------------------------------------------------------------ -QJsonArray::QJsonArray() { - -} - -//------------------------------------------------------------------------------ -// Name: QJsonArray -// Desc: copy constructor -//------------------------------------------------------------------------------ -QJsonArray::QJsonArray(const QJsonArray &other) : values_(other.values_) { - -} - -#if __cplusplus >= 201103L -//------------------------------------------------------------------------------ -// Name: QJsonArray -// Desc: Creates an array initialized from args initialization list. -//------------------------------------------------------------------------------ -QJsonArray::QJsonArray(std::initializer_list args) { - for(const QJsonValue &arg : args) { - values_.append(arg); - } -} -#endif - -//------------------------------------------------------------------------------ -// Name: ~QJsonArray -// Desc: destructor -//------------------------------------------------------------------------------ -QJsonArray::~QJsonArray() { - -} - -//------------------------------------------------------------------------------ -// Name: operator= -// Desc: assignment operator -//------------------------------------------------------------------------------ -QJsonArray &QJsonArray::operator=(const QJsonArray &other) { - QJsonArray(other).swap(*this); - return *this; -} - -//------------------------------------------------------------------------------ -// Name: operator+= -// Desc: -//------------------------------------------------------------------------------ -QJsonArray &QJsonArray::operator+=(const QJsonValue &value) { - values_.append(value); - return *this; -} - -//------------------------------------------------------------------------------ -// Name: operator<< -// Desc: -//------------------------------------------------------------------------------ -QJsonArray &QJsonArray::operator<<(const QJsonValue &value) { - values_.append(value); - return *this; -} - -//------------------------------------------------------------------------------ -// Name: operator+ -// Desc: -//------------------------------------------------------------------------------ -QJsonArray QJsonArray::operator+(const QJsonValue &value) const { - QJsonArray arr(*this); - arr.append(value); - return arr; -} - -//------------------------------------------------------------------------------ -// Name: operator!= -// Desc: returns true if the compared array IS NOT equal to this -//------------------------------------------------------------------------------ -bool QJsonArray::operator!=(const QJsonArray &other) const { - return values_ != other.values_; -} - -//------------------------------------------------------------------------------ -// Name: operator== -// Desc: returns true if the compared array IS equal to this -//------------------------------------------------------------------------------ -bool QJsonArray::operator==(const QJsonArray &other) const { - return values_ == other.values_; -} - -//------------------------------------------------------------------------------ -// Name: begin -// Desc: returns an iterator to the first contained element -//------------------------------------------------------------------------------ -QJsonArray::const_iterator QJsonArray::begin() const { - return values_.begin(); -} - -//------------------------------------------------------------------------------ -// Name: end -// Desc: returns an iterator to one past the last contained element -//------------------------------------------------------------------------------ -QJsonArray::const_iterator QJsonArray::end() const { - return values_.end(); -} - -//------------------------------------------------------------------------------ -// Name: begin -// Desc: returns an iterator to the first contained element -//------------------------------------------------------------------------------ -QJsonArray::iterator QJsonArray::begin() { - return values_.begin(); -} - -//------------------------------------------------------------------------------ -// Name: end -// Desc: returns an iterator to one past the last contained element -//------------------------------------------------------------------------------ -QJsonArray::iterator QJsonArray::end() { - return values_.end(); -} - -//------------------------------------------------------------------------------ -// Name: constBegin -// Desc: returns an iterator to the first contained element -//------------------------------------------------------------------------------ -QJsonArray::const_iterator QJsonArray::constBegin() const { - return begin(); -} - -//------------------------------------------------------------------------------ -// Name: constEnd -// Desc: returns an iterator to one past the last contained element -//------------------------------------------------------------------------------ -QJsonArray::const_iterator QJsonArray::constEnd() const { - return end(); -} - -//------------------------------------------------------------------------------ -// Name: first -// Desc: returns the first element by value -//------------------------------------------------------------------------------ -QJsonValue QJsonArray::first() const { - Q_ASSERT(!empty()); - return values_.first(); -} - -//------------------------------------------------------------------------------ -// Name: last -// Desc: returns the last element by value -//------------------------------------------------------------------------------ -QJsonValue QJsonArray::last() const { - Q_ASSERT(!empty()); - return values_.last(); -} - -//------------------------------------------------------------------------------ -// Name: operator[] -//------------------------------------------------------------------------------ -QJsonValueRef QJsonArray::operator[](int i) { - return QJsonValueRef(this, i); -} - -//------------------------------------------------------------------------------ -// Name: operator[] -//------------------------------------------------------------------------------ -QJsonValue QJsonArray::operator[](int i) const { - return values_[i]; -} - -//------------------------------------------------------------------------------ -// Name: at -//------------------------------------------------------------------------------ -QJsonValue QJsonArray::at(int i) const { - return values_.at(i); -} - -//------------------------------------------------------------------------------ -// Name: size -//------------------------------------------------------------------------------ -int QJsonArray::size() const { - return values_.size(); -} - -//------------------------------------------------------------------------------ -// Name: count -//------------------------------------------------------------------------------ -int QJsonArray::count() const { - return size(); -} - -//------------------------------------------------------------------------------ -// Name: empty -//------------------------------------------------------------------------------ -bool QJsonArray::empty() const { - return values_.empty(); -} - -//------------------------------------------------------------------------------ -// Name: isEmpty -//------------------------------------------------------------------------------ -bool QJsonArray::isEmpty() const { - return empty(); -} - -//------------------------------------------------------------------------------ -// Name: pop_back -//------------------------------------------------------------------------------ -void QJsonArray::pop_back() { - values_.pop_back(); -} - -//------------------------------------------------------------------------------ -// Name: pop_front -//------------------------------------------------------------------------------ -void QJsonArray::pop_front() { - values_.pop_front(); -} - -//------------------------------------------------------------------------------ -// Name: push_back -//------------------------------------------------------------------------------ -void QJsonArray::push_back(const QJsonValue &value) { - values_.push_back(value); -} - -//------------------------------------------------------------------------------ -// Name: push_front -//------------------------------------------------------------------------------ -void QJsonArray::push_front(const QJsonValue &value) { - values_.push_front(value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::append(const QJsonValue &value) { - values_.append(value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -bool QJsonArray::contains(const QJsonValue &value) const { - return values_.contains(value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonArray::iterator QJsonArray::erase(iterator it) { - return values_.erase(it); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::insert(int i, const QJsonValue &value) { - values_.insert(i, value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonArray::iterator QJsonArray::insert(iterator before, const QJsonValue &value) { - return values_.insert(before, value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::prepend(const QJsonValue &value) { - values_.prepend(value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::removeAt(int i) { - values_.removeAt(i); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::removeFirst() { - values_.removeFirst(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::removeLast() { - values_.removeLast(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::replace(int i, const QJsonValue &value) { - values_.replace(i, value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonValue QJsonArray::takeAt(int i) { - return values_.takeAt(i); -} - -//------------------------------------------------------------------------------ -// Name: toVariantList -//------------------------------------------------------------------------------ -QVariantList QJsonArray::toVariantList() const { - QVariantList a; - Q_FOREACH(const QJsonValue &v, *this) { - a.push_back(v.toVariant()); - } - return a; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonArray QJsonArray::fromStringList(const QStringList &list) { - QJsonArray a; - Q_FOREACH(const QString &s, list) { - a.push_back(QJsonValue(s)); - } - return a; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonArray QJsonArray::fromVariantList(const QVariantList &list) { - QJsonArray a; - Q_FOREACH(const QVariant &v, list) { - a.push_back(QJsonValue::fromVariant(v)); - } - return a; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonRoot *QJsonArray::clone() const { - return new QJsonArray(*this); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -const QJsonObject *QJsonArray::toObject() const { - return 0; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject *QJsonArray::toObject() { - return 0; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonArray *QJsonArray::toArray() { - return this; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -const QJsonArray *QJsonArray::toArray() const { - return this; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonArray::swap(QJsonArray &other) { - qSwap(values_, other.values_); -} - -#endif diff --git a/qjson4/QJsonArray.h b/qjson4/QJsonArray.h deleted file mode 100644 index dc4fc69..0000000 --- a/qjson4/QJsonArray.h +++ /dev/null @@ -1,139 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#ifndef QJSON_ARRAY_H_ -#define QJSON_ARRAY_H_ - -#include - -#if QT_VERSION >= 0x050000 -#include -#else - -#include "QJsonRoot.h" -#include -#include - -class QJsonValue; -class QJsonValueRef; - -class QJsonArray : public QJsonRoot { - friend class QJsonDocument; - friend class QJsonValue; - friend class QJsonValueRef; - friend class QJsonParser; -public: - // TODO(eteran): manually implement the array, for now we use QList - // but the real thing has a custom implementation - // I guess for the purposes of less interdependancies? - // maybe so it's easier to forward declare the iterators? - - typedef QList::const_iterator const_iterator; - typedef QList::iterator iterator; - typedef const_iterator ConstIterator; - typedef iterator Iterator; - typedef QList::const_pointer const_pointer; - typedef QList::const_reference const_reference; - typedef QList::difference_type difference_type; - typedef QList::pointer pointer; - typedef QList::reference reference; - typedef QList::size_type size_type; - typedef QList::value_type value_type; - -public: - QJsonArray(); - QJsonArray(const QJsonArray &other); -#if __cplusplus >= 201103L - QJsonArray(std::initializer_list args); -#endif - ~QJsonArray(); - -public: - QJsonArray &operator=(const QJsonArray &other); - -public: - bool operator!=(const QJsonArray &other) const; - bool operator==(const QJsonArray &other) const; - QJsonArray operator+(const QJsonValue &value) const; - QJsonArray &operator+=(const QJsonValue &value); - QJsonArray &operator<<(const QJsonValue &value); - -public: - const_iterator begin() const; - const_iterator end() const; - iterator begin(); - iterator end(); - const_iterator constBegin() const; - const_iterator constEnd() const; - -public: - QJsonValueRef operator[](int i); - QJsonValue operator[](int i) const; - QJsonValue at(int i) const; - QJsonValue first() const; - QJsonValue last() const; - -public: - int size() const; - int count() const; - bool empty() const; - bool isEmpty() const; - -public: - void pop_back(); - void pop_front(); - void push_back(const QJsonValue &value); - void push_front(const QJsonValue &value); - -public: - void append(const QJsonValue &value); - bool contains(const QJsonValue &value) const; - iterator erase(iterator it); - void insert(int i, const QJsonValue &value); - iterator insert(iterator before, const QJsonValue &value); - void prepend(const QJsonValue &value); - void removeAt(int i); - void removeFirst(); - void removeLast(); - void replace(int i, const QJsonValue &value); - QJsonValue takeAt(int i); - -public: - QVariantList toVariantList() const; - -public: - static QJsonArray fromStringList(const QStringList &list); - static QJsonArray fromVariantList(const QVariantList &list); - -private: - virtual QJsonRoot *clone() const; - virtual QJsonArray *toArray(); - virtual QJsonObject *toObject(); - virtual const QJsonArray *toArray() const; - virtual const QJsonObject *toObject() const; - -private: - void swap(QJsonArray &other); - -private: - QList values_; -}; - -#endif - -#endif diff --git a/qjson4/QJsonDocument b/qjson4/QJsonDocument deleted file mode 100644 index f652bf4..0000000 --- a/qjson4/QJsonDocument +++ /dev/null @@ -1 +0,0 @@ -#include "QJsonDocument.h" diff --git a/qjson4/QJsonDocument.cpp b/qjson4/QJsonDocument.cpp deleted file mode 100644 index 7f8ad18..0000000 --- a/qjson4/QJsonDocument.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#include "QJsonDocument.h" -#include "QJsonObject.h" -#include "QJsonArray.h" -#include "QJsonParser.h" - -#include -#include -#include -#include -#include - -#if QT_VERSION < 0x050000 - -//------------------------------------------------------------------------------ -// Name: QJsonDocument -//------------------------------------------------------------------------------ -QJsonDocument::QJsonDocument() : root_(0) { -} - -//------------------------------------------------------------------------------ -// Name: QJsonDocument -//------------------------------------------------------------------------------ -QJsonDocument::QJsonDocument(const QJsonObject &object) : root_(0) { - setObject(object); -} - -//------------------------------------------------------------------------------ -// Name: QJsonDocument -//------------------------------------------------------------------------------ -QJsonDocument::QJsonDocument(const QJsonArray &array) : root_(0) { - setArray(array); -} - -//------------------------------------------------------------------------------ -// Name: QJsonDocument -//------------------------------------------------------------------------------ -QJsonDocument::QJsonDocument(const QJsonDocument &other) : root_(0) { - if(other.root_) { - root_ = other.root_->clone(); - } -} - -//------------------------------------------------------------------------------ -// Name: ~QJsonDocument -//------------------------------------------------------------------------------ -QJsonDocument::~QJsonDocument() { - delete root_; -} - -//------------------------------------------------------------------------------ -// Name: operator= -//------------------------------------------------------------------------------ -QJsonDocument &QJsonDocument::operator=(const QJsonDocument &other) { - QJsonDocument(other).swap(*this); - return *this; -} - -//------------------------------------------------------------------------------ -// Name: operator!= -//------------------------------------------------------------------------------ -bool QJsonDocument::operator!=(const QJsonDocument &other) const { - return !(*this == other); -} - -//------------------------------------------------------------------------------ -// Name: operator== -//------------------------------------------------------------------------------ -bool QJsonDocument::operator==(const QJsonDocument &other) const { - - if(isArray() && other.isArray()) { - return array() == other.array(); - } - - if(isObject() && other.isObject()) { - return object() == other.object(); - } - - if(isEmpty() && other.isEmpty()) { - return true; - } - - if(isNull() && other.isNull()) { - return true; - } - - return false; -} - -//------------------------------------------------------------------------------ -// Name: isArray -//------------------------------------------------------------------------------ -bool QJsonDocument::isArray() const { - return root_ && root_->toArray(); -} - -//------------------------------------------------------------------------------ -// Name: isEmpty -//------------------------------------------------------------------------------ -bool QJsonDocument::isEmpty() const { - - // TODO(eteran): figure out the rules here that Qt5 uses - // it *looks* like they define empty as being NULL - // which is obviously different than this - - return !root_; -} - -//------------------------------------------------------------------------------ -// Name: isNull -//------------------------------------------------------------------------------ -bool QJsonDocument::isNull() const { - return !root_; -} - -//------------------------------------------------------------------------------ -// Name: isObject -//------------------------------------------------------------------------------ -bool QJsonDocument::isObject() const { - return root_ && root_->toObject(); -} - -//------------------------------------------------------------------------------ -// Name: setArray -//------------------------------------------------------------------------------ -void QJsonDocument::setArray(const QJsonArray &array) { - setRoot(array); -} - -//------------------------------------------------------------------------------ -// Name: setObject -//------------------------------------------------------------------------------ -void QJsonDocument::setObject(const QJsonObject &object) { - setRoot(object); -} - -//------------------------------------------------------------------------------ -// Name: setRoot -//------------------------------------------------------------------------------ -void QJsonDocument::setRoot(const QJsonRoot &root) { - delete root_; - root_ = root.clone(); -} - -//------------------------------------------------------------------------------ -// Name: toBinaryData -//------------------------------------------------------------------------------ -QByteArray QJsonDocument::toBinaryData() const { - QByteArray r; - // TODO(eteran): implement this - return r; -} - -//------------------------------------------------------------------------------ -// Name: escapeString -//------------------------------------------------------------------------------ -QString QJsonDocument::escapeString(const QString &s) const { - - QString r; - - Q_FOREACH(QChar ch, s) { - switch(ch.toLatin1()) { - case '\"': r.append("\\\""); break; - case '\\': r.append("\\\\"); break; -#if 0 - case '/': r.append("\\/"); break; -#endif - case '\b': r.append("\\b"); break; - case '\f': r.append("\\f"); break; - case '\n': r.append("\\n"); break; - case '\r': r.append("\\r"); break; - case '\t': r.append("\\t"); break; - default: - r += ch; - break; - } - } - - return r; -} - -//------------------------------------------------------------------------------ -// Name: toJson -//------------------------------------------------------------------------------ -QString QJsonDocument::toJson(const QJsonValue &v, JsonFormat format, int indent) const { - - QString b; - QTextStream ss(&b, QIODevice::WriteOnly | QIODevice::Text); - bool compact = (format == JsonFormat::Compact); - - switch(v.type()) { - case QJsonValue::Null: - ss << "null"; - break; - case QJsonValue::Bool: - ss << (v.toBool() ? "true" : "false"); - break; - case QJsonValue::Double: - { - double d = v.toDouble (); - if (qIsFinite(d)) { - // +2 to format to ensure the expected precision - ss << QByteArray::number(d, 'g', 15 + 2); // ::digits10 is 15 - } else { - ss << "null"; // +INF || -INF || NaN (see RFC4627#section2.4) - } - } - break; - case QJsonValue::String: - ss << '"' << escapeString(v.toString()) << '"'; - break; - case QJsonValue::Array: - { - const QJsonArray a = v.toArray(); - ss << (compact ? "[" : "[\n"); - if(!a.empty()) { - QJsonArray::const_iterator it = a.begin(); - QJsonArray::const_iterator e = a.end(); - - if (!compact) ss << QByteArray(4*indent, ' '); - ss << toJson(*it++, format, indent+1); - - for(;it != e; ++it) { - ss << (compact ? "," : ",\n"); - if (!compact) ss << QByteArray(4*indent, ' '); - ss << toJson(*it, format, indent+1); - } - } - indent--; - ss << (compact ? "]" : QString("\n%1]").arg(QString(4*indent, ' '))); - } - break; - case QJsonValue::Object: - { - const QJsonObject o = v.toObject(); - ss << (compact ? "{" : "{\n"); - if(!o.empty()) { - QJsonObject::const_iterator it = o.begin(); - QJsonObject::const_iterator e = o.end(); - - if (!compact) ss << QByteArray(4*indent, ' '); - ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1); - ++it; - for(;it != e; ++it) { - ss << (compact ? "," : ",\n"); - if (!compact) ss << QByteArray(4*indent, ' '); - ss << '"' << escapeString(it.key()) << (compact ? "\":" : "\": ") << toJson(it.value(), format, indent+1); - } - } - indent--; - ss << (compact ? "}" : QString("\n%1}").arg(QString(4*indent, ' '))); - } - break; - case QJsonValue::Undefined: - Q_ASSERT(0); - break; - } - - return b; -} - -//------------------------------------------------------------------------------ -// Name: toJson -//------------------------------------------------------------------------------ -QByteArray QJsonDocument::toJson(JsonFormat format) const { - - Q_UNUSED(format); - - if(isArray()) { - QString s = toJson(array(), format); - return s.toUtf8(); - } - - if(isObject()) { - QString s = toJson(object(), format); - return s.toUtf8(); - } - - return QByteArray(); -} - -//------------------------------------------------------------------------------ -// Name: toVariant -//------------------------------------------------------------------------------ -QVariant QJsonDocument::toVariant() const { - - if(!isEmpty()) { - if(QJsonObject *const object = root_->toObject()) { - return object->toVariantMap(); - } - - if(QJsonArray *const array = root_->toArray()) { - return array->toVariantList(); - } - } - - return QVariant(); -} - -//------------------------------------------------------------------------------ -// Name: array -//------------------------------------------------------------------------------ -QJsonArray QJsonDocument::array() const { - - if(!isEmpty()) { - if(QJsonArray *const array = root_->toArray()) { - return *array; - } - } - - return QJsonArray(); -} - -//------------------------------------------------------------------------------ -// Name: object -//------------------------------------------------------------------------------ -QJsonObject QJsonDocument::object() const { - - if(!isEmpty()) { - if(QJsonObject *const object = root_->toObject()) { - return *object; - } - } - - return QJsonObject(); -} - -//------------------------------------------------------------------------------ -// Name: rawData -//------------------------------------------------------------------------------ -const char *QJsonDocument::rawData(int *size) const { - Q_UNUSED(size); - // TODO(eteran): implement this - return 0; -} - -//------------------------------------------------------------------------------ -// Name: fromBinaryData -//------------------------------------------------------------------------------ -QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation) { - Q_UNUSED(data); - Q_UNUSED(validation); - - QJsonDocument doc; - // TODO(eteran): implement this - return doc; -} - -//------------------------------------------------------------------------------ -// Name: fromJson -//------------------------------------------------------------------------------ -QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) { - QJsonDocument doc; - - const char *const begin = json.constData(); - const char *const end = begin + json.size(); - - QJsonParser parser(begin, end); - - doc.root_ = parser.parse(); - - if(error) { - *error = parser.state(); - } - - return doc; -} - -//------------------------------------------------------------------------------ -// Name: fromRawData -//------------------------------------------------------------------------------ -QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidation validation) { - - // data has to be aligned to a 4 byte boundary. - Q_ASSERT(!(reinterpret_cast(data) % 3)); - - return fromBinaryData(QByteArray::fromRawData(data, size), validation); -} - -//------------------------------------------------------------------------------ -// Name: fromVariant -//------------------------------------------------------------------------------ -QJsonDocument QJsonDocument::fromVariant(const QVariant &variant) { - - QJsonDocument doc; - - if (variant.type() == QVariant::Map) { - doc.setObject(QJsonObject::fromVariantMap(variant.toMap())); - } else if (variant.type() == QVariant::Hash) { - doc.setObject(QJsonObject::fromVariantHash(variant.toHash())); - } else if (variant.type() == QVariant::List) { - doc.setArray(QJsonArray::fromVariantList(variant.toList())); - } else if (variant.type() == QVariant::StringList) { - doc.setArray(QJsonArray::fromStringList(variant.toStringList())); - } - - return doc; -} - -//------------------------------------------------------------------------------ -// Name: swap -//------------------------------------------------------------------------------ -void QJsonDocument::swap(QJsonDocument &other) { - qSwap(root_, other.root_); -} - -#endif diff --git a/qjson4/QJsonDocument.h b/qjson4/QJsonDocument.h deleted file mode 100644 index 3731f62..0000000 --- a/qjson4/QJsonDocument.h +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#ifndef QJSON_DOCUMENT_H_ -#define QJSON_DOCUMENT_H_ - -#include - -#if QT_VERSION >= 0x050000 -#include -#else - -class QVariant; -class QByteArray; -class QTextStream; -class QJsonObject; -class QJsonValue; -class QJsonArray; -class QJsonParseError; -class QJsonRoot; - -class QJsonDocument { -public: - enum DataValidation { - Validate = 0, - BypassValidation = 1 - }; - - enum JsonFormat { - Indented, - Compact - }; - -public: - QJsonDocument(); - QJsonDocument(const QJsonObject &object); - QJsonDocument(const QJsonArray &array); - QJsonDocument(const QJsonDocument &other); - ~QJsonDocument(); - -public: - QJsonDocument &operator=(const QJsonDocument &other); - -public: - bool operator!=(const QJsonDocument &other) const; - bool operator==(const QJsonDocument &other) const; - -public: - bool isArray() const; - bool isEmpty() const; - bool isNull() const; - bool isObject() const; - -public: - QByteArray toBinaryData() const; - QByteArray toJson(JsonFormat format = Indented) const; - QVariant toVariant() const; - -public: - QJsonArray array() const; - QJsonObject object() const; - const char *rawData(int *size) const; - -public: - void setArray(const QJsonArray &array); - void setObject(const QJsonObject &object); - -public: - static QJsonDocument fromBinaryData(const QByteArray &data, DataValidation validation = Validate); - static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0); - static QJsonDocument fromRawData(const char *data, int size, DataValidation validation = Validate); - static QJsonDocument fromVariant(const QVariant &variant); - -private: - void setRoot(const QJsonRoot &root); - QString toJson(const QJsonValue &v, JsonFormat format, int indent = 1) const; - QString escapeString(const QString &s) const; - -private: - void swap(QJsonDocument &other); - -private: - QJsonRoot *root_; -}; - -#endif - -#endif diff --git a/qjson4/QJsonObject b/qjson4/QJsonObject deleted file mode 100644 index fb2126e..0000000 --- a/qjson4/QJsonObject +++ /dev/null @@ -1 +0,0 @@ -#include "QJsonObject.h" diff --git a/qjson4/QJsonObject.cpp b/qjson4/QJsonObject.cpp deleted file mode 100644 index ac36bb0..0000000 --- a/qjson4/QJsonObject.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#include "QJsonObject.h" - -#if QT_VERSION < 0x050000 - -//------------------------------------------------------------------------------ -// Name: QJsonObject -//------------------------------------------------------------------------------ -QJsonObject::QJsonObject() { -} - -//------------------------------------------------------------------------------ -// Name: QJsonObject -//------------------------------------------------------------------------------ -QJsonObject::QJsonObject(const QJsonObject &other) : values_(other.values_) { -} - -#if __cplusplus >= 201103L -//------------------------------------------------------------------------------ -// Name: QJsonObject -//------------------------------------------------------------------------------ -QJsonObject::QJsonObject(std::initializer_list > args) { - for(const QPair &arg : args) { - values_.insert(arg.first, arg.second); - - } -} -#endif - -//------------------------------------------------------------------------------ -// Name: ~QJsonObject -//------------------------------------------------------------------------------ -QJsonObject::~QJsonObject() { -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject &QJsonObject::operator=(const QJsonObject &other) { - QJsonObject(other).swap(*this); - return *this; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::iterator QJsonObject::begin() { - return values_.begin(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::const_iterator QJsonObject::begin() const { - return values_.begin(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::iterator QJsonObject::end() { - return values_.end(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::const_iterator QJsonObject::end() const { - return values_.end(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::const_iterator QJsonObject::constBegin() const { - return begin(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::const_iterator QJsonObject::constEnd() const { - return end(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -int QJsonObject::count() const { - return size(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -int QJsonObject::length() const { - return size(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -int QJsonObject::size() const { - return values_.size(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -bool QJsonObject::empty() const { - return values_.empty(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -bool QJsonObject::isEmpty() const { - return empty(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const { - return values_.find(key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -bool QJsonObject::contains(const QString &key) const { - return values_.contains(key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::iterator QJsonObject::find(const QString &key) { - return values_.find(key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::const_iterator QJsonObject::find(const QString &key) const { - return values_.find(key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::iterator QJsonObject::erase(iterator it) { - return values_.erase(it); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject::iterator QJsonObject::insert(const QString &key, const QJsonValue &value) { - return values_.insert(key, value); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QStringList QJsonObject::keys() const { - return values_.keys(); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -void QJsonObject::remove(const QString &key) { - values_.remove(key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonValue QJsonObject::take(const QString &key) { - return values_.take(key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonValue QJsonObject::value(const QString &key) const { - return values_.value(key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -bool QJsonObject::operator!=(const QJsonObject &other) const { - return values_ != other.values_; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -bool QJsonObject::operator==(const QJsonObject &other) const { - return values_ != other.values_; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonValue QJsonObject::operator[](const QString &key) const { - return values_[key]; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonValueRef QJsonObject::operator[](const QString &key) { - return QJsonValueRef(this, key); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QVariantMap QJsonObject::toVariantMap() const { - QVariantMap a; - for(const_iterator it = begin(); it != end(); ++it) { - a.insert(it.key(), it.value().toVariant()); - } - return a; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QVariantHash QJsonObject::toVariantHash() const { - QVariantHash a; - for(const_iterator it = begin(); it != end(); ++it) { - a.insert(it.key(), it.value().toVariant()); - } - return a; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject QJsonObject::fromVariantMap(const QVariantMap &map) { - QJsonObject o; - for(QVariantMap::const_iterator it = map.begin(); it != map.end(); ++it) { - o.insert(it.key(), QJsonValue::fromVariant(it.value())); - } - return o; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject QJsonObject::fromVariantHash(const QVariantHash &hash) { - QJsonObject o; - for(QVariantHash::const_iterator it = hash.begin(); it != hash.end(); ++it) { - o.insert(it.key(), QJsonValue::fromVariant(it.value())); - } - return o; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonRoot *QJsonObject::clone() const { - return new QJsonObject(*this); -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -const QJsonObject *QJsonObject::toObject() const { - return this; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonObject *QJsonObject::toObject() { - return this; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -QJsonArray *QJsonObject::toArray() { - return 0; -} - -//------------------------------------------------------------------------------ -// Name: -//------------------------------------------------------------------------------ -const QJsonArray *QJsonObject::toArray() const { - return 0; -} - -//------------------------------------------------------------------------------ -// Name: swap -//------------------------------------------------------------------------------ -void QJsonObject::swap(QJsonObject &other) { - qSwap(values_, other.values_); -} - -#endif diff --git a/qjson4/QJsonObject.h b/qjson4/QJsonObject.h deleted file mode 100644 index 6ee3a97..0000000 --- a/qjson4/QJsonObject.h +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#ifndef QJSON_OBJECT_H_ -#define QJSON_OBJECT_H_ - -#include - -#if QT_VERSION >= 0x050000 -#include -#else - -#include "QJsonRoot.h" -#include "QJsonValueRef.h" -#include "QJsonValue.h" -#include -#include -#include -#include - -class QJsonObject : public QJsonRoot { - friend class QJsonDocument; - friend class QJsonValue; - friend class QJsonValueRef; - friend class QJsonParser; -public: - // TODO(eteran): manually implement the map, for now we use QMap - // but the real thing has a custom implementation - // I guess for the purposes of less interdependancies? - // maybe so it's easier to forward declare the iterators? - - typedef QMap::const_iterator const_iterator; - typedef QMap::iterator iterator; - typedef const_iterator ConstIterator; - typedef iterator Iterator; - typedef QMap::key_type key_type; - typedef QMap::mapped_type mapped_type; - typedef QMap::size_type size_type; - -public: - QJsonObject(); -#if __cplusplus >= 201103L - QJsonObject(std::initializer_list > args); -#endif - QJsonObject(const QJsonObject &other); - ~QJsonObject(); - QJsonObject &operator=(const QJsonObject &other); - -public: - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - const_iterator constBegin() const; - const_iterator constEnd() const; - -public: - int count() const; - int length() const; - int size() const; - bool empty() const; - bool isEmpty() const; - -public: - const_iterator constFind(const QString &key) const; - bool contains(const QString &key) const; - iterator find(const QString &key); - const_iterator find(const QString &key) const; - -public: - iterator erase(iterator it); - iterator insert(const QString &key, const QJsonValue &value); - QStringList keys() const; - void remove(const QString &key); - QJsonValue take(const QString &key); - QJsonValue value(const QString &key) const; - bool operator!=(const QJsonObject &other) const; - bool operator==(const QJsonObject &other) const; - QJsonValue operator[](const QString &key) const; - QJsonValueRef operator[](const QString &key); - -public: - QVariantMap toVariantMap() const; - QVariantHash toVariantHash() const; - -public: - static QJsonObject fromVariantMap(const QVariantMap &map); - static QJsonObject fromVariantHash(const QVariantHash &hash); - -private: - virtual QJsonRoot *clone() const; - virtual QJsonArray *toArray(); - virtual QJsonObject *toObject(); - virtual const QJsonArray *toArray() const; - virtual const QJsonObject *toObject() const; - -private: - void swap(QJsonObject &other); - -private: - QMap values_; -}; - -#endif - -#endif diff --git a/qjson4/QJsonParseError b/qjson4/QJsonParseError deleted file mode 100644 index 7d30db8..0000000 --- a/qjson4/QJsonParseError +++ /dev/null @@ -1 +0,0 @@ -#include "QJsonParseError.h" diff --git a/qjson4/QJsonParseError.cpp b/qjson4/QJsonParseError.cpp deleted file mode 100644 index 598c67c..0000000 --- a/qjson4/QJsonParseError.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#include "QJsonParseError.h" - -#if QT_VERSION < 0x050000 - -//------------------------------------------------------------------------------ -// Name: errorString -// Desc: The QJsonParseError class is used to report errors during JSON parsing. -//------------------------------------------------------------------------------ -QString QJsonParseError::errorString() const { - switch(error) { - case NoError: - return "No error occurred"; - case UnterminatedObject: - return "unterminated object"; - case MissingNameSeparator: - return "missing name separator"; - case UnterminatedArray: - return "unterminated array"; - case MissingValueSeparator: - return "missing value separator"; - case IllegalValue: - return "illegal value"; - case TerminationByNumber: - return "invalid termination by number"; - case IllegalNumber: - return "illegal number"; - case IllegalEscapeSequence: - return "illegal escape sequence"; - case IllegalUTF8String: - return "invalid UTF8 string"; - case UnterminatedString: - return "unterminated string"; - case MissingObject: - return "object is missing after a comma"; - case DeepNesting: - return "too deeply nested document"; - case DocumentTooLarge: - return "too large document"; - case GarbageAtEnd: - return "garbage at the end of the document"; - } - - return QString(); -} - -#endif diff --git a/qjson4/QJsonParseError.h b/qjson4/QJsonParseError.h deleted file mode 100644 index eddf04d..0000000 --- a/qjson4/QJsonParseError.h +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#ifndef QJSON_PARSE_ERROR_H_ -#define QJSON_PARSE_ERROR_H_ - -#include - -#if QT_VERSION >= 0x050000 -#include -#else - -#include - -class QJsonParseError { -public: - enum ParseError { - NoError = 0, - UnterminatedObject = 1, - MissingNameSeparator = 2, - UnterminatedArray = 3, - MissingValueSeparator = 4, - IllegalValue = 5, - TerminationByNumber = 6, - IllegalNumber = 7, - IllegalEscapeSequence = 8, - IllegalUTF8String = 9, - UnterminatedString = 10, - MissingObject = 11, - DeepNesting = 12, - DocumentTooLarge = 13, - GarbageAtEnd = 14 - }; - -public: - QString errorString() const; - -public: - ParseError error; - int offset; -}; - -#endif - -#endif diff --git a/qjson4/QJsonParser.cpp b/qjson4/QJsonParser.cpp deleted file mode 100644 index 052c9a8..0000000 --- a/qjson4/QJsonParser.cpp +++ /dev/null @@ -1,455 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#include "QJsonParser.h" -#include "QJsonArray.h" -#include "QJsonObject.h" -#include "QJsonValue.h" - - -#if QT_VERSION < 0x050000 - -#include -#include -#include - -namespace { - -unsigned int to_hex(int ch) { - - static const int hexval[256] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 - }; - - if(static_cast(ch) < 256) { - return hexval[static_cast(ch)]; - } else { - return 0; - } -} - -} - -//------------------------------------------------------------------------------ -// Name: QJsonParser -//------------------------------------------------------------------------------ -QJsonParser::QJsonParser(const char *begin, const char *end) : begin_(begin), end_(end), p_(begin) { - state_.error = QJsonParseError::NoError; - state_.offset = 0; -} - -//------------------------------------------------------------------------------ -// Name: parse -//------------------------------------------------------------------------------ -QJsonRoot *QJsonParser::parse() { - if(begin_ == end_) { - return 0; - } - - QJsonRoot *ret = 0; - - try { - const char ch = peek(); - switch(ch) { - case ArrayBegin: - ret = getArray(); - break; - case ObjectBegin: - ret = getObject(); - break; - default: - state_.error = QJsonParseError::IllegalValue; - state_.offset = p_ - begin_; - break; - } - } catch(const QJsonParseError &e) { - state_ = e; - } - - if(ret) { - // eat up trailing white space... - while(p_ != end_ && std::isspace(*p_)) { - ++p_; - } - - //detect trailing garbage - if(p_ != end_) { - state_.error = QJsonParseError::GarbageAtEnd; - state_.offset = p_ - begin_; - } - } - - return ret; -} - -//------------------------------------------------------------------------------ -// Name: peek -//------------------------------------------------------------------------------ -char QJsonParser::peek() { - // first eat up some whitespace - while(p_ != end_ && std::isspace(*p_)) { - ++p_; - } - - return *p_; -} - -//------------------------------------------------------------------------------ -// Name: getValue -//------------------------------------------------------------------------------ -QJsonValue QJsonParser::getValue() { - - switch(peek()) { - case ObjectBegin: - { - QScopedPointer obj(getObject()); - return QJsonValue(*obj); - } - case ArrayBegin: - { - QScopedPointer arr(getArray()); - return QJsonValue(*arr); - } - case Quote: - return QJsonValue(getString()); - case 't': - return getTrue(); - case 'f': - return getFalse(); - case 'n': - return getNull(); - default: - return getNumber(); - } - - throwError(QJsonParseError::MissingObject); - return QJsonValue(); -} - -//------------------------------------------------------------------------------ -// Name: getObject -//------------------------------------------------------------------------------ -QJsonObject *QJsonParser::getObject() { - - QScopedPointer obj(new QJsonObject); - - char tok = peek(); - if(tok != ObjectBegin) { - throwError(QJsonParseError::IllegalValue); - } - - ++p_; - - // handle empty object - tok = peek(); - if(peek() == ObjectEnd) { - ++p_; - } else { - - do { - QPair p = getPair(); - obj->values_.insert(p.first, p.second); - - tok = peek(); - ++p_; - - } while(tok == ValueSeparator); - } - - if(tok != ObjectEnd) { - throwError(QJsonParseError::UnterminatedObject); - } - - return obj.take(); -} - -//------------------------------------------------------------------------------ -// Name: getArray -//------------------------------------------------------------------------------ -QJsonArray *QJsonParser::getArray() { - - QScopedPointer arr(new QJsonArray); - - char tok = peek(); - - if(tok != ArrayBegin) { - throwError(QJsonParseError::IllegalValue); - } - - ++p_; - - // handle empty object - tok = peek(); - if(tok == ArrayEnd) { - ++p_; - } else { - do { - arr->values_.push_back(getValue()); - - tok = peek(); - ++p_; - - } while(tok == ValueSeparator); - } - - if(tok != ArrayEnd) { - throwError(QJsonParseError::MissingValueSeparator); - } - - return arr.take(); -} - -//------------------------------------------------------------------------------ -// Name: getPair -//------------------------------------------------------------------------------ -QPair QJsonParser::getPair() { - - QString key = getString(); - - if(peek() != NameSeparator) { - throwError(QJsonParseError::MissingNameSeparator); - } - ++p_; - - return qMakePair(key, getValue()); -} - -//------------------------------------------------------------------------------ -// Name: getString -//------------------------------------------------------------------------------ -QString QJsonParser::getString() { - - if(peek() != Quote) { - throwError(QJsonParseError::IllegalUTF8String); - } - ++p_; - - QByteArray s; - - while(p_ != end_ && *p_ != Quote && *p_ != '\n') { - if(*p_ == '\\') { - ++p_; - if(p_ != end_) { - switch(*p_) { - case '"': s.append('"'); break; - case '\\': s.append('\\'); break; - case '/': s.append('/'); break; - case 'b': s.append('\b'); break; - case 'f': s.append('\f'); break; - case 'n': s.append('\n'); break; - case 'r': s.append('\r'); break; - case 't': s.append('\t'); break; - case 'u': - { - - QString hexChar; - - // convert \uXXXX escape sequences to UTF-8 - char hex[4]; - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[0] = *++p_; - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[1] = *++p_; - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[2] = *++p_; - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[3] = *++p_; - - if(!std::isxdigit(hex[0])) throwError(QJsonParseError::IllegalUTF8String); - if(!std::isxdigit(hex[1])) throwError(QJsonParseError::IllegalUTF8String); - if(!std::isxdigit(hex[2])) throwError(QJsonParseError::IllegalUTF8String); - if(!std::isxdigit(hex[3])) throwError(QJsonParseError::IllegalUTF8String); - - quint16 w1 = 0; - quint16 w2 = 0; - - w1 |= (to_hex(hex[0]) << 12); - w1 |= (to_hex(hex[1]) << 8); - w1 |= (to_hex(hex[2]) << 4); - w1 |= (to_hex(hex[3])); - - hexChar.append(QChar(w1)); - - if((w1 & 0xfc00) == 0xdc00) { - throwError(QJsonParseError::IllegalUTF8String); - } - - if((w1 & 0xfc00) == 0xd800) { - // part of a surrogate pair - if(p_ == end_ || *++p_ != '\\') { throwError(QJsonParseError::IllegalEscapeSequence); } - if(p_ == end_ || *++p_ != 'u') { throwError(QJsonParseError::IllegalEscapeSequence); } - - // convert \uXXXX escape sequences to UTF-8 - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[0] = *++p_; - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[1] = *++p_; - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[2] = *++p_; - if(p_ == end_) { throwError(QJsonParseError::IllegalEscapeSequence); } hex[3] = *++p_; - - if(!std::isxdigit(hex[0])) throwError(QJsonParseError::IllegalUTF8String); - if(!std::isxdigit(hex[1])) throwError(QJsonParseError::IllegalUTF8String); - if(!std::isxdigit(hex[2])) throwError(QJsonParseError::IllegalUTF8String); - if(!std::isxdigit(hex[3])) throwError(QJsonParseError::IllegalUTF8String); - - w2 |= (to_hex(hex[0]) << 12); - w2 |= (to_hex(hex[1]) << 8); - w2 |= (to_hex(hex[2]) << 4); - w2 |= (to_hex(hex[3])); - - hexChar.append(QChar(w2)); - } - - s.append(hexChar.toUtf8()); - } - break; - - default: - s.append('\\'); - break; - } - } - } else { - s.append(*p_); - } - ++p_; - } - - if(*p_ != Quote || p_ == end_) { - throwError(QJsonParseError::UnterminatedString); - } - - ++p_; - - return QString::fromUtf8(s, s.size()); -} - -//------------------------------------------------------------------------------ -// Name: getNull -//------------------------------------------------------------------------------ -QJsonValue QJsonParser::getNull() { - if(p_ == end_ || *p_++ != 'n') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'u') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'l') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'l') { throwError(QJsonParseError::IllegalValue); } - - return QJsonValue(); -} - -//------------------------------------------------------------------------------ -// Name: getTrue -//------------------------------------------------------------------------------ -QJsonValue QJsonParser::getTrue() { - if(p_ == end_ || *p_++ != 't') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'r') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'u') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'e') { throwError(QJsonParseError::IllegalValue); } - - return QJsonValue(true); -} - -//------------------------------------------------------------------------------ -// Name: getFalse -//------------------------------------------------------------------------------ -QJsonValue QJsonParser::getFalse() { - if(p_ == end_ || *p_++ != 'f') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'a') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'l') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 's') { throwError(QJsonParseError::IllegalValue); } - if(p_ == end_ || *p_++ != 'e') { throwError(QJsonParseError::IllegalValue); } - - return QJsonValue(false); -} - -//------------------------------------------------------------------------------ -// Name: getNumber -//------------------------------------------------------------------------------ -QJsonValue QJsonParser::getNumber() { - // JSON numbers fit the regex: -?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)? - - const char *const first = p_; - - // -? - if(p_ != end_ && *p_ == '-') { - ++p_; - } - - // (0|[1-9][0-9]*) - if(p_ != end_) { - if(*p_ >= '1' && *p_ <= '9') { - while(p_ != end_ && std::isdigit(*p_)) { - ++p_; - } - } else if(*p_ == '0') { - ++p_; - } else { - throwError(QJsonParseError::IllegalNumber); - } - } - - // (\.[0-9]+)? - if(p_ != end_ && *p_ == '.') { - ++p_; - if(!std::isdigit(*p_)) { - throwError(QJsonParseError::IllegalNumber); - } - - while(p_ != end_ && std::isdigit(*p_)) { - ++p_; - } - } - - // ([eE][+-]?[0-9]+)? - if(p_ != end_ && (*p_ == 'e' || *p_ == 'E')) { - ++p_; - if(p_ != end_ && (*p_ == '+' || *p_ == '-')) { - ++p_; - } - if(!std::isdigit(*p_)) { - throwError(QJsonParseError::IllegalNumber); - } - while(p_ != end_ && std::isdigit(*p_)) { - ++p_; - } - } - - if(p_ == end_) { - throwError(QJsonParseError::TerminationByNumber); - } - - return QJsonValue(QByteArray::fromRawData(first, p_ - first).toDouble()); -} - -//------------------------------------------------------------------------------ -// Name: state -//------------------------------------------------------------------------------ -QJsonParseError QJsonParser::state() const { - return state_; -} - -//------------------------------------------------------------------------------ -// Name: throwError -//------------------------------------------------------------------------------ -void QJsonParser::throwError(QJsonParseError::ParseError e) { - QJsonParseError err; - err.error = e; - err.offset = p_ - begin_; - throw err; -} - -#endif diff --git a/qjson4/QJsonParser.h b/qjson4/QJsonParser.h deleted file mode 100644 index f11f5a0..0000000 --- a/qjson4/QJsonParser.h +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -// NOTE: this is not part of the "public" Qt API, so using this class directly -// is not recomended - -#ifndef QJSON_PARSER_H_ -#define QJSON_PARSER_H_ - -#include - -#if QT_VERSION < 0x050000 - -#include "QJsonParseError.h" -#include -class QJsonRoot; -class QJsonObject; -class QJsonArray; -class QJsonValue; - -class QJsonParser { - friend class QJsonDocument; - -public: - QJsonParser(const char *begin, const char *end); - -public: - QJsonRoot *parse(); - -public: - QJsonParseError state() const; - -private: - static const char ArrayBegin = '['; - static const char ArrayEnd = ']'; - static const char NameSeparator = ':'; - static const char ValueSeparator = ','; - static const char ObjectBegin = '{'; - static const char ObjectEnd = '}'; - static const char Quote = '"'; - -private: - char peek(); - QJsonObject *getObject(); - QJsonArray *getArray(); - QJsonValue getValue(); - QString getString(); - QJsonValue getTrue(); - QJsonValue getFalse(); - QJsonValue getNull(); - QJsonValue getNumber(); - QPair getPair(); - -private: - void throwError(QJsonParseError::ParseError e); - -private: - QJsonParseError state_; - const char *const begin_; - const char *const end_; - const char * p_; -}; - -#endif - -#endif diff --git a/qjson4/QJsonRoot b/qjson4/QJsonRoot deleted file mode 100644 index fbcaca1..0000000 --- a/qjson4/QJsonRoot +++ /dev/null @@ -1 +0,0 @@ -#include "QJsonRoot.h" diff --git a/qjson4/QJsonRoot.h b/qjson4/QJsonRoot.h deleted file mode 100644 index d249465..0000000 --- a/qjson4/QJsonRoot.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#ifndef QJSON_ROOT_H_ -#define QJSON_ROOT_H_ - -#include - -#if QT_VERSION < 0x050000 - -class QJsonObject; -class QJsonArray; - -class QJsonRoot { -public: - virtual ~QJsonRoot() {}; - -public: - virtual QJsonRoot *clone() const = 0; - -public: - virtual QJsonArray *toArray() = 0; - virtual QJsonObject *toObject() = 0; - virtual const QJsonArray *toArray() const = 0; - virtual const QJsonObject *toObject() const = 0; -}; - -#endif - -#endif diff --git a/qjson4/QJsonValue b/qjson4/QJsonValue deleted file mode 100644 index eb1b6fe..0000000 --- a/qjson4/QJsonValue +++ /dev/null @@ -1 +0,0 @@ -#include "QJsonValue.h" diff --git a/qjson4/QJsonValue.cpp b/qjson4/QJsonValue.cpp deleted file mode 100644 index 8ac4770..0000000 --- a/qjson4/QJsonValue.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#include "QJsonValue.h" -#include "QJsonArray.h" -#include "QJsonObject.h" - -#if QT_VERSION < 0x050000 -#include -#include - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(Type type) : type_(type) { -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(bool b) : type_(Bool) { - value_.b = b; -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(double n) : type_(Double) { - value_.n = n; -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(const QString &s) : type_(String) { - value_.s = new QString(s); -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(QLatin1String s) : type_(String) { - value_.s = new QString(s); -} - -#ifndef QT_NO_CAST_FROM_ASCII -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(const char *s) : type_(String) { - value_.s = new QString(QString::fromUtf8(s)); -} -#endif - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(const QJsonArray &a) : type_(Array) { - value_.r = a.clone(); -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(const QJsonObject &o) : type_(Object) { - value_.r = o.clone(); -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(int n) : type_(Double) { - value_.n = n; -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(qint64 n) : type_(Double) { - value_.n = n; -} - -//------------------------------------------------------------------------------ -// Name: QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::QJsonValue(const QJsonValue &other) : type_(other.type_) { - - switch(other.type_) { - case Bool: - value_.b = other.value_.b; - break; - case Double: - value_.n = other.value_.n; - break; - case String: - value_.s = new QString(*other.value_.s); - break; - case Array: - case Object: - value_.r = other.value_.r->clone(); - break; - case Undefined: - case Null: - value_ = other.value_; - break; - } -} - -//------------------------------------------------------------------------------ -// Name: ~QJsonValue -//------------------------------------------------------------------------------ -QJsonValue::~QJsonValue() { - switch(type_) { - case Null: - case Bool: - case Double: - case Undefined: - break; - case String: - delete value_.s; - break; - case Object: - case Array: - delete value_.r; - break; - } -} - -//------------------------------------------------------------------------------ -// Name: operator= -//------------------------------------------------------------------------------ -QJsonValue &QJsonValue::operator=(const QJsonValue &other) { - QJsonValue(other).swap(*this); - return *this; -} - -//------------------------------------------------------------------------------ -// Name: operator!= -//------------------------------------------------------------------------------ -bool QJsonValue::operator!=(const QJsonValue &other) const { - return !(*this == other); -} - -//------------------------------------------------------------------------------ -// Name: operator== -//------------------------------------------------------------------------------ -bool QJsonValue::operator==(const QJsonValue &other) const { - if(type_ == other.type_) { - switch(type_) { - case Null: - return true; - case Bool: - return value_.b == other.value_.b; - case Double: - return value_.n == other.value_.n; - case Undefined: - return true; - case String: - return *value_.s == *other.value_.s; - case Array: - return *(value_.r->toArray()) == *(other.value_.r->toArray()); - case Object: - return *(value_.r->toObject()) == *(other.value_.r->toObject()); - } - } - return false; -} - -//------------------------------------------------------------------------------ -// Name: isArray -//------------------------------------------------------------------------------ -bool QJsonValue::isArray() const { - return type_ == Array; -} - -//------------------------------------------------------------------------------ -// Name: isBool -//------------------------------------------------------------------------------ -bool QJsonValue::isBool() const { - return type_ == Bool; -} - -//------------------------------------------------------------------------------ -// Name: isDouble -//------------------------------------------------------------------------------ -bool QJsonValue::isDouble() const { - return type_ == Double; -} - -//------------------------------------------------------------------------------ -// Name: isNull -//------------------------------------------------------------------------------ -bool QJsonValue::isNull() const { - return type_ == Null; -} - -//------------------------------------------------------------------------------ -// Name: isObject -//------------------------------------------------------------------------------ -bool QJsonValue::isObject() const { - return type_ == Object; -} - -//------------------------------------------------------------------------------ -// Name: isString -//------------------------------------------------------------------------------ -bool QJsonValue::isString() const { - return type_ == String; -} - -//------------------------------------------------------------------------------ -// Name: isUndefined -//------------------------------------------------------------------------------ -bool QJsonValue::isUndefined() const { - return type_ == Undefined; -} - -//------------------------------------------------------------------------------ -// Name: type -//------------------------------------------------------------------------------ -QJsonValue::Type QJsonValue::type() const { - return type_; -} - -//------------------------------------------------------------------------------ -// Name: toArray -//------------------------------------------------------------------------------ -QJsonArray QJsonValue::toArray(const QJsonArray &defaultValue) const { - if(isArray()) { - return *(value_.r->toArray()); - } - - return defaultValue; -} - -//------------------------------------------------------------------------------ -// Name: toArray -//------------------------------------------------------------------------------ -QJsonArray QJsonValue::toArray() const { - return toArray(QJsonArray()); -} - -//------------------------------------------------------------------------------ -// Name: toBool -//------------------------------------------------------------------------------ -bool QJsonValue::toBool(bool defaultValue) const { - if(isBool()) { - return value_.b; - } - - return defaultValue; -} - -//------------------------------------------------------------------------------ -// Name: toDouble -//------------------------------------------------------------------------------ -double QJsonValue::toDouble(double defaultValue) const { - if(isDouble()) { - return value_.n; - } - - return defaultValue; -} - -//------------------------------------------------------------------------------ -// Name: toInt -//------------------------------------------------------------------------------ -int QJsonValue::toInt(int defaultValue) const { - if(isDouble() && qFloor(value_.n) == value_.n) { - return value_.n; - } - - return defaultValue; -} - -//------------------------------------------------------------------------------ -// Name: toObject -//------------------------------------------------------------------------------ -QJsonObject QJsonValue::toObject(const QJsonObject &defaultValue) const { - if(isObject()) { - return *(value_.r->toObject()); - } - - return defaultValue; -} - -//------------------------------------------------------------------------------ -// Name: toObject -//------------------------------------------------------------------------------ -QJsonObject QJsonValue::toObject() const { - return toObject(QJsonObject()); -} - -//------------------------------------------------------------------------------ -// Name: toString -//------------------------------------------------------------------------------ -QString QJsonValue::toString(const QString &defaultValue) const { - - if(isString()) { - return *value_.s; - } - - return defaultValue; -} - -//------------------------------------------------------------------------------ -// Name: toVariant -//------------------------------------------------------------------------------ -QVariant QJsonValue::toVariant() const { - switch(type_) { - case Null: - return QVariant(); - case Bool: - return QVariant::fromValue(value_.b); - case Double: - return QVariant::fromValue(value_.n); - case String: - return QVariant::fromValue(*value_.s); - case Array: - return value_.r->toArray()->toVariantList(); - case Object: - return value_.r->toObject()->toVariantMap(); - case Undefined: - return QVariant(); - } - - return QVariant(); -} - -//------------------------------------------------------------------------------ -// Name: fromVariant -//------------------------------------------------------------------------------ -QJsonValue QJsonValue::fromVariant(const QVariant &variant) { - if(variant.isNull()) { - return QJsonValue(Null); - } - - switch(variant.type()) { - case QVariant::Bool: - return QJsonValue(variant.toBool()); - case QVariant::Int: - return QJsonValue(variant.toInt()); - case QVariant::Double: - case QVariant::LongLong: - case QVariant::ULongLong: - case QVariant::UInt: - return QJsonValue(variant.toDouble()); - case QVariant::String: - return QJsonValue(variant.toString()); - case QVariant::List: - return QJsonArray::fromVariantList(variant.toList()); - case QVariant::StringList: - return QJsonArray::fromStringList(variant.toStringList()); - case QVariant::Map: - return QJsonObject::fromVariantMap(variant.toMap()); - default: - const QString s = variant.toString(); - if(!s.isEmpty()) { - return QJsonValue(s); - } - break; - } - - return QJsonValue(Null); - -} - -//------------------------------------------------------------------------------ -// Name: swap -//------------------------------------------------------------------------------ -void QJsonValue::swap(QJsonValue &other) { - qSwap(type_, other.type_); - qSwap(value_, other.value_); -} - -#endif diff --git a/qjson4/QJsonValue.h b/qjson4/QJsonValue.h deleted file mode 100644 index d902352..0000000 --- a/qjson4/QJsonValue.h +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#ifndef QJSON_VALUE_H_ -#define QJSON_VALUE_H_ - -#include - -#if QT_VERSION >= 0x050000 -#include -#else - -class QString; - -#include - -class QJsonRoot; -class QJsonArray; -class QJsonObject; - -class QJsonValue { -public: - enum Type { - Null = 0x0, - Bool = 0x1, - Double = 0x2, - String = 0x3, - Array = 0x4, - Object = 0x5, - Undefined = 0x80 - }; - -public: - QJsonValue(Type type = Null); - QJsonValue(bool b); - QJsonValue(double n); - QJsonValue(int n); - QJsonValue(qint64 n); - QJsonValue(const QString &s); - QJsonValue(QLatin1String s); -#ifndef QT_NO_CAST_FROM_ASCII - QJsonValue(const char *s); -#endif - QJsonValue(const QJsonArray &a); - QJsonValue(const QJsonObject &o); - QJsonValue(const QJsonValue &other); - - ~QJsonValue(); - -private: - // to protect against incorrect usage due to passing a const char * - QJsonValue(const void *); - -public: - QJsonValue &operator=(const QJsonValue &other); - -public: - bool operator!=(const QJsonValue &other) const; - bool operator==(const QJsonValue &other) const; - -public: - bool isArray() const; - bool isBool() const; - bool isDouble() const; - bool isNull() const; - bool isObject() const; - bool isString() const; - bool isUndefined() const; - -public: - QJsonArray toArray(const QJsonArray &defaultValue) const; - QJsonArray toArray() const; - bool toBool(bool defaultValue = false) const; - double toDouble(double defaultValue = 0) const; - int toInt(int defaultValue = 0) const; - QJsonObject toObject(const QJsonObject &defaultValue) const; - QJsonObject toObject() const; - QString toString(const QString &defaultValue = QString()) const; - QVariant toVariant() const; - -public: - Type type() const; - -public: - static QJsonValue fromVariant(const QVariant &variant); - -private: - void swap(QJsonValue &other); - -private: - Type type_; - - union ValueType { - bool b; - double n; - QString *s; - QJsonRoot *r; // OJsonObject or QJsonArray - }; - - ValueType value_; -}; - -#endif - -#endif diff --git a/qjson4/QJsonValueRef b/qjson4/QJsonValueRef deleted file mode 100644 index f3b6811..0000000 --- a/qjson4/QJsonValueRef +++ /dev/null @@ -1 +0,0 @@ -#include "QJsonValueRef.h" diff --git a/qjson4/QJsonValueRef.cpp b/qjson4/QJsonValueRef.cpp deleted file mode 100644 index dade257..0000000 --- a/qjson4/QJsonValueRef.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#include "QJsonValueRef.h" - -#if QT_VERSION < 0x050000 - -#include "QJsonArray.h" -#include "QJsonObject.h" - -//------------------------------------------------------------------------------ -// Name: -// Desc: -//------------------------------------------------------------------------------ -QJsonValueRef::QJsonValueRef(QJsonArray *array, int idx) : p_(array), index_(idx) { -} - -//------------------------------------------------------------------------------ -// Name: -// Desc: -//------------------------------------------------------------------------------ -QJsonValueRef::QJsonValueRef(QJsonObject *object, const QString &key) : p_(object), index_(0), key_(key) { -} - -//------------------------------------------------------------------------------ -// Name: -// Desc: -//------------------------------------------------------------------------------ -QJsonValueRef::operator QJsonValue() const { - return toValue(); -} - -//------------------------------------------------------------------------------ -// Name: -// Desc: -//------------------------------------------------------------------------------ -QJsonValueRef &QJsonValueRef::operator=(const QJsonValue &val) { - - if(QJsonObject *const o = p_->toObject()) { - o->values_[key_] = val; - } else if(QJsonArray *const a = p_->toArray()) { - a->values_[index_] = val; - } - return *this; -} - -//------------------------------------------------------------------------------ -// Name: -// Desc: -//------------------------------------------------------------------------------ -QJsonValueRef &QJsonValueRef::operator=(const QJsonValueRef &ref) { - - if(QJsonObject *const o = p_->toObject()) { - o->values_[key_] = ref; - } else if(QJsonArray *const a = p_->toArray()) { - a->values_[index_] = ref; - } - return *this; -} - -//------------------------------------------------------------------------------ -// Name: type -// Desc: -//------------------------------------------------------------------------------ -QJsonValue::Type QJsonValueRef::type() const { - return toValue().type(); -} - -//------------------------------------------------------------------------------ -// Name: isNull -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::isNull() const { - return toValue().isNull(); -} - -//------------------------------------------------------------------------------ -// Name: isBool -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::isBool() const { - return toValue().isBool(); -} - -//------------------------------------------------------------------------------ -// Name: isDouble -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::isDouble() const { - return toValue().isDouble(); -} - -//------------------------------------------------------------------------------ -// Name: isString -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::isString() const { - return toValue().isString(); -} - -//------------------------------------------------------------------------------ -// Name: isArray -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::isArray() const { - return toValue().isArray(); -} - -//------------------------------------------------------------------------------ -// Name: isObject -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::isObject() const { - return toValue().isObject(); -} - -//------------------------------------------------------------------------------ -// Name: isUndefined -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::isUndefined() const { - return toValue().isUndefined(); -} - -//------------------------------------------------------------------------------ -// Name: toBool -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::toBool() const { - return toValue().toBool(); -} - -//------------------------------------------------------------------------------ -// Name: toDouble -// Desc: -//------------------------------------------------------------------------------ -double QJsonValueRef::toDouble() const { - return toValue().toDouble(); -} - -//------------------------------------------------------------------------------ -// Name: toInt -// Desc: -//------------------------------------------------------------------------------ -int QJsonValueRef::toInt(int defaultValue) const { - return toValue().toInt(defaultValue); -} - -//------------------------------------------------------------------------------ -// Name: toString -// Desc: -//------------------------------------------------------------------------------ -QString QJsonValueRef::toString() const { - return toValue().toString(); -} - -//------------------------------------------------------------------------------ -// Name: toArray -// Desc: -//------------------------------------------------------------------------------ -QJsonArray QJsonValueRef::toArray() const { - return toValue().toArray(); -} - -//------------------------------------------------------------------------------ -// Name: toObject -// Desc: -//------------------------------------------------------------------------------ -QJsonObject QJsonValueRef::toObject() const { - return toValue().toObject(); -} - -//------------------------------------------------------------------------------ -// Name: operator== -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::operator==(const QJsonValue &other) const { - return toValue() == other; -} - -//------------------------------------------------------------------------------ -// Name: operator!= -// Desc: -//------------------------------------------------------------------------------ -bool QJsonValueRef::operator!=(const QJsonValue &other) const { - return toValue() != other; -} - -//------------------------------------------------------------------------------ -// Name: toValue -// Desc: -//------------------------------------------------------------------------------ -QJsonValue QJsonValueRef::toValue() const { - if(QJsonObject *const o = p_->toObject()) { - return o->values_[key_]; - } else if(QJsonArray *const a = p_->toArray()) { - return a->values_[index_]; - } - - return QJsonValue(); -} - -//------------------------------------------------------------------------------ -// Name: swap -// Desc: -//------------------------------------------------------------------------------ -void QJsonValueRef::swap(QJsonValueRef &other) { - qSwap(p_, other.p_); - qSwap(key_, other.key_); - qSwap(index_, other.index_); -} - -#endif diff --git a/qjson4/QJsonValueRef.h b/qjson4/QJsonValueRef.h deleted file mode 100644 index 478b657..0000000 --- a/qjson4/QJsonValueRef.h +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************** -* gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016 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 . -*****************************************************************************/ - -#ifndef QJSON_VALUEREF_H_ -#define QJSON_VALUEREF_H_ - -#include - -#if QT_VERSION >= 0x050000 -#include -#else - -#include "QJsonValue.h" -class QJsonRoot; - -class QJsonValueRef { -public: - QJsonValueRef(QJsonArray *array, int idx); - - // slight variant from official APIs implementation - QJsonValueRef(QJsonObject *object, const QString &key); - -public: - operator QJsonValue() const; - -public: - QJsonValueRef &operator=(const QJsonValue &val); - QJsonValueRef &operator=(const QJsonValueRef &val); - -public: - QJsonValue::Type type() const; - bool isNull() const; - bool isBool() const; - bool isDouble() const; - bool isString() const; - bool isArray() const; - bool isObject() const; - bool isUndefined() const; - -public: - bool toBool() const; - double toDouble() const; - QString toString() const; - QJsonArray toArray() const; - QJsonObject toObject() const; - int toInt(int defaultValue = 0) const; - -public: - bool operator==(const QJsonValue &other) const; - bool operator!=(const QJsonValue &other) const; - -private: - QJsonValue toValue() const; - void swap(QJsonValueRef &other); - -private: - QJsonRoot *p_; - int index_; - QString key_; -}; - -#endif - -#endif diff --git a/res/qt4/qt_de.qm b/res/qt4/qt_de.qm deleted file mode 100644 index 113bbcc..0000000 Binary files a/res/qt4/qt_de.qm and /dev/null differ diff --git a/res/qt4/qt_fr.qm b/res/qt4/qt_fr.qm deleted file mode 100644 index be99664..0000000 Binary files a/res/qt4/qt_fr.qm and /dev/null differ diff --git a/res/qt4/qt_ko.qm b/res/qt4/qt_ko.qm deleted file mode 100644 index e3d1231..0000000 Binary files a/res/qt4/qt_ko.qm and /dev/null differ diff --git a/res/qt4/qt_ru.qm b/res/qt4/qt_ru.qm deleted file mode 100644 index d9baf23..0000000 Binary files a/res/qt4/qt_ru.qm and /dev/null differ diff --git a/res/qt4/qt_uk.qm b/res/qt4/qt_uk.qm deleted file mode 100644 index 112ca5c..0000000 Binary files a/res/qt4/qt_uk.qm and /dev/null differ diff --git a/res/qt4/qt_zh_TW.qm b/res/qt4/qt_zh_TW.qm deleted file mode 100644 index a9a25b2..0000000 Binary files a/res/qt4/qt_zh_TW.qm and /dev/null differ diff --git a/res/qt4/tr_qt.qrc b/res/qt4/tr_qt.qrc deleted file mode 100644 index 0b79a15..0000000 --- a/res/qt4/tr_qt.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - qt_de.qm - qt_fr.qm - qt_ko.qm - qt_ru.qm - qt_uk.qm - qt_zh_TW.qm - - diff --git a/AboutDialog.cpp b/src/AboutDialog.cpp similarity index 100% rename from AboutDialog.cpp rename to src/AboutDialog.cpp diff --git a/AboutDialog.h b/src/AboutDialog.h similarity index 100% rename from AboutDialog.h rename to src/AboutDialog.h diff --git a/AboutDialog.ui b/src/AboutDialog.ui similarity index 100% rename from AboutDialog.ui rename to src/AboutDialog.ui diff --git a/AppEnv.cpp b/src/AppEnv.cpp similarity index 100% rename from AppEnv.cpp rename to src/AppEnv.cpp diff --git a/AppEnv.h b/src/AppEnv.h similarity index 100% rename from AppEnv.h rename to src/AppEnv.h diff --git a/CrewDatabase.cpp b/src/CrewDatabase.cpp similarity index 100% rename from CrewDatabase.cpp rename to src/CrewDatabase.cpp diff --git a/CrewDatabase.h b/src/CrewDatabase.h similarity index 100% rename from CrewDatabase.h rename to src/CrewDatabase.h diff --git a/DatabaseThread.cpp b/src/DatabaseThread.cpp similarity index 100% rename from DatabaseThread.cpp rename to src/DatabaseThread.cpp diff --git a/DatabaseThread.h b/src/DatabaseThread.h similarity index 100% rename from DatabaseThread.h rename to src/DatabaseThread.h diff --git a/ExportDialog.cpp b/src/ExportDialog.cpp similarity index 100% rename from ExportDialog.cpp rename to src/ExportDialog.cpp diff --git a/ExportDialog.h b/src/ExportDialog.h similarity index 100% rename from ExportDialog.h rename to src/ExportDialog.h diff --git a/ExportDialog.ui b/src/ExportDialog.ui similarity index 100% rename from ExportDialog.ui rename to src/ExportDialog.ui diff --git a/ExportThread.cpp b/src/ExportThread.cpp similarity index 100% rename from ExportThread.cpp rename to src/ExportThread.cpp diff --git a/ExportThread.h b/src/ExportThread.h similarity index 100% rename from ExportThread.h rename to src/ExportThread.h diff --git a/GlobalString.cpp b/src/GlobalString.cpp similarity index 100% rename from GlobalString.cpp rename to src/GlobalString.cpp diff --git a/GlobalString.h b/src/GlobalString.h similarity index 100% rename from GlobalString.h rename to src/GlobalString.h diff --git a/IconLoader.cpp b/src/IconLoader.cpp similarity index 100% rename from IconLoader.cpp rename to src/IconLoader.cpp diff --git a/IconLoader.h b/src/IconLoader.h similarity index 100% rename from IconLoader.h rename to src/IconLoader.h diff --git a/ImportDialog.cpp b/src/ImportDialog.cpp similarity index 100% rename from ImportDialog.cpp rename to src/ImportDialog.cpp diff --git a/ImportDialog.h b/src/ImportDialog.h similarity index 100% rename from ImportDialog.h rename to src/ImportDialog.h diff --git a/ImportDialog.ui b/src/ImportDialog.ui similarity index 100% rename from ImportDialog.ui rename to src/ImportDialog.ui diff --git a/JsonEditorDialog.cpp b/src/JsonEditorDialog.cpp similarity index 100% rename from JsonEditorDialog.cpp rename to src/JsonEditorDialog.cpp diff --git a/JsonEditorDialog.h b/src/JsonEditorDialog.h similarity index 100% rename from JsonEditorDialog.h rename to src/JsonEditorDialog.h diff --git a/JsonEditorDialog.ui b/src/JsonEditorDialog.ui similarity index 100% rename from JsonEditorDialog.ui rename to src/JsonEditorDialog.ui diff --git a/MapLocationDialog.cpp b/src/MapLocationDialog.cpp similarity index 100% rename from MapLocationDialog.cpp rename to src/MapLocationDialog.cpp diff --git a/MapLocationDialog.h b/src/MapLocationDialog.h similarity index 100% rename from MapLocationDialog.h rename to src/MapLocationDialog.h diff --git a/MapLocationDialog.ui b/src/MapLocationDialog.ui similarity index 100% rename from MapLocationDialog.ui rename to src/MapLocationDialog.ui diff --git a/MessageThread.cpp b/src/MessageThread.cpp similarity index 100% rename from MessageThread.cpp rename to src/MessageThread.cpp diff --git a/MessageThread.h b/src/MessageThread.h similarity index 100% rename from MessageThread.h rename to src/MessageThread.h diff --git a/OptionsDialog.cpp b/src/OptionsDialog.cpp similarity index 100% rename from OptionsDialog.cpp rename to src/OptionsDialog.cpp diff --git a/OptionsDialog.h b/src/OptionsDialog.h similarity index 100% rename from OptionsDialog.h rename to src/OptionsDialog.h diff --git a/OptionsDialog.ui b/src/OptionsDialog.ui similarity index 100% rename from OptionsDialog.ui rename to src/OptionsDialog.ui diff --git a/PictureDialog.cpp b/src/PictureDialog.cpp similarity index 100% rename from PictureDialog.cpp rename to src/PictureDialog.cpp diff --git a/PictureDialog.h b/src/PictureDialog.h similarity index 100% rename from PictureDialog.h rename to src/PictureDialog.h diff --git a/PictureDialog.ui b/src/PictureDialog.ui similarity index 100% rename from PictureDialog.ui rename to src/PictureDialog.ui diff --git a/PictureExport.cpp b/src/PictureExport.cpp similarity index 100% rename from PictureExport.cpp rename to src/PictureExport.cpp diff --git a/PictureExport.h b/src/PictureExport.h similarity index 100% rename from PictureExport.h rename to src/PictureExport.h diff --git a/PictureWidget.cpp b/src/PictureWidget.cpp similarity index 100% rename from PictureWidget.cpp rename to src/PictureWidget.cpp diff --git a/PictureWidget.h b/src/PictureWidget.h similarity index 100% rename from PictureWidget.h rename to src/PictureWidget.h diff --git a/PlayerListDialog.cpp b/src/PlayerListDialog.cpp similarity index 100% rename from PlayerListDialog.cpp rename to src/PlayerListDialog.cpp diff --git a/PlayerListDialog.h b/src/PlayerListDialog.h similarity index 100% rename from PlayerListDialog.h rename to src/PlayerListDialog.h diff --git a/PlayerListDialog.ui b/src/PlayerListDialog.ui similarity index 100% rename from PlayerListDialog.ui rename to src/PlayerListDialog.ui diff --git a/ProfileDatabase.cpp b/src/ProfileDatabase.cpp similarity index 100% rename from ProfileDatabase.cpp rename to src/ProfileDatabase.cpp diff --git a/ProfileDatabase.h b/src/ProfileDatabase.h similarity index 100% rename from ProfileDatabase.h rename to src/ProfileDatabase.h diff --git a/ProfileInterface.cpp b/src/ProfileInterface.cpp similarity index 100% rename from ProfileInterface.cpp rename to src/ProfileInterface.cpp diff --git a/ProfileInterface.h b/src/ProfileInterface.h similarity index 100% rename from ProfileInterface.h rename to src/ProfileInterface.h diff --git a/ProfileInterface.ui b/src/ProfileInterface.ui similarity index 100% rename from ProfileInterface.ui rename to src/ProfileInterface.ui diff --git a/ProfileLoader.cpp b/src/ProfileLoader.cpp similarity index 100% rename from ProfileLoader.cpp rename to src/ProfileLoader.cpp diff --git a/ProfileLoader.h b/src/ProfileLoader.h similarity index 100% rename from ProfileLoader.h rename to src/ProfileLoader.h diff --git a/ProfileWidget.cpp b/src/ProfileWidget.cpp similarity index 100% rename from ProfileWidget.cpp rename to src/ProfileWidget.cpp diff --git a/ProfileWidget.h b/src/ProfileWidget.h similarity index 100% rename from ProfileWidget.h rename to src/ProfileWidget.h diff --git a/RagePhoto.cpp b/src/RagePhoto.cpp similarity index 100% rename from RagePhoto.cpp rename to src/RagePhoto.cpp diff --git a/RagePhoto.h b/src/RagePhoto.h similarity index 100% rename from RagePhoto.h rename to src/RagePhoto.h diff --git a/SavegameCopy.cpp b/src/SavegameCopy.cpp similarity index 100% rename from SavegameCopy.cpp rename to src/SavegameCopy.cpp diff --git a/SavegameCopy.h b/src/SavegameCopy.h similarity index 100% rename from SavegameCopy.h rename to src/SavegameCopy.h diff --git a/SavegameData.cpp b/src/SavegameData.cpp similarity index 100% rename from SavegameData.cpp rename to src/SavegameData.cpp diff --git a/SavegameData.h b/src/SavegameData.h similarity index 100% rename from SavegameData.h rename to src/SavegameData.h diff --git a/SavegameDialog.cpp b/src/SavegameDialog.cpp similarity index 100% rename from SavegameDialog.cpp rename to src/SavegameDialog.cpp diff --git a/SavegameDialog.h b/src/SavegameDialog.h similarity index 100% rename from SavegameDialog.h rename to src/SavegameDialog.h diff --git a/SavegameDialog.ui b/src/SavegameDialog.ui similarity index 100% rename from SavegameDialog.ui rename to src/SavegameDialog.ui diff --git a/SavegameWidget.cpp b/src/SavegameWidget.cpp similarity index 100% rename from SavegameWidget.cpp rename to src/SavegameWidget.cpp diff --git a/SavegameWidget.h b/src/SavegameWidget.h similarity index 100% rename from SavegameWidget.h rename to src/SavegameWidget.h diff --git a/SavegameWidget.ui b/src/SavegameWidget.ui similarity index 100% rename from SavegameWidget.ui rename to src/SavegameWidget.ui diff --git a/SidebarGenerator.cpp b/src/SidebarGenerator.cpp similarity index 100% rename from SidebarGenerator.cpp rename to src/SidebarGenerator.cpp diff --git a/SidebarGenerator.h b/src/SidebarGenerator.h similarity index 100% rename from SidebarGenerator.h rename to src/SidebarGenerator.h diff --git a/SnapmaticEditor.cpp b/src/SnapmaticEditor.cpp similarity index 100% rename from SnapmaticEditor.cpp rename to src/SnapmaticEditor.cpp diff --git a/SnapmaticEditor.h b/src/SnapmaticEditor.h similarity index 100% rename from SnapmaticEditor.h rename to src/SnapmaticEditor.h diff --git a/SnapmaticEditor.ui b/src/SnapmaticEditor.ui similarity index 100% rename from SnapmaticEditor.ui rename to src/SnapmaticEditor.ui diff --git a/SnapmaticPicture.cpp b/src/SnapmaticPicture.cpp similarity index 100% rename from SnapmaticPicture.cpp rename to src/SnapmaticPicture.cpp diff --git a/SnapmaticPicture.h b/src/SnapmaticPicture.h similarity index 100% rename from SnapmaticPicture.h rename to src/SnapmaticPicture.h diff --git a/SnapmaticWidget.cpp b/src/SnapmaticWidget.cpp similarity index 100% rename from SnapmaticWidget.cpp rename to src/SnapmaticWidget.cpp diff --git a/SnapmaticWidget.h b/src/SnapmaticWidget.h similarity index 100% rename from SnapmaticWidget.h rename to src/SnapmaticWidget.h diff --git a/SnapmaticWidget.ui b/src/SnapmaticWidget.ui similarity index 100% rename from SnapmaticWidget.ui rename to src/SnapmaticWidget.ui diff --git a/StandardPaths.cpp b/src/StandardPaths.cpp similarity index 100% rename from StandardPaths.cpp rename to src/StandardPaths.cpp diff --git a/StandardPaths.h b/src/StandardPaths.h similarity index 100% rename from StandardPaths.h rename to src/StandardPaths.h diff --git a/StringParser.cpp b/src/StringParser.cpp similarity index 100% rename from StringParser.cpp rename to src/StringParser.cpp diff --git a/StringParser.h b/src/StringParser.h similarity index 100% rename from StringParser.h rename to src/StringParser.h diff --git a/TelemetryClass.cpp b/src/TelemetryClass.cpp similarity index 100% rename from TelemetryClass.cpp rename to src/TelemetryClass.cpp diff --git a/TelemetryClass.h b/src/TelemetryClass.h similarity index 100% rename from TelemetryClass.h rename to src/TelemetryClass.h diff --git a/TranslationClass.cpp b/src/TranslationClass.cpp similarity index 100% rename from TranslationClass.cpp rename to src/TranslationClass.cpp diff --git a/TranslationClass.h b/src/TranslationClass.h similarity index 100% rename from TranslationClass.h rename to src/TranslationClass.h diff --git a/UserInterface.cpp b/src/UserInterface.cpp similarity index 100% rename from UserInterface.cpp rename to src/UserInterface.cpp diff --git a/UserInterface.h b/src/UserInterface.h similarity index 100% rename from UserInterface.h rename to src/UserInterface.h diff --git a/UserInterface.ui b/src/UserInterface.ui similarity index 100% rename from UserInterface.ui rename to src/UserInterface.ui diff --git a/anpro/QrCode.cpp b/src/anpro/QrCode.cpp similarity index 100% rename from anpro/QrCode.cpp rename to src/anpro/QrCode.cpp diff --git a/anpro/QrCode.h b/src/anpro/QrCode.h similarity index 100% rename from anpro/QrCode.h rename to src/anpro/QrCode.h diff --git a/anpro/imagecropper.cpp b/src/anpro/imagecropper.cpp similarity index 100% rename from anpro/imagecropper.cpp rename to src/anpro/imagecropper.cpp diff --git a/anpro/imagecropper.h b/src/anpro/imagecropper.h similarity index 100% rename from anpro/imagecropper.h rename to src/anpro/imagecropper.h diff --git a/anpro/imagecropper_e.h b/src/anpro/imagecropper_e.h similarity index 100% rename from anpro/imagecropper_e.h rename to src/anpro/imagecropper_e.h diff --git a/anpro/imagecropper_p.h b/src/anpro/imagecropper_p.h similarity index 100% rename from anpro/imagecropper_p.h rename to src/anpro/imagecropper_p.h diff --git a/config.h b/src/config.h similarity index 97% rename from config.h rename to src/config.h index 23874e2..87f8bb9 100644 --- a/config.h +++ b/src/config.h @@ -1,6 +1,6 @@ /***************************************************************************** * gta5view Grand Theft Auto V Profile Viewer -* Copyright (C) 2016-2021 Syping +* Copyright (C) 2016-2023 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 @@ -47,11 +47,11 @@ #endif #ifndef GTA5SYNC_COPYRIGHT -#define GTA5SYNC_COPYRIGHT "2016-2022" +#define GTA5SYNC_COPYRIGHT "2016-2023" #endif #ifndef GTA5SYNC_APPVER -#define GTA5SYNC_APPVER "1.10.1" +#define GTA5SYNC_APPVER "1.11.0" #endif #if __cplusplus diff --git a/main.cpp b/src/main.cpp similarity index 100% rename from main.cpp rename to src/main.cpp diff --git a/pcg/LICENSE.txt b/src/pcg/LICENSE.txt similarity index 100% rename from pcg/LICENSE.txt rename to src/pcg/LICENSE.txt diff --git a/pcg/pcg_basic.c b/src/pcg/pcg_basic.c similarity index 100% rename from pcg/pcg_basic.c rename to src/pcg/pcg_basic.c diff --git a/pcg/pcg_basic.h b/src/pcg/pcg_basic.h similarity index 100% rename from pcg/pcg_basic.h rename to src/pcg/pcg_basic.h diff --git a/tmext/TelemetryClassAuthenticator.cpp b/src/tmext/TelemetryClassAuthenticator.cpp similarity index 100% rename from tmext/TelemetryClassAuthenticator.cpp rename to src/tmext/TelemetryClassAuthenticator.cpp diff --git a/tmext/TelemetryClassAuthenticator.h b/src/tmext/TelemetryClassAuthenticator.h similarity index 100% rename from tmext/TelemetryClassAuthenticator.h rename to src/tmext/TelemetryClassAuthenticator.h diff --git a/uimod/JSHighlighter.cpp b/src/uimod/JSHighlighter.cpp similarity index 100% rename from uimod/JSHighlighter.cpp rename to src/uimod/JSHighlighter.cpp diff --git a/uimod/JSHighlighter.h b/src/uimod/JSHighlighter.h similarity index 100% rename from uimod/JSHighlighter.h rename to src/uimod/JSHighlighter.h diff --git a/uimod/UiModLabel.cpp b/src/uimod/UiModLabel.cpp similarity index 100% rename from uimod/UiModLabel.cpp rename to src/uimod/UiModLabel.cpp diff --git a/uimod/UiModLabel.h b/src/uimod/UiModLabel.h similarity index 100% rename from uimod/UiModLabel.h rename to src/uimod/UiModLabel.h diff --git a/uimod/UiModWidget.cpp b/src/uimod/UiModWidget.cpp similarity index 100% rename from uimod/UiModWidget.cpp rename to src/uimod/UiModWidget.cpp diff --git a/uimod/UiModWidget.h b/src/uimod/UiModWidget.h similarity index 100% rename from uimod/UiModWidget.h rename to src/uimod/UiModWidget.h diff --git a/wrapper.h b/src/wrapper.h similarity index 100% rename from wrapper.h rename to src/wrapper.h