From f7470ce3a3cbbb3b1b7d2fc8ce6f17464fd7268d Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 27 Mar 2024 09:12:38 -0400 Subject: [PATCH 1/7] qml: Add walletEnabled property to AppMode model --- src/qml/appmode.h | 8 +++++++- src/qml/bitcoin.cpp | 33 +++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/qml/appmode.h b/src/qml/appmode.h index 8265984103..ba15865eda 100644 --- a/src/qml/appmode.h +++ b/src/qml/appmode.h @@ -12,6 +12,7 @@ class AppMode : public QObject Q_OBJECT Q_PROPERTY(bool isDesktop READ isDesktop NOTIFY modeChanged) Q_PROPERTY(bool isMobile READ isMobile NOTIFY modeChanged) + Q_PROPERTY(bool walletEnabled READ walletEnabled NOTIFY walletEnabledChanged) Q_PROPERTY(QString state READ state NOTIFY modeChanged) public: @@ -20,12 +21,15 @@ class AppMode : public QObject MOBILE }; - explicit AppMode(Mode mode) : m_mode(mode) + explicit AppMode(Mode mode, bool wallet_enabled) + : m_mode(mode) + , m_wallet_enabled(wallet_enabled) { } bool isMobile() { return m_mode == MOBILE; } bool isDesktop() { return m_mode == DESKTOP; } + bool walletEnabled() { return m_wallet_enabled; } QString state() { switch (m_mode) { @@ -41,9 +45,11 @@ class AppMode : public QObject Q_SIGNALS: void modeChanged(); + void walletEnabledChanged(); private: const Mode m_mode; + const bool m_wallet_enabled; }; #endif // BITCOIN_QML_APPMODE_H diff --git a/src/qml/bitcoin.cpp b/src/qml/bitcoin.cpp index d87386cbd5..90e713bfd7 100644 --- a/src/qml/bitcoin.cpp +++ b/src/qml/bitcoin.cpp @@ -75,17 +75,33 @@ void SetupUIArgs(ArgsManager& argsman) argsman.AddArg("-splash", strprintf("Show splash screen on startup (default: %u)", DEFAULT_SPLASHSCREEN), ArgsManager::ALLOW_ANY, OptionsCategory::GUI); } +AppMode SetupAppMode() +{ + bool wallet_enabled; + AppMode::Mode mode; + #ifdef __ANDROID__ + mode = AppMode::MOBILE; + #else + mode = AppMode::DESKTOP; + #endif // __ANDROID__ + + #ifdef ENABLE_WALLET + wallet_enabled = true; + #else + wallet_enabled = false; + #endif // ENABLE_WALLET + + return AppMode(mode, wallet_enabled); +} + bool InitErrorMessageBox( const bilingual_str& message, [[maybe_unused]] const std::string& caption, [[maybe_unused]] unsigned int style) { QQmlApplicationEngine engine; -#ifdef __ANDROID__ - AppMode app_mode(AppMode::MOBILE); -#else - AppMode app_mode(AppMode::DESKTOP); -#endif // __ANDROID__ + + AppMode app_mode = SetupAppMode(); qmlRegisterSingletonInstance("org.bitcoincore.qt", 1, 0, "AppMode", &app_mode); engine.rootContext()->setContextProperty("message", QString::fromStdString(message.translated)); @@ -284,11 +300,8 @@ int QmlGuiMain(int argc, char* argv[]) engine.rootContext()->setContextProperty("optionsModel", &options_model); engine.rootContext()->setContextProperty("needOnboarding", need_onboarding); -#ifdef __ANDROID__ - AppMode app_mode(AppMode::MOBILE); -#else - AppMode app_mode(AppMode::DESKTOP); -#endif // __ANDROID__ + + AppMode app_mode = SetupAppMode(); qmlRegisterSingletonInstance("org.bitcoincore.qt", 1, 0, "AppMode", &app_mode); qmlRegisterType("org.bitcoincore.qt", 1, 0, "BlockClockDial"); From bef69da1bfb94dd87e097bb1911e538ba8b9498c Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 27 Mar 2024 09:15:55 -0400 Subject: [PATCH 2/7] qml: Introduce gear-outline icon This icon is used in the navigation bar in Wallet mode --- src/Makefile.qt.include | 1 + src/qml/bitcoin_qml.qrc | 1 + src/qml/imageprovider.cpp | 5 +++++ src/qml/res/icons/gear-outline.png | Bin 0 -> 4438 bytes src/qml/res/src/gear-outline.svg | 3 +++ 5 files changed, 10 insertions(+) create mode 100644 src/qml/res/icons/gear-outline.png create mode 100644 src/qml/res/src/gear-outline.svg diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index c9bdb051e8..c664b74cf1 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -329,6 +329,7 @@ QML_RES_ICONS = \ qml/res/icons/cross.png \ qml/res/icons/export.png \ qml/res/icons/gear.png \ + qml/res/icons/gear-outline.png \ qml/res/icons/info.png \ qml/res/icons/network-dark.png \ qml/res/icons/network-light.png \ diff --git a/src/qml/bitcoin_qml.qrc b/src/qml/bitcoin_qml.qrc index 1c98e6dc6d..1ab761ebed 100644 --- a/src/qml/bitcoin_qml.qrc +++ b/src/qml/bitcoin_qml.qrc @@ -78,6 +78,7 @@ res/icons/cross.png res/icons/export.png res/icons/gear.png + res/icons/gear-outline.png res/icons/info.png res/icons/network-dark.png res/icons/network-light.png diff --git a/src/qml/imageprovider.cpp b/src/qml/imageprovider.cpp index 26ffc102ea..2beb42e857 100644 --- a/src/qml/imageprovider.cpp +++ b/src/qml/imageprovider.cpp @@ -92,6 +92,11 @@ QPixmap ImageProvider::requestPixmap(const QString& id, QSize* size, const QSize return QIcon(":/icons/gear").pixmap(requested_size); } + if (id == "gear-outline") { + *size = requested_size; + return QIcon(":/icons/gear-outline").pixmap(requested_size); + } + if (id == "info") { *size = requested_size; return QIcon(":/icons/info").pixmap(requested_size); diff --git a/src/qml/res/icons/gear-outline.png b/src/qml/res/icons/gear-outline.png new file mode 100644 index 0000000000000000000000000000000000000000..2a868c77001d3508ce533d36a42940307aebd9cc GIT binary patch literal 4438 zcmb7H`#;m)AAip!At6Mc66R8Koy!n~nB3+Xx#iB7doH;%U$G z>rf{-0|1~Dl!1YjiGhK5Xjljm73c#1m!Bj&xn|sHC75b?)9}fI`$F&wDx(%>;f7lN zLJzDYM!9OW3P0}gV%4M|irM!9K7TIldVT+41MW2Lo;a0tVUzT76)ZhlAn5d!O8TQS z7`GBSmw+Cwfex%=0ks)*;`fxof!YVx>iD2=AtPI4zVam#2o+Zs$3{&QUUWR(KfZnB zKkKQdCspE;h7t(j8w#8}v68R=mHRHcdu8{73C|hbFqd8Gqwo=*WZ$#_L~My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file mode 100644 index 0000000000..8c7e5dd018 --- /dev/null +++ b/src/qml/res/src/gear-outline.svg @@ -0,0 +1,3 @@ + + + From d556c93c7d1aebf449c51fd5627ac910c62f1174 Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 27 Mar 2024 09:38:49 -0400 Subject: [PATCH 3/7] qml: Introduce singlesig-wallet icon --- src/Makefile.qt.include | 1 + src/qml/bitcoin_qml.qrc | 1 + src/qml/imageprovider.cpp | 5 +++++ src/qml/res/icons/singlesig-wallet.png | Bin 0 -> 1919 bytes src/qml/res/src/singlesig-wallet.svg | 3 +++ 5 files changed, 10 insertions(+) create mode 100644 src/qml/res/icons/singlesig-wallet.png create mode 100644 src/qml/res/src/singlesig-wallet.svg diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index c664b74cf1..89c4238029 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -334,6 +334,7 @@ QML_RES_ICONS = \ qml/res/icons/network-dark.png \ qml/res/icons/network-light.png \ qml/res/icons/shutdown.png \ + qml/res/icons/singlesig-wallet.png \ qml/res/icons/storage-dark.png \ qml/res/icons/storage-light.png diff --git a/src/qml/bitcoin_qml.qrc b/src/qml/bitcoin_qml.qrc index 1ab761ebed..3e1d7914f7 100644 --- a/src/qml/bitcoin_qml.qrc +++ b/src/qml/bitcoin_qml.qrc @@ -83,6 +83,7 @@ res/icons/network-dark.png res/icons/network-light.png res/icons/shutdown.png + res/icons/singlesig-wallet.png res/icons/storage-dark.png res/icons/storage-light.png diff --git a/src/qml/imageprovider.cpp b/src/qml/imageprovider.cpp index 2beb42e857..6a739a5aee 100644 --- a/src/qml/imageprovider.cpp +++ b/src/qml/imageprovider.cpp @@ -117,6 +117,11 @@ QPixmap ImageProvider::requestPixmap(const QString& id, QSize* size, const QSize return QIcon(":/icons/shutdown").pixmap(requested_size); } + if (id == "singlesig-wallet") { + *size = requested_size; + return QIcon(":/icons/singlesig-wallet").pixmap(requested_size); + } + if (id == "storage-dark") { *size = requested_size; return QIcon(":/icons/storage-dark").pixmap(requested_size); diff --git a/src/qml/res/icons/singlesig-wallet.png b/src/qml/res/icons/singlesig-wallet.png new file mode 100644 index 0000000000000000000000000000000000000000..36a82fec8aa318e4c04b7f46377eb4948f9068e2 GIT binary patch literal 1919 zcmZvcdpy&N8^^z!F_#b}a(1F2my;|>xnvF#Um_jk5?Ks3@-~4*-B7=!E%A zvWY(=D^jGCioNa0a^&`{7okB12o)j#-( zH^u(nugwM7+Uk~FNyqI8-#r{QBeRe&kNV}c(Km~4FF{3BbX34ML3Z?;E6JhhgJAJUD)b&JX3eyA22!O-f{QS z(&j05w@(s>>8_h7D`AG>S3hu93cK+3<(jAx^UM!Ac za*Rh_d>*9T&KZMi+c!J20r*|pXHL^gHeXkGC9{lJzkh^~Qvaxzog*g$CAP=}xj15g zogZD%S^YplLcA+fiGx2$n0eDn8vozCObOeO|j^sY}ZrU-Ya~7bC%H&%=REmc!hSTH?{v(9PNe z9bCP~UnZhHFG8_i_NtxxHh)1%OKP2eK`0jyh$$J2)=|`xPqG~OP5-^rVc;TPMcY-7 z%?#nBTQ1?@s1wLnYbsc5;nXET=~n&FKZJ@(SaXtmV|`BS`zVg@4s4A9OhT0>w{Die z8nVgd39!Wr0*_?4Ojm;$#6@z&L!JT3ig|1t{E$P>L3P`&-C8c6xFuEA6nG2tr{uuq zh+e5N;xx0rBxdOm*(YPY4k+utl(v#jJ)!Hm9MaBep6LB<5w>HcKP!a3y&uQlbf&zy z%e&XVvRNJTe2mBDRCkPRlBikR(?x0-3fK%f6mPyqgHl7&@tpi9j9*>1=3nYgXdjdw zX)abRkK?Uu`o^RZ^?VQhjvA1#{TVaUavdi)E;KTO=)Gqh_n3M}-FEYk?zII{>Wj-$ z!A18BO^cVIi*o`Dk5Cxar8f^W8lQ{);15jfuV7~gCnzi3Kpixp_iP-RR^of4>7%GVT=6)NJ}Ri8&E zb=$D*+pHd-TY)+cpjnTdi``JJT=fr3tvU6p?BSNa zCU3fjpN`@7bh$;IoBr~EX|+F_Z$;xRU8$tr)qAeL(l_YVw*5YK<{<8p$##^3n=(m+ zG~^D)e89?S#XXf@Fq?ub>E3`(p1X61Z`*>3K3Wh8U66`Bw-x1c&A1kArl!P5j8S`d zKxH-y-{POe*D?kLKzWrCqd`Htcq`na>?c3^-tYM7V`#LNLr<@@W{#yIrM(_G> zX{;d4gqSD(yd(E_7P)ldtq&$?&Q_=&g9+_}% zb0*1e19{nZS@hcT*hoxRjTc-Kk?4wmmdR92n2Nd)5P1!8h|xQ-uWj4cU4TfoL#{rD zyvJvv>?1cTyY$`iu$a;x1eUv4&JCksf4GhgsaW`D)9paS*AzJX6 zKlp#ZPG>aM#IDz0&ovNLtRjTelx6Rt*!5-q+MBG4T>d}+z(ORpCP6i8tz{!CStjpQ zw2?!Ai6tRWuD+&gTD-k%)p7nl(&sQYxS%`9an$`D{#z#JG}s=sOZ<@PaDW@6-W353 z2)9n&_8tn+!j^DU8p`di7Ov${TOhD^N4No?ha_|^$lB`;7OeSgG-1vT^a`7%#pI$} z3a^w#hEuLSZb~@`(Ri@_NrMj`p{y1Q{w?u-Fwz@Frjvu%$(TZyL^A+7xM3RXuqpoo DageKp literal 0 HcmV?d00001 diff --git a/src/qml/res/src/singlesig-wallet.svg b/src/qml/res/src/singlesig-wallet.svg new file mode 100644 index 0000000000..76d1ca5019 --- /dev/null +++ b/src/qml/res/src/singlesig-wallet.svg @@ -0,0 +1,3 @@ + + + From 4b79ac2c6e3c517268474444baf4f0b9519ecda1 Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:38:04 -0400 Subject: [PATCH 4/7] qml: Introduce DesktopWallets page This is a main page when the AppMode is Desktop with walletEnabled. The page contains a tab based layout with the sub pages being selectable by clicking on a NavigationTab in the NavigationBar at the top of the page. --- src/Makefile.qt.include | 4 +- src/qml/bitcoin_qml.qrc | 2 + src/qml/controls/NavigationTab.qml | 84 ++++++++++++++++ src/qml/pages/main.qml | 26 ++++- src/qml/pages/wallet/DesktopWallets.qml | 121 ++++++++++++++++++++++++ 5 files changed, 234 insertions(+), 3 deletions(-) create mode 100644 src/qml/controls/NavigationTab.qml create mode 100644 src/qml/pages/wallet/DesktopWallets.qml diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 89c4238029..9f3df2e8e4 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -371,6 +371,7 @@ QML_RES_QML = \ qml/controls/PageIndicator.qml \ qml/controls/NavigationBar.qml \ qml/controls/NavigationBar2.qml \ + qml/controls/NavigationTab.qml \ qml/controls/OptionButton.qml \ qml/controls/OptionSwitch.qml \ qml/controls/OutlineButton.qml \ @@ -401,7 +402,8 @@ QML_RES_QML = \ qml/pages/settings/SettingsDisplay.qml \ qml/pages/settings/SettingsProxy.qml \ qml/pages/settings/SettingsStorage.qml \ - qml/pages/settings/SettingsTheme.qml + qml/pages/settings/SettingsTheme.qml \ + qml/pages/wallet/DesktopWallets.qml if TARGET_ANDROID BITCOIN_QT_H += qml/androidnotifier.h diff --git a/src/qml/bitcoin_qml.qrc b/src/qml/bitcoin_qml.qrc index 3e1d7914f7..86372d3c4f 100644 --- a/src/qml/bitcoin_qml.qrc +++ b/src/qml/bitcoin_qml.qrc @@ -31,6 +31,7 @@ controls/PageIndicator.qml controls/NavigationBar.qml controls/NavigationBar2.qml + controls/NavigationTab.qml controls/OptionButton.qml controls/OptionSwitch.qml controls/OutlineButton.qml @@ -62,6 +63,7 @@ pages/settings/SettingsProxy.qml pages/settings/SettingsStorage.qml pages/settings/SettingsTheme.qml + pages/wallet/DesktopWallets.qml res/icons/arrow-down.png diff --git a/src/qml/controls/NavigationTab.qml b/src/qml/controls/NavigationTab.qml new file mode 100644 index 0000000000..219c90a135 --- /dev/null +++ b/src/qml/controls/NavigationTab.qml @@ -0,0 +1,84 @@ +// Copyright (c) 2024 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import org.bitcoincore.qt 1.0 + +Button { + property color bgActiveColor: Theme.color.orange + property color textColor: Theme.color.neutral7 + property color textHoverColor: Theme.color.neutral9 + property color textActiveColor: Theme.color.orange + property color iconColor: "transparent" + property string iconSource: "" + + id: root + checkable: true + hoverEnabled: AppMode.isDesktop + implicitHeight: 60 + implicitWidth: 80 + bottomPadding: 0 + topPadding: 0 + + contentItem: Item { + width: parent.width + height: parent.height + CoreText { + id: buttonText + font.pixelSize: 15 + text: root.text + color: root.textColor + bold: true + visible: root.text !== "" + anchors.centerIn: parent + } + Icon { + id: icon + source: root.iconSource + color: iconColor + visible: root.iconSource !== "" + anchors.centerIn: parent + } + } + + background: Item { + Rectangle { + id: bg + height: parent.height - 5 + width: parent.width + radius: 5 + color: Theme.color.neutral3 + visible: root.hovered + + FocusBorder { + visible: root.visualFocus + } + + Behavior on color { + ColorAnimation { duration: 150 } + } + } + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 3 + visible: root.checked + color: root.bgActiveColor + } + } + + states: [ + State { + name: "CHECKED"; when: root.checked + PropertyChanges { target: buttonText; color: root.textActiveColor } + PropertyChanges { target: icon; color: root.textActiveColor } + }, + State { + name: "HOVER"; when: root.hovered + PropertyChanges { target: buttonText; color: root.textHoverColor } + PropertyChanges { target: icon; color: root.textHoverColor } + } + ] +} diff --git a/src/qml/pages/main.qml b/src/qml/pages/main.qml index 581e9b42b4..4c1c964d7c 100644 --- a/src/qml/pages/main.qml +++ b/src/qml/pages/main.qml @@ -11,6 +11,7 @@ import "../components" import "../controls" import "./onboarding" import "./node" +import "./wallet" ApplicationWindow { id: appWindow @@ -33,7 +34,17 @@ ApplicationWindow { StackView { id: main - initialItem: needOnboarding ? onboardingWizard : node + initialItem: { + if (needOnboarding) { + onboardingWizard + } else { + if (AppMode.walletEnabled && AppMode.isDesktop) { + desktopWallets + } else { + node + } + } + } anchors.fill: parent focus: true Keys.onReleased: { @@ -66,10 +77,21 @@ ApplicationWindow { OnboardingStorageAmount {} OnboardingConnection {} - onFinishedChanged: main.push(node) + onFinishedChanged: { + if (AppMode.walletEnabled && AppMode.isDesktop) { + main.push(desktopWallets) + } else { + main.push(node) + } + } } } + Component { + id: desktopWallets + DesktopWallets {} + } + Component { id: shutdown Shutdown {} diff --git a/src/qml/pages/wallet/DesktopWallets.qml b/src/qml/pages/wallet/DesktopWallets.qml new file mode 100644 index 0000000000..7159d946ce --- /dev/null +++ b/src/qml/pages/wallet/DesktopWallets.qml @@ -0,0 +1,121 @@ +// Copyright (c) 2024 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 +import org.bitcoincore.qt 1.0 +import "../../controls" +import "../../components" +import "../node" + +Page { + id: root + background: null + + ButtonGroup { id: navigationTabs } + + header: NavigationBar2 { + id: navBar + leftItem: RowLayout { + spacing: 5 + Icon { + source: "image://images/singlesig-wallet" + color: Theme.color.neutral8 + Layout.preferredWidth: 30 + Layout.preferredHeight: 30 + Layout.leftMargin: 10 + } + Column { + spacing: 2 + CoreText { + text: "Singlesig Wallet" + color: Theme.color.neutral7 + bold: true + } + CoreText { + text: " 0.00 167 599" + color: Theme.color.neutral7 + } + } + } + centerItem: RowLayout { + NavigationTab { + id: activityTabButton + checked: true + text: qsTr("Activity") + property int index: 0 + ButtonGroup.group: navigationTabs + } + NavigationTab { + text: qsTr("Send") + property int index: 1 + ButtonGroup.group: navigationTabs + } + NavigationTab { + text: qsTr("Receive") + property int index: 2 + ButtonGroup.group: navigationTabs + } + } + rightItem: RowLayout { + spacing: 5 + NetworkIndicator { + textSize: 11 + Layout.rightMargin: 5 + } + NavigationTab { + Layout.preferredWidth: 30 + Layout.rightMargin: 10 + property int index: 3 + ButtonGroup.group: navigationTabs + } + NavigationTab { + iconSource: "image://images/gear-outline" + iconColor: Theme.color.neutral7 + Layout.preferredWidth: 30 + property int index: 4 + ButtonGroup.group: navigationTabs + } + } + background: Rectangle { + color: Theme.color.neutral4 + anchors.bottom: navBar.bottom + anchors.bottomMargin: 4 + height: 1 + width: parent.width + } + } + + StackLayout { + width: parent.width + height: parent.height + currentIndex: navigationTabs.checkedButton.index + Item { + id: activityTab + CoreText { text: "Activity" } + } + Item { + id: sendTab + CoreText { text: "Send" } + } + Item { + id: receiveTab + CoreText { text: "Receive" } + } + Item { + id: blockClockTab + anchors.fill: parent + BlockClock { + parentWidth: parent.width - 40 + parentHeight: parent.height + anchors.centerIn: parent + } + } + NodeSettings { + } + } + + Component.onCompleted: nodeModel.startNodeInitializionThread(); +} From 6e42abc89304ee0ebe22a16d561cd8813b687548 Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:57:17 -0400 Subject: [PATCH 5/7] qml: Add property to hide NetworkIndicator on BlockClock page The network indicator is redundant on the block clock page when in Desktop wallet mode. --- src/qml/components/BlockClock.qml | 2 ++ src/qml/components/NetworkIndicator.qml | 3 ++- src/qml/pages/wallet/DesktopWallets.qml | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qml/components/BlockClock.qml b/src/qml/components/BlockClock.qml index a02abae6a4..6e1c28f0a7 100644 --- a/src/qml/components/BlockClock.qml +++ b/src/qml/components/BlockClock.qml @@ -15,6 +15,7 @@ Item { id: root property real parentWidth: 600 property real parentHeight: 600 + property bool showNetworkIndicator: true width: dial.width height: dial.height + networkIndicator.height + networkIndicator.anchors.topMargin @@ -146,6 +147,7 @@ Item { NetworkIndicator { id: networkIndicator + show: root.showNetworkIndicator anchors.top: dial.bottom anchors.topMargin: networkIndicator.visible ? 30 : 0 anchors.horizontalCenter: root.horizontalCenter diff --git a/src/qml/components/NetworkIndicator.qml b/src/qml/components/NetworkIndicator.qml index 471ccfbbcd..fb0845217e 100644 --- a/src/qml/components/NetworkIndicator.qml +++ b/src/qml/components/NetworkIndicator.qml @@ -12,12 +12,13 @@ import org.bitcoincore.qt 1.0 Button { id: root property color bgColor + property bool show: true property int textSize: 15 topPadding: 2 bottomPadding: 2 leftPadding: 7 rightPadding: 7 - state: chainModel.currentNetworkName + state: show ? chainModel.currentNetworkName : "MAIN" contentItem: CoreText { text: root.text font.pixelSize: root.textSize diff --git a/src/qml/pages/wallet/DesktopWallets.qml b/src/qml/pages/wallet/DesktopWallets.qml index 7159d946ce..2cb3bb7531 100644 --- a/src/qml/pages/wallet/DesktopWallets.qml +++ b/src/qml/pages/wallet/DesktopWallets.qml @@ -111,6 +111,7 @@ Page { parentWidth: parent.width - 40 parentHeight: parent.height anchors.centerIn: parent + showNetworkIndicator: false } } NodeSettings { From 3d3a39eba5cf1703902ab95cc42bf99f6e0e47e1 Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 27 Mar 2024 21:20:13 -0400 Subject: [PATCH 6/7] qml: Shorten the DesktopWallet NetworkIndicator --- src/qml/components/NetworkIndicator.qml | 7 ++++--- src/qml/pages/wallet/DesktopWallets.qml | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qml/components/NetworkIndicator.qml b/src/qml/components/NetworkIndicator.qml index fb0845217e..7743822e7a 100644 --- a/src/qml/components/NetworkIndicator.qml +++ b/src/qml/components/NetworkIndicator.qml @@ -12,6 +12,7 @@ import org.bitcoincore.qt 1.0 Button { id: root property color bgColor + property bool shorten: false property bool show: true property int textSize: 15 topPadding: 2 @@ -48,7 +49,7 @@ Button { PropertyChanges { target: root visible: true - text: qsTr("Test Network") + text: shorten ? qsTr("Testnet") : qsTr("Test Network") bgColor: Theme.color.green } }, @@ -57,7 +58,7 @@ Button { PropertyChanges { target: root visible: true - text: qsTr("Signet Network") + text: shorten ? qsTr("Signet") : qsTr("Signet Network") bgColor: Theme.color.amber } }, @@ -66,7 +67,7 @@ Button { PropertyChanges { target: root visible: true - text: qsTr("Regtest Mode") + text: shorten ? qsTr("Regtest") : qsTr("Regtest Mode") bgColor: Theme.color.blue } } diff --git a/src/qml/pages/wallet/DesktopWallets.qml b/src/qml/pages/wallet/DesktopWallets.qml index 2cb3bb7531..b37f7d847b 100644 --- a/src/qml/pages/wallet/DesktopWallets.qml +++ b/src/qml/pages/wallet/DesktopWallets.qml @@ -64,6 +64,7 @@ Page { NetworkIndicator { textSize: 11 Layout.rightMargin: 5 + shorten: true } NavigationTab { Layout.preferredWidth: 30 From 37e3af6cd67cc9495f13c22936315e893ce8c8dc Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Wed, 27 Mar 2024 23:26:42 -0400 Subject: [PATCH 7/7] qml: Remove Done button from Settings in Desktop Wallet --- src/qml/pages/node/NodeSettings.qml | 3 +++ src/qml/pages/wallet/DesktopWallets.qml | 1 + 2 files changed, 4 insertions(+) diff --git a/src/qml/pages/node/NodeSettings.qml b/src/qml/pages/node/NodeSettings.qml index 87a5f5de4b..a2ca4c667b 100644 --- a/src/qml/pages/node/NodeSettings.qml +++ b/src/qml/pages/node/NodeSettings.qml @@ -12,6 +12,8 @@ import "../settings" Item { signal doneClicked + property alias showDoneButton: doneButton.visible + id: root StackView { @@ -33,6 +35,7 @@ Item { header: "Settings" } rightItem: NavButton { + id: doneButton text: qsTr("Done") onClicked: root.doneClicked() } diff --git a/src/qml/pages/wallet/DesktopWallets.qml b/src/qml/pages/wallet/DesktopWallets.qml index b37f7d847b..3c5c20fc10 100644 --- a/src/qml/pages/wallet/DesktopWallets.qml +++ b/src/qml/pages/wallet/DesktopWallets.qml @@ -116,6 +116,7 @@ Page { } } NodeSettings { + showDoneButton: false } }