qml: separate app menu and wallet menu
This commit is contained in:
@@ -11,6 +11,8 @@ Pane {
|
|||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
|
property string title: qsTr("Network")
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|||||||
@@ -498,21 +498,6 @@ Pane {
|
|||||||
visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning
|
visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning
|
||||||
icon.source: '../../icons/lightning.png'
|
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'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import "controls"
|
|||||||
Item {
|
Item {
|
||||||
id: mainView
|
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 var _sendDialog
|
||||||
property string _intentUri
|
property string _intentUri
|
||||||
@@ -61,37 +61,42 @@ Item {
|
|||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Wallet details')
|
text: qsTr('Wallet details')
|
||||||
enabled: Daemon.currentWallet
|
enabled: Daemon.currentWallet
|
||||||
onTriggered: menu.openPage(true, Qt.resolvedUrl('WalletDetails.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('WalletDetails.qml'))
|
||||||
icon.source: '../../icons/wallet.png'
|
icon.source: '../../icons/wallet.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MenuItem {
|
||||||
|
icon.color: 'transparent'
|
||||||
|
action: Action {
|
||||||
|
text: qsTr('Addresses');
|
||||||
|
onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml'));
|
||||||
|
enabled: Daemon.currentWallet
|
||||||
|
icon.source: '../../icons/tab_addresses.png'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
icon.color: 'transparent'
|
||||||
|
action: Action {
|
||||||
|
text: qsTr('Channels');
|
||||||
|
enabled: Daemon.currentWallet && Daemon.currentWallet.isLightning
|
||||||
|
onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml'))
|
||||||
|
icon.source: '../../icons/lightning.png'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: 'transparent'
|
||||||
action: Action {
|
action: Action {
|
||||||
text: qsTr('Preferences');
|
text: qsTr('Other wallets');
|
||||||
onTriggered: menu.openPage(false, Qt.resolvedUrl('Preferences.qml'))
|
onTriggered: menu.openPage(Qt.resolvedUrl('Wallets.qml'))
|
||||||
icon.source: '../../icons/preferences.png'
|
icon.source: '../../icons/file.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem {
|
function openPage(url) {
|
||||||
icon.color: 'transparent'
|
stack.pushOnRoot(url)
|
||||||
action: Action {
|
|
||||||
text: qsTr('About');
|
|
||||||
onTriggered: menu.openPage(false, Qt.resolvedUrl('About.qml'))
|
|
||||||
icon.source: '../../icons/electrum.png'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openPage(onroot, url) {
|
|
||||||
if (onroot) {
|
|
||||||
stack.pushOnRoot(url)
|
|
||||||
} else {
|
|
||||||
stack.push(url)
|
|
||||||
}
|
|
||||||
currentIndex = -1
|
currentIndex = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,55 @@ ApplicationWindow
|
|||||||
property bool _wantClose: false
|
property bool _wantClose: false
|
||||||
property var _exceptionDialog
|
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 {
|
header: ToolBar {
|
||||||
id: toolbar
|
id: toolbar
|
||||||
|
|
||||||
@@ -62,24 +111,15 @@ ApplicationWindow
|
|||||||
Layout.rightMargin: constants.paddingMedium
|
Layout.rightMargin: constants.paddingMedium
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|
||||||
ToolButton {
|
Item {
|
||||||
id: menuButton
|
Layout.preferredWidth: constants.paddingXLarge
|
||||||
enabled: stack.currentItem && stack.currentItem.menu
|
Layout.preferredHeight: 1
|
||||||
? stack.currentItem.menu.count > 0
|
|
||||||
: false
|
|
||||||
|
|
||||||
text: enabled ? '≡' : ''
|
|
||||||
font.pixelSize: constants.fontSizeXLarge
|
|
||||||
onClicked: {
|
|
||||||
stack.currentItem.menu.open()
|
|
||||||
stack.currentItem.menu.y = toolbarTopLayout.height
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
Layout.preferredWidth: constants.iconSizeSmall
|
Layout.preferredWidth: constants.iconSizeSmall
|
||||||
Layout.preferredHeight: constants.iconSizeSmall
|
Layout.preferredHeight: constants.iconSizeSmall
|
||||||
visible: Daemon.currentWallet
|
visible: Daemon.currentWallet && stack.currentItem.title == Daemon.currentWallet.name
|
||||||
source: '../../icons/wallet.png'
|
source: '../../icons/wallet.png'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,9 +134,10 @@ ApplicationWindow
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
height: toolbarTopLayout.height
|
height: toolbarTopLayout.height
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
// enabled: Daemon.currentWallet
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (stack.currentItem.objectName != 'Wallets')
|
stack.getRoot().menu.open()
|
||||||
stack.pushOnRoot(Qt.resolvedUrl('Wallets.qml'))
|
stack.getRoot().menu.y = toolbar.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,20 +177,14 @@ ApplicationWindow
|
|||||||
LightningNetworkStatusIndicator {
|
LightningNetworkStatusIndicator {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: openAppMenu()
|
||||||
if (stack.currentItem.objectName != 'NetworkOverview')
|
|
||||||
stack.push(Qt.resolvedUrl('NetworkOverview.qml'))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OnchainNetworkStatusIndicator {
|
OnchainNetworkStatusIndicator {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: openAppMenu()
|
||||||
if (stack.currentItem.objectName != 'NetworkOverview')
|
|
||||||
stack.push(Qt.resolvedUrl('NetworkOverview.qml'))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user