mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Merge pull request #2435
0e3f3c1
SettingsWallet: refactor list items into separate component (xiphon)
This commit is contained in:
commit
47bc0f2a3c
3 changed files with 142 additions and 291 deletions
65
components/SettingsListItem.qml
Normal file
65
components/SettingsListItem.qml
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
import QtQuick 2.9
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import "../components" as MoneroComponents
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
property alias buttonText: button.text
|
||||||
|
property alias description: description.text
|
||||||
|
property alias title: title.text
|
||||||
|
signal clicked()
|
||||||
|
|
||||||
|
id: settingsListItem
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
// divider
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.bottomMargin: 8
|
||||||
|
color: MoneroComponents.Style.dividerColor
|
||||||
|
opacity: MoneroComponents.Style.dividerOpacity
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
MoneroComponents.TextPlain {
|
||||||
|
id: title
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 20
|
||||||
|
Layout.topMargin: 8
|
||||||
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
|
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
||||||
|
font.bold: true
|
||||||
|
font.family: MoneroComponents.Style.fontRegular.name
|
||||||
|
font.pixelSize: 16
|
||||||
|
}
|
||||||
|
|
||||||
|
MoneroComponents.TextPlainArea {
|
||||||
|
id: description
|
||||||
|
color: MoneroComponents.Style.dimmedFontColor
|
||||||
|
colorBlackTheme: MoneroComponents.Style._b_dimmedFontColor
|
||||||
|
colorWhiteTheme: MoneroComponents.Style._w_dimmedFontColor
|
||||||
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: TextInput.AlignLeft
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MoneroComponents.StandardButton {
|
||||||
|
id: button
|
||||||
|
small: true
|
||||||
|
onClicked: {
|
||||||
|
settingsListItem.clicked()
|
||||||
|
}
|
||||||
|
width: 135
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,110 +47,27 @@ Rectangle {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: 20
|
anchors.margins: 20
|
||||||
anchors.topMargin: 0
|
anchors.topMargin: 0
|
||||||
spacing: 0
|
spacing: 8
|
||||||
|
|
||||||
Rectangle {
|
MoneroComponents.SettingsListItem {
|
||||||
// divider
|
buttonText: qsTr("Close wallet") + translationManager.emptyString
|
||||||
Layout.preferredHeight: 1
|
description: qsTr("Logs out of this wallet.") + translationManager.emptyString
|
||||||
Layout.fillWidth: true
|
title: qsTr("Close this wallet") + translationManager.emptyString
|
||||||
Layout.bottomMargin: 8
|
|
||||||
color: MoneroComponents.Style.dividerColor
|
|
||||||
opacity: MoneroComponents.Style.dividerOpacity
|
|
||||||
}
|
|
||||||
|
|
||||||
GridLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: childrenRect.height
|
|
||||||
columnSpacing: 0
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 20
|
|
||||||
Layout.topMargin: 8
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
|
||||||
font.bold: true
|
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
|
||||||
font.pixelSize: 16
|
|
||||||
text: qsTr("Close this wallet") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.TextPlainArea {
|
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
|
||||||
colorBlackTheme: MoneroComponents.Style._b_dimmedFontColor
|
|
||||||
colorWhiteTheme: MoneroComponents.Style._w_dimmedFontColor
|
|
||||||
width: parent.width
|
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: TextInput.AlignLeft
|
|
||||||
text: qsTr("Logs out of this wallet.") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
|
||||||
small: true
|
|
||||||
text: qsTr("Close wallet") + translationManager.emptyString
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
middlePanel.addressBookView.clearFields();
|
middlePanel.addressBookView.clearFields();
|
||||||
middlePanel.transferView.clearFields();
|
middlePanel.transferView.clearFields();
|
||||||
middlePanel.receiveView.clearFields();
|
middlePanel.receiveView.clearFields();
|
||||||
appWindow.showWizard();
|
appWindow.showWizard();
|
||||||
}
|
}
|
||||||
width: 135
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
MoneroComponents.SettingsListItem {
|
||||||
// divider
|
buttonText: qsTr("Create wallet") + translationManager.emptyString
|
||||||
Layout.preferredHeight: 1
|
description: qsTr("Creates a new wallet that can only view and initiate transactions, but requires a spendable wallet to sign transactions before sending.") + translationManager.emptyString
|
||||||
Layout.fillWidth: true
|
title: qsTr("Create a view-only wallet") + translationManager.emptyString
|
||||||
Layout.topMargin: 8
|
|
||||||
Layout.bottomMargin: 8
|
|
||||||
color: MoneroComponents.Style.dividerColor
|
|
||||||
opacity: MoneroComponents.Style.dividerOpacity
|
|
||||||
}
|
|
||||||
|
|
||||||
GridLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: childrenRect.height
|
|
||||||
columnSpacing: 0
|
|
||||||
visible: !appWindow.viewOnly
|
visible: !appWindow.viewOnly
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 20
|
|
||||||
Layout.topMargin: 8
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
|
||||||
font.bold: true
|
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
|
||||||
font.pixelSize: 16
|
|
||||||
text: qsTr("Create a view-only wallet") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.TextPlainArea {
|
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
|
||||||
colorBlackTheme: MoneroComponents.Style._b_dimmedFontColor
|
|
||||||
colorWhiteTheme: MoneroComponents.Style._w_dimmedFontColor
|
|
||||||
width: parent.width
|
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: TextInput.AlignLeft
|
|
||||||
text: qsTr("Creates a new wallet that can only view and initiate transactions, but requires a spendable wallet to sign transactions before sending.") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
|
||||||
small: true
|
|
||||||
text: qsTr("Create wallet") + translationManager.emptyString
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var newPath = currentWallet.path + "_viewonly";
|
var newPath = currentWallet.path + "_viewonly";
|
||||||
if (currentWallet.createViewOnly(newPath, appWindow.walletPassword)) {
|
if (currentWallet.createViewOnly(newPath, appWindow.walletPassword)) {
|
||||||
|
@ -165,111 +82,24 @@ Rectangle {
|
||||||
informationPopup.open()
|
informationPopup.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
width: 135
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
MoneroComponents.SettingsListItem {
|
||||||
// divider
|
buttonText: qsTr("Show seed") + translationManager.emptyString
|
||||||
visible: !appWindow.viewOnly
|
description: qsTr("Store this information safely to recover your wallet in the future.") + translationManager.emptyString
|
||||||
Layout.preferredHeight: 1
|
title: qsTr("Show seed & keys") + translationManager.emptyString
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 8
|
|
||||||
Layout.bottomMargin: 8
|
|
||||||
color: MoneroComponents.Style.dividerColor
|
|
||||||
opacity: MoneroComponents.Style.dividerOpacity
|
|
||||||
}
|
|
||||||
|
|
||||||
GridLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: childrenRect.height
|
|
||||||
columnSpacing: 0
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 20
|
|
||||||
Layout.topMargin: 8
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
|
||||||
font.bold: true
|
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
|
||||||
font.pixelSize: 16
|
|
||||||
text: qsTr("Show seed & keys") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.TextPlainArea {
|
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
|
||||||
colorBlackTheme: MoneroComponents.Style._b_dimmedFontColor
|
|
||||||
colorWhiteTheme: MoneroComponents.Style._w_dimmedFontColor
|
|
||||||
width: parent.width
|
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: TextInput.AlignLeft
|
|
||||||
text: qsTr("Store this information safely to recover your wallet in the future.") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
|
||||||
small: true
|
|
||||||
text: qsTr("Show seed") + translationManager.emptyString
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Utils.showSeedPage();
|
Utils.showSeedPage();
|
||||||
}
|
}
|
||||||
width: 135
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
MoneroComponents.SettingsListItem {
|
||||||
// divider
|
buttonText: qsTr("Rescan") + translationManager.emptyString
|
||||||
Layout.preferredHeight: 1
|
description: qsTr("Use this feature if you think the shown balance is not accurate.") + translationManager.emptyString
|
||||||
Layout.fillWidth: true
|
title: qsTr("Rescan wallet balance") + translationManager.emptyString
|
||||||
Layout.topMargin: 8
|
|
||||||
Layout.bottomMargin: 8
|
|
||||||
color: MoneroComponents.Style.dividerColor
|
|
||||||
opacity: MoneroComponents.Style.dividerOpacity
|
|
||||||
}
|
|
||||||
|
|
||||||
GridLayout {
|
|
||||||
visible: appWindow.walletMode >= 2
|
visible: appWindow.walletMode >= 2
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: childrenRect.height
|
|
||||||
columnSpacing: 0
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 20
|
|
||||||
Layout.topMargin: 8
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
|
||||||
font.bold: true
|
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
|
||||||
font.pixelSize: 16
|
|
||||||
text: qsTr("Rescan wallet balance") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.TextPlainArea {
|
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
|
||||||
colorBlackTheme: MoneroComponents.Style._b_dimmedFontColor
|
|
||||||
colorWhiteTheme: MoneroComponents.Style._w_dimmedFontColor
|
|
||||||
width: parent.width
|
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: TextInput.AlignLeft
|
|
||||||
text: qsTr("Use this feature if you think the shown balance is not accurate.") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
|
||||||
small: true
|
|
||||||
text: qsTr("Rescan") + translationManager.emptyString
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (!currentWallet.rescanSpent()) {
|
if (!currentWallet.rescanSpent()) {
|
||||||
console.error("Error: ", currentWallet.errorString);
|
console.error("Error: ", currentWallet.errorString);
|
||||||
|
@ -286,56 +116,13 @@ Rectangle {
|
||||||
informationPopup.open();
|
informationPopup.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
width: 135
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
// divider
|
|
||||||
visible: appWindow.walletMode >= 2
|
|
||||||
Layout.preferredHeight: 1
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 8
|
|
||||||
Layout.bottomMargin: 8
|
|
||||||
color: MoneroComponents.Style.dividerColor
|
|
||||||
opacity: MoneroComponents.Style.dividerOpacity
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
MoneroComponents.SettingsListItem {
|
||||||
Layout.fillWidth: true
|
buttonText: qsTr("Change password") + translationManager.emptyString
|
||||||
Layout.preferredHeight: childrenRect.height
|
description: qsTr("Change the password of your wallet.") + translationManager.emptyString
|
||||||
columnSpacing: 0
|
title: qsTr("Change wallet password") + translationManager.emptyString
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 20
|
|
||||||
Layout.topMargin: 8
|
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
|
||||||
opacity: MoneroComponents.Style.blackTheme ? 1.0 : 0.8
|
|
||||||
font.bold: true
|
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
|
||||||
font.pixelSize: 16
|
|
||||||
text: qsTr("Change wallet password") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.TextPlainArea {
|
|
||||||
color: MoneroComponents.Style.dimmedFontColor
|
|
||||||
colorBlackTheme: MoneroComponents.Style._b_dimmedFontColor
|
|
||||||
colorWhiteTheme: MoneroComponents.Style._w_dimmedFontColor
|
|
||||||
width: parent.width
|
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: TextInput.AlignLeft
|
|
||||||
text: qsTr("Change the password of your wallet.") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MoneroComponents.StandardButton {
|
|
||||||
small: true
|
|
||||||
text: qsTr("Change password") + translationManager.emptyString
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
passwordDialog.onAcceptedCallback = function() {
|
passwordDialog.onAcceptedCallback = function() {
|
||||||
if(appWindow.walletPassword === passwordDialog.password){
|
if(appWindow.walletPassword === passwordDialog.password){
|
||||||
|
@ -352,8 +139,6 @@ Rectangle {
|
||||||
passwordDialog.onRejectedCallback = null;
|
passwordDialog.onRejectedCallback = null;
|
||||||
passwordDialog.open()
|
passwordDialog.open()
|
||||||
}
|
}
|
||||||
width: 135
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
qml.qrc
1
qml.qrc
|
@ -12,6 +12,7 @@
|
||||||
<file>images/plus-white.png</file>
|
<file>images/plus-white.png</file>
|
||||||
<file>images/plus-white@2x.png</file>
|
<file>images/plus-white@2x.png</file>
|
||||||
<file>components/Label.qml</file>
|
<file>components/Label.qml</file>
|
||||||
|
<file>components/SettingsListItem.qml</file>
|
||||||
<file>images/whatIsIcon.png</file>
|
<file>images/whatIsIcon.png</file>
|
||||||
<file>images/whatIsIcon@2x.png</file>
|
<file>images/whatIsIcon@2x.png</file>
|
||||||
<file>images/lockIcon.png</file>
|
<file>images/lockIcon.png</file>
|
||||||
|
|
Loading…
Reference in a new issue