From 3c18ac0f7a3061f74e3de6b8a991fad29d2cf561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Mon, 12 Aug 2024 21:05:13 +0200 Subject: [PATCH] feat(AboutViewPage): display the runtime Qt version in Settings/About - it's easier to make sure and detect what users are using, esp. when they report bugs - with a clickable link to the release notes --- storybook/pages/AboutViewPage.qml | 5 +++++ ui/StatusQ/CMakeLists.txt | 2 ++ .../include/StatusQ/systemutilsinternal.h | 12 ++++++++++++ ui/StatusQ/src/plugin.cpp | 6 ++++++ ui/StatusQ/src/systemutilsinternal.cpp | 9 +++++++++ ui/app/AppLayouts/Profile/ProfileLayout.qml | 4 ++++ ui/app/AppLayouts/Profile/views/AboutView.qml | 19 ++++++++++++++++++- 7 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 ui/StatusQ/include/StatusQ/systemutilsinternal.h create mode 100644 ui/StatusQ/src/systemutilsinternal.cpp diff --git a/storybook/pages/AboutViewPage.qml b/storybook/pages/AboutViewPage.qml index e20d4a5d0e..2b9b7271a7 100644 --- a/storybook/pages/AboutViewPage.qml +++ b/storybook/pages/AboutViewPage.qml @@ -2,6 +2,7 @@ import QtQuick 2.14 import QtQuick.Controls 2.14 import QtQuick.Layouts 1.14 +import StatusQ.Core 0.1 import AppLayouts.Profile.views 1.0 import Storybook 1.0 @@ -37,6 +38,10 @@ SplitView { return "0.162.9" } + function qtRuntimeVersion() { + return SystemUtils.qtRuntimeVersion() + } + function getReleaseNotes() { logs.logEvent("store::getReleaseNotes") const link = isProduction ? "https://github.com/status-im/status-desktop/releases/tag/%1" : diff --git a/ui/StatusQ/CMakeLists.txt b/ui/StatusQ/CMakeLists.txt index 5734c5d2fc..28137c8c2c 100644 --- a/ui/StatusQ/CMakeLists.txt +++ b/ui/StatusQ/CMakeLists.txt @@ -122,6 +122,7 @@ add_library(StatusQ SHARED include/StatusQ/submodelproxymodel.h include/StatusQ/sumaggregator.h include/StatusQ/undefinedfilter.h + include/StatusQ/systemutilsinternal.h include/StatusQ/writableproxymodel.h src/QClipboardProxy.cpp src/aggregator.cpp @@ -152,6 +153,7 @@ add_library(StatusQ SHARED src/stringutilsinternal.cpp src/submodelproxymodel.cpp src/sumaggregator.cpp + src/systemutilsinternal.cpp src/undefinedfilter.cpp src/writableproxymodel.cpp diff --git a/ui/StatusQ/include/StatusQ/systemutilsinternal.h b/ui/StatusQ/include/StatusQ/systemutilsinternal.h new file mode 100644 index 0000000000..ecd129feab --- /dev/null +++ b/ui/StatusQ/include/StatusQ/systemutilsinternal.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +class SystemUtilsInternal : public QObject +{ + Q_OBJECT +public: + explicit SystemUtilsInternal(QObject *parent = nullptr); + + Q_INVOKABLE QString qtRuntimeVersion() const; +}; diff --git a/ui/StatusQ/src/plugin.cpp b/ui/StatusQ/src/plugin.cpp index dcc0bf9a82..bcc8733a32 100644 --- a/ui/StatusQ/src/plugin.cpp +++ b/ui/StatusQ/src/plugin.cpp @@ -29,6 +29,7 @@ #include "StatusQ/submodelproxymodel.h" #include "StatusQ/sumaggregator.h" #include "StatusQ/undefinedfilter.h" +#include "StatusQ/systemutilsinternal.h" #include "StatusQ/writableproxymodel.h" #include "wallet/managetokenscontroller.h" @@ -94,6 +95,11 @@ public: return new StringUtilsInternal(engine); }); + qmlRegisterSingletonType( + "StatusQ.Core", 0, 1, "SystemUtils", [](QQmlEngine*, QJSEngine*) { + return new SystemUtilsInternal; + }); + qmlRegisterSingletonType( "StatusQ.Internal", 0, 1, "PermissionUtils", [](QQmlEngine*, QJSEngine*) { return new PermissionUtilsInternal; diff --git a/ui/StatusQ/src/systemutilsinternal.cpp b/ui/StatusQ/src/systemutilsinternal.cpp new file mode 100644 index 0000000000..92829a2f1a --- /dev/null +++ b/ui/StatusQ/src/systemutilsinternal.cpp @@ -0,0 +1,9 @@ +#include "StatusQ/systemutilsinternal.h" + +SystemUtilsInternal::SystemUtilsInternal(QObject *parent) + : QObject{parent} +{} + +QString SystemUtilsInternal::qtRuntimeVersion() const { + return qVersion(); +} diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index c57a6514ce..3ee55ff641 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -356,6 +356,10 @@ StatusSectionLayout { return root.store.getStatusGoVersion() } + function qtRuntimeVersion() { + return SystemUtils.qtRuntimeVersion() + } + function getReleaseNotes() { const link = isProduction ? "https://github.com/status-im/status-desktop/releases/tag/%1" : "https://github.com/status-im/status-desktop/commit/%1" diff --git a/ui/app/AppLayouts/Profile/views/AboutView.qml b/ui/app/AppLayouts/Profile/views/AboutView.qml index 074aa663fe..0ea6e6e7a5 100644 --- a/ui/app/AppLayouts/Profile/views/AboutView.qml +++ b/ui/app/AppLayouts/Profile/views/AboutView.qml @@ -85,7 +85,7 @@ SettingsContentBase { font.bold: true normalColor: Theme.palette.directColor1 text: root.store.getStatusGoVersion() - onClicked: root.store.openLink("https://github.com/status-im/status-go/tree/v%1".arg(root.store.getStatusGoVersion())) + onClicked: root.store.openLink("https://github.com/status-im/status-go/tree/%1".arg(root.store.getStatusGoVersion())) } StatusBaseText { @@ -96,6 +96,23 @@ SettingsContentBase { Item { width: 1; height: 17} + StatusLinkText { + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 17 + font.bold: true + normalColor: Theme.palette.directColor1 + text: root.store.qtRuntimeVersion() + onClicked: root.store.openLink("https://github.com/qt/qtreleasenotes/blob/dev/qt/%1/release-note.md".arg(text)) + } + + StatusBaseText { + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: Style.current.additionalTextSize + text: qsTr("Qt Version") + } + + Item { width: 1; height: 17} + StatusButton { anchors.horizontalCenter: parent.horizontalCenter size: StatusBaseButton.Size.Small