Browse Source

qml: put FlatButtons in ButtonContainer where (potentially) more buttons are grouped

master
Sander van Grieken 3 years ago
parent
commit
b2a02dd047
  1. 84
      electrum/gui/qml/components/ChannelDetails.qml
  2. 50
      electrum/gui/qml/components/Channels.qml
  3. 4
      electrum/gui/qml/components/ExportTxDialog.qml
  4. 65
      electrum/gui/qml/components/InvoiceDialog.qml
  5. 35
      electrum/gui/qml/components/NetworkOverview.qml
  6. 2
      electrum/gui/qml/components/ReceiveDialog.qml
  7. 37
      electrum/gui/qml/components/SendDialog.qml
  8. 25
      electrum/gui/qml/components/TxDetails.qml
  9. 58
      electrum/gui/qml/components/WalletDetails.qml
  10. 42
      electrum/gui/qml/components/WalletMainView.qml

84
electrum/gui/qml/components/ChannelDetails.qml

@ -203,58 +203,60 @@ Pane {
} }
} }
FlatButton { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
visible: !channeldetails.isBackup
text: qsTr('Backup'); FlatButton {
onClicked: { Layout.fillWidth: true
var dialog = app.genericShareDialog.createObject(root, Layout.preferredWidth: 1
{ visible: !channeldetails.isBackup
text: qsTr('Backup')
onClicked: {
var dialog = app.genericShareDialog.createObject(root, {
title: qsTr('Channel Backup for %1').arg(channeldetails.short_cid), title: qsTr('Channel Backup for %1').arg(channeldetails.short_cid),
text: channeldetails.channelBackup(), text: channeldetails.channelBackup(),
text_help: channeldetails.channelBackupHelpText(), text_help: channeldetails.channelBackupHelpText(),
iconSource: Qt.resolvedUrl('../../icons/file.png') iconSource: Qt.resolvedUrl('../../icons/file.png')
} })
) dialog.open()
dialog.open() }
icon.source: '../../icons/file.png'
} }
icon.source: '../../icons/file.png'
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
text: qsTr('Close channel'); text: qsTr('Close channel');
visible: channeldetails.canClose visible: channeldetails.canClose
onClicked: { onClicked: {
var dialog = closechannel.createObject(root, { 'channelid': channelid }) var dialog = closechannel.createObject(root, { channelid: channelid })
dialog.open() dialog.open()
}
icon.source: '../../icons/closebutton.png'
} }
icon.source: '../../icons/closebutton.png'
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
text: qsTr('Delete channel'); text: qsTr('Delete channel');
visible: channeldetails.canDelete visible: channeldetails.canDelete
onClicked: { onClicked: {
var dialog = app.messageDialog.createObject(root, var dialog = app.messageDialog.createObject(root, {
{ text: qsTr('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.'),
'text': qsTr('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.'), yesno: true
'yesno': true })
} dialog.yesClicked.connect(function() {
) channeldetails.deleteChannel()
dialog.yesClicked.connect(function() { app.stack.pop()
channeldetails.deleteChannel() Daemon.currentWallet.historyModel.init_model(true) // needed here?
app.stack.pop() Daemon.currentWallet.channelModel.remove_channel(channelid)
Daemon.currentWallet.historyModel.init_model(true) // needed here? })
Daemon.currentWallet.channelModel.remove_channel(channelid) dialog.open()
}) }
dialog.open() icon.source: '../../icons/delete.png'
} }
icon.source: '../../icons/delete.png'
} }
} }
ChannelDetails { ChannelDetails {

50
electrum/gui/qml/components/Channels.qml

@ -103,34 +103,40 @@ Pane {
} }
FlatButton { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Swap'); FlatButton {
visible: Daemon.currentWallet.lightningCanSend.satsInt > 0 || Daemon.currentWallet.lightningCanReceive.satInt > 0 Layout.fillWidth: true
icon.source: '../../icons/status_waiting.png' Layout.preferredWidth: 1
onClicked: { text: qsTr('Swap');
var dialog = swapDialog.createObject(root) visible: Daemon.currentWallet.lightningCanSend.satsInt > 0 || Daemon.currentWallet.lightningCanReceive.satInt > 0
dialog.open() icon.source: '../../icons/status_waiting.png'
onClicked: {
var dialog = swapDialog.createObject(root)
dialog.open()
}
} }
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Open Channel') Layout.preferredWidth: 1
onClicked: { text: qsTr('Open Channel')
var dialog = openChannelDialog.createObject(root) onClicked: {
dialog.open() var dialog = openChannelDialog.createObject(root)
dialog.open()
}
icon.source: '../../icons/lightning.png'
} }
icon.source: '../../icons/lightning.png'
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Channel backups') Layout.preferredWidth: 1
onClicked: { text: qsTr('Channel backups')
app.stack.push(Qt.resolvedUrl('ChannelBackups.qml')) onClicked: {
app.stack.push(Qt.resolvedUrl('ChannelBackups.qml'))
}
icon.source: '../../icons/file.png'
} }
icon.source: '../../icons/file.png'
} }
} }

4
electrum/gui/qml/components/ExportTxDialog.qml

@ -64,8 +64,8 @@ ElDialog {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { ButtonContainer {
Layout.fillWidth: true // Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
FlatButton { FlatButton {

65
electrum/gui/qml/components/InvoiceDialog.qml

@ -337,39 +337,46 @@ ElDialog {
} }
} }
FlatButton { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Pay')
icon.source: '../../icons/confirmed.png' FlatButton {
enabled: invoice.invoiceType != Invoice.Invalid && invoice.canPay && !amountContainer.editmode Layout.fillWidth: true
onClicked: { Layout.preferredWidth: 1
if (invoice_key == '') // save invoice if not retrieved from key text: qsTr('Pay')
invoice.save_invoice() icon.source: '../../icons/confirmed.png'
dialog.close() enabled: invoice.invoiceType != Invoice.Invalid && invoice.canPay && !amountContainer.editmode
doPay() // only signal here onClicked: {
if (invoice_key == '') // save invoice if not retrieved from key
invoice.save_invoice()
dialog.close()
doPay() // only signal here
}
} }
} FlatButton {
FlatButton { Layout.fillWidth: true
Layout.fillWidth: true Layout.preferredWidth: 1
text: qsTr('Delete') text: qsTr('Delete')
icon.source: '../../icons/delete.png' icon.source: '../../icons/delete.png'
visible: invoice_key != '' visible: invoice_key != ''
onClicked: { onClicked: {
invoice.wallet.delete_invoice(invoice_key) invoice.wallet.delete_invoice(invoice_key)
dialog.close() dialog.close()
}
} }
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Save') Layout.preferredWidth: 1
icon.source: '../../icons/save.png' text: qsTr('Save')
visible: invoice_key == '' icon.source: '../../icons/save.png'
enabled: invoice.canSave visible: invoice_key == ''
onClicked: { enabled: invoice.canSave
app.stack.push(Qt.resolvedUrl('Invoices.qml')) onClicked: {
invoice.save_invoice() app.stack.push(Qt.resolvedUrl('Invoices.qml'))
dialog.close() invoice.save_invoice()
dialog.close()
}
} }
} }

35
electrum/gui/qml/components/NetworkOverview.qml

@ -161,26 +161,31 @@ Pane {
} }
FlatButton { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Server Settings');
icon.source: '../../icons/network.png' FlatButton {
onClicked: { Layout.fillWidth: true
var dialog = serverConfig.createObject(root) Layout.preferredWidth: 1
dialog.open() text: qsTr('Server Settings');
icon.source: '../../icons/network.png'
onClicked: {
var dialog = serverConfig.createObject(root)
dialog.open()
}
} }
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Proxy Settings'); Layout.preferredWidth: 1
icon.source: '../../icons/status_connected_proxy.png' text: qsTr('Proxy Settings');
onClicked: { icon.source: '../../icons/status_connected_proxy.png'
var dialog = proxyConfig.createObject(root) onClicked: {
dialog.open() var dialog = proxyConfig.createObject(root)
dialog.open()
}
} }
} }
} }
function setFeeHistogram() { function setFeeHistogram() {

2
electrum/gui/qml/components/ReceiveDialog.qml

@ -241,7 +241,7 @@ ElDialog {
color: Material.accentColor color: Material.accentColor
} }
RowLayout { ButtonContainer {
id: buttons id: buttons
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
FlatButton { FlatButton {

37
electrum/gui/qml/components/SendDialog.qml

@ -49,25 +49,32 @@ ElDialog {
onFound: dialog.dispatch(scanData) onFound: dialog.dispatch(scanData)
} }
FlatButton { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
icon.source: '../../icons/pen.png'
text: qsTr('Manual input') FlatButton {
onClicked: { Layout.fillWidth: true
var _mid = manualInputDialog.createObject(mainView) Layout.preferredWidth: 1
_mid.accepted.connect(function() { icon.source: '../../icons/pen.png'
dialog.dispatch(_mid.recipient) text: qsTr('Manual input')
}) onClicked: {
_mid.open() var _mid = manualInputDialog.createObject(mainView)
_mid.accepted.connect(function() {
dialog.dispatch(_mid.recipient)
})
_mid.open()
}
} }
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
icon.source: '../../icons/paste.png' Layout.preferredWidth: 1
text: qsTr('Paste from clipboard') icon.source: '../../icons/paste.png'
onClicked: dialog.dispatch(AppController.clipboardToText()) text: qsTr('Paste from clipboard')
onClicked: dialog.dispatch(AppController.clipboardToText())
}
} }
} }
Component { Component {

25
electrum/gui/qml/components/TxDetails.qml

@ -315,8 +315,10 @@ Pane {
} }
RowLayout { ButtonContainer {
Layout.fillWidth: true
visible: txdetails.canSign || txdetails.canBroadcast visible: txdetails.canSign || txdetails.canBroadcast
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
@ -333,7 +335,9 @@ Pane {
} }
} }
RowLayout { ButtonContainer {
Layout.fillWidth: true
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
@ -359,15 +363,16 @@ Pane {
visible: txdetails.canRemove visible: txdetails.canRemove
onClicked: txdetails.removeLocalTx() onClicked: txdetails.removeLocalTx()
} }
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr('Cancel Tx') Layout.preferredWidth: 1
visible: txdetails.canCancel text: qsTr('Cancel Tx')
onClicked: { visible: txdetails.canCancel
var dialog = rbfCancelDialog.createObject(root, { txid: root.txid }) onClicked: {
dialog.open() var dialog = rbfCancelDialog.createObject(root, { txid: root.txid })
dialog.open()
}
} }
} }

58
electrum/gui/qml/components/WalletDetails.qml

@ -460,32 +460,40 @@ Pane {
} }
} }
FlatButton { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
visible: Daemon.currentWallet.walletType == 'imported'
text: Daemon.currentWallet.isWatchOnly FlatButton {
? qsTr('Import additional addresses') Layout.fillWidth: true
: qsTr('Import additional keys') Layout.preferredWidth: 1
onClicked: rootItem.importAddressesKeys() visible: Daemon.currentWallet.walletType == 'imported'
} text: Daemon.currentWallet.isWatchOnly
FlatButton { ? qsTr('Import additional addresses')
Layout.fillWidth: true : qsTr('Import additional keys')
text: qsTr('Change Password') onClicked: rootItem.importAddressesKeys()
onClicked: rootItem.changePassword() }
icon.source: '../../icons/lock.png' FlatButton {
} Layout.fillWidth: true
FlatButton { Layout.preferredWidth: 1
Layout.fillWidth: true text: qsTr('Change Password')
text: qsTr('Delete Wallet') onClicked: rootItem.changePassword()
onClicked: rootItem.deleteWallet() icon.source: '../../icons/lock.png'
icon.source: '../../icons/delete.png' }
} FlatButton {
FlatButton { Layout.fillWidth: true
Layout.fillWidth: true Layout.preferredWidth: 1
text: qsTr('Enable Lightning') text: qsTr('Delete Wallet')
onClicked: rootItem.enableLightning() onClicked: rootItem.deleteWallet()
visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning icon.source: '../../icons/delete.png'
icon.source: '../../icons/lightning.png' }
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Enable Lightning')
onClicked: rootItem.enableLightning()
visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning
icon.source: '../../icons/lightning.png'
}
} }
} }

42
electrum/gui/qml/components/WalletMainView.qml

@ -154,8 +154,8 @@ Item {
} }
} }
RowLayout { ButtonContainer {
spacing: 0 Layout.fillWidth: true
FlatButton { FlatButton {
Layout.fillWidth: false Layout.fillWidth: false
@ -169,17 +169,17 @@ Item {
mainView.menu.y = mainView.height - mainView.menu.height mainView.menu.y = mainView.height - mainView.menu.height
} }
} }
Rectangle { // Rectangle {
Layout.fillWidth: false // Layout.fillWidth: false
Layout.preferredWidth: 2 // Layout.preferredWidth: 2
Layout.preferredHeight: parent.height * 2/3 // Layout.preferredHeight: parent.height * 2/3
Layout.alignment: Qt.AlignVCenter // Layout.alignment: Qt.AlignVCenter
color: constants.darkerBackground // color: constants.darkerBackground
} // }
Item { // Item {
visible: !Daemon.currentWallet // visible: !Daemon.currentWallet
Layout.fillWidth: true // Layout.fillWidth: true
} // }
FlatButton { FlatButton {
visible: Daemon.currentWallet visible: Daemon.currentWallet
Layout.fillWidth: true Layout.fillWidth: true
@ -191,14 +191,14 @@ Item {
dialog.open() dialog.open()
} }
} }
Rectangle { // Rectangle {
visible: Daemon.currentWallet // 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
Layout.alignment: Qt.AlignVCenter // Layout.alignment: Qt.AlignVCenter
color: constants.darkerBackground // color: constants.darkerBackground
} // }
FlatButton { FlatButton {
visible: Daemon.currentWallet visible: Daemon.currentWallet
Layout.fillWidth: true Layout.fillWidth: true

Loading…
Cancel
Save