From 44a035ef6b073a104de114e269976fdf52bac57a Mon Sep 17 00:00:00 2001
From: Burak Hancerli <burak.hancerli@qt.io>
Date: Mon, 3 Jun 2024 13:26:23 +0200
Subject: [PATCH] fix: cannot open the about page and remove unnecessary
 variables

---
 .gitignore              | 10 +++++-----
 src/backend/backend.cpp | 26 ++++++++++++++------------
 src/backend/backend.h   |  6 +-----
 src/ui/AboutHeader.qml  | 13 ++-----------
 src/ui/main.qml         | 34 +++++++++++++++++-----------------
 5 files changed, 39 insertions(+), 50 deletions(-)

diff --git a/.gitignore b/.gitignore
index 24e6943..a8f3c8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,8 @@
 .DS_Store
-ui/*.db
-ui/*.qtds
-ui/*.db-shm
-ui/*.db-wal
-ui/share.qrc
+src/ui/*.db
+src/ui/*.qtds
+src/ui/*.db-shm
+src/ui/*.db-wal
+src/ui/share.qrc
 logcat.txt
 output.junit.xml
diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp
index 35afbe2..79a35b8 100644
--- a/src/backend/backend.cpp
+++ b/src/backend/backend.cpp
@@ -57,18 +57,6 @@ Backend::Backend(QObject *parent)
     m_backgroundTimer.setInterval(1000 * 10);
     enableBackgroundUpdate(updateInBackground());
 
-#ifdef QT_DEBUG
-    const QString buildType = "Debug";
-#else
-    const QString buildType = "Release";
-#endif
-    m_buildInfo = QCoreApplication::applicationVersion() + "\nTechnology Preview - "
-                  + QString(CMAKE_VAR_GIT_VERSION) + "\nQt " + QString(QT_VERSION_STR) + " - "
-                  + buildType + " Build" + "\nQt Quick Components "
-                  + QString(CMAKE_VAR_QT_QUICK_COMPONENTS_VERSION)
-                  + "\nZXing-Cpp: " + QString(CMAKE_VAR_ZXING_VERSION)
-                  + "\nOpenSSL support: " + QVariant(QSslSocket::supportsSsl()).toString();
-
     const QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
     qDebug() << "Qt Design Viewer";
     qDebug() << "System information:";
@@ -78,6 +66,20 @@ Backend::Backend(QObject *parent)
     qDebug() << "-- Screen width: " << QString::number(screenGeometry.width());
 }
 
+QString Backend::buildInfo() const
+{
+#ifdef QT_DEBUG
+    const QString buildType = "Debug";
+#else
+    const QString buildType = "Release";
+#endif
+    return {QCoreApplication::applicationVersion() + "\nTechnology Preview - "
+            + QString(CMAKE_VAR_GIT_VERSION) + "\nQt " + QString(QT_VERSION_STR) + " - " + buildType
+            + " Build" + "\nQt Quick Components " + QString(CMAKE_VAR_QT_QUICK_COMPONENTS_VERSION)
+            + "\nZXing-Cpp: " + QString(CMAKE_VAR_ZXING_VERSION)
+            + "\nOpenSSL support: " + QVariant(QSslSocket::supportsSsl()).toString()};
+}
+
 void Backend::enableBackgroundUpdate(const bool &enabled)
 {
     if (enabled) {
diff --git a/src/backend/backend.h b/src/backend/backend.h
index c7f2090..dd8b563 100644
--- a/src/backend/backend.h
+++ b/src/backend/backend.h
@@ -52,7 +52,6 @@ public:
 private:
     // UI data
     QString m_logs;
-    QString m_buildInfo;
     QJsonArray m_projectList;
 
     // Other members
@@ -77,9 +76,6 @@ signals:
     // UI signals - Logs page
     void logsChanged(QString);
 
-    // UI signals - About page
-    void buildInfoChanged(QString);
-
     // UI signals - Popup
     void downloadProgress(float);
     void popupProgressIndeterminateChanged(bool indeterminate);
@@ -91,7 +87,7 @@ signals:
     void networkUpdated(QString);
 
 public slots:
-    QString buildInfo() const { return m_buildInfo; }
+    QString buildInfo() const;
     void scanQrCode();
 
     void runOnlineProject(const QString &url);
diff --git a/src/ui/AboutHeader.qml b/src/ui/AboutHeader.qml
index e07e5c3..1a18df5 100644
--- a/src/ui/AboutHeader.qml
+++ b/src/ui/AboutHeader.qml
@@ -4,14 +4,13 @@ import QtQuick.Layouts
 
 
 Item {
-    id: header
+    id: headerPage
 
     ColumnLayout {
         anchors.fill: parent
         Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
 
         Item {
-            id: item2
             width: 200
             height: 200
             Layout.preferredHeight: 10
@@ -19,23 +18,15 @@ Item {
         }
 
         Label {
-            id: logs
             Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
             horizontalAlignment: "AlignHCenter"
             text: backend.buildInfo()
         }
 
+
         Item {
-            id: item1
             Layout.fillHeight: true
             Layout.fillWidth: true
         }
-
-        Connections {
-            target: backend
-            function onBuildInfoChanged(buildInfo){
-                logs.text = buildInfo;
-            }
-        }
     }
 }
diff --git a/src/ui/main.qml b/src/ui/main.qml
index 47f5480..bd78266 100644
--- a/src/ui/main.qml
+++ b/src/ui/main.qml
@@ -35,7 +35,7 @@ Rectangle {
     }
 
     Popup {
-        property var popupCloseReceived : false
+        property bool popupCloseReceived : false
         id: popup
         anchors.centerIn: parent
         width: 300
@@ -114,10 +114,10 @@ Rectangle {
             Layout.fillWidth: true
         }
 
-        // Network {
-        //     id: networkPage
-        //     Layout.fillWidth: true
-        // }
+        Network {
+            id: networkPage
+            Layout.fillWidth: true
+        }
 
         SettingsPage {
             id: settingsPage
@@ -213,18 +213,18 @@ Rectangle {
                     }
                 }
 
-                // TabButton {
-                //     id: network
-                //     text: qsTr("Network")
-                //     Layout.fillWidth: true
-                //     checkable: true
-                //     autoExclusive: true
-                //     visible: true;
-                //     onClicked: {
-                //         stackLayout.currentIndex = 3
-                //         drawer.close()
-                //     }
-                // }
+                TabButton {
+                    id: network
+                    text: qsTr("Network")
+                    Layout.fillWidth: true
+                    checkable: true
+                    autoExclusive: true
+                    visible: false;
+                    onClicked: {
+                        stackLayout.currentIndex = 3
+                        drawer.close()
+                    }
+                }
 
                 TabButton {
                     id: settings
-- 
GitLab