Browse Source

qml MessageDialog: split messages into title and header message. hide header if it is empty.

master
ThomasV 3 years ago
parent
commit
5e29b94561
  1. 2
      electrum/gui/qml/components/ChannelBackups.qml
  2. 5
      electrum/gui/qml/components/ChannelDetails.qml
  3. 2
      electrum/gui/qml/components/Channels.qml
  4. 3
      electrum/gui/qml/components/MessageDialog.qml
  5. 2
      electrum/gui/qml/components/OpenChannelDialog.qml
  6. 6
      electrum/gui/qml/components/Preferences.qml
  7. 13
      electrum/gui/qml/components/TxDetails.qml
  8. 8
      electrum/gui/qml/components/WalletDetails.qml
  9. 4
      electrum/gui/qml/components/WalletMainView.qml
  10. 6
      electrum/gui/qml/components/main.qml

2
electrum/gui/qml/components/ChannelBackups.qml

@ -93,7 +93,7 @@ Pane {
Connections { Connections {
target: Daemon.currentWallet target: Daemon.currentWallet
function onImportChannelBackupFailed(message) { function onImportChannelBackupFailed(message) {
var dialog = app.messageDialog.createObject(root, { text: message }) var dialog = app.messageDialog.createObject(root, { title: qstr('Error'), text: message })
dialog.open() dialog.open()
} }
} }

5
electrum/gui/qml/components/ChannelDetails.qml

@ -283,9 +283,8 @@ Pane {
visible: channeldetails.canDelete visible: channeldetails.canDelete
onClicked: { onClicked: {
var dialog = app.messageDialog.createObject(root, { var dialog = app.messageDialog.createObject(root, {
text: channeldetails.isBackup title: qsTr('Are you sure?'),
? qsTr('Are you sure you want to delete this channel backup?') text: channeldetails.isBackup ? '' : qsTr('This will purge associated transactions from your wallet history.'),
: qsTr('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.'),
yesno: true yesno: true
}) })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {

2
electrum/gui/qml/components/Channels.qml

@ -163,7 +163,7 @@ Pane {
Connections { Connections {
target: Daemon.currentWallet target: Daemon.currentWallet
function onImportChannelBackupFailed(message) { function onImportChannelBackupFailed(message) {
var dialog = app.messageDialog.createObject(root, { text: message }) var dialog = app.messageDialog.createObject(root, { title: qsTr('Error'), text: message })
dialog.open() dialog.open()
} }
} }

3
electrum/gui/qml/components/MessageDialog.qml

@ -24,6 +24,7 @@ ElDialog {
ColumnLayout { ColumnLayout {
ColumnLayout { ColumnLayout {
visible: text
Layout.margins: constants.paddingMedium Layout.margins: constants.paddingMedium
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
TextArea { TextArea {
@ -39,7 +40,7 @@ ElDialog {
} }
ButtonContainer { ButtonContainer {
Layout.fillWidth: true Layout.preferredWidth: dialog.parent.width * 2/3
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true

2
electrum/gui/qml/components/OpenChannelDialog.qml

@ -214,7 +214,7 @@ ElDialog {
} }
onValidationError: { onValidationError: {
if (code == 'invalid_nodeid') { if (code == 'invalid_nodeid') {
var dialog = app.messageDialog.createObject(app, { 'text': message }) var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), 'text': message })
dialog.open() dialog.open()
} }
} }

6
electrum/gui/qml/components/Preferences.qml

@ -256,7 +256,8 @@ Pane {
if (activeFocus) { if (activeFocus) {
if (!checked) { if (!checked) {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('Using plain gossip mode is not recommended on mobile. Are you sure?'), title: qsTr('Are you sure?'),
text: qsTr('Electrum will have to download the Lightning Network graph, which is not recommended on mobile.'),
yesno: true yesno: true
}) })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
@ -291,7 +292,8 @@ Pane {
if (activeFocus) { if (activeFocus) {
if (!checked) { if (!checked) {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('Are you sure? This option allows you to recover your lightning funds if you lose your device, or if you uninstall this app while lightning channels are active. Do not disable it unless you know how to recover channels from backups.'), title: qsTr('Are you sure?'),
text: qsTr('This option allows you to recover your lightning funds if you lose your device, or if you uninstall this app while lightning channels are active. Do not disable it unless you know how to recover channels from backups.'),
yesno: true yesno: true
}) })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {

13
electrum/gui/qml/components/TxDetails.qml

@ -414,8 +414,8 @@ Pane {
if (txid != txdetails.txid) if (txid != txdetails.txid)
return return
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('Transaction added to wallet history.') + '\n\n' + title: qsTr('Transaction added to wallet history.'),
qsTr('Note: this is an offline transaction, if you want the network to see it, you need to broadcast it.') text: qsTr('Note: this is an offline transaction, if you want the network to see it, you need to broadcast it.')
}) })
dialog.open() dialog.open()
root.close() root.close()
@ -446,7 +446,8 @@ Pane {
txdetails.sign_and_broadcast() txdetails.sign_and_broadcast()
} else { } else {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('Transaction fee updated.') + '\n\n' + qsTr('You still need to sign and broadcast this transaction.') title: qsTr('Transaction fee updated.'),
text: qsTr('You still need to sign and broadcast this transaction.')
}) })
dialog.open() dialog.open()
} }
@ -472,7 +473,8 @@ Pane {
txdetails.sign_and_broadcast() txdetails.sign_and_broadcast()
} else { } else {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('CPFP fee bump transaction created.') + '\n\n' + qsTr('You still need to sign and broadcast this transaction.') title: qsTr('CPFP fee bump transaction created.'),
text: qsTr('You still need to sign and broadcast this transaction.')
}) })
dialog.open() dialog.open()
} }
@ -497,7 +499,8 @@ Pane {
txdetails.sign_and_broadcast() txdetails.sign_and_broadcast()
} else { } else {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('Cancel transaction created.') + '\n\n' + qsTr('You still need to sign and broadcast this transaction.') title: qsTr('Cancel transaction created.'),
text: qsTr('You still need to sign and broadcast this transaction.')
}) })
dialog.open() dialog.open()
} }

8
electrum/gui/qml/components/WalletDetails.qml

@ -17,7 +17,7 @@ Pane {
function enableLightning() { function enableLightning() {
var dialog = app.messageDialog.createObject(rootItem, var dialog = app.messageDialog.createObject(rootItem,
{'text': qsTr('Enable Lightning for this wallet?'), 'yesno': true}) {'title': qsTr('Enable Lightning for this wallet?'), 'yesno': true})
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
Daemon.currentWallet.enableLightning() Daemon.currentWallet.enableLightning()
}) })
@ -466,19 +466,19 @@ Pane {
} }
function onWalletDeleteError(code, message) { function onWalletDeleteError(code, message) {
if (code == 'unpaid_requests') { if (code == 'unpaid_requests') {
var dialog = app.messageDialog.createObject(app, {text: message, yesno: true }) var dialog = app.messageDialog.createObject(app, {title: qsTr('Error'), text: message, yesno: true })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
Daemon.checkThenDeleteWallet(Daemon.currentWallet, true) Daemon.checkThenDeleteWallet(Daemon.currentWallet, true)
}) })
dialog.open() dialog.open()
} else if (code == 'balance') { } else if (code == 'balance') {
var dialog = app.messageDialog.createObject(app, {text: message, yesno: true }) var dialog = app.messageDialog.createObject(app, {title: qsTr('Error'), text: message, yesno: true })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
Daemon.checkThenDeleteWallet(Daemon.currentWallet, true, true) Daemon.checkThenDeleteWallet(Daemon.currentWallet, true, true)
}) })
dialog.open() dialog.open()
} else { } else {
var dialog = app.messageDialog.createObject(app, {text: message }) var dialog = app.messageDialog.createObject(app, {title: qsTr('Error'), text: message })
dialog.open() dialog.open()
} }
} }

4
electrum/gui/qml/components/WalletMainView.qml

@ -252,7 +252,7 @@ Item {
dialog.open() dialog.open()
} }
onLnurlError: { onLnurlError: {
var dialog = app.messageDialog.createObject(app, { text: message }) var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), text: message })
dialog.open() dialog.open()
} }
} }
@ -370,7 +370,7 @@ Item {
} }
onChannelBackupFound: { onChannelBackupFound: {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('Import Channel backup?'), title: qsTr('Import Channel backup?'),
yesno: true yesno: true
}) })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {

6
electrum/gui/qml/components/main.qml

@ -375,7 +375,7 @@ ApplicationWindow
app.handleAuthRequired(_swaphelper, method, authMessage) app.handleAuthRequired(_swaphelper, method, authMessage)
} }
onError: { onError: {
var dialog = app.messageDialog.createObject(app, { text: message }) var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), text: message })
dialog.open() dialog.open()
} }
} }
@ -452,7 +452,7 @@ ApplicationWindow
mainStackView.clear() mainStackView.clear()
} else { } else {
var dialog = app.messageDialog.createObject(app, { var dialog = app.messageDialog.createObject(app, {
text: qsTr('Close Electrum?'), title: qsTr('Close Electrum?'),
yesno: true yesno: true
}) })
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
@ -578,7 +578,7 @@ ApplicationWindow
qtobject.authProceed() qtobject.authProceed()
return return
} }
var dialog = app.messageDialog.createObject(app, {text: authMessage, yesno: true}) var dialog = app.messageDialog.createObject(app, {title: authMessage, yesno: true})
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
qtobject.authProceed() qtobject.authProceed()
}) })

Loading…
Cancel
Save