From 5ef7fabc73601b8bb9793a5193fb71d396266473 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 30 Mar 2023 11:24:50 +0200 Subject: [PATCH] qml InvoiceDialog: merge status and userinfo --- electrum/gui/qml/components/Constants.qml | 2 + electrum/gui/qml/components/InvoiceDialog.qml | 42 +++++-------------- .../qml/components/controls/InfoTextArea.qml | 19 +++++++-- 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/electrum/gui/qml/components/Constants.qml b/electrum/gui/qml/components/Constants.qml index 1852d4a46..87c3c6fd2 100644 --- a/electrum/gui/qml/components/Constants.qml +++ b/electrum/gui/qml/components/Constants.qml @@ -38,6 +38,8 @@ Item { property color colorInfo: Material.accentColor property color colorWarning: 'yellow' property color colorError: '#ffff8080' + property color colorProgress: '#ffffff80' + property color colorDone: '#ff80ff80' property color colorMine: "yellow" property color colorLightningLocal: "blue" diff --git a/electrum/gui/qml/components/InvoiceDialog.qml b/electrum/gui/qml/components/InvoiceDialog.qml index adff3ca83..16ba9a645 100644 --- a/electrum/gui/qml/components/InvoiceDialog.qml +++ b/electrum/gui/qml/components/InvoiceDialog.qml @@ -52,10 +52,18 @@ ElDialog { Layout.fillWidth: true Layout.bottomMargin: constants.paddingLarge visible: text - text: invoice.userinfo - iconStyle: invoice.status == Invoice.Failed || invoice.status == Invoice.Expired + text: invoice.userinfo ? invoice.userinfo : invoice.status_str + iconStyle: invoice.status == Invoice.Failed || invoice.status == Invoice.Unknown ? InfoTextArea.IconStyle.Warn - : InfoTextArea.IconStyle.Info + : invoice.status == Invoice.Expired + ? InfoTextArea.IconStyle.Error + : invoice.status == Invoice.Inflight || invoice.status == Invoice.Routing || invoice.status == Invoice.Unconfirmed + ? InfoTextArea.IconStyle.Progress + : invoice.status == Invoice.Paid + ? InfoTextArea.IconStyle.Done + : invoice.status == Invoice.Unpaid && invoice.expiration > 0 + ? InfoTextArea.IconStyle.Pending + : InfoTextArea.IconStyle.Info } Label { @@ -85,34 +93,6 @@ ElDialog { } } - Label { - text: qsTr('Status') - color: Material.accentColor - } - - RowLayout { - Image { - Layout.preferredWidth: constants.iconSizeSmall - Layout.preferredHeight: constants.iconSizeSmall - source: invoice.status == Invoice.Expired - ? '../../icons/expired.png' - : invoice.status == Invoice.Unpaid - ? '../../icons/unpaid.png' - : invoice.status == Invoice.Failed || invoice.status == Invoice.Unknown - ? '../../icons/warning.png' - : invoice.status == Invoice.Inflight || invoice.status == Invoice.Routing - ? '../../icons/status_waiting.png' - : invoice.status == Invoice.Unconfirmed - ? '../../icons/unconfirmed.png' - : invoice.status == Invoice.Paid - ? '../../icons/confirmed.png' - : '' - } - Label { - text: invoice.status_str - } - } - Label { Layout.columnSpan: 2 Layout.topMargin: constants.paddingSmall diff --git a/electrum/gui/qml/components/controls/InfoTextArea.qml b/electrum/gui/qml/components/controls/InfoTextArea.qml index a660a722d..b8867eb77 100644 --- a/electrum/gui/qml/components/controls/InfoTextArea.qml +++ b/electrum/gui/qml/components/controls/InfoTextArea.qml @@ -8,7 +8,10 @@ TextHighlightPane { None, Info, Warn, - Error + Error, + Progress, + Pending, + Done } property alias text: infotext.text @@ -21,7 +24,11 @@ TextHighlightPane { ? constants.colorWarning : iconStyle == InfoTextArea.IconStyle.Error ? constants.colorError - : constants.colorInfo + : iconStyle == InfoTextArea.IconStyle.Progress + ? constants.colorProgress + : iconStyle == InfoTextArea.IconStyle.Done + ? constants.colorDone + : constants.colorInfo padding: constants.paddingXLarge RowLayout { @@ -35,7 +42,13 @@ TextHighlightPane { ? "../../../icons/warning.png" : iconStyle == InfoTextArea.IconStyle.Error ? "../../../icons/expired.png" - : "" + : iconStyle == InfoTextArea.IconStyle.Progress + ? "../../../icons/unconfirmed.png" + : iconStyle == InfoTextArea.IconStyle.Pending + ? "../../../icons/unpaid.png" + : iconStyle == InfoTextArea.IconStyle.Done + ? "../../../icons/confirmed.png" + : "" Layout.preferredWidth: constants.iconSizeMedium Layout.preferredHeight: constants.iconSizeMedium }