2018-08-05 18:53:20 +00:00
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2019-04-11 01:17:29 +00:00
import QtQuick 2.9
2018-07-18 16:23:50 +00:00
import QtQuick . Layouts 1.1
import QtQuick . Controls 2.0
2018-08-05 11:13:59 +00:00
import QtQuick . Dialogs 1.2
2018-07-18 16:23:50 +00:00
2019-02-26 23:26:16 +00:00
import "../../js/Wizard.js" as Wizard
2019-05-15 03:21:09 +00:00
import "../../js/Utils.js" as Utils
2018-08-05 10:55:24 +00:00
import "../../version.js" as Version
2018-07-18 16:23:50 +00:00
import "../../components" as MoneroComponents
Rectangle {
color: "transparent"
Layout.fillWidth: true
2019-12-20 14:26:45 +00:00
property alias infoHeight: infoLayout . height
2019-01-14 00:02:44 +00:00
property string walletModeString: {
if ( appWindow . walletMode === 0 ) {
return qsTr ( "Simple mode" ) + translationManager . emptyString ;
} else if ( appWindow . walletMode === 1 ) {
return qsTr ( "Simple mode" ) + " (bootstrap)" + translationManager . emptyString ;
} else if ( appWindow . walletMode === 2 ) {
return qsTr ( "Advanced mode" ) + translationManager . emptyString ;
}
}
2018-07-18 16:23:50 +00:00
ColumnLayout {
id: infoLayout
Layout.fillWidth: true
anchors.left: parent . left
anchors.top: parent . top
anchors.right: parent . right
2019-09-05 22:11:12 +00:00
anchors.margins: 20
2018-07-18 16:23:50 +00:00
anchors.topMargin: 0
2019-04-25 19:09:23 +00:00
spacing: 30
2018-07-18 16:23:50 +00:00
GridLayout {
columns: 2
columnSpacing: 0
MoneroComponents . TextBlock {
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-07-18 16:23:50 +00:00
text: qsTr ( "GUI version: " ) + translationManager . emptyString
}
MoneroComponents . TextBlock {
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . dimmedFontColor
2018-07-18 16:23:50 +00:00
text: Version . GUI_VERSION + " (Qt " + qtRuntimeVersion + ")" + translationManager . emptyString
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
MoneroComponents . TextBlock {
id: guiMoneroVersion
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-07-18 16:23:50 +00:00
text: qsTr ( "Embedded Monero version: " ) + translationManager . emptyString
}
MoneroComponents . TextBlock {
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . dimmedFontColor
2020-07-10 13:37:04 +00:00
text: moneroVersion
2018-07-18 16:23:50 +00:00
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
MoneroComponents . TextBlock {
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-08-05 18:29:35 +00:00
text: qsTr ( "Wallet path: " ) + translationManager . emptyString
2018-07-18 16:23:50 +00:00
}
MoneroComponents . TextBlock {
2020-04-24 00:43:40 +00:00
id: walletLocation
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . dimmedFontColor
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2020-04-24 00:43:40 +00:00
property string walletPath: ( isIOS ? moneroAccountsDir : "" ) + persistentSettings . wallet_path
2019-12-10 00:42:48 +00:00
text: " \
< style type = 'text/css' > \
a { cursor: pointer ; text - decoration: none ; color: # FF6C3C } \
< / s t y l e > \
< a href = '#' > % 1 < / a > " . a r g ( w a l l e t P a t h )
textFormat: Text . RichText
onLinkActivated: oshelper . openContainingFolder ( walletPath )
MouseArea {
anchors.fill: parent
acceptedButtons: Qt . NoButton
cursorShape: parent . hoveredLink ? Qt.PointingHandCursor : Qt . ArrowCursor
2018-08-05 18:29:35 +00:00
}
2018-07-18 16:23:50 +00:00
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
MoneroComponents . TextBlock {
id: restoreHeight
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-07-18 16:23:50 +00:00
textFormat: Text . RichText
2019-05-15 07:27:57 +00:00
text: ( typeof currentWallet == "undefined" ) ? "" : qsTr ( "Wallet restore height: " ) + translationManager . emptyString
2018-07-18 16:23:50 +00:00
}
MoneroComponents . TextBlock {
id: restoreHeightText
2018-08-05 11:13:59 +00:00
Layout.fillWidth: true
2018-07-18 16:23:50 +00:00
textFormat: Text . RichText
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . dimmedFontColor
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-07-18 16:23:50 +00:00
property var style: "<style type='text/css'>a {cursor:pointer;text-decoration: none; color: #FF6C3C}</style>"
2019-12-08 21:06:31 +00:00
text: ( currentWallet ? currentWallet.walletCreationHeight : "" ) + style + " <a href='#'> (%1)</a>" . arg ( qsTr ( "Change" ) ) + translationManager . emptyString
2018-07-18 16:23:50 +00:00
onLinkActivated: {
2019-02-26 23:26:16 +00:00
inputDialog . labelText = qsTr ( "Set a new restore height.\nYou can enter a block height or a date (YYYY-MM-DD):" ) + translationManager . emptyString ;
2018-07-18 16:23:50 +00:00
inputDialog . onAcceptedCallback = function ( ) {
2019-02-26 23:26:16 +00:00
var _restoreHeight ;
if ( inputDialog . inputText ) {
var restoreHeightText = inputDialog . inputText ;
// Parse date string or restore height as integer
if ( restoreHeightText . indexOf ( '-' ) === 4 && restoreHeightText . length === 10 ) {
2019-05-15 03:21:09 +00:00
_restoreHeight = Wizard . getApproximateBlockchainHeight ( restoreHeightText , Utils . netTypeToString ( ) ) ;
2019-02-26 23:26:16 +00:00
} else {
_restoreHeight = parseInt ( restoreHeightText )
}
}
2018-10-29 19:01:46 +00:00
if ( ! isNaN ( _restoreHeight ) ) {
2018-07-18 16:23:50 +00:00
if ( _restoreHeight >= 0 ) {
currentWallet . walletCreationHeight = _restoreHeight
// 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 . onAcceptedCallback = function ( ) {
2019-07-02 10:57:37 +00:00
appWindow . closeWallet ( function ( ) {
walletManager . clearWalletCache ( persistentSettings . wallet_path ) ;
walletManager . openWalletAsync ( persistentSettings . wallet_path , appWindow . walletPassword ,
persistentSettings . nettype , persistentSettings . kdfRounds ) ;
} ) ;
2018-07-18 16:23:50 +00:00
}
confirmationDialog . onRejectedCallback = null ;
confirmationDialog . open ( )
return ;
}
}
2019-02-26 23:26:16 +00:00
appWindow . showStatusMessage ( qsTr ( "Invalid restore height specified. Must be a number or a date formatted YYYY-MM-DD" ) , 3 ) ;
2018-07-18 16:23:50 +00:00
}
inputDialog . onRejectedCallback = null ;
2020-04-25 18:55:32 +00:00
inputDialog . open ( currentWallet ? currentWallet . walletCreationHeight . toFixed ( 0 ) : "0" )
2018-07-18 16:23:50 +00:00
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt . NoButton
cursorShape: parent . hoveredLink ? Qt.PointingHandCursor : Qt . ArrowCursor
}
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2018-07-18 16:23:50 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
MoneroComponents . TextBlock {
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2018-07-18 16:23:50 +00:00
text: qsTr ( "Wallet log path: " ) + translationManager . emptyString
}
MoneroComponents . TextBlock {
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . dimmedFontColor
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2019-12-10 00:42:48 +00:00
text: " \
< style type = 'text/css' > \
a { cursor: pointer ; text - decoration: none ; color: # FF6C3C } \
< / s t y l e > \
< a href = '#' > % 1 < / a > " . a r g ( w a l l e t L o g P a t h )
textFormat: Text . RichText
onLinkActivated: oshelper . openContainingFolder ( walletLogPath )
MouseArea {
anchors.fill: parent
acceptedButtons: Qt . NoButton
cursorShape: parent . hoveredLink ? Qt.PointingHandCursor : Qt . ArrowCursor
}
2018-07-18 16:23:50 +00:00
}
2019-01-14 00:02:44 +00:00
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2019-01-14 00:02:44 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2019-01-14 00:02:44 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
MoneroComponents . TextBlock {
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2019-01-14 00:02:44 +00:00
text: qsTr ( "Wallet mode: " ) + translationManager . emptyString
}
MoneroComponents . TextBlock {
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . dimmedFontColor
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2019-01-14 00:02:44 +00:00
text: walletModeString
}
2019-04-11 01:17:29 +00:00
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2019-04-11 01:17:29 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
height: 1
2019-04-25 19:09:23 +00:00
Layout.topMargin: 2
Layout.bottomMargin: 2
2019-04-11 01:17:29 +00:00
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
MoneroComponents . TextBlock {
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2019-04-11 01:17:29 +00:00
text: qsTr ( "Graphics mode: " ) + translationManager . emptyString
}
MoneroComponents . TextBlock {
Layout.fillWidth: true
color: MoneroComponents . Style . dimmedFontColor
2019-04-25 19:09:23 +00:00
font.pixelSize: 14
2019-04-11 01:17:29 +00:00
text: isOpenGL ? "OpenGL" : "Low graphics mode"
}
2019-07-03 03:13:51 +00:00
Rectangle {
visible: isTails
height: 1
Layout.topMargin: 2
Layout.bottomMargin: 2
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
visible: isTails
height: 1
Layout.topMargin: 2
Layout.bottomMargin: 2
Layout.fillWidth: true
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
MoneroComponents . TextBlock {
visible: isTails
Layout.fillWidth: true
font.pixelSize: 14
text: qsTr ( "Tails: " ) + translationManager . emptyString
}
MoneroComponents . TextBlock {
visible: isTails
Layout.fillWidth: true
color: MoneroComponents . Style . dimmedFontColor
font.pixelSize: 14
text: tailsUsePersistence ? qsTr ( "persistent" ) + translationManager.emptyString : qsTr ( "persistence disabled" ) + translationManager . emptyString ;
}
2018-07-18 16:23:50 +00:00
}
2018-08-05 18:35:46 +00:00
2020-07-08 20:46:38 +00:00
RowLayout {
spacing: 20 ;
MoneroComponents . StandardButton {
small: true
text: qsTr ( "Copy to clipboard" ) + translationManager . emptyString
onClicked: {
var data = "" ;
data += "GUI version: " + Version . GUI_VERSION + " (Qt " + qtRuntimeVersion + ")" ;
2020-07-10 13:37:04 +00:00
data += "\nEmbedded Monero version: " + moneroVersion ;
2020-07-08 20:46:38 +00:00
data += "\nWallet path: " + walletLocation . walletPath ;
2020-09-01 19:39:19 +00:00
data += "\nWallet restore height: " ;
2020-07-08 20:46:38 +00:00
if ( currentWallet )
data += currentWallet . walletCreationHeight ;
data += "\nWallet log path: " + walletLogPath ;
data += "\nWallet mode: " + walletModeString ;
2020-09-01 19:39:19 +00:00
data += "\nGraphics mode: " + isOpenGL ? "OpenGL" : "Low graphics mode" ;
2020-09-07 20:17:33 +00:00
if ( isTails )
data += "\nTails: " + tailsUsePersistence ? "persistent" : "persistence disabled" ;
2020-07-08 20:46:38 +00:00
console . log ( "Copied to clipboard" ) ;
clipboard . setText ( data ) ;
appWindow . showStatusMessage ( qsTr ( "Copied to clipboard" ) , 3 ) ;
}
}
MoneroComponents . StandardButton {
small: true
text: qsTr ( "Donate to Monero" ) + translationManager . emptyString
onClicked: {
middlePanel . sendTo ( "888tNkZrPN6JsEgekjMnABU4TBzc2Dt29EPAvkRxbANsAnjyPbb3iQ1YBRk1UXcdRsiKc9dhwMVgN5S9cQUiyoogDavup3H" , "" , "Donation to Monero Core Team" ) ;
}
2018-08-05 18:35:46 +00:00
}
}
2018-07-18 16:23:50 +00:00
}
}