diff --git a/electrum/gui/qml/components/AddressDetails.qml b/electrum/gui/qml/components/AddressDetails.qml index 0af155d69..0ffc17bee 100644 --- a/electrum/gui/qml/components/AddressDetails.qml +++ b/electrum/gui/qml/components/AddressDetails.qml @@ -11,247 +11,229 @@ Pane { id: root width: parent.width height: parent.height + padding: 0 property string address - property string title: qsTr("Address details") - signal addressDetailsChanged - property QtObject menu: Menu { - id: menu - MenuItem { - icon.color: 'transparent' - action: Action { - text: qsTr('Spend from') - icon.source: '../../icons/tab_send.png' - enabled: false - } - } - MenuItem { - icon.color: 'transparent' - action: Action { - text: qsTr('Sign/Verify') - icon.source: '../../icons/key.png' - enabled: false - } - } - MenuItem { - icon.color: 'transparent' - action: Action { - text: qsTr('Encrypt/Decrypt') - icon.source: '../../icons/mail_icon.png' - enabled: false - } - } - MenuItem { - icon.color: 'transparent' - action: Action { - text: addressdetails.isFrozen ? qsTr('Unfreeze') : qsTr('Freeze') - onTriggered: addressdetails.freeze(!addressdetails.isFrozen) - icon.source: '../../icons/seal.png' - } - } - } - - Flickable { + ColumnLayout { anchors.fill: parent - contentHeight: rootLayout.height - clip:true - interactive: height < contentHeight - - GridLayout { - id: rootLayout - width: parent.width - columns: 2 - - Label { - text: qsTr('Address') - Layout.columnSpan: 2 - color: Material.accentColor - } + spacing: 0 - TextHighlightPane { - Layout.columnSpan: 2 - Layout.fillWidth: true - padding: 0 - leftPadding: constants.paddingSmall + Flickable { + Layout.preferredWidth: parent.width + Layout.fillHeight: true - RowLayout { - width: parent.width - Label { - text: root.address - font.pixelSize: constants.fontSizeLarge - font.family: FixedFont - Layout.fillWidth: true - wrapMode: Text.Wrap - } - ToolButton { - icon.source: '../../icons/share.png' - icon.color: 'transparent' - onClicked: { - var dialog = app.genericShareDialog.createObject(root, - { title: qsTr('Address'), text: root.address } - ) - dialog.open() - } - } - } - } + leftMargin: constants.paddingLarge + rightMargin: constants.paddingLarge + topMargin: constants.paddingLarge - Label { - text: qsTr('Label') - Layout.columnSpan: 2 - color: Material.accentColor - } + contentHeight: rootLayout.height + clip:true + interactive: height < contentHeight - TextHighlightPane { - id: labelContent + GridLayout { + id: rootLayout + width: parent.width - property bool editmode: false + columns: 2 - Layout.columnSpan: 2 - Layout.fillWidth: true - padding: 0 - leftPadding: constants.paddingSmall + Label { + text: qsTr('Address') + Layout.columnSpan: 2 + color: Material.accentColor + } - RowLayout { - width: parent.width - Label { - visible: !labelContent.editmode - text: addressdetails.label - wrapMode: Text.Wrap - Layout.fillWidth: true - font.pixelSize: constants.fontSizeLarge - } - ToolButton { - visible: !labelContent.editmode - icon.source: '../../icons/pen.png' - icon.color: 'transparent' - onClicked: { - labelEdit.text = addressdetails.label - labelContent.editmode = true - labelEdit.focus = true + TextHighlightPane { + Layout.columnSpan: 2 + Layout.fillWidth: true + padding: 0 + leftPadding: constants.paddingSmall + + RowLayout { + width: parent.width + Label { + text: root.address + font.pixelSize: constants.fontSizeLarge + font.family: FixedFont + Layout.fillWidth: true + wrapMode: Text.Wrap } - } - TextField { - id: labelEdit - visible: labelContent.editmode - text: addressdetails.label - font.pixelSize: constants.fontSizeLarge - Layout.fillWidth: true - } - ToolButton { - visible: labelContent.editmode - icon.source: '../../icons/confirmed.png' - icon.color: 'transparent' - onClicked: { - labelContent.editmode = false - addressdetails.set_label(labelEdit.text) + ToolButton { + icon.source: '../../icons/share.png' + icon.color: 'transparent' + onClicked: { + var dialog = app.genericShareDialog.createObject(root, + { title: qsTr('Address'), text: root.address } + ) + dialog.open() + } } } - ToolButton { - visible: labelContent.editmode - icon.source: '../../icons/closebutton.png' - icon.color: 'transparent' - onClicked: labelContent.editmode = false - } } - } - Label { - text: qsTr('Public keys') - Layout.columnSpan: 2 - color: Material.accentColor - } + Label { + text: qsTr('Label') + Layout.columnSpan: 2 + color: Material.accentColor + } + + TextHighlightPane { + id: labelContent + + property bool editmode: false - Repeater { - model: addressdetails.pubkeys - delegate: TextHighlightPane { Layout.columnSpan: 2 Layout.fillWidth: true padding: 0 leftPadding: constants.paddingSmall + RowLayout { width: parent.width Label { - text: modelData - Layout.fillWidth: true + visible: !labelContent.editmode + text: addressdetails.label wrapMode: Text.Wrap + Layout.fillWidth: true font.pixelSize: constants.fontSizeLarge - font.family: FixedFont } ToolButton { - icon.source: '../../icons/share.png' + visible: !labelContent.editmode + icon.source: '../../icons/pen.png' icon.color: 'transparent' onClicked: { - var dialog = app.genericShareDialog.createObject(root, - { title: qsTr('Public key'), text: modelData } - ) - dialog.open() + labelEdit.text = addressdetails.label + labelContent.editmode = true + labelEdit.focus = true } } + TextField { + id: labelEdit + visible: labelContent.editmode + text: addressdetails.label + font.pixelSize: constants.fontSizeLarge + Layout.fillWidth: true + } + ToolButton { + visible: labelContent.editmode + icon.source: '../../icons/confirmed.png' + icon.color: 'transparent' + onClicked: { + labelContent.editmode = false + addressdetails.set_label(labelEdit.text) + } + } + ToolButton { + visible: labelContent.editmode + icon.source: '../../icons/closebutton.png' + icon.color: 'transparent' + onClicked: labelContent.editmode = false + } } } - } - Label { - text: qsTr('Script type') - color: Material.accentColor - } + Label { + text: qsTr('Public keys') + Layout.columnSpan: 2 + color: Material.accentColor + } - Label { - text: addressdetails.scriptType - Layout.fillWidth: true - } + Repeater { + model: addressdetails.pubkeys + delegate: TextHighlightPane { + Layout.columnSpan: 2 + Layout.fillWidth: true + padding: 0 + leftPadding: constants.paddingSmall + RowLayout { + width: parent.width + Label { + text: modelData + Layout.fillWidth: true + wrapMode: Text.Wrap + font.pixelSize: constants.fontSizeLarge + font.family: FixedFont + } + ToolButton { + icon.source: '../../icons/share.png' + icon.color: 'transparent' + onClicked: { + var dialog = app.genericShareDialog.createObject(root, + { title: qsTr('Public key'), text: modelData } + ) + dialog.open() + } + } + } + } + } - Label { - text: qsTr('Balance') - color: Material.accentColor - } + Label { + text: qsTr('Script type') + color: Material.accentColor + } - RowLayout { Label { - font.family: FixedFont - text: Config.formatSats(addressdetails.balance) + text: addressdetails.scriptType + Layout.fillWidth: true } + Label { + text: qsTr('Balance') color: Material.accentColor - text: Config.baseUnit } + + RowLayout { + Label { + font.family: FixedFont + text: Config.formatSats(addressdetails.balance) + } + Label { + color: Material.accentColor + text: Config.baseUnit + } + Label { + text: Daemon.fx.enabled + ? '(' + Daemon.fx.fiatValue(addressdetails.balance) + ' ' + Daemon.fx.fiatCurrency + ')' + : '' + } + } + Label { - text: Daemon.fx.enabled - ? '(' + Daemon.fx.fiatValue(addressdetails.balance) + ' ' + Daemon.fx.fiatCurrency + ')' - : '' + text: qsTr('Transactions') + color: Material.accentColor } - } - Label { - text: qsTr('Transactions') - color: Material.accentColor - } + Label { + text: addressdetails.numTx + } - Label { - text: addressdetails.numTx - } + Label { + text: qsTr('Derivation path') + color: Material.accentColor + } - Label { - text: qsTr('Derivation path') - color: Material.accentColor - } + Label { + text: addressdetails.derivationPath + } - Label { - text: addressdetails.derivationPath - } + Label { + text: qsTr('Frozen') + color: Material.accentColor + } - Label { - text: qsTr('Frozen') - color: Material.accentColor + Label { + text: addressdetails.isFrozen ? qsTr('Frozen') : qsTr('Not frozen') + } } + } - Label { - text: addressdetails.isFrozen ? qsTr('Frozen') : qsTr('Not frozen') - } + FlatButton { + Layout.fillWidth: true + text: addressdetails.isFrozen ? qsTr('Unfreeze address') : qsTr('Freeze address') + onClicked: addressdetails.freeze(!addressdetails.isFrozen) + icon.source: '../../icons/seal.png' } } diff --git a/electrum/gui/qml/components/Addresses.qml b/electrum/gui/qml/components/Addresses.qml index 6da4040c7..447e4d12e 100644 --- a/electrum/gui/qml/components/Addresses.qml +++ b/electrum/gui/qml/components/Addresses.qml @@ -9,7 +9,6 @@ Pane { id: rootItem padding: 0 width: parent.width - property string title: Daemon.currentWallet.name + ' - ' + qsTr('Addresses') ColumnLayout { id: layout @@ -50,17 +49,15 @@ Pane { ColumnLayout { id: delegateLayout + width: parent.width spacing: 0 - x: constants.paddingMedium - width: parent.width - 2*constants.paddingMedium - - Item { - Layout.preferredWidth: 1 - Layout.preferredHeight: constants.paddingTiny - } GridLayout { columns: 2 + Layout.topMargin: constants.paddingSmall + Layout.leftMargin: constants.paddingLarge + Layout.rightMargin: constants.paddingLarge + Label { id: indexLabel font.bold: true @@ -137,30 +134,25 @@ Pane { Component { id: sectionDelegate - Rectangle { + Item { id: root width: ListView.view.width height: childrenRect.height - color: 'transparent' required property string section - RowLayout { - x: constants.paddingMedium - width: parent.width - 2 * constants.paddingMedium - - Rectangle { - Layout.preferredHeight: 1 - Layout.fillWidth: true - color: Material.accentColor - } + ColumnLayout { + width: parent.width Label { - padding: constants.paddingMedium + Layout.topMargin: constants.paddingLarge + Layout.leftMargin: constants.paddingLarge text: root.section + ' ' + qsTr('addresses') - font.bold: true - font.pixelSize: constants.fontSizeMedium + font.pixelSize: constants.fontSizeLarge + color: Material.accentColor } Rectangle { + Layout.leftMargin: constants.paddingLarge + Layout.rightMargin: constants.paddingLarge Layout.preferredHeight: 1 Layout.fillWidth: true color: Material.accentColor