Browse Source

qml: show menu also when no wallet loaded

Sander van Grieken 3 years ago
parent
commit
8b7743c4bf
  1. 89
      electrum/gui/qml/components/WalletMainView.qml

89
electrum/gui/qml/components/WalletMainView.qml

@ -101,51 +101,57 @@ Item {
} }
ColumnLayout { ColumnLayout {
anchors.centerIn: parent anchors.fill: parent
width: parent.width
spacing: 2*constants.paddingXLarge History {
visible: !Daemon.currentWallet id: history
visible: Daemon.currentWallet
Label { Layout.fillWidth: true
text: qsTr('No wallet loaded') Layout.fillHeight: true
font.pixelSize: constants.fontSizeXXLarge
Layout.alignment: Qt.AlignHCenter
} }
Pane { ColumnLayout {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
padding: 0 Layout.fillHeight: true
background: Rectangle { spacing: 2*constants.paddingXLarge
color: Material.dialogColor visible: !Daemon.currentWallet
Item {
Layout.fillHeight: true
} }
FlatButton { Label {
text: qsTr('Open/Create Wallet') Layout.alignment: Qt.AlignHCenter
icon.source: '../../icons/wallet.png' text: qsTr('No wallet loaded')
onClicked: { font.pixelSize: constants.fontSizeXXLarge
if (Daemon.availableWallets.rowCount() > 0) { }
stack.push(Qt.resolvedUrl('Wallets.qml'))
} else { Pane {
var newww = app.newWalletWizard.createObject(app) Layout.alignment: Qt.AlignHCenter
newww.walletCreated.connect(function() { padding: 0
Daemon.availableWallets.reload() background: Rectangle {
// and load the new wallet color: Material.dialogColor
Daemon.load_wallet(newww.path, newww.wizard_data['password']) }
}) FlatButton {
newww.open() text: qsTr('Open/Create Wallet')
icon.source: '../../icons/wallet.png'
onClicked: {
if (Daemon.availableWallets.rowCount() > 0) {
stack.push(Qt.resolvedUrl('Wallets.qml'))
} else {
var newww = app.newWalletWizard.createObject(app)
newww.walletCreated.connect(function() {
Daemon.availableWallets.reload()
// and load the new wallet
Daemon.load_wallet(newww.path, newww.wizard_data['password'])
})
newww.open()
}
} }
} }
} }
} Item {
} Layout.fillHeight: true
}
ColumnLayout {
anchors.fill: parent
visible: Daemon.currentWallet
History {
id: history
Layout.preferredWidth: parent.width
Layout.fillHeight: true
} }
RowLayout { RowLayout {
@ -167,7 +173,12 @@ Item {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
color: constants.darkerBackground color: constants.darkerBackground
} }
Item {
visible: !Daemon.currentWallet
Layout.fillWidth: true
}
FlatButton { FlatButton {
visible: Daemon.currentWallet
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
icon.source: '../../icons/tab_receive.png' icon.source: '../../icons/tab_receive.png'
@ -178,6 +189,7 @@ Item {
} }
} }
Rectangle { Rectangle {
visible: Daemon.currentWallet
Layout.fillWidth: false Layout.fillWidth: false
Layout.preferredWidth: 2 Layout.preferredWidth: 2
Layout.preferredHeight: parent.height * 2/3 Layout.preferredHeight: parent.height * 2/3
@ -185,6 +197,7 @@ Item {
color: constants.darkerBackground color: constants.darkerBackground
} }
FlatButton { FlatButton {
visible: Daemon.currentWallet
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
icon.source: '../../icons/tab_send.png' icon.source: '../../icons/tab_send.png'

Loading…
Cancel
Save