2015-04-01 11:56:05 +03:00
// Copyright (c) 2014-2015, The Monero Project
2016-10-09 02:23:57 +03:00
//
2015-04-01 11:56:05 +03:00
// All rights reserved.
2016-10-09 02:23:57 +03:00
//
2015-04-01 11:56:05 +03:00
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
2016-10-09 02:23:57 +03:00
//
2015-04-01 11:56:05 +03:00
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
2016-10-09 02:23:57 +03:00
//
2015-04-01 11:56:05 +03:00
// 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.
2016-10-09 02:23:57 +03:00
//
2015-04-01 11:56:05 +03:00
// 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.
2016-10-09 02:23:57 +03:00
//
2015-04-01 11:56:05 +03:00
// 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.
2014-07-07 20:08:30 +03:00
import QtQuick 2.0
2016-10-04 00:52:48 +03:00
import QtQuick . Controls 1.4
import QtQuick . Controls . Styles 1.4
import QtQuick . Layouts 1.1
2016-10-05 01:21:59 +03:00
import QtQuick . Dialogs 1.2
2016-12-20 23:13:42 +02:00
import "../version.js" as Version
2016-10-05 01:21:59 +03:00
2016-10-04 00:52:48 +03:00
import "../components"
import moneroComponents . Clipboard 1.0
2014-07-07 20:08:30 +03:00
Rectangle {
2016-10-05 01:21:59 +03:00
property var daemonAddress
2017-01-04 18:25:22 +02:00
property bool viewOnly: false
2017-04-03 19:51:55 +03:00
id: page
2016-10-05 01:21:59 +03:00
2016-10-04 00:52:48 +03:00
color: "#F0EEEE"
Clipboard { id: clipboard }
2016-10-09 01:54:15 +03:00
function initSettings ( ) {
2017-01-04 18:25:22 +02:00
//runs on every page load
2016-10-05 01:21:59 +03:00
// Daemon settings
daemonAddress = persistentSettings . daemon_address . split ( ":" ) ;
}
2016-10-04 00:52:48 +03:00
ColumnLayout {
id: mainLayout
2017-08-07 17:05:54 +03:00
anchors.margins: 17 * scaleRatio
2016-10-04 00:52:48 +03:00
anchors.left: parent . left
anchors.top: parent . top
anchors.right: parent . right
2017-08-07 17:05:54 +03:00
spacing: 10 * scaleRatio
2016-10-04 00:52:48 +03:00
2017-01-04 18:25:22 +02:00
//! Manage wallet
RowLayout {
Label {
id: manageWalletLabel
Layout.fillWidth: true
color: "#4A4949"
text: qsTr ( "Manage wallet" ) + translationManager . emptyString
2017-08-07 17:05:54 +03:00
Layout.topMargin: 10 * scaleRatio
2017-01-04 18:25:22 +02:00
}
}
2016-10-04 00:52:48 +03:00
2017-01-04 18:25:22 +02:00
Rectangle {
Layout.fillWidth: true
height: 1
color: "#DEDEDE"
2016-10-09 01:54:15 +03:00
}
2016-10-04 00:52:48 +03:00
2017-04-03 19:51:55 +03:00
GridLayout {
2017-05-03 16:32:46 +03:00
columns: ( isMobile ) ? 2 : 4
2017-01-04 18:25:22 +02:00
StandardButton {
id: closeWalletButton
text: qsTr ( "Close wallet" ) + translationManager . emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
visible: true
onClicked: {
console . log ( "closing wallet button clicked" )
appWindow . showWizard ( ) ;
}
}
StandardButton {
enabled: ! viewOnly
id: createViewOnlyWalletButton
text: qsTr ( "Create view only wallet" ) + translationManager . emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
visible: true
onClicked: {
wizard . openCreateViewOnlyWalletPage ( ) ;
}
}
2017-05-03 16:57:41 +03:00
/ * R e s c a n c a c h e - D i s a b l e d u n t i l w e k n o w i t ' s n e e d e d
2017-05-03 15:37:33 +03:00
StandardButton {
id: rescanWalletbutton
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
text: qsTr ( "Rescan wallet cache" ) + translationManager . emptyString
onClicked: {
// 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 . password ,
persistentSettings . testnet ) ;
}
confirmationDialog . onRejectedCallback = null ;
confirmationDialog . open ( )
}
}
2017-05-03 16:57:41 +03:00
* /
2017-05-03 16:32:46 +03:00
StandardButton {
id: rescanSpentButton
text: qsTr ( "Rescan wallet balance" ) + translationManager . emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
onClicked: {
if ( ! currentWallet . rescanSpent ( ) ) {
console . error ( "Error: " , currentWallet . errorString ) ;
informationPopup . title = qsTr ( "Error" ) + translationManager . emptyString ;
informationPopup . text = qsTr ( "Error: " ) + currentWallet . errorString
informationPopup . icon = StandardIcon . Critical
informationPopup . onCloseCallback = null
informationPopup . open ( ) ;
} else {
informationPopup . title = qsTr ( "Information" ) + translationManager . emptyString
informationPopup . text = qsTr ( "Sucessfully rescanned spent outputs" ) + translationManager . emptyString
informationPopup . icon = StandardIcon . Information
informationPopup . onCloseCallback = null
informationPopup . open ( ) ;
}
}
}
2016-10-09 01:54:15 +03:00
}
2016-10-05 01:21:59 +03:00
2017-01-04 18:25:22 +02:00
//! Manage daemon
RowLayout {
Label {
id: manageDaemonLabel
2017-03-14 16:05:47 +02:00
Layout.fillWidth: true
2017-01-04 18:25:22 +02:00
color: "#4A4949"
text: qsTr ( "Manage daemon" ) + translationManager . emptyString
fontSize: 16
anchors.topMargin: 30
Layout.topMargin: 30
}
}
2016-10-09 01:54:15 +03:00
Rectangle {
Layout.fillWidth: true
height: 1
color: "#DEDEDE"
2016-10-04 00:52:48 +03:00
}
2017-04-03 19:51:55 +03:00
GridLayout {
2017-03-14 16:05:47 +02:00
id: daemonStatusRow
2017-04-03 19:51:55 +03:00
columns: ( isMobile ) ? 2 : 4
2017-01-04 18:25:22 +02:00
StandardButton {
visible: true
enabled: ! appWindow . daemonRunning
id: startDaemonButton
text: qsTr ( "Start daemon" ) + translationManager . emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
onClicked: {
appWindow . startDaemon ( daemonFlags . text )
}
}
StandardButton {
visible: true
enabled: appWindow . daemonRunning
id: stopDaemonButton
text: qsTr ( "Stop daemon" ) + translationManager . emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
onClicked: {
appWindow . stopDaemon ( )
}
}
2017-01-23 00:04:46 +02:00
StandardButton {
visible: true
id: daemonStatusButton
2017-02-23 20:47:58 +02:00
text: qsTr ( "Show status" ) + translationManager . emptyString
2017-01-23 00:04:46 +02:00
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
onClicked: {
daemonManager . sendCommand ( "status" , currentWallet . testnet ) ;
daemonConsolePopup . open ( ) ;
}
}
2017-05-04 15:06:29 +03:00
}
2017-01-23 00:04:46 +02:00
2017-05-04 15:06:29 +03:00
RowLayout {
id: blockchainFolderRow
Label {
id: blockchainFolderLabel
color: "#4A4949"
text: qsTr ( "Blockchain location" ) + translationManager . emptyString
}
LineEdit {
id: blockchainFolder
Layout.preferredWidth: 200
Layout.fillWidth: true
text: persistentSettings . blockchainDataDir
placeholderText: qsTr ( "(optional)" ) + translationManager . emptyString
2017-01-23 00:04:46 +02:00
2017-05-04 15:06:29 +03:00
MouseArea {
anchors.fill: parent
onClicked: {
mouse . accepted = false
if ( persistentSettings . blockchainDataDir != "" )
blockchainFileDialog . folder = "file://" + persistentSettings . blockchainDataDir
blockchainFileDialog . open ( )
blockchainFolder . focus = true
}
}
}
2017-01-04 18:25:22 +02:00
}
2017-05-04 15:06:29 +03:00
RowLayout {
2017-01-04 18:25:22 +02:00
id: daemonFlagsRow
Label {
id: daemonFlagsLabel
color: "#4A4949"
text: qsTr ( "Daemon startup flags" ) + translationManager . emptyString
fontSize: 16
}
LineEdit {
id: daemonFlags
Layout.preferredWidth: 200
Layout.fillWidth: true
text: appWindow . persistentSettings . daemonFlags ;
placeholderText: qsTr ( "(optional)" ) + translationManager . emptyString
}
}
2016-10-05 01:21:59 +03:00
RowLayout {
2016-10-09 01:54:15 +03:00
Layout.fillWidth: true
spacing: 10
2016-10-05 01:21:59 +03:00
Label {
id: daemonAddrLabel
2016-10-09 01:54:15 +03:00
Layout.fillWidth: true
2016-10-05 01:21:59 +03:00
color: "#4A4949"
2016-10-12 01:14:43 +03:00
text: qsTr ( "Daemon address" ) + translationManager . emptyString
2016-10-09 01:54:15 +03:00
fontSize: 16
2016-10-05 01:21:59 +03:00
}
2017-04-03 19:51:55 +03:00
}
GridLayout {
id: daemonAddrRow
Layout.fillWidth: true
columnSpacing: 10
columns: ( isMobile ) ? 2 : 3
2016-10-05 01:21:59 +03:00
LineEdit {
id: daemonAddr
2017-04-03 19:51:55 +03:00
Layout.preferredWidth: 100
2016-10-09 01:54:15 +03:00
Layout.fillWidth: true
text: ( daemonAddress !== undefined ) ? daemonAddress [ 0 ] : ""
2017-03-09 02:28:24 +02:00
placeholderText: qsTr ( "Hostname / IP" ) + translationManager . emptyString
2016-10-05 01:21:59 +03:00
}
2016-10-04 00:52:48 +03:00
2016-10-09 01:54:15 +03:00
2016-10-05 01:21:59 +03:00
LineEdit {
id: daemonPort
2016-10-09 01:54:15 +03:00
Layout.preferredWidth: 100
Layout.fillWidth: true
2016-11-25 03:41:44 +02:00
text: ( daemonAddress !== undefined ) ? daemonAddress [ 1 ] : "18081"
2017-03-09 02:28:24 +02:00
placeholderText: qsTr ( "Port" ) + translationManager . emptyString
2016-10-05 01:21:59 +03:00
}
2017-02-25 23:16:58 +02:00
}
2016-10-05 01:21:59 +03:00
2017-02-25 23:16:58 +02:00
RowLayout {
2017-04-03 19:51:55 +03:00
Layout.fillWidth: true
spacing: 10
2017-02-25 23:16:58 +02:00
Label {
id: daemonLoginLabel
Layout.fillWidth: true
color: "#4A4949"
text: qsTr ( "Login (optional)" ) + translationManager . emptyString
fontSize: 16
}
2017-04-03 19:51:55 +03:00
}
RowLayout {
2017-02-25 23:16:58 +02:00
LineEdit {
id: daemonUsername
Layout.preferredWidth: 100
Layout.fillWidth: true
text: persistentSettings . daemonUsername
2017-03-09 02:28:24 +02:00
placeholderText: qsTr ( "Username" ) + translationManager . emptyString
2017-02-25 23:16:58 +02:00
}
LineEdit {
id: daemonPassword
Layout.preferredWidth: 100
Layout.fillWidth: true
text: persistentSettings . daemonPassword
2017-03-09 02:28:24 +02:00
placeholderText: qsTr ( "Password" ) + translationManager . emptyString
2017-02-25 23:16:58 +02:00
echoMode: TextInput . Password
}
2016-10-05 01:21:59 +03:00
StandardButton {
id: daemonAddrSave
2016-10-09 01:54:15 +03:00
Layout.fillWidth: false
Layout.leftMargin: 30
2017-03-23 19:30:36 +02:00
text: qsTr ( "Connect" ) + translationManager . emptyString
2016-10-05 01:21:59 +03:00
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
onClicked: {
console . log ( "saving daemon adress settings" )
2017-03-03 13:40:50 +02:00
var newDaemon = daemonAddr . text . trim ( ) + ":" + daemonPort . text . trim ( )
2016-10-05 01:21:59 +03:00
if ( persistentSettings . daemon_address != newDaemon ) {
persistentSettings . daemon_address = newDaemon
}
2017-02-25 23:16:58 +02:00
// Update daemon login
persistentSettings . daemonUsername = daemonUsername . text ;
persistentSettings . daemonPassword = daemonPassword . text ;
currentWallet . setDaemonLogin ( persistentSettings . daemonUsername , persistentSettings . daemonPassword ) ;
//Reinit wallet
currentWallet . initAsync ( newDaemon ) ;
2016-10-05 01:21:59 +03:00
}
}
}
2016-10-29 17:30:41 +03:00
RowLayout {
Label {
color: "#4A4949"
2017-01-04 18:25:22 +02:00
text: qsTr ( "Layout settings" ) + translationManager . emptyString
2016-10-29 17:30:41 +03:00
fontSize: 16
2017-01-04 18:25:22 +02:00
anchors.topMargin: 30
Layout.topMargin: 30
2016-10-29 17:30:41 +03:00
}
}
2017-01-04 18:25:22 +02:00
Rectangle {
Layout.fillWidth: true
height: 1
color: "#DEDEDE"
2016-12-21 15:30:15 +02:00
}
2016-12-09 23:35:08 +02:00
RowLayout {
CheckBox {
id: customDecorationsCheckBox
checked: persistentSettings . customDecorations
2016-12-15 02:59:10 +02:00
onClicked: appWindow . setCustomWindowDecorations ( checked )
2016-12-09 23:35:08 +02:00
text: qsTr ( "Custom decorations" ) + translationManager . emptyString
checkedIcon: "../images/checkedVioletIcon.png"
uncheckedIcon: "../images/uncheckedIcon.png"
}
}
2016-12-31 12:56:08 +02:00
// Log level
2017-04-03 19:51:55 +03:00
2016-12-31 12:56:08 +02:00
RowLayout {
Label {
color: "#4A4949"
text: qsTr ( "Log level" ) + translationManager . emptyString
2017-08-07 17:05:54 +03:00
anchors.topMargin: 30 * scaleRatio
Layout.topMargin: 30 * scaleRatio
2016-12-31 12:56:08 +02:00
}
2017-04-03 19:51:55 +03:00
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#DEDEDE"
}
ColumnLayout {
2016-12-31 12:56:08 +02:00
ComboBox {
id: logLevel
2017-01-16 23:56:37 +02:00
model: [ 0 , 1 , 2 , 3 , 4 , "custom" ]
2016-12-31 12:56:08 +02:00
currentIndex : appWindow . persistentSettings . logLevel ;
onCurrentIndexChanged: {
2017-01-16 23:56:37 +02:00
if ( currentIndex == 5 ) {
console . log ( "log categories changed: " , logCategories . text ) ;
walletManager . setLogCategories ( logCategories . text ) ;
}
else {
console . log ( "log level changed: " , currentIndex ) ;
walletManager . setLogLevel ( currentIndex ) ;
}
2016-12-31 12:56:08 +02:00
appWindow . persistentSettings . logLevel = currentIndex ;
}
}
2017-01-16 23:56:37 +02:00
LineEdit {
id: logCategories
Layout.fillWidth: true
2017-02-05 14:38:43 +02:00
text: appWindow . persistentSettings . logCategories
2017-01-16 23:56:37 +02:00
placeholderText: qsTr ( "(e.g. *:WARNING,net.p2p:DEBUG)" ) + translationManager . emptyString
enabled: logLevel . currentIndex == 5
onEditingFinished: {
if ( enabled ) {
console . log ( "log categories changed: " , text ) ;
walletManager . setLogCategories ( text ) ;
2017-02-05 14:38:43 +02:00
appWindow . persistentSettings . logCategories = text ;
2017-01-16 23:56:37 +02:00
}
}
}
2016-12-31 12:56:08 +02:00
}
2017-01-04 18:25:22 +02:00
// Version
RowLayout {
Label {
color: "#4A4949"
2017-08-24 12:31:56 +03:00
text: qsTr ( "Debug info" ) + translationManager . emptyString
2017-01-04 18:25:22 +02:00
fontSize: 16
2017-08-07 17:05:54 +03:00
anchors.topMargin: 30 * scaleRatio
Layout.topMargin: 30 * scaleRatio
2017-01-04 18:25:22 +02:00
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#DEDEDE"
}
2017-08-24 12:31:56 +03:00
TextBlock {
2016-12-20 23:13:42 +02:00
Layout.topMargin: 8
2017-08-24 12:31:56 +03:00
Layout.fillWidth: true
2016-12-21 12:47:16 +02:00
text: qsTr ( "GUI version: " ) + Version . GUI_VERSION + translationManager . emptyString
}
2017-08-24 12:31:56 +03:00
TextBlock {
2016-12-21 12:47:16 +02:00
id: guiMoneroVersion
2017-08-24 12:31:56 +03:00
Layout.fillWidth: true
2016-12-21 12:47:16 +02:00
text: qsTr ( "Embedded Monero version: " ) + Version . GUI_MONERO_VERSION + translationManager . emptyString
2017-08-24 12:31:56 +03:00
}
TextBlock {
2017-10-23 19:33:10 +03:00
id: restoreHeightText
2017-08-24 12:31:56 +03:00
Layout.fillWidth: true
2017-10-23 19:33:10 +03:00
textFormat: Text . RichText
property var txt: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C}</style>" + qsTr ( "Wallet creation height: " ) + currentWallet . walletCreationHeight + translationManager . emptyString
property var linkTxt: qsTr ( " <a href='#'>(Click to change)</a>" ) + translationManager . emptyString
text: ( typeof currentWallet == "undefined" ) ? "" : txt + linkTxt
onLinkActivated: {
restoreHeightRow . visible = true ;
}
2017-08-24 12:31:56 +03:00
}
2017-10-23 19:33:10 +03:00
RowLayout {
id: restoreHeightRow
visible: false
LineEdit {
id: restoreHeight
Layout.preferredWidth: 80
Layout.fillWidth: true
text: currentWallet . walletCreationHeight
validator: IntValidator {
bottom: 0
}
}
StandardButton {
id: restoreHeightSave
Layout.fillWidth: false
Layout.leftMargin: 30
text: qsTr ( "Save" ) + translationManager . emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
onClicked: {
currentWallet . walletCreationHeight = restoreHeight . text
// Restore height is saved in .keys file. Set password to trigger rewrite.
currentWallet . setPassword ( appWindow . password )
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 . password ,
persistentSettings . testnet ) ;
}
confirmationDialog . onRejectedCallback = null ;
confirmationDialog . open ( )
}
}
}
2017-08-24 12:31:56 +03:00
TextBlock {
Layout.fillWidth: true
text: ( typeof currentWallet == "undefined" ) ? "" : qsTr ( "Wallet log path: " ) + currentWallet . walletLogPath + translationManager . emptyString
}
TextBlock {
Layout.fillWidth: true
text: ( typeof currentWallet == "undefined" ) ? "" : qsTr ( "Daemon log path: " ) + currentWallet . daemonLogPath + translationManager . emptyString
2016-12-20 23:13:42 +02:00
}
2016-10-04 00:52:48 +03:00
}
2016-10-05 01:21:59 +03:00
2016-11-07 15:59:00 +02:00
// Daemon console
2017-01-23 00:04:46 +02:00
DaemonConsole {
2016-11-07 15:59:00 +02:00
id: daemonConsolePopup
2016-11-26 20:30:53 +02:00
height: 500
2016-11-07 15:59:00 +02:00
width: 800
2017-03-09 02:28:24 +02:00
title: qsTr ( "Daemon log" ) + translationManager . emptyString
2016-11-07 15:59:00 +02:00
onAccepted: {
close ( ) ;
}
}
2016-10-05 01:21:59 +03:00
2017-05-04 15:06:29 +03:00
// Choose blockchain folder
FileDialog {
id: blockchainFileDialog
title: qsTr ( "Please choose a folder" ) + translationManager . emptyString ;
selectFolder: true
folder: "file://" + persistentSettings . blockchainDataDir
onAccepted: {
var dataDir = walletManager . urlToLocalPath ( blockchainFileDialog . fileUrl )
var validator = daemonManager . validateDataDir ( dataDir ) ;
if ( ! validator . valid ) {
confirmationDialog . title = qsTr ( "Warning" ) + translationManager . emptyString ;
confirmationDialog . text = "" ;
if ( validator . readOnly ) {
confirmationDialog . text += qsTr ( "Error: Filesystem is read only" ) + "\n\n"
}
if ( validator . storageAvailable < 20 ) {
confirmationDialog . text += qsTr ( "Warning: There's only %1 GB available on the device. Blockchain requires ~%2 GB of data." ) . arg ( validator . storageAvailable ) . arg ( 15 ) + "\n\n"
} else {
confirmationDialog . text += qsTr ( "Note: There's %1 GB available on the device. Blockchain requires ~%2 GB of data." ) . arg ( validator . storageAvailable ) . arg ( 15 ) + "\n\n"
}
if ( ! validator . lmdbExists ) {
confirmationDialog . text += qsTr ( "Note: lmdb folder not found. A new folder will be created." ) + "\n\n"
}
confirmationDialog . icon = StandardIcon . Question
confirmationDialog . cancelText = qsTr ( "Cancel" )
// Continue
confirmationDialog . onAcceptedCallback = function ( ) {
persistentSettings . blockchainDataDir = dataDir
}
// Cancel
confirmationDialog . onRejectedCallback = function ( ) {
} ;
confirmationDialog . open ( )
} else {
persistentSettings . blockchainDataDir = dataDir
}
delete validator ;
}
onRejected: {
console . log ( "data dir selection canceled" )
}
}
2016-11-07 15:59:00 +02:00
// fires on every page load
2016-10-05 01:21:59 +03:00
function onPageCompleted ( ) {
console . log ( "Settings page loaded" ) ;
initSettings ( ) ;
2017-01-04 18:25:22 +02:00
viewOnly = currentWallet . viewOnly ;
2017-04-03 19:51:55 +03:00
if ( typeof daemonManager != "undefined" )
appWindow . daemonRunning = daemonManager . running ( persistentSettings . testnet )
2016-10-05 01:21:59 +03:00
}
2016-11-07 15:59:00 +02:00
// fires only once
Component.onCompleted: {
2017-04-03 19:51:55 +03:00
if ( typeof daemonManager != "undefined" )
daemonManager . daemonConsoleUpdated . connect ( onDaemonConsoleUpdated )
2016-11-07 15:59:00 +02:00
}
function onDaemonConsoleUpdated ( message ) {
// Update daemon console
daemonConsolePopup . textArea . append ( message )
}
2016-10-04 00:52:48 +03:00
2016-10-09 01:54:15 +03:00
}
2016-10-09 02:23:57 +03:00