From b8466739f95348165a6ca012cc60bc252624a107 Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Sat, 21 Apr 2018 13:17:53 +0200 Subject: [PATCH 1/4] Reformat Settings->Debug Info --- components/TextBlock.qml | 1 + pages/Settings.qml | 194 +++++++++++++++++++++++---------------- 2 files changed, 118 insertions(+), 77 deletions(-) diff --git a/components/TextBlock.qml b/components/TextBlock.qml index e06c6ae9..aec20892 100644 --- a/components/TextBlock.qml +++ b/components/TextBlock.qml @@ -5,6 +5,7 @@ import "../components" as MoneroComponents TextEdit { color: MoneroComponents.Style.defaultFontColor font.family: MoneroComponents.Style.fontRegular.name + selectionColor: MoneroComponents.Style.dimmedFontColor wrapMode: Text.Wrap readOnly: true selectByMouse: true diff --git a/pages/Settings.qml b/pages/Settings.qml index 0b27c898..da2d6025 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -623,101 +623,141 @@ Rectangle { } } - TextBlock { - Layout.topMargin: 8 - font.pixelSize: 14 - Layout.fillWidth: true - text: qsTr("GUI version: ") + Version.GUI_VERSION + " (Qt " + qtRuntimeVersion + ")" + translationManager.emptyString - } - TextBlock { - id: guiMoneroVersion - Layout.fillWidth: true - font.pixelSize: 14 - text: qsTr("Embedded Monero version: ") + Version.GUI_MONERO_VERSION + translationManager.emptyString - } - TextBlock { - id: restoreHeightText - Layout.fillWidth: true - font.pixelSize: 14 - textFormat: Text.RichText - property var txt: "" + qsTr("Wallet creation height: ") + (currentWallet ? currentWallet.walletCreationHeight : "") + translationManager.emptyString - property var linkTxt: qsTr(" (Click to change)") + translationManager.emptyString - text: (typeof currentWallet == "undefined") ? "" : txt + linkTxt + GridLayout { + id: grid + columns: 2 + columnSpacing: 20 * scaleRatio - onLinkActivated: { - restoreHeightRow.visible = true; + TextBlock { + font.pixelSize: 14 + text: qsTr("GUI version: ") + translationManager.emptyString } - } + TextBlock { + font.pixelSize: 14 + font.bold: true + text: Version.GUI_VERSION + " (Qt " + qtRuntimeVersion + ")" + translationManager.emptyString + } - RowLayout { - id: restoreHeightRow - visible: false - LineEdit { - id: restoreHeight - Layout.preferredWidth: 80 + TextBlock { + id: guiMoneroVersion + font.pixelSize: 14 + text: qsTr("Embedded Monero version: ") + translationManager.emptyString + } + + TextBlock { + font.pixelSize: 14 + font.bold: true + text: Version.GUI_MONERO_VERSION + translationManager.emptyString + } + + TextBlock { Layout.fillWidth: true - text: currentWallet ? currentWallet.walletCreationHeight : "0" - validator: IntValidator { - bottom:0 + font.pixelSize: 14 + text: qsTr("Wallet name: ") + translationManager.emptyString + } + + TextBlock { + Layout.fillWidth: true + font.pixelSize: 14 + font.bold: true + text: walletName + translationManager.emptyString + } + + TextBlock { + id: restoreHeight + font.pixelSize: 14 + textFormat: Text.RichText + text: (typeof currentWallet == "undefined") ? "" : qsTr("Wallet creation height: ") + translationManager.emptyString + } + + TextBlock { + id: restoreHeightText + textFormat: Text.RichText + font.pixelSize: 14 + font.bold: true + property var style: "" + text: (currentWallet ? currentWallet.walletCreationHeight : "") + style + qsTr(" (Click to change)") + translationManager.emptyString + onLinkActivated: { + restoreHeightRow.visible = true; } } - StandardButton { - id: restoreHeightSave - small: true - Layout.fillWidth: false - Layout.leftMargin: 30 - text: qsTr("Save") + translationManager.emptyString + RowLayout { + id: restoreHeightRow + visible: false + Layout.preferredWidth: parent.width - onClicked: { - currentWallet.walletCreationHeight = restoreHeight.text - // Restore height is saved in .keys file. Set password to trigger rewrite. - currentWallet.setPassword(appWindow.walletPassword) - restoreHeightRow.visible = false - - // Show confirmation dialog - confirmationDialog.title = qsTr("Rescan wallet cache") + translationManager.emptyString; - confirmationDialog.text = qsTr("Are you sure you want to rebuild the wallet cache?\n" - + "The following information will be deleted\n" - + "- Recipient addresses\n" - + "- Tx keys\n" - + "- Tx descriptions\n\n" - + "The old wallet cache file will be renamed and can be restored later.\n" - ); - confirmationDialog.icon = StandardIcon.Question - confirmationDialog.cancelText = qsTr("Cancel") - confirmationDialog.onAcceptedCallback = function() { - walletManager.closeWallet(); - walletManager.clearWalletCache(persistentSettings.wallet_path); - walletManager.openWalletAsync(persistentSettings.wallet_path, appWindow.walletPassword, - persistentSettings.nettype); + LineEdit { + id: restoreHeightEdit + Layout.preferredWidth: 80 + Layout.fillWidth: true + text: currentWallet ? currentWallet.walletCreationHeight : "0" + validator: IntValidator { + bottom:0 } + } - confirmationDialog.onRejectedCallback = null; + StandardButton { + id: restoreHeightSave + small: true + Layout.fillWidth: false + Layout.leftMargin: 30 + text: qsTr("Save") + translationManager.emptyString - confirmationDialog.open() + onClicked: { + currentWallet.walletCreationHeight = restoreHeightEdit.text + // Restore height is saved in .keys file. Set password to trigger rewrite. + currentWallet.setPassword(appWindow.walletPassword) + restoreHeightRow.visible = false + // Show confirmation dialog + confirmationDialog.title = qsTr("Rescan wallet cache") + translationManager.emptyString; + confirmationDialog.text = qsTr("Are you sure you want to rebuild the wallet cache?\n" + + "The following information will be deleted\n" + + "- Recipient addresses\n" + + "- Tx keys\n" + + "- Tx descriptions\n\n" + + "The old wallet cache file will be renamed and can be restored later.\n" + ); + confirmationDialog.icon = StandardIcon.Question + confirmationDialog.cancelText = qsTr("Cancel") + confirmationDialog.onAcceptedCallback = function() { + walletManager.closeWallet(); + walletManager.clearWalletCache(persistentSettings.wallet_path); + walletManager.openWalletAsync(persistentSettings.wallet_path, appWindow.walletPassword, + persistentSettings.nettype); + } + + confirmationDialog.onRejectedCallback = null; + confirmationDialog.open() + } } } - } + TextBlock { + Layout.fillWidth: true + font.pixelSize: 14 + text: (!currentWallet) ? "" : qsTr("Wallet log path: ") + translationManager.emptyString + } + TextBlock { + Layout.fillWidth: true + font.pixelSize: 14 + text: currentWallet.walletLogPath + translationManager.emptyString + } - TextBlock { - Layout.fillWidth: true - font.pixelSize: 14 - text: (!currentWallet) ? "" : qsTr("Wallet log path: ") + currentWallet.walletLogPath + translationManager.emptyString - } - TextBlock { - Layout.fillWidth: true - font.pixelSize: 14 - text: qsTr("Wallet Name: ") + walletName + translationManager.emptyString - } - TextBlock { - Layout.fillWidth: true - font.pixelSize: 14 - text: (!currentWallet) ? "" : qsTr("Daemon log path: ") + currentWallet.daemonLogPath + translationManager.emptyString + TextBlock { + Layout.fillWidth: true + font.pixelSize: 14 + text: (!currentWallet) ? "" : qsTr("Daemon log path: ") + translationManager.emptyString + } + + TextBlock { + Layout.fillWidth: true + font.pixelSize: 14 + text: (!currentWallet) ? "" : currentWallet.daemonLogPath + translationManager.emptyString + } } } From 170ddf1f6f4fa8a2a260c554dd44a2f7b67bba9e Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Sat, 21 Apr 2018 22:43:22 +0200 Subject: [PATCH 2/4] Removes 'Daemon log path:' from the debug info --- pages/Settings.qml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pages/Settings.qml b/pages/Settings.qml index da2d6025..77c9f09f 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -746,18 +746,6 @@ Rectangle { font.pixelSize: 14 text: currentWallet.walletLogPath + translationManager.emptyString } - - TextBlock { - Layout.fillWidth: true - font.pixelSize: 14 - text: (!currentWallet) ? "" : qsTr("Daemon log path: ") + translationManager.emptyString - } - - TextBlock { - Layout.fillWidth: true - font.pixelSize: 14 - text: (!currentWallet) ? "" : currentWallet.daemonLogPath + translationManager.emptyString - } } } From 199aedf60a58fed424c3706f45bbac200bf33bc8 Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Sat, 28 Apr 2018 15:17:36 +0200 Subject: [PATCH 3/4] Dialog(s) for changing restore height --- js/Utils.js | 4 +++ pages/Settings.qml | 82 +++++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 48 deletions(-) diff --git a/js/Utils.js b/js/Utils.js index 7cf582b2..fdf24c6b 100644 --- a/js/Utils.js +++ b/js/Utils.js @@ -23,3 +23,7 @@ function formatDate( date, params ) { // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString return new Date( date ).toLocaleString( 'en-US', options ); } + +function isNumeric(n) { + return !isNaN(parseFloat(n)) && isFinite(n); +} \ No newline at end of file diff --git a/pages/Settings.qml b/pages/Settings.qml index 77c9f09f..a9389ee4 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -679,59 +679,45 @@ Rectangle { property var style: "" text: (currentWallet ? currentWallet.walletCreationHeight : "") + style + qsTr(" (Click to change)") + translationManager.emptyString onLinkActivated: { - restoreHeightRow.visible = true; - } - } + inputDialog.labelText = qsTr("Set a new restore height:") + translationManager.emptyString; + inputDialog.inputText = currentWallet ? currentWallet.walletCreationHeight : "0"; + inputDialog.onAcceptedCallback = function() { + var _restoreHeight = inputDialog.inputText; + if(Utils.isNumeric(_restoreHeight)){ + _restoreHeight = parseInt(_restoreHeight); + if(_restoreHeight >= 0) { + currentWallet.walletCreationHeight = restoreHeightEdit.text + // Restore height is saved in .keys file. Set password to trigger rewrite. + currentWallet.setPassword(appWindow.walletPassword) - RowLayout { - id: restoreHeightRow - visible: false - Layout.preferredWidth: parent.width + // Show confirmation dialog + confirmationDialog.title = qsTr("Rescan wallet cache") + translationManager.emptyString; + confirmationDialog.text = qsTr("Are you sure you want to rebuild the wallet cache?\n" + + "The following information will be deleted\n" + + "- Recipient addresses\n" + + "- Tx keys\n" + + "- Tx descriptions\n\n" + + "The old wallet cache file will be renamed and can be restored later.\n" + ); + confirmationDialog.icon = StandardIcon.Question + confirmationDialog.cancelText = qsTr("Cancel") + confirmationDialog.onAcceptedCallback = function() { + walletManager.closeWallet(); + walletManager.clearWalletCache(persistentSettings.wallet_path); + walletManager.openWalletAsync(persistentSettings.wallet_path, appWindow.walletPassword, + persistentSettings.nettype); + } - LineEdit { - id: restoreHeightEdit - Layout.preferredWidth: 80 - Layout.fillWidth: true - text: currentWallet ? currentWallet.walletCreationHeight : "0" - validator: IntValidator { - bottom:0 - } - } - - StandardButton { - id: restoreHeightSave - small: true - Layout.fillWidth: false - Layout.leftMargin: 30 - text: qsTr("Save") + translationManager.emptyString - - onClicked: { - currentWallet.walletCreationHeight = restoreHeightEdit.text - // Restore height is saved in .keys file. Set password to trigger rewrite. - currentWallet.setPassword(appWindow.walletPassword) - restoreHeightRow.visible = false - - // Show confirmation dialog - confirmationDialog.title = qsTr("Rescan wallet cache") + translationManager.emptyString; - confirmationDialog.text = qsTr("Are you sure you want to rebuild the wallet cache?\n" - + "The following information will be deleted\n" - + "- Recipient addresses\n" - + "- Tx keys\n" - + "- Tx descriptions\n\n" - + "The old wallet cache file will be renamed and can be restored later.\n" - ); - confirmationDialog.icon = StandardIcon.Question - confirmationDialog.cancelText = qsTr("Cancel") - confirmationDialog.onAcceptedCallback = function() { - walletManager.closeWallet(); - walletManager.clearWalletCache(persistentSettings.wallet_path); - walletManager.openWalletAsync(persistentSettings.wallet_path, appWindow.walletPassword, - persistentSettings.nettype); + confirmationDialog.onRejectedCallback = null; + confirmationDialog.open() + return; + } } - confirmationDialog.onRejectedCallback = null; - confirmationDialog.open() + appWindow.showStatusMessage(qsTr("Invalid restore height specified. Must be a number."),3); } + inputDialog.onRejectedCallback = null; + inputDialog.open() } } From ec640dcd1b29d7460973e96d9e59674614072fd2 Mon Sep 17 00:00:00 2001 From: Sander Ferdinand Date: Sat, 28 Apr 2018 18:14:13 +0200 Subject: [PATCH 4/4] Cursor pointer on link hover --- pages/Settings.qml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/Settings.qml b/pages/Settings.qml index a9389ee4..fac31037 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -719,6 +719,12 @@ Rectangle { inputDialog.onRejectedCallback = null; inputDialog.open() } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + } } TextBlock {