From a57a0d001b42763404ba0d9a95a072ba38447973 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Wed, 15 Nov 2023 18:28:44 +0100 Subject: [PATCH] qml: make TextAreas more visible --- .../components/ImportAddressesKeysDialog.qml | 20 +++++++++++------- .../qml/components/LnurlPayRequestDialog.qml | 21 +++++++++---------- .../components/SignVerifyMessageDialog.qml | 12 +++++++++++ .../qml/components/controls/ElTextArea.qml | 11 ++++++---- .../qml/components/wizard/WCHaveMasterKey.qml | 8 +++++-- .../gui/qml/components/wizard/WCImport.qml | 14 +++++++++---- 6 files changed, 58 insertions(+), 28 deletions(-) diff --git a/electrum/gui/qml/components/ImportAddressesKeysDialog.qml b/electrum/gui/qml/components/ImportAddressesKeysDialog.qml index 7ed2f6f2a..e8c96b850 100644 --- a/electrum/gui/qml/components/ImportAddressesKeysDialog.qml +++ b/electrum/gui/qml/components/ImportAddressesKeysDialog.qml @@ -45,20 +45,26 @@ ElDialog { Layout.rightMargin: constants.paddingLarge Label { - text: Daemon.currentWallet.isWatchOnly - ? qsTr('Import additional addresses') - : qsTr('Import additional keys') + Layout.fillWidth: true + wrapMode: Text.Wrap + text: (Daemon.currentWallet.isWatchOnly + ? qsTr('Enter, paste or scan additional addresses') + : qsTr('Enter, paste or scan additional private keys')) + + '. ' + qsTr('You can add multiple, each on a separate line.') } RowLayout { - TextArea { + ElTextArea { id: import_ta Layout.fillWidth: true - Layout.minimumHeight: 80 - focus: true + Layout.fillHeight: true + font.family: FixedFont wrapMode: TextEdit.WrapAnywhere onTextChanged: valid = verify(text) - inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText + inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase + background: PaneInsetBackground { + baseColor: constants.darkerDialogBackground + } } ColumnLayout { Layout.alignment: Qt.AlignTop diff --git a/electrum/gui/qml/components/LnurlPayRequestDialog.qml b/electrum/gui/qml/components/LnurlPayRequestDialog.qml index 974fd1818..30ffd5dfe 100644 --- a/electrum/gui/qml/components/LnurlPayRequestDialog.qml +++ b/electrum/gui/qml/components/LnurlPayRequestDialog.qml @@ -36,6 +36,14 @@ ElDialog { Layout.rightMargin: constants.paddingLarge Layout.bottomMargin: constants.paddingLarge + InfoTextArea { + Layout.columnSpan: 2 + Layout.fillWidth: true + compact: true + visible: invoiceParser.lnurlData['min_sendable_sat'] != invoiceParser.lnurlData['max_sendable_sat'] + text: qsTr('Amount must be between %1 and %2 %3').arg(Config.formatSats(invoiceParser.lnurlData['min_sendable_sat'])).arg(Config.formatSats(invoiceParser.lnurlData['max_sendable_sat'])).arg(Config.baseUnit) + } + Label { text: qsTr('Provider') color: Material.accentColor @@ -93,26 +101,17 @@ ElDialog { } } - InfoTextArea { - Layout.columnSpan: 2 - Layout.fillWidth: true - compact: true - visible: invoiceParser.lnurlData['min_sendable_sat'] != invoiceParser.lnurlData['max_sendable_sat'] - text: qsTr('Amount must be between %1 and %2 %3').arg(Config.formatSats(invoiceParser.lnurlData['min_sendable_sat'])).arg(Config.formatSats(invoiceParser.lnurlData['max_sendable_sat'])).arg(Config.baseUnit) - } - Label { Layout.columnSpan: 2 visible: invoiceParser.lnurlData['comment_allowed'] > 0 text: qsTr('Message') color: Material.accentColor } - TextArea { + ElTextArea { id: comment Layout.columnSpan: 2 Layout.fillWidth: true - Layout.leftMargin: constants.paddingLarge - Layout.minimumHeight: 80 + Layout.minimumHeight: 160 visible: invoiceParser.lnurlData['comment_allowed'] > 0 wrapMode: TextEdit.Wrap placeholderText: qsTr('Enter an (optional) message for the receiver') diff --git a/electrum/gui/qml/components/SignVerifyMessageDialog.qml b/electrum/gui/qml/components/SignVerifyMessageDialog.qml index 03a6d9825..af1581926 100644 --- a/electrum/gui/qml/components/SignVerifyMessageDialog.qml +++ b/electrum/gui/qml/components/SignVerifyMessageDialog.qml @@ -101,6 +101,18 @@ ElDialog { plaintext.text = AppController.clipboardToText() } } + ToolButton { + icon.source: '../../icons/share.png' + icon.color: enabled ? 'transparent' : Material.iconDisabledColor + enabled: plaintext.text + onClicked: { + var dialog = app.genericShareDialog.createObject(app, { + title: qsTr('Message'), + text_qr: plaintext.text + }) + dialog.open() + } + } } } diff --git a/electrum/gui/qml/components/controls/ElTextArea.qml b/electrum/gui/qml/components/controls/ElTextArea.qml index 45268a50a..7a90c4d65 100644 --- a/electrum/gui/qml/components/controls/ElTextArea.qml +++ b/electrum/gui/qml/components/controls/ElTextArea.qml @@ -1,7 +1,7 @@ -import QtQuick 2.15 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.14 -import QtQuick.Controls.Material 2.0 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtQuick.Controls.Material import org.electrum 1.0 @@ -16,6 +16,9 @@ Flickable { property alias wrapMode: edit.wrapMode property alias background: rootpane.background property alias font: edit.font + property alias inputMethodHints: edit.inputMethodHints + property alias placeholderText: edit.placeholderText + property alias color: edit.color contentWidth: rootpane.width contentHeight: rootpane.height diff --git a/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml b/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml index 4aafd0d8f..c5a15c9ae 100644 --- a/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml +++ b/electrum/gui/qml/components/wizard/WCHaveMasterKey.qml @@ -122,10 +122,10 @@ WizardComponent { } RowLayout { - TextArea { + ElTextArea { id: masterkey_ta Layout.fillWidth: true - Layout.minimumHeight: 80 + Layout.minimumHeight: 160 font.family: FixedFont wrapMode: TextEdit.WrapAnywhere onTextChanged: { @@ -133,8 +133,12 @@ WizardComponent { verifyMasterKey(text) } inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase + background: PaneInsetBackground { + baseColor: constants.darkerDialogBackground + } } ColumnLayout { + Layout.alignment: Qt.AlignTop ToolButton { icon.source: '../../../icons/paste.png' icon.height: constants.iconSizeMedium diff --git a/electrum/gui/qml/components/wizard/WCImport.qml b/electrum/gui/qml/components/wizard/WCImport.qml index ce5de51a6..06238a3b9 100644 --- a/electrum/gui/qml/components/wizard/WCImport.qml +++ b/electrum/gui/qml/components/wizard/WCImport.qml @@ -26,7 +26,7 @@ WizardComponent { ColumnLayout { width: parent.width - + height: parent.height InfoTextArea { Layout.preferredWidth: parent.width text: qsTr('Enter a list of Bitcoin addresses (this will create a watching-only wallet), or a list of private keys.') @@ -34,15 +34,21 @@ WizardComponent { RowLayout { Layout.topMargin: constants.paddingMedium - TextArea { + Layout.fillHeight: true + + ElTextArea { id: import_ta Layout.fillWidth: true - Layout.minimumHeight: 80 - focus: true + Layout.fillHeight: true + font.family: FixedFont wrapMode: TextEdit.WrapAnywhere onTextChanged: valid = verify(text) inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase + background: PaneInsetBackground { + baseColor: constants.darkerDialogBackground + } } + ColumnLayout { Layout.alignment: Qt.AlignTop ToolButton {