diff --git a/electrum/gui/qml/components/NetworkOverview.qml b/electrum/gui/qml/components/NetworkOverview.qml index 361ac659e..91c0f79c7 100644 --- a/electrum/gui/qml/components/NetworkOverview.qml +++ b/electrum/gui/qml/components/NetworkOverview.qml @@ -11,6 +11,8 @@ Pane { padding: 0 + property string title: qsTr("Network") + ColumnLayout { anchors.fill: parent spacing: 0 diff --git a/electrum/gui/qml/components/WalletDetails.qml b/electrum/gui/qml/components/WalletDetails.qml index 62dc7aeca..7ab98b254 100644 --- a/electrum/gui/qml/components/WalletDetails.qml +++ b/electrum/gui/qml/components/WalletDetails.qml @@ -498,21 +498,6 @@ Pane { visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning icon.source: '../../icons/lightning.png' } - FlatButton { - Layout.fillWidth: true - Layout.preferredWidth: 1 - text: qsTr('Channels') - onClicked: app.stack.push(Qt.resolvedUrl('Channels.qml')) - visible: Daemon.currentWallet && Daemon.currentWallet.isLightning - icon.source: '../../icons/lightning.png' - } - FlatButton { - Layout.fillWidth: true - Layout.preferredWidth: 1 - text: qsTr('Addresses') - onClicked: app.stack.push(Qt.resolvedUrl('Addresses.qml')) - icon.source: '../../icons/tab_addresses.png' - } } } diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index f9eceae2d..15170538b 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -11,7 +11,7 @@ import "controls" Item { id: mainView - property string title: Daemon.currentWallet ? Daemon.currentWallet.name : '' + property string title: Daemon.currentWallet ? Daemon.currentWallet.name : qsTr('no wallet loaded') property var _sendDialog property string _intentUri @@ -61,37 +61,42 @@ Item { action: Action { text: qsTr('Wallet details') enabled: Daemon.currentWallet - onTriggered: menu.openPage(true, Qt.resolvedUrl('WalletDetails.qml')) + onTriggered: menu.openPage(Qt.resolvedUrl('WalletDetails.qml')) icon.source: '../../icons/wallet.png' } } - - MenuSeparator { } - MenuItem { icon.color: 'transparent' action: Action { - text: qsTr('Preferences'); - onTriggered: menu.openPage(false, Qt.resolvedUrl('Preferences.qml')) - icon.source: '../../icons/preferences.png' + text: qsTr('Addresses'); + onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml')); + enabled: Daemon.currentWallet + icon.source: '../../icons/tab_addresses.png' } } - MenuItem { - icon.color: 'transparent' + icon.color: 'transparent' action: Action { - text: qsTr('About'); - onTriggered: menu.openPage(false, Qt.resolvedUrl('About.qml')) - icon.source: '../../icons/electrum.png' + text: qsTr('Channels'); + enabled: Daemon.currentWallet && Daemon.currentWallet.isLightning + onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml')) + icon.source: '../../icons/lightning.png' } } - function openPage(onroot, url) { - if (onroot) { - stack.pushOnRoot(url) - } else { - stack.push(url) + MenuSeparator { } + + MenuItem { + icon.color: 'transparent' + action: Action { + text: qsTr('Other wallets'); + onTriggered: menu.openPage(Qt.resolvedUrl('Wallets.qml')) + icon.source: '../../icons/file.png' } + } + + function openPage(url) { + stack.pushOnRoot(url) currentIndex = -1 } } diff --git a/electrum/gui/qml/components/main.qml b/electrum/gui/qml/components/main.qml index 8110eb3b1..d40a98ac4 100644 --- a/electrum/gui/qml/components/main.qml +++ b/electrum/gui/qml/components/main.qml @@ -36,6 +36,55 @@ ApplicationWindow property bool _wantClose: false property var _exceptionDialog + property QtObject appMenu: Menu { + parent: Overlay.overlay + dim: true + modal: true + Overlay.modal: Rectangle { + color: "#44000000" + } + + id: menu + + MenuItem { + icon.color: 'transparent' + action: Action { + text: qsTr('Network') + onTriggered: menu.openPage(Qt.resolvedUrl('NetworkOverview.qml')) + icon.source: '../../icons/network.png' + } + } + + MenuItem { + icon.color: 'transparent' + action: Action { + text: qsTr('Preferences'); + onTriggered: menu.openPage(Qt.resolvedUrl('Preferences.qml')) + icon.source: '../../icons/preferences.png' + } + } + + MenuItem { + icon.color: 'transparent' + action: Action { + text: qsTr('About'); + onTriggered: menu.openPage(Qt.resolvedUrl('About.qml')) + icon.source: '../../icons/electrum.png' + } + } + + function openPage(url) { + stack.pushOnRoot(url) + currentIndex = -1 + } + } + + function openAppMenu() { + appMenu.open() + appMenu.x = app.width - appMenu.width + appMenu.y = toolbar.height + } + header: ToolBar { id: toolbar @@ -62,24 +111,15 @@ ApplicationWindow Layout.rightMargin: constants.paddingMedium Layout.alignment: Qt.AlignVCenter - ToolButton { - id: menuButton - enabled: stack.currentItem && stack.currentItem.menu - ? stack.currentItem.menu.count > 0 - : false - - text: enabled ? '≡' : '' - font.pixelSize: constants.fontSizeXLarge - onClicked: { - stack.currentItem.menu.open() - stack.currentItem.menu.y = toolbarTopLayout.height - } + Item { + Layout.preferredWidth: constants.paddingXLarge + Layout.preferredHeight: 1 } Image { Layout.preferredWidth: constants.iconSizeSmall Layout.preferredHeight: constants.iconSizeSmall - visible: Daemon.currentWallet + visible: Daemon.currentWallet && stack.currentItem.title == Daemon.currentWallet.name source: '../../icons/wallet.png' } @@ -94,9 +134,10 @@ ApplicationWindow MouseArea { height: toolbarTopLayout.height anchors.fill: parent + // enabled: Daemon.currentWallet onClicked: { - if (stack.currentItem.objectName != 'Wallets') - stack.pushOnRoot(Qt.resolvedUrl('Wallets.qml')) + stack.getRoot().menu.open() + stack.getRoot().menu.y = toolbar.height } } } @@ -136,20 +177,14 @@ ApplicationWindow LightningNetworkStatusIndicator { MouseArea { anchors.fill: parent - onClicked: { - if (stack.currentItem.objectName != 'NetworkOverview') - stack.push(Qt.resolvedUrl('NetworkOverview.qml')) - } + onClicked: openAppMenu() } } OnchainNetworkStatusIndicator { MouseArea { anchors.fill: parent - onClicked: { - if (stack.currentItem.objectName != 'NetworkOverview') - stack.push(Qt.resolvedUrl('NetworkOverview.qml')) - } + onClicked: openAppMenu() } } }