Merge pull request #1337

l33t

b846673 Reformat Settings->Debug Info
170ddf1 Removes 'Daemon log path:' from the debug info
199aedf Dialog(s) for changing restore height
ec640dc Cursor pointer on link hover
This commit is contained in:
luigi1111
2018-04-30 23:09:31 -05:00
3 changed files with 105 additions and 80 deletions

View File

@@ -5,6 +5,7 @@ import "../components" as MoneroComponents
TextEdit { TextEdit {
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
selectionColor: MoneroComponents.Style.dimmedFontColor
wrapMode: Text.Wrap wrapMode: Text.Wrap
readOnly: true readOnly: true
selectByMouse: true selectByMouse: true

View File

@@ -23,3 +23,7 @@ function formatDate( date, params ) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
return new Date( date ).toLocaleString( 'en-US', options ); return new Date( date ).toLocaleString( 'en-US', options );
} }
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}

View File

@@ -623,101 +623,121 @@ Rectangle {
} }
} }
TextBlock { GridLayout {
Layout.topMargin: 8 id: grid
font.pixelSize: 14 columns: 2
Layout.fillWidth: true columnSpacing: 20 * scaleRatio
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: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C}</style>" + qsTr("Wallet creation height: ") + (currentWallet ? currentWallet.walletCreationHeight : "") + translationManager.emptyString
property var linkTxt: qsTr(" <a href='#'>(Click to change)</a>") + translationManager.emptyString
text: (typeof currentWallet == "undefined") ? "" : txt + linkTxt
onLinkActivated: { TextBlock {
restoreHeightRow.visible = true; 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 { TextBlock {
id: restoreHeightRow id: guiMoneroVersion
visible: false font.pixelSize: 14
LineEdit { text: qsTr("Embedded Monero version: ") + translationManager.emptyString
id: restoreHeight }
Layout.preferredWidth: 80
TextBlock {
font.pixelSize: 14
font.bold: true
text: Version.GUI_MONERO_VERSION + translationManager.emptyString
}
TextBlock {
Layout.fillWidth: true Layout.fillWidth: true
text: currentWallet ? currentWallet.walletCreationHeight : "0" font.pixelSize: 14
validator: IntValidator { text: qsTr("Wallet name: ") + translationManager.emptyString
bottom:0
}
} }
StandardButton { TextBlock {
id: restoreHeightSave Layout.fillWidth: true
small: true font.pixelSize: 14
Layout.fillWidth: false font.bold: true
Layout.leftMargin: 30 text: walletName + translationManager.emptyString
text: qsTr("Save") + translationManager.emptyString }
onClicked: { TextBlock {
currentWallet.walletCreationHeight = restoreHeight.text id: restoreHeight
// Restore height is saved in .keys file. Set password to trigger rewrite. font.pixelSize: 14
currentWallet.setPassword(appWindow.walletPassword) textFormat: Text.RichText
restoreHeightRow.visible = false text: (typeof currentWallet == "undefined") ? "" : qsTr("Wallet creation height: ") + translationManager.emptyString
}
// Show confirmation dialog TextBlock {
confirmationDialog.title = qsTr("Rescan wallet cache") + translationManager.emptyString; id: restoreHeightText
confirmationDialog.text = qsTr("Are you sure you want to rebuild the wallet cache?\n" textFormat: Text.RichText
+ "The following information will be deleted\n" font.pixelSize: 14
+ "- Recipient addresses\n" font.bold: true
+ "- Tx keys\n" property var style: "<style type='text/css'>a {cursor:pointer;text-decoration: none; color: #FF6C3C}</style>"
+ "- Tx descriptions\n\n" text: (currentWallet ? currentWallet.walletCreationHeight : "") + style + qsTr(" <a href='#'> (Click to change)</a>") + translationManager.emptyString
+ "The old wallet cache file will be renamed and can be restored later.\n" onLinkActivated: {
); inputDialog.labelText = qsTr("Set a new restore height:") + translationManager.emptyString;
confirmationDialog.icon = StandardIcon.Question inputDialog.inputText = currentWallet ? currentWallet.walletCreationHeight : "0";
confirmationDialog.cancelText = qsTr("Cancel") inputDialog.onAcceptedCallback = function() {
confirmationDialog.onAcceptedCallback = function() { var _restoreHeight = inputDialog.inputText;
walletManager.closeWallet(); if(Utils.isNumeric(_restoreHeight)){
walletManager.clearWalletCache(persistentSettings.wallet_path); _restoreHeight = parseInt(_restoreHeight);
walletManager.openWalletAsync(persistentSettings.wallet_path, appWindow.walletPassword, if(_restoreHeight >= 0) {
persistentSettings.nettype); currentWallet.walletCreationHeight = restoreHeightEdit.text
// Restore height is saved in .keys file. Set password to trigger rewrite.
currentWallet.setPassword(appWindow.walletPassword)
// 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;
}
}
appWindow.showStatusMessage(qsTr("Invalid restore height specified. Must be a number."),3);
} }
inputDialog.onRejectedCallback = null;
inputDialog.open()
}
confirmationDialog.onRejectedCallback = null; MouseArea {
anchors.fill: parent
confirmationDialog.open() acceptedButtons: Qt.NoButton
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
} }
} }
}
TextBlock {
Layout.fillWidth: true
font.pixelSize: 14
text: (!currentWallet) ? "" : qsTr("Wallet log path: ") + translationManager.emptyString
}
TextBlock {
TextBlock { Layout.fillWidth: true
Layout.fillWidth: true font.pixelSize: 14
font.pixelSize: 14 text: currentWallet.walletLogPath + translationManager.emptyString
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
} }
} }