From 1ddd596e55db160bc4f5b723af3111b6e7a70675 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Burak=20Han=C3=A7erli?= <burak.hancerli@qt.io>
Date: Sun, 12 Nov 2023 15:50:04 +0000
Subject: [PATCH] QDS-11197 Add QR Code registration instructions

---
 android/AndroidManifest.xml |  2 +-
 src/backend.cpp             |  1 +
 src/backend.h               |  1 +
 ui/HomePage.qml             | 32 ++++++++++++++++++++++++++++++++
 ui/main.qml                 |  4 ++--
 5 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index e7dbc2d..e732779 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.qt.qtdesignviewer"
-    android:installLocation="auto" android:versionCode="10" android:versionName="1.2">
+    android:installLocation="auto" android:versionCode="11" android:versionName="1.2">
     <!-- %%INSERT_PERMISSIONS -->
     <!-- %%INSERT_FEATURES -->
     <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
diff --git a/src/backend.cpp b/src/backend.cpp
index 7cadef2..206cfca 100644
--- a/src/backend.cpp
+++ b/src/backend.cpp
@@ -483,6 +483,7 @@ void Backend::registerUser(const QUrl &url)
     printLog("Registering User Hash: " + userHash);
     m_userHash = userHash;
     QSettings().setValue("user/hash", m_userHash);
+    emit userRegistered();
     updateUserProjectList();
 }
 
diff --git a/src/backend.h b/src/backend.h
index fa47d36..f8defbb 100644
--- a/src/backend.h
+++ b/src/backend.h
@@ -94,6 +94,7 @@ signals:
     void popupTextChanged(QString text);
     void popupOpen();
     void popupClose();
+    void userRegistered();
 
 public slots:
     void downloadAndRun(const QString &url);
diff --git a/ui/HomePage.qml b/ui/HomePage.qml
index 7e05fe9..714d40f 100644
--- a/ui/HomePage.qml
+++ b/ui/HomePage.qml
@@ -10,6 +10,8 @@ Item {
 
     ColumnLayout {
         anchors.fill: parent
+
+
         Item {
             id: item2
             Layout.preferredWidth: 10
@@ -18,6 +20,33 @@ Item {
             Layout.fillHeight: true
         }
 
+        Text {
+            id: qrCodeStatus
+            text: qsTr("No user code is registered.\nTo access your shared projects;")
+            font.pixelSize: 12
+            horizontalAlignment: Text.AlignHCenter
+            verticalAlignment: Text.AlignVCenter
+            wrapMode: Text.WordWrap
+            Layout.fillWidth: true
+            Connections {
+                target: backend
+                function onUserRegistered(){
+                    qrCodeStatus.text = "QR Code Registered\nYou can simply scan a new QR code to register another user.";
+                    qrCodeInstructions.text = "";
+                }
+            }
+        }
+
+        Text {
+            id: qrCodeInstructions
+            text: qsTr("1. Open Design Studio (4.4 or later)\n2. Open any project\n3. Click \"File\" menu from top\n4. Select \"Share Application Online\"\n5. Scan QR code with your camera or any QR reader app")
+            font.pixelSize: 12
+            horizontalAlignment: Text.AlignHCenter
+            verticalAlignment: Text.AlignVCenter
+            wrapMode: Text.WordWrap
+            Layout.fillWidth: true
+        }
+
         ComboBox {
             id: projectList
             Layout.fillWidth: true
@@ -40,6 +69,7 @@ Item {
             Layout.preferredHeight: 50
         }
 
+
         ColumnLayout {
             id: column
             Layout.fillWidth: true
@@ -76,5 +106,7 @@ Item {
         }
 
 
+
+
     }
 }
diff --git a/ui/main.qml b/ui/main.qml
index ac4d4be..ad11c1a 100644
--- a/ui/main.qml
+++ b/ui/main.qml
@@ -203,11 +203,11 @@ Rectangle {
     states: [
         State {
             name: "vertical"
-            when: root.width <= 400
+            when: root.width >= 400
         },
         State {
             name: "horizontal"
-            when: root.width > 400
+            when: root.width < 400
 
             PropertyChanges {
                 target: qdsicon1
-- 
GitLab