From 68b630a2e9bf943e56d41b879cb510075c28a89b Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Fri, 30 Sep 2022 14:37:14 +0200 Subject: [PATCH] qml: unify dialog headers --- .../gui/qml/components/GenericShareDialog.qml | 27 ++++++------- .../gui/qml/components/OpenWalletDialog.qml | 33 +--------------- .../gui/qml/components/PasswordDialog.qml | 34 +--------------- electrum/gui/qml/components/Pin.qml | 34 +--------------- electrum/gui/qml/components/RequestDialog.qml | 14 ------- .../gui/qml/components/controls/ElDialog.qml | 39 +++++++++++++++++++ 6 files changed, 56 insertions(+), 125 deletions(-) diff --git a/electrum/gui/qml/components/GenericShareDialog.qml b/electrum/gui/qml/components/GenericShareDialog.qml index 8416a3e00..672dd6ca7 100644 --- a/electrum/gui/qml/components/GenericShareDialog.qml +++ b/electrum/gui/qml/components/GenericShareDialog.qml @@ -14,6 +14,7 @@ ElDialog { property string text_help title: '' + parent: Overlay.overlay modal: true standardButtons: Dialog.Close @@ -25,19 +26,19 @@ ElDialog { color: "#aa000000" } - header: RowLayout { - width: dialog.width - Label { - Layout.fillWidth: true - text: dialog.title - visible: dialog.title - elide: Label.ElideRight - padding: constants.paddingXLarge - bottomPadding: 0 - font.bold: true - font.pixelSize: constants.fontSizeMedium - } - } + // header: RowLayout { + // width: dialog.width + // Label { + // Layout.fillWidth: true + // text: dialog.title + // visible: dialog.title + // elide: Label.ElideRight + // padding: constants.paddingXLarge + // bottomPadding: 0 + // font.bold: true + // font.pixelSize: constants.fontSizeMedium + // } + // } Flickable { anchors.fill: parent diff --git a/electrum/gui/qml/components/OpenWalletDialog.qml b/electrum/gui/qml/components/OpenWalletDialog.qml index fc221dd05..504909a0e 100644 --- a/electrum/gui/qml/components/OpenWalletDialog.qml +++ b/electrum/gui/qml/components/OpenWalletDialog.qml @@ -14,6 +14,7 @@ ElDialog { height: parent.height title: qsTr("Open Wallet") + iconSource: '../../../icons/wallet.png' property string name property string path @@ -30,38 +31,6 @@ ElDialog { property bool _unlockClicked: false - header: GridLayout { - columns: 2 - rowSpacing: 0 - - Image { - source: "../../icons/wallet.png" - Layout.preferredWidth: constants.iconSizeXLarge - Layout.preferredHeight: constants.iconSizeXLarge - Layout.leftMargin: constants.paddingMedium - Layout.topMargin: constants.paddingMedium - Layout.bottomMargin: constants.paddingMedium - } - - Label { - text: title - Layout.fillWidth: true - topPadding: constants.paddingXLarge - bottomPadding: constants.paddingXLarge - font.bold: true - font.pixelSize: constants.fontSizeMedium - } - - Rectangle { - Layout.columnSpan: 2 - Layout.fillWidth: true - Layout.leftMargin: constants.paddingXXSmall - Layout.rightMargin: constants.paddingXXSmall - height: 1 - color: Qt.rgba(0,0,0,0.5) - } - } - ColumnLayout { width: parent.width spacing: constants.paddingLarge diff --git a/electrum/gui/qml/components/PasswordDialog.qml b/electrum/gui/qml/components/PasswordDialog.qml index 52415adc6..58918dbb3 100644 --- a/electrum/gui/qml/components/PasswordDialog.qml +++ b/electrum/gui/qml/components/PasswordDialog.qml @@ -11,6 +11,7 @@ ElDialog { id: passworddialog title: qsTr("Enter Password") + iconSource: '../../../icons/lock.png' property bool confirmPassword: false property string password @@ -24,39 +25,6 @@ ElDialog { color: "#aa000000" } - header: GridLayout { - columns: 2 - rowSpacing: 0 - - Image { - source: "../../icons/lock.png" - Layout.preferredWidth: constants.iconSizeXLarge - Layout.preferredHeight: constants.iconSizeXLarge - Layout.leftMargin: constants.paddingMedium - Layout.topMargin: constants.paddingMedium - Layout.bottomMargin: constants.paddingMedium - } - - Label { - text: title - elide: Label.ElideRight - Layout.fillWidth: true - topPadding: constants.paddingXLarge - bottomPadding: constants.paddingXLarge - font.bold: true - font.pixelSize: constants.fontSizeMedium - } - - Rectangle { - Layout.columnSpan: 2 - Layout.fillWidth: true - Layout.leftMargin: constants.paddingXXSmall - Layout.rightMargin: constants.paddingXXSmall - height: 1 - color: Qt.rgba(0,0,0,0.5) - } - } - ColumnLayout { width: parent.width diff --git a/electrum/gui/qml/components/Pin.qml b/electrum/gui/qml/components/Pin.qml index c7209641b..db8e206fa 100644 --- a/electrum/gui/qml/components/Pin.qml +++ b/electrum/gui/qml/components/Pin.qml @@ -11,6 +11,7 @@ ElDialog { id: root title: qsTr('PIN') + iconSource: '../../../icons/lock.png' width: parent.width * 2/3 height: parent.height * 1/3 @@ -75,39 +76,6 @@ ElDialog { } } - header: GridLayout { - columns: 2 - rowSpacing: 0 - - Image { - source: "../../icons/lock.png" - Layout.preferredWidth: constants.iconSizeXLarge - Layout.preferredHeight: constants.iconSizeXLarge - Layout.leftMargin: constants.paddingMedium - Layout.topMargin: constants.paddingMedium - Layout.bottomMargin: constants.paddingMedium - } - - Label { - text: title - elide: Label.ElideRight - Layout.fillWidth: true - topPadding: constants.paddingXLarge - bottomPadding: constants.paddingXLarge - font.bold: true - font.pixelSize: constants.fontSizeMedium - } - - Rectangle { - Layout.columnSpan: 2 - Layout.fillWidth: true - Layout.leftMargin: constants.paddingXXSmall - Layout.rightMargin: constants.paddingXXSmall - height: 1 - color: Qt.rgba(0,0,0,0.5) - } - } - ColumnLayout { width: parent.width height: parent.height diff --git a/electrum/gui/qml/components/RequestDialog.qml b/electrum/gui/qml/components/RequestDialog.qml index 4f3e6f935..5007efd52 100644 --- a/electrum/gui/qml/components/RequestDialog.qml +++ b/electrum/gui/qml/components/RequestDialog.qml @@ -30,20 +30,6 @@ ElDialog { color: "#aa000000" } - header: RowLayout { - width: dialog.width - Label { - Layout.fillWidth: true - text: dialog.title - visible: dialog.title - elide: Label.ElideRight - padding: constants.paddingXLarge - bottomPadding: 0 - font.bold: true - font.pixelSize: constants.fontSizeMedium - } - } - Flickable { anchors.fill: parent contentHeight: rootLayout.height diff --git a/electrum/gui/qml/components/controls/ElDialog.qml b/electrum/gui/qml/components/controls/ElDialog.qml index 459b1fb9c..e1a28d6f2 100644 --- a/electrum/gui/qml/components/controls/ElDialog.qml +++ b/electrum/gui/qml/components/controls/ElDialog.qml @@ -6,6 +6,7 @@ Dialog { id: abstractdialog property bool allowClose: true + property string iconSource onOpenedChanged: { if (opened) { @@ -14,4 +15,42 @@ Dialog { app.activeDialogs.pop() } } + + header: ColumnLayout { + spacing: 0 + + RowLayout { + spacing: 0 + + Image { + visible: iconSource + source: iconSource + Layout.preferredWidth: constants.iconSizeXLarge + Layout.preferredHeight: constants.iconSizeXLarge + Layout.leftMargin: constants.paddingMedium + Layout.topMargin: constants.paddingMedium + Layout.bottomMargin: constants.paddingMedium + } + + Label { + text: title + elide: Label.ElideRight + Layout.fillWidth: true + leftPadding: constants.paddingXLarge + topPadding: constants.paddingXLarge + bottomPadding: constants.paddingXLarge + font.bold: true + font.pixelSize: constants.fontSizeMedium + } + } + + Rectangle { + Layout.fillWidth: true + Layout.leftMargin: constants.paddingXXSmall + Layout.rightMargin: constants.paddingXXSmall + height: 1 + color: Qt.rgba(0,0,0,0.5) + } + } + }