Use MoneroComponents for keys page and make warningbox selectable

This commit is contained in:
skftn 2018-12-30 00:24:39 +01:00 committed by dsc
parent 9689fff957
commit 4b78ef71dc
No known key found for this signature in database
GPG key ID: 7BBC83D7A8810AAB
2 changed files with 29 additions and 105 deletions

View file

@ -44,13 +44,14 @@ Rectangle {
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: root.fontSize font.pixelSize: root.fontSize
horizontalAlignment: TextInput.AlignLeft horizontalAlignment: TextInput.AlignLeft
selectByMouse: false selectionColor: MoneroComponents.Style.dimmedFontColor
selectByMouse: true
textFormat: Text.RichText textFormat: Text.RichText
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
textMargin: 0 textMargin: 0
leftPadding: 0 leftPadding: 0
topPadding: 6 topPadding: 6
readOnly: true readOnly: false
onLinkActivated: root.linkActivated(); onLinkActivated: root.linkActivated();
// @TODO: Legacy. Remove after Qt 5.8. // @TODO: Legacy. Remove after Qt 5.8.

View file

@ -33,19 +33,18 @@ import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import moneroComponents.Clipboard 1.0 import moneroComponents.Clipboard 1.0
import "../version.js" as Version import "../version.js" as Version
import "../components" import "../components" as MoneroComponents
import "." 1.0 import "." 1.0
Rectangle { Rectangle {
property bool viewOnly: false
id: page id: page
property bool viewOnly: false
property int keysHeight: mainLayout.height + 100 * scaleRatio // Ensure sufficient height for QR code, even in minimum width window case. property int keysHeight: mainLayout.height + 100 * scaleRatio // Ensure sufficient height for QR code, even in minimum width window case.
color: "transparent" color: "transparent"
Clipboard { id: clipboard } Clipboard { id: clipboard }
ColumnLayout { ColumnLayout {
id: mainLayout id: mainLayout
@ -59,57 +58,15 @@ Rectangle {
spacing: 30 * scaleRatio spacing: 30 * scaleRatio
Layout.fillWidth: true Layout.fillWidth: true
RowLayout{ MoneroComponents.WarningBox {
// TODO: Move the warning box to its own component, so it can be used in multiple places text: qsTr("WARNING: Do not reuse your Monero keys on another fork, UNLESS this fork has key reuse mitigations built in. Doing so will harm your privacy.") + translationManager.emptyString;
visible: warningText.text !== ""
Rectangle {
id: statusRect
Layout.preferredHeight: warningText.height + 26
Layout.fillWidth: true
radius: 2
border.color: Qt.rgba(255, 255, 255, 0.25)
border.width: 1
color: "transparent"
GridLayout{
Layout.fillWidth: true
Layout.preferredHeight: warningText.height + 40
Image {
Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: 33
Layout.preferredWidth: 33
Layout.leftMargin: 10
Layout.topMargin: 10
source: "../images/warning.png"
}
Text {
id: warningText
Layout.topMargin: 12 * scaleRatio
Layout.preferredWidth: statusRect.width - 80
Layout.leftMargin: 6
text: qsTr("WARNING: Do not reuse your Monero keys on another fork, UNLESS this fork has key reuse mitigations built in. Doing so will harm your privacy.") + translationManager.emptyString
wrapMode: Text.Wrap
font.family: Style.fontRegular.name
font.pixelSize: 15 * scaleRatio
color: Style.defaultFontColor
textFormat: Text.RichText
onLinkActivated: {
appWindow.startDaemon(appWindow.persistentSettings.daemonFlags);
}
}
}
}
} }
//! Manage wallet //! Manage wallet
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Label { MoneroComponents.Label {
Layout.fillWidth: true Layout.fillWidth: true
fontSize: 22 * scaleRatio fontSize: 22 * scaleRatio
Layout.topMargin: 10 * scaleRatio Layout.topMargin: 10 * scaleRatio
@ -119,50 +76,16 @@ Rectangle {
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
height: 2 * scaleRatio height: 2 * scaleRatio
color: Style.dividerColor color: MoneroComponents.Style.dividerColor
opacity: Style.dividerOpacity opacity: MoneroComponents.Style.dividerOpacity
Layout.bottomMargin: 10 * scaleRatio Layout.bottomMargin: 10 * scaleRatio
} }
Rectangle { MoneroComponents.WarningBox {
id: warningTextRec text: qsTr("WARNING: Copying your seed to clipboard can expose you to malicious software, which may record your seed and steal your Monero. Please write down your seed manually.") + translationManager.emptyString
Layout.preferredHeight: warningTextSeed.height + 26 * scaleRatio
Layout.fillWidth: true
radius: 2 * scaleRatio
border.color: Qt.rgba(255, 255, 255, 0.25)
border.width: 1 * scaleRatio
color: "transparent"
GridLayout{
Layout.fillWidth: true
Layout.preferredHeight: warningTextSeed.height + 40 * scaleRatio
Image {
Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: 33 * scaleRatio
Layout.preferredWidth: 33 * scaleRatio
Layout.leftMargin: 10 * scaleRatio
Layout.topMargin: 10 * scaleRatio
source: "../images/warning.png"
}
Text {
id: warningTextSeed
Layout.topMargin: 12 * scaleRatio
Layout.preferredWidth: statusRect.width - 80 * scaleRatio
Layout.leftMargin: 6 * scaleRatio
text: qsTr("WARNING: Copying your seed to clipboard can expose you to malicious software, which may record your seed and steal your Monero. Please write down your seed manually.") + translationManager.emptyString
wrapMode: Text.Wrap
font.family: Style.fontRegular.name
font.pixelSize: 15 * scaleRatio
color: Style.defaultFontColor
textFormat: Text.RichText
}
}
} }
LineEditMulti{ MoneroComponents.LineEditMulti {
id: seedText id: seedText
spacing: 0 spacing: 0
copyButton: true copyButton: true
@ -176,7 +99,7 @@ Rectangle {
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Label { MoneroComponents.Label {
Layout.fillWidth: true Layout.fillWidth: true
fontSize: 22 * scaleRatio fontSize: 22 * scaleRatio
Layout.topMargin: 10 * scaleRatio Layout.topMargin: 10 * scaleRatio
@ -185,11 +108,11 @@ Rectangle {
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
height: 2 height: 2
color: Style.dividerColor color: MoneroComponents.Style.dividerColor
opacity: Style.dividerOpacity opacity: MoneroComponents.Style.dividerOpacity
Layout.bottomMargin: 10 * scaleRatio Layout.bottomMargin: 10 * scaleRatio
} }
LineEdit { MoneroComponents.LineEdit {
Layout.fillWidth: true Layout.fillWidth: true
id: secretViewKey id: secretViewKey
readOnly: true readOnly: true
@ -197,7 +120,7 @@ Rectangle {
labelText: qsTr("Secret view key") + translationManager.emptyString labelText: qsTr("Secret view key") + translationManager.emptyString
fontSize: 16 * scaleRatio fontSize: 16 * scaleRatio
} }
LineEdit { MoneroComponents.LineEdit {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 25 * scaleRatio Layout.topMargin: 25 * scaleRatio
id: publicViewKey id: publicViewKey
@ -206,7 +129,7 @@ Rectangle {
labelText: qsTr("Public view key") + translationManager.emptyString labelText: qsTr("Public view key") + translationManager.emptyString
fontSize: 16 * scaleRatio fontSize: 16 * scaleRatio
} }
LineEdit { MoneroComponents.LineEdit {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 25 * scaleRatio Layout.topMargin: 25 * scaleRatio
id: secretSpendKey id: secretSpendKey
@ -215,7 +138,7 @@ Rectangle {
labelText: qsTr("Secret spend key") + translationManager.emptyString labelText: qsTr("Secret spend key") + translationManager.emptyString
fontSize: 16 * scaleRatio fontSize: 16 * scaleRatio
} }
LineEdit { MoneroComponents.LineEdit {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 25 * scaleRatio Layout.topMargin: 25 * scaleRatio
id: publicSpendKey id: publicSpendKey
@ -229,7 +152,7 @@ Rectangle {
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Label { MoneroComponents.Label {
Layout.fillWidth: true Layout.fillWidth: true
fontSize: 22 * scaleRatio fontSize: 22 * scaleRatio
Layout.topMargin: 10 * scaleRatio Layout.topMargin: 10 * scaleRatio
@ -238,13 +161,13 @@ Rectangle {
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
height: 2 height: 2
color: Style.dividerColor color: MoneroComponents.Style.dividerColor
opacity: Style.dividerOpacity opacity: MoneroComponents.Style.dividerOpacity
Layout.bottomMargin: 10 * scaleRatio Layout.bottomMargin: 10 * scaleRatio
} }
ColumnLayout { ColumnLayout {
RadioButton { MoneroComponents.RadioButton {
id: showFullQr id: showFullQr
enabled: !this.checked enabled: !this.checked
checked: fullWalletQRCode.visible checked: fullWalletQRCode.visible
@ -254,7 +177,7 @@ Rectangle {
showViewOnlyQr.checked = false showViewOnlyQr.checked = false
} }
} }
RadioButton { MoneroComponents.RadioButton {
enabled: !this.checked enabled: !this.checked
id: showViewOnlyQr id: showViewOnlyQr
checked: viewOnlyQRCode.visible checked: viewOnlyQRCode.visible
@ -289,7 +212,7 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
font.bold: true font.bold: true
font.pixelSize: 16 * scaleRatio font.pixelSize: 16 * scaleRatio
color: Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
text: (viewOnlyQRCode.visible) ? qsTr("View Only Wallet") + translationManager.emptyString : qsTr("Spendable Wallet") + translationManager.emptyString text: (viewOnlyQRCode.visible) ? qsTr("View Only Wallet") + translationManager.emptyString : qsTr("Spendable Wallet") + translationManager.emptyString
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }