From 25ec67ec8b1008528016892b7faf30245645988c Mon Sep 17 00:00:00 2001
From: Syping <schiedelrafael@keppe.org>
Date: Tue, 17 Nov 2020 06:58:29 +0100
Subject: [PATCH] Fix resources and Qt4 build

---
 CMakeLists.txt                    |   6 +--
 ImportDialog.cpp                  |  10 ++++-
 gta5view.pro                      |  12 +++---
 res/{ => qt4}/qt_de.qm            | Bin
 res/{ => qt4}/qt_fr.qm            | Bin
 res/{ => qt4}/qt_ko.qm            | Bin
 res/{ => qt4}/qt_ru.qm            | Bin
 res/{ => qt4}/qt_uk.qm            | Bin
 res/{ => qt4}/qt_zh_TW.qm         | Bin
 res/{tr_qt4.qrc => qt4/tr_qt.qrc} |   0
 res/{ => qt5}/qtbase_en_GB.qm     | Bin
 res/{ => qt5}/qtbase_en_GB.ts     |   0
 res/qt5/tr_qt.qrc                 |  11 +++++
 res/qt6/qtbase_en_GB.qm           | Bin 0 -> 1025 bytes
 res/qt6/qtbase_en_GB.ts           |  65 ++++++++++++++++++++++++++++++
 res/qt6/tr_qt.qrc                 |  11 +++++
 res/tr_qt5.qrc                    |  11 -----
 res/tr_qt6.qrc                    |  11 -----
 18 files changed, 105 insertions(+), 32 deletions(-)
 rename res/{ => qt4}/qt_de.qm (100%)
 rename res/{ => qt4}/qt_fr.qm (100%)
 rename res/{ => qt4}/qt_ko.qm (100%)
 rename res/{ => qt4}/qt_ru.qm (100%)
 rename res/{ => qt4}/qt_uk.qm (100%)
 rename res/{ => qt4}/qt_zh_TW.qm (100%)
 rename res/{tr_qt4.qrc => qt4/tr_qt.qrc} (100%)
 rename res/{ => qt5}/qtbase_en_GB.qm (100%)
 rename res/{ => qt5}/qtbase_en_GB.ts (100%)
 create mode 100644 res/qt5/tr_qt.qrc
 create mode 100644 res/qt6/qtbase_en_GB.qm
 create mode 100644 res/qt6/qtbase_en_GB.ts
 create mode 100644 res/qt6/tr_qt.qrc
 delete mode 100644 res/tr_qt5.qrc
 delete mode 100644 res/tr_qt6.qrc

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3fb7c2..f2f2811 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -164,7 +164,7 @@ if(Qt5LinguistTools_FOUND)
         res/gta5sync_ru.ts
         res/gta5sync_uk.ts
         res/gta5sync_zh_TW.ts
-        res/qtbase_en_GB.ts
+        res/qt5/qtbase_en_GB.ts
     )
     add_custom_target(translations DEPENDS ${GTA5VIEW_TRANSLATIONS})
 else()
@@ -176,7 +176,7 @@ else()
         res/gta5sync_ru.qm
         res/gta5sync_uk.qm
         res/gta5sync_zh_TW.qm
-        res/qtbase_en_GB.qm
+        res/qt5/qtbase_en_GB.qm
     )
 endif()
 
@@ -188,7 +188,7 @@ if(QCONF_BUILD)
 else()
     list(APPEND GTA5VIEW_RESOURCES
         res/tr_g5p.qrc
-        res/tr_qt${QT_VERSION_MAJOR}.qrc
+        res/qt${QT_VERSION_MAJOR}/tr_qt.qrc
     )
 endif()
 
diff --git a/ImportDialog.cpp b/ImportDialog.cpp
index e14bb00..94d9763 100644
--- a/ImportDialog.cpp
+++ b/ImportDialog.cpp
@@ -371,9 +371,13 @@ void ImportDialog::saveSettings(QString settingsProfile)
     settings.setValue("SelectedColour", selectedColour);
     settings.setValue("BackgroundStretch", ui->cbStretch->isChecked());
     settings.setValue("ForceAvatarColour", ui->cbForceAvatarColour->isChecked());
+#if QT_VERSION >= 0x050000
     const QVariant data = ui->cbResolution->currentData();
+#else
+    const QVariant data = ui->cbResolution->itemData(ui->cbResolution->currentIndex());
+#endif
     if (data.type() == QVariant::Size) {
-        settings.setValue("Resolution", ui->cbResolution->currentData());
+        settings.setValue("Resolution", data);
     }
     else {
         settings.setValue("Resolution", SnapmaticPicture::getSnapmaticResolution());
@@ -896,7 +900,11 @@ void ImportDialog::on_cbImportAsIs_toggled(bool checked)
 void ImportDialog::on_cbResolution_currentIndexChanged(int index)
 {
     Q_UNUSED(index)
+#if QT_VERSION >= 0x050000
     const QVariant data = ui->cbResolution->currentData();
+#else
+    const QVariant data = ui->cbResolution->itemData(ui->cbResolution->currentIndex());
+#endif
     if (data.type() == QVariant::Size) {
         const QSize dataSize = data.toSize();
         if (dataSize == SnapmaticPicture::getSnapmaticResolution()) {
diff --git a/gta5view.pro b/gta5view.pro
index cacdc53..daa7ec4 100644
--- a/gta5view.pro
+++ b/gta5view.pro
@@ -208,12 +208,12 @@ isEqual(QT_MAJOR_VERSION, 4): SOURCES += qjson4/QJsonArray.cpp \
     qjson4/QJsonValueRef.cpp \
     qjson4/QJsonParser.cpp
 
-isEqual(QT_MAJOR_VERSION, 4): RESOURCES += res/tr_qt4.qrc
+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/tr_qt5.qrc
+isEqual(QT_MAJOR_VERSION, 5): RESOURCES += res/qt5/tr_qt.qrc
 
 # QT5+ ONLY STUFF
 
@@ -221,7 +221,7 @@ greaterThan(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc
 
 # QT6 ONLY STUFF
 
-isEqual(QT_MAJOR_VERSION, 6): RESOURCES += res/tr_qt6.qrc
+isEqual(QT_MAJOR_VERSION, 6): RESOURCES += res/qt6/tr_qt.qrc
 
 # RESOURCE COMPILATION
 
@@ -245,9 +245,9 @@ INSTALLS += target pixmaps appfiles
 # QCONF BASED BUILD STUFF
 
 contains(DEFINES, GTA5SYNC_QCONF) {
-    isEqual(QT_MAJOR_VERSION, 4): RESOURCES -= res/tr_qt4.qrc
-    isEqual(QT_MAJOR_VERSION, 5): RESOURCES -= res/tr_qt5.qrc
-    isEqual(QT_MAJOR_VERSION, 6): RESOURCES -= res/tr_qt6.qrc
+    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
diff --git a/res/qt_de.qm b/res/qt4/qt_de.qm
similarity index 100%
rename from res/qt_de.qm
rename to res/qt4/qt_de.qm
diff --git a/res/qt_fr.qm b/res/qt4/qt_fr.qm
similarity index 100%
rename from res/qt_fr.qm
rename to res/qt4/qt_fr.qm
diff --git a/res/qt_ko.qm b/res/qt4/qt_ko.qm
similarity index 100%
rename from res/qt_ko.qm
rename to res/qt4/qt_ko.qm
diff --git a/res/qt_ru.qm b/res/qt4/qt_ru.qm
similarity index 100%
rename from res/qt_ru.qm
rename to res/qt4/qt_ru.qm
diff --git a/res/qt_uk.qm b/res/qt4/qt_uk.qm
similarity index 100%
rename from res/qt_uk.qm
rename to res/qt4/qt_uk.qm
diff --git a/res/qt_zh_TW.qm b/res/qt4/qt_zh_TW.qm
similarity index 100%
rename from res/qt_zh_TW.qm
rename to res/qt4/qt_zh_TW.qm
diff --git a/res/tr_qt4.qrc b/res/qt4/tr_qt.qrc
similarity index 100%
rename from res/tr_qt4.qrc
rename to res/qt4/tr_qt.qrc
diff --git a/res/qtbase_en_GB.qm b/res/qt5/qtbase_en_GB.qm
similarity index 100%
rename from res/qtbase_en_GB.qm
rename to res/qt5/qtbase_en_GB.qm
diff --git a/res/qtbase_en_GB.ts b/res/qt5/qtbase_en_GB.ts
similarity index 100%
rename from res/qtbase_en_GB.ts
rename to res/qt5/qtbase_en_GB.ts
diff --git a/res/qt5/tr_qt.qrc b/res/qt5/tr_qt.qrc
new file mode 100644
index 0000000..7bfe7cc
--- /dev/null
+++ b/res/qt5/tr_qt.qrc
@@ -0,0 +1,11 @@
+<RCC>
+    <qresource prefix="/tr">
+        <file>qtbase_en_GB.qm</file>
+        <file>qtbase_de.qm</file>
+        <file>qtbase_fr.qm</file>
+        <file>qtbase_ko.qm</file>
+        <file>qtbase_ru.qm</file>
+        <file>qtbase_uk.qm</file>
+        <file>qtbase_zh_TW.qm</file>
+    </qresource>
+</RCC>
diff --git a/res/qt6/qtbase_en_GB.qm b/res/qt6/qtbase_en_GB.qm
new file mode 100644
index 0000000000000000000000000000000000000000..8a7e376d275b61ee312255285d228e414acdf964
GIT binary patch
literal 1025
zcma)4L2DC16n;sXq=ZzVQjk*W6wF*wg!EXXklmK1q8MHAs^jd`Zadu#JG&s_4=61N
z9t01)<m5%~B8s4gqTscc;>n8_>A9t#-)>7JxH0Z9`)207`QG=wc~{@K7rz|tKL0v1
z_2GW^{kNAyR8;=GWy`{<L-n1<M7b{2UnF*q>U+nqKk4R^ZKC{9{`IqDKU3J>{zz1~
zG_vx@!95yzdXV_-@@iuo{?_Qq;R*KZl^^fs;XbNf`TQOBLABHU1p8{NzVH_Q3m!mL
z3pkl2PEB$#7)2D|Z&OSrU2mqlfHcly3dxM(0+lc)c++)R6fiqBQLxGEKnI~I!&AML
zt`|L_gNL~!!xS=DB!KCW1fm4m--u(}62_BE{sU<mNd4@xvCi=`S_8p;;p-Js=F6c{
z{(J`gzPJ)^-MMi+D-2a~jCNY#25NLrWk?Fc@7J)Gbey+6xxpNnq(0SeSpFivt=z2i
zeJqRI5z&7{-4%Lh)cGdYoi)Man(%!!JicUU9;+-^D0D4-J9N=mH!<`?1a)fEKo=%<
zjw;YF(am5mT7r%?>}g+0#QV@yk?yH@*^WaKgiJ)N)|h3rxk@`!#;_&FPP$VHUn)IR
k*H+92k)8wvB*c^{S^H1(_DED6rIm~ZJ>nK>&*yT#0k946mH+?%

literal 0
HcmV?d00001

diff --git a/res/qt6/qtbase_en_GB.ts b/res/qt6/qtbase_en_GB.ts
new file mode 100644
index 0000000..0fbfffd
--- /dev/null
+++ b/res/qt6/qtbase_en_GB.ts
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="en_GB">
+<context>
+    <name>QColorDialog</name>
+    <message>
+        <source>Hu&amp;e:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>&amp;Sat:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>&amp;Val:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>&amp;Red:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>&amp;Green:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Bl&amp;ue:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>A&amp;lpha channel:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>&amp;HTML:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Cursor at %1, %2
+Press ESC to cancel</source>
+        <translation>Cursour at %1, %2
+Press ESC to cancel</translation>
+    </message>
+    <message>
+        <source>Select Color</source>
+        <translation>Select Colour</translation>
+    </message>
+    <message>
+        <source>&amp;Basic colors</source>
+        <translation>&amp;Basic colours</translation>
+    </message>
+    <message>
+        <source>&amp;Custom colors</source>
+        <translation>&amp;Custom colours</translation>
+    </message>
+    <message>
+        <source>&amp;Add to Custom Colors</source>
+        <translation>&amp;Add to Custom Colours</translation>
+    </message>
+    <message>
+        <source>&amp;Pick Screen Color</source>
+        <translation>&amp;Pick Screen Colour</translation>
+    </message>
+</context>
+</TS>
diff --git a/res/qt6/tr_qt.qrc b/res/qt6/tr_qt.qrc
new file mode 100644
index 0000000..7bfe7cc
--- /dev/null
+++ b/res/qt6/tr_qt.qrc
@@ -0,0 +1,11 @@
+<RCC>
+    <qresource prefix="/tr">
+        <file>qtbase_en_GB.qm</file>
+        <file>qtbase_de.qm</file>
+        <file>qtbase_fr.qm</file>
+        <file>qtbase_ko.qm</file>
+        <file>qtbase_ru.qm</file>
+        <file>qtbase_uk.qm</file>
+        <file>qtbase_zh_TW.qm</file>
+    </qresource>
+</RCC>
diff --git a/res/tr_qt5.qrc b/res/tr_qt5.qrc
deleted file mode 100644
index 7cfd46a..0000000
--- a/res/tr_qt5.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
-    <qresource prefix="/tr">
-        <file>qtbase_en_GB.qm</file>
-        <file>qt5/qtbase_de.qm</file>
-        <file>qt5/qtbase_fr.qm</file>
-        <file>qt5/qtbase_ko.qm</file>
-        <file>qt5/qtbase_ru.qm</file>
-        <file>qt5/qtbase_uk.qm</file>
-        <file>qt5/qtbase_zh_TW.qm</file>
-    </qresource>
-</RCC>
diff --git a/res/tr_qt6.qrc b/res/tr_qt6.qrc
deleted file mode 100644
index a8adf50..0000000
--- a/res/tr_qt6.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
-    <qresource prefix="/tr">
-        <file>qtbase_en_GB.qm</file>
-        <file>qt6/qtbase_de.qm</file>
-        <file>qt6/qtbase_fr.qm</file>
-        <file>qt6/qtbase_ko.qm</file>
-        <file>qt6/qtbase_ru.qm</file>
-        <file>qt6/qtbase_uk.qm</file>
-        <file>qt6/qtbase_zh_TW.qm</file>
-    </qresource>
-</RCC>