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
visible: !channeldetails.isBackup
text: qsTr('Backup');
onClicked: {
var dialog = app.genericShareDialog.createObject(root,
{
FlatButton {
Layout.fillWidth: true
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),
text: channeldetails.channelBackup(),
text_help: channeldetails.channelBackupHelpText(),
iconSource: Qt.resolvedUrl('../../icons/file.png')
}
)
dialog.open()
})
dialog.open()
}
icon.source: '../../icons/file.png'
}
icon.source: '../../icons/file.png'
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Close channel');
visible: channeldetails.canClose
onClicked: {
var dialog = closechannel.createObject(root, { 'channelid': channelid })
dialog.open()
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Close channel');
visible: channeldetails.canClose
onClicked: {
var dialog = closechannel.createObject(root, { channelid: channelid })
dialog.open()
}
icon.source: '../../icons/closebutton.png'
}
icon.source: '../../icons/closebutton.png'
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Delete channel');
visible: channeldetails.canDelete
onClicked: {
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.'),
'yesno': true
}
)
dialog.yesClicked.connect(function() {
channeldetails.deleteChannel()
app.stack.pop()
Daemon.currentWallet.historyModel.init_model(true) // needed here?
Daemon.currentWallet.channelModel.remove_channel(channelid)
})
dialog.open()
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Delete channel');
visible: channeldetails.canDelete
onClicked: {
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.'),
yesno: true
})
dialog.yesClicked.connect(function() {
channeldetails.deleteChannel()
app.stack.pop()
Daemon.currentWallet.historyModel.init_model(true) // needed here?
Daemon.currentWallet.channelModel.remove_channel(channelid)
})
dialog.open()
}
icon.source: '../../icons/delete.png'
}
icon.source: '../../icons/delete.png'
}
}
ChannelDetails {

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

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

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

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

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

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

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

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

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

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

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

@ -315,8 +315,10 @@ Pane {
}
RowLayout {
ButtonContainer {
Layout.fillWidth: true
visible: txdetails.canSign || txdetails.canBroadcast
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
@ -333,7 +335,9 @@ Pane {
}
}
RowLayout {
ButtonContainer {
Layout.fillWidth: true
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
@ -359,15 +363,16 @@ Pane {
visible: txdetails.canRemove
onClicked: txdetails.removeLocalTx()
}
}
FlatButton {
Layout.fillWidth: true
text: qsTr('Cancel Tx')
visible: txdetails.canCancel
onClicked: {
var dialog = rbfCancelDialog.createObject(root, { txid: root.txid })
dialog.open()
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Cancel Tx')
visible: txdetails.canCancel
onClicked: {
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
visible: Daemon.currentWallet.walletType == 'imported'
text: Daemon.currentWallet.isWatchOnly
? qsTr('Import additional addresses')
: qsTr('Import additional keys')
onClicked: rootItem.importAddressesKeys()
}
FlatButton {
Layout.fillWidth: true
text: qsTr('Change Password')
onClicked: rootItem.changePassword()
icon.source: '../../icons/lock.png'
}
FlatButton {
Layout.fillWidth: true
text: qsTr('Delete Wallet')
onClicked: rootItem.deleteWallet()
icon.source: '../../icons/delete.png'
}
FlatButton {
Layout.fillWidth: true
text: qsTr('Enable Lightning')
onClicked: rootItem.enableLightning()
visible: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning
icon.source: '../../icons/lightning.png'
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
visible: Daemon.currentWallet.walletType == 'imported'
text: Daemon.currentWallet.isWatchOnly
? qsTr('Import additional addresses')
: qsTr('Import additional keys')
onClicked: rootItem.importAddressesKeys()
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Change Password')
onClicked: rootItem.changePassword()
icon.source: '../../icons/lock.png'
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Delete Wallet')
onClicked: rootItem.deleteWallet()
icon.source: '../../icons/delete.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 {
spacing: 0
ButtonContainer {
Layout.fillWidth: true
FlatButton {
Layout.fillWidth: false
@ -169,17 +169,17 @@ Item {
mainView.menu.y = mainView.height - mainView.menu.height
}
}
Rectangle {
Layout.fillWidth: false
Layout.preferredWidth: 2
Layout.preferredHeight: parent.height * 2/3
Layout.alignment: Qt.AlignVCenter
color: constants.darkerBackground
}
Item {
visible: !Daemon.currentWallet
Layout.fillWidth: true
}
// Rectangle {
// Layout.fillWidth: false
// Layout.preferredWidth: 2
// Layout.preferredHeight: parent.height * 2/3
// Layout.alignment: Qt.AlignVCenter
// color: constants.darkerBackground
// }
// Item {
// visible: !Daemon.currentWallet
// Layout.fillWidth: true
// }
FlatButton {
visible: Daemon.currentWallet
Layout.fillWidth: true
@ -191,14 +191,14 @@ Item {
dialog.open()
}
}
Rectangle {
visible: Daemon.currentWallet
Layout.fillWidth: false
Layout.preferredWidth: 2
Layout.preferredHeight: parent.height * 2/3
Layout.alignment: Qt.AlignVCenter
color: constants.darkerBackground
}
// Rectangle {
// visible: Daemon.currentWallet
// Layout.fillWidth: false
// Layout.preferredWidth: 2
// Layout.preferredHeight: parent.height * 2/3
// Layout.alignment: Qt.AlignVCenter
// color: constants.darkerBackground
// }
FlatButton {
visible: Daemon.currentWallet
Layout.fillWidth: true

Loading…
Cancel
Save