From b15bc79bf851b99de523c153a671cab56878662b Mon Sep 17 00:00:00 2001
From: EndrII <EndrIIMail@gmail.com>
Date: Fri, 4 Jun 2021 09:58:54 +0300
Subject: [PATCH] added suppor developers only mode

---
 src/Example/src/main.qml                      | 62 ++++++++++++++++++-
 src/Library/src/QuasarAppCredits.qrc          |  1 +
 .../src/QuasarAppCreditsModule/Credits.qml    | 55 ++++++++++++----
 .../src/QuasarAppCreditsModule/ListViewer.qml | 48 ++++++++++++++
 src/Library/src/credits_languages/de.ts       |  8 ++-
 src/Library/src/credits_languages/en.ts       |  4 +-
 src/Library/src/credits_languages/es.ts       |  8 ++-
 src/Library/src/credits_languages/fr.ts       |  8 ++-
 src/Library/src/credits_languages/ja.ts       |  4 +-
 src/Library/src/credits_languages/pl.ts       |  8 ++-
 src/Library/src/credits_languages/ru.ts       |  4 +-
 src/Library/src/credits_languages/tr.ts       |  4 +-
 src/Library/src/credits_languages/uk.ts       |  4 +-
 src/Library/src/credits_languages/zh.ts       |  8 ++-
 14 files changed, 190 insertions(+), 36 deletions(-)
 create mode 100644 src/Library/src/QuasarAppCreditsModule/ListViewer.qml

diff --git a/src/Example/src/main.qml b/src/Example/src/main.qml
index 0763930..7c05542 100644
--- a/src/Example/src/main.qml
+++ b/src/Example/src/main.qml
@@ -4,9 +4,65 @@ import QuasarAppCreditsModule 1.0
 
 ApplicationWindow {
 
-    Credits {
-        anchors.fill: parent;
-        state: "minimal"
+    SwipeView {
+        id: view
+
+        currentIndex: 1
+        anchors.fill: parent
+
+        Credits {
+            state: "about"
+            developersList: [
+                {
+                    section: qsTr("## QuasarApp Core"),
+                    sectionList: [
+                        "* Oleg-Disigner",
+                        "* Yankovich Andrei"
+                    ]
+                }
+            ]
+        }
+        Credits {
+            state: "minimal"
+        }
+        Credits {
+            state: "bitcoinSimple"
+        }
+
+        Credits {
+            state: "patreon"
+        }
+
+        Credits {
+            state: "bitcoin"
+        }
+
+        Credits {
+            state: "full"
+        }
+
+        Credits {
+            state: "full"
+            developersList: [
+                {
+                    section: qsTr("## QuasarApp Core"),
+                    sectionList: [
+                        "* Oleg-Disigner",
+                        "* Yankovich Andrei"
+                    ]
+                }
+            ]
+        }
+    }
+
+    PageIndicator {
+        id: indicator
+
+        count: view.count
+        currentIndex: view.currentIndex
+
+        anchors.bottom: view.bottom
+        anchors.horizontalCenter: parent.horizontalCenter
     }
 
     width: 470
diff --git a/src/Library/src/QuasarAppCredits.qrc b/src/Library/src/QuasarAppCredits.qrc
index 19561a3..5a2115a 100644
--- a/src/Library/src/QuasarAppCredits.qrc
+++ b/src/Library/src/QuasarAppCredits.qrc
@@ -16,5 +16,6 @@
         <file>credits_languages/de.qm</file>
         <file>credits_languages/zh.qm</file>
         <file>credits_languages/es.qm</file>
+        <file>QuasarAppCreditsModule/ListViewer.qml</file>
     </qresource>
 </RCC>
diff --git a/src/Library/src/QuasarAppCreditsModule/Credits.qml b/src/Library/src/QuasarAppCreditsModule/Credits.qml
index d502cff..ba30c9e 100644
--- a/src/Library/src/QuasarAppCreditsModule/Credits.qml
+++ b/src/Library/src/QuasarAppCreditsModule/Credits.qml
@@ -10,6 +10,21 @@ Page {
     property bool showHeader: true
     property bool showPatreon: true
     property bool showBitcoin: true
+    property bool showPatrons: (showQR || showPatreon || showBitcoin) && patronsList.length
+
+    // developersa and patronsList lists must be contain structure with a section amd sectionList fields.
+    // The section it is section name
+    // the sectionList it is list of section members.
+    property var developersList: []
+    property var patronsList: [
+        {
+            section: qsTr("## Silver Membership Patrons:"),
+            sectionList: [
+                "* Rustem Husnutdinov",
+                "* Semih Ufuk Güler"
+            ]
+        }
+    ]
 
     header: Image {
         fillMode: Image.PreserveAspectFit
@@ -90,33 +105,33 @@ Page {
                 Layout.fillWidth: true
 
                 textFormat: TextEdit.MarkdownText
+                visible: showPatrons
 
 
             }
 
+            ListViewer {
+                model: patronsList
+
+                visible: showPatrons
+            }
+
             Label {
-                text: qsTr("## Silver Membership Patrons:")
+                text: qsTr("# Developers list:")
                 Layout.fillWidth: true
 
                 textFormat: TextEdit.MarkdownText
 
-            }
-
-            Label {
-                text: qsTr("* Rustem Husnutdinov")
-                Layout.fillWidth: true
-
-                textFormat: TextEdit.MarkdownText
+                visible: developersList.length
 
             }
-            
-            Label {
-                text: qsTr("* Semih Ufuk Güler")
-                Layout.fillWidth: true
 
-                textFormat: TextEdit.MarkdownText
+            ListViewer {
+                model: developersList
 
+                visible: developersList.length
             }
+
         }
 
         anchors.fill: parent
@@ -175,6 +190,20 @@ Page {
                 showHeader: true
                 showPatreon: false
                 showBitcoin: false
+                showPatrons: true
+
+            }
+        },
+
+        State {
+            name: "about"
+            PropertyChanges {
+                target: root
+                showQR: false
+                showHeader: true
+                showPatreon: false
+                showBitcoin: false
+                patronsList: []
 
             }
         }
diff --git a/src/Library/src/QuasarAppCreditsModule/ListViewer.qml b/src/Library/src/QuasarAppCreditsModule/ListViewer.qml
new file mode 100644
index 0000000..95fb1a0
--- /dev/null
+++ b/src/Library/src/QuasarAppCreditsModule/ListViewer.qml
@@ -0,0 +1,48 @@
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Layouts 1.15
+
+// developersa and patronsList lists must be contain structure with a section amd sectionList fields.
+// The section it is section name
+// the sectionList it is list of section members.
+// Example of the structure:
+//[
+//    {
+//        section: qsTr("## Silver Membership Patrons:"),
+//        sectionList: [
+//            "* Rustem Husnutdinov",
+//            "* Semih Ufuk Güler"
+//        ]
+//    }
+//]
+Repeater {
+    model: patronsList
+
+    visible: showPatrons
+
+    ColumnLayout {
+        Layout.fillWidth: true
+
+        Label {
+            text: modelData.section
+            Layout.fillWidth: true
+
+            textFormat: TextEdit.MarkdownText
+            visible: showPatrons
+
+        }
+
+        Repeater {
+            model: modelData.sectionList
+
+            Label {
+                text: modelData
+                Layout.fillWidth: true
+
+                textFormat: TextEdit.MarkdownText
+
+            }
+
+        }
+    }
+}
diff --git a/src/Library/src/credits_languages/de.ts b/src/Library/src/credits_languages/de.ts
index 0cf437d..147d11e 100644
--- a/src/Library/src/credits_languages/de.ts
+++ b/src/Library/src/credits_languages/de.ts
@@ -29,11 +29,15 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
         <source>* Semih Ufuk Güler</source>
-        <translation>* Semih Ufuk Güler</translation>
+        <translation type="vanished">* Semih Ufuk Güler</translation>
+    </message>
+    <message>
+        <source># Developers list:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 </TS>
diff --git a/src/Library/src/credits_languages/en.ts b/src/Library/src/credits_languages/en.ts
index 2ef4478..2d580bd 100644
--- a/src/Library/src/credits_languages/en.ts
+++ b/src/Library/src/credits_languages/en.ts
@@ -29,10 +29,10 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
-        <source>* Semih Ufuk Güler</source>
+        <source># Developers list:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
diff --git a/src/Library/src/credits_languages/es.ts b/src/Library/src/credits_languages/es.ts
index c7dd8d9..2bbb705 100644
--- a/src/Library/src/credits_languages/es.ts
+++ b/src/Library/src/credits_languages/es.ts
@@ -29,11 +29,15 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
         <source>* Semih Ufuk Güler</source>
-        <translation>* Semih Ufuk Güler</translation>
+        <translation type="vanished">* Semih Ufuk Güler</translation>
+    </message>
+    <message>
+        <source># Developers list:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 </TS>
diff --git a/src/Library/src/credits_languages/fr.ts b/src/Library/src/credits_languages/fr.ts
index 94d91bf..b1489d1 100644
--- a/src/Library/src/credits_languages/fr.ts
+++ b/src/Library/src/credits_languages/fr.ts
@@ -29,11 +29,15 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
         <source>* Semih Ufuk Güler</source>
-        <translation>* Semih Ufuk Güler</translation>
+        <translation type="vanished">* Semih Ufuk Güler</translation>
+    </message>
+    <message>
+        <source># Developers list:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 </TS>
diff --git a/src/Library/src/credits_languages/ja.ts b/src/Library/src/credits_languages/ja.ts
index 62ec074..5c4d020 100644
--- a/src/Library/src/credits_languages/ja.ts
+++ b/src/Library/src/credits_languages/ja.ts
@@ -29,10 +29,10 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
-        <source>* Semih Ufuk Güler</source>
+        <source># Developers list:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
diff --git a/src/Library/src/credits_languages/pl.ts b/src/Library/src/credits_languages/pl.ts
index 2b78aca..7cc466a 100644
--- a/src/Library/src/credits_languages/pl.ts
+++ b/src/Library/src/credits_languages/pl.ts
@@ -29,11 +29,15 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
         <source>* Semih Ufuk Güler</source>
-        <translation>* Semih Ufuk Güler</translation>
+        <translation type="vanished">* Semih Ufuk Güler</translation>
+    </message>
+    <message>
+        <source># Developers list:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 </TS>
diff --git a/src/Library/src/credits_languages/ru.ts b/src/Library/src/credits_languages/ru.ts
index 3f949b4..416a87d 100644
--- a/src/Library/src/credits_languages/ru.ts
+++ b/src/Library/src/credits_languages/ru.ts
@@ -29,10 +29,10 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
-        <source>* Semih Ufuk Güler</source>
+        <source># Developers list:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
diff --git a/src/Library/src/credits_languages/tr.ts b/src/Library/src/credits_languages/tr.ts
index de2f406..80e7763 100644
--- a/src/Library/src/credits_languages/tr.ts
+++ b/src/Library/src/credits_languages/tr.ts
@@ -29,10 +29,10 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
-        <source>* Semih Ufuk Güler</source>
+        <source># Developers list:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
diff --git a/src/Library/src/credits_languages/uk.ts b/src/Library/src/credits_languages/uk.ts
index 6e82e04..9fadbc6 100644
--- a/src/Library/src/credits_languages/uk.ts
+++ b/src/Library/src/credits_languages/uk.ts
@@ -29,10 +29,10 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
-        <source>* Semih Ufuk Güler</source>
+        <source># Developers list:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
diff --git a/src/Library/src/credits_languages/zh.ts b/src/Library/src/credits_languages/zh.ts
index d5ffa41..11e5117 100644
--- a/src/Library/src/credits_languages/zh.ts
+++ b/src/Library/src/credits_languages/zh.ts
@@ -29,11 +29,15 @@
     </message>
     <message>
         <source>* Rustem Husnutdinov</source>
-        <translation>* Rustem Husnutdinov</translation>
+        <translation type="vanished">* Rustem Husnutdinov</translation>
     </message>
     <message>
         <source>* Semih Ufuk Güler</source>
-        <translation>* Semih Ufuk Güler</translation>
+        <translation type="vanished">* Semih Ufuk Güler</translation>
+    </message>
+    <message>
+        <source># Developers list:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 </TS>