2019-03-12 05:46:08 +00:00
// Copyright (c) 2014-2019, The Monero Project
2018-08-05 18:53:20 +00:00
//
// 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 13:19:45 +00:00
import QtQuick . Layouts 1.1
import QtQuick . Controls 2.0
2019-04-11 01:17:29 +00:00
import FontAwesome 1.0
2018-07-18 13:19:45 +00:00
import "../../components" as MoneroComponents
2019-04-11 01:17:29 +00:00
import "../../components/effects" as MoneroEffects
2018-07-18 13:19:45 +00:00
Rectangle {
color: "transparent"
Layout.fillWidth: true
2019-12-20 14:26:45 +00:00
property alias nodeHeight: root . height
2018-07-18 13:19:45 +00:00
/* main layout */
ColumnLayout {
id: root
2019-09-05 22:11:12 +00:00
anchors.margins: 20
2018-07-18 13:19:45 +00:00
anchors.topMargin: 0
anchors.left: parent . left
anchors.top: parent . top
anchors.right: parent . right
2019-04-25 19:09:23 +00:00
spacing: 0
2018-07-18 13:19:45 +00:00
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 90
color: "transparent"
Rectangle {
id: localNodeDivider
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
anchors.topMargin: 0
2018-07-18 13:19:45 +00:00
anchors.left: parent . left
anchors.right: parent . right
height: 1
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
visible: ! persistentSettings . useRemoteNode
Layout.fillHeight: true
anchors.top: parent . top
anchors.bottom: parent . bottom
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . blackTheme ? "white" : "darkgrey"
2018-07-18 13:19:45 +00:00
width: 2
}
Rectangle {
width: parent . width
height: localNodeHeader . height + localNodeArea . contentHeight
color: "transparent" ;
anchors.left: parent . left
anchors.verticalCenter: parent . verticalCenter
Rectangle {
id: localNodeIcon
color: "transparent"
height: 32
width: 32
anchors.left: parent . left
2019-04-25 19:09:23 +00:00
anchors.leftMargin: 16
2018-07-18 13:19:45 +00:00
anchors.verticalCenter: parent . verticalCenter
2019-07-27 16:06:07 +00:00
MoneroComponents . Label {
fontSize: 32
text: FontAwesome . home
2019-09-04 22:22:17 +00:00
fontFamily: FontAwesome . fontFamilySolid
2019-07-27 16:06:07 +00:00
anchors.centerIn: parent
fontColor: MoneroComponents . Style . defaultFontColor
2019-09-04 22:22:17 +00:00
styleName: "Solid"
2018-07-18 13:19:45 +00:00
}
}
2019-04-11 01:17:29 +00:00
MoneroComponents . TextPlain {
2018-07-18 13:19:45 +00:00
id: localNodeHeader
anchors.left: localNodeIcon . right
2019-04-25 19:09:23 +00:00
anchors.leftMargin: 14
2018-07-18 13:19:45 +00:00
anchors.top: parent . top
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . defaultFontColor
opacity: MoneroComponents . Style . blackTheme ? 1.0 : 0.8
2018-07-18 13:19:45 +00:00
font.bold: true
font.family: MoneroComponents . Style . fontRegular . name
2019-04-25 19:09:23 +00:00
font.pixelSize: 16
2018-07-18 13:19:45 +00:00
text: qsTr ( "Local node" ) + translationManager . emptyString
}
2019-11-27 12:09:50 +00:00
Text {
2018-07-18 13:19:45 +00:00
id: localNodeArea
anchors.top: localNodeHeader . bottom
2019-04-25 19:09:23 +00:00
anchors.topMargin: 4
2018-07-18 13:19:45 +00:00
anchors.left: localNodeIcon . right
2019-04-25 19:09:23 +00:00
anchors.leftMargin: 14
2018-08-05 17:22:59 +00:00
color: MoneroComponents . Style . dimmedFontColor
2018-07-18 13:19:45 +00:00
font.family: MoneroComponents . Style . fontRegular . name
2019-04-25 19:09:23 +00:00
font.pixelSize: 15
2018-07-18 13:19:45 +00:00
horizontalAlignment: TextInput . AlignLeft
wrapMode: Text . WordWrap ;
leftPadding: 0
topPadding: 0
text: qsTr ( "The blockchain is downloaded to your computer. Provides higher security and requires more local storage." ) + translationManager . emptyString
width: parent . width - ( localNodeIcon . width + localNodeIcon . anchors . leftMargin + anchors . leftMargin )
2021-04-03 10:45:02 +00:00
}
2018-07-18 13:19:45 +00:00
}
MouseArea {
cursorShape: Qt . PointingHandCursor
anchors.fill: parent
2020-10-18 02:45:44 +00:00
enabled: persistentSettings . useRemoteNode
2018-07-18 13:19:45 +00:00
onClicked: {
persistentSettings . useRemoteNode = false ;
appWindow . disconnectRemoteNode ( ) ;
}
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 90
color: "transparent"
Rectangle {
id: remoteNodeDivider
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
anchors.topMargin: 0
2018-07-18 13:19:45 +00:00
anchors.left: parent . left
anchors.right: parent . right
height: 1
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
Rectangle {
visible: persistentSettings . useRemoteNode
Layout.fillHeight: true
anchors.top: parent . top
anchors.bottom: parent . bottom
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . blackTheme ? "white" : "darkgrey"
2018-07-18 13:19:45 +00:00
width: 2
}
Rectangle {
width: parent . width
height: remoteNodeHeader . height + remoteNodeArea . contentHeight
color: "transparent" ;
anchors.left: parent . left
anchors.verticalCenter: parent . verticalCenter
Rectangle {
id: remoteNodeIcon
color: "transparent"
height: 32
width: 32
anchors.left: parent . left
2019-04-25 19:09:23 +00:00
anchors.leftMargin: 16
2018-07-18 13:19:45 +00:00
anchors.verticalCenter: parent . verticalCenter
2019-07-27 16:06:07 +00:00
MoneroComponents . Label {
fontSize: 28
text: FontAwesome . cloud
2019-09-04 22:22:17 +00:00
fontFamily: FontAwesome . fontFamilySolid
styleName: "Solid"
2019-07-27 16:06:07 +00:00
anchors.centerIn: parent
fontColor: MoneroComponents . Style . defaultFontColor
2018-07-18 13:19:45 +00:00
}
}
2019-04-11 01:17:29 +00:00
MoneroComponents . TextPlain {
2018-07-18 13:19:45 +00:00
id: remoteNodeHeader
anchors.left: remoteNodeIcon . right
2019-04-25 19:09:23 +00:00
anchors.leftMargin: 14
2018-07-18 13:19:45 +00:00
anchors.top: parent . top
2019-04-11 01:17:29 +00:00
color: MoneroComponents . Style . defaultFontColor
opacity: MoneroComponents . Style . blackTheme ? 1.0 : 0.8
2018-07-18 13:19:45 +00:00
font.bold: true
font.family: MoneroComponents . Style . fontRegular . name
2019-04-25 19:09:23 +00:00
font.pixelSize: 16
2018-07-18 13:19:45 +00:00
text: qsTr ( "Remote node" ) + translationManager . emptyString
}
2019-11-27 12:09:50 +00:00
Text {
2018-07-18 13:19:45 +00:00
id: remoteNodeArea
anchors.top: remoteNodeHeader . bottom
2019-04-25 19:09:23 +00:00
anchors.topMargin: 4
2018-07-18 13:19:45 +00:00
anchors.left: remoteNodeIcon . right
2019-04-25 19:09:23 +00:00
anchors.leftMargin: 14
2018-08-05 17:22:59 +00:00
color: MoneroComponents . Style . dimmedFontColor
2018-07-18 13:19:45 +00:00
font.family: MoneroComponents . Style . fontRegular . name
2019-04-25 19:09:23 +00:00
font.pixelSize: 15
2018-07-18 13:19:45 +00:00
horizontalAlignment: TextInput . AlignLeft
wrapMode: Text . WordWrap ;
leftPadding: 0
topPadding: 0
text: qsTr ( "Uses a third-party server to connect to the Monero network. Less secure, but easier on your computer." ) + translationManager . emptyString
width: parent . width - ( remoteNodeIcon . width + remoteNodeIcon . anchors . leftMargin + anchors . leftMargin )
}
MouseArea {
cursorShape: Qt . PointingHandCursor
anchors.fill: parent
2020-10-18 02:45:44 +00:00
enabled: ! persistentSettings . useRemoteNode
2018-07-18 13:19:45 +00:00
onClicked: {
appWindow . connectRemoteNode ( ) ;
}
}
}
Rectangle {
id: localNodeBottomDivider
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
anchors.topMargin: 0
2018-07-18 13:19:45 +00:00
anchors.left: parent . left
anchors.right: parent . right
anchors.bottom: parent . bottom
height: 1
color: MoneroComponents . Style . dividerColor
opacity: MoneroComponents . Style . dividerOpacity
}
}
2021-04-20 22:11:36 +00:00
MoneroComponents . WarningBox {
Layout.topMargin: 46
text: qsTr ( "To find a remote node, type 'Monero remote node' into your favorite search engine. Please ensure the node is run by a trusted third-party." ) + translationManager . emptyString
2019-09-05 22:11:12 +00:00
visible: persistentSettings . useRemoteNode
2021-04-20 22:11:36 +00:00
}
2018-07-18 13:19:45 +00:00
2021-04-20 22:11:36 +00:00
MoneroComponents . RemoteNodeList {
Layout.fillWidth: true
Layout.topMargin: 26
visible: persistentSettings . useRemoteNode
2018-07-18 13:19:45 +00:00
}
ColumnLayout {
id: localNodeLayout
2019-04-25 19:09:23 +00:00
spacing: 20
2018-07-18 13:19:45 +00:00
Layout.topMargin: 40
2019-09-05 22:11:12 +00:00
visible: ! persistentSettings . useRemoteNode
2018-07-18 13:19:45 +00:00
2018-12-13 18:45:21 +00:00
MoneroComponents . StandardButton {
small: true
2019-07-27 16:08:24 +00:00
text: ( appWindow . daemonRunning ? qsTr ( "Stop daemon" ) : qsTr ( "Start daemon" ) ) + translationManager . emptyString
2018-12-13 18:45:21 +00:00
onClicked: {
if ( appWindow . daemonRunning ) {
appWindow . stopDaemon ( ) ;
} else {
2019-01-30 14:09:45 +00:00
persistentSettings . daemonFlags = daemonFlags . text ;
2018-12-13 18:45:21 +00:00
appWindow . startDaemon ( persistentSettings . daemonFlags ) ;
2018-07-18 13:19:45 +00:00
}
}
}
RowLayout {
MoneroComponents . LineEditMulti {
id: blockchainFolder
Layout.preferredWidth: 200
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
fontSize: 15
labelFontSize: 14
2018-07-18 13:19:45 +00:00
property string style: "<style type='text/css'>a {cursor:pointer;text-decoration: none; color: #FF6C3C}</style>"
2019-12-08 21:06:31 +00:00
labelText: qsTr ( "Blockchain location" ) + style + " <a href='#'> (%1)</a>" . arg ( qsTr ( "Change" ) ) + translationManager . emptyString
2020-03-02 10:35:36 +00:00
labelButtonText: qsTr ( "Reset" ) + translationManager . emptyString
labelButtonVisible: text
2018-07-18 13:19:45 +00:00
placeholderText: qsTr ( "(default)" ) + translationManager . emptyString
2019-04-25 19:09:23 +00:00
placeholderFontSize: 15
2019-09-01 00:38:03 +00:00
readOnly: true
2020-03-02 10:35:36 +00:00
text: persistentSettings . blockchainDataDir
2018-07-18 13:19:45 +00:00
addressValidation: false
onInputLabelLinkActivated: {
//mouse.accepted = false
if ( persistentSettings . blockchainDataDir !== "" ) {
blockchainFileDialog . folder = "file://" + persistentSettings . blockchainDataDir ;
}
blockchainFileDialog . open ( ) ;
blockchainFolder . focus = true ;
}
2020-03-02 10:35:36 +00:00
onLabelButtonClicked: persistentSettings . blockchainDataDir = ""
2018-07-18 13:19:45 +00:00
}
}
2019-01-30 14:13:30 +00:00
MoneroComponents . LineEditMulti {
id: daemonFlags
Layout.fillWidth: true
2019-04-25 19:09:23 +00:00
labelFontSize: 14
fontSize: 15
2019-01-30 14:13:30 +00:00
wrapMode: Text . WrapAnywhere
labelText: qsTr ( "Daemon startup flags" ) + translationManager . emptyString
placeholderText: qsTr ( "(optional)" ) + translationManager . emptyString
2019-04-25 19:09:23 +00:00
placeholderFontSize: 15
2019-01-30 14:13:30 +00:00
text: persistentSettings . daemonFlags
addressValidation: false
2021-03-19 10:28:26 +00:00
error: text . match ( /(^|\s)--(data-dir|bootstrap-daemon-address|non-interactive)/ )
2020-04-27 13:13:38 +00:00
onEditingFinished: {
if ( ! daemonFlags . error ) {
persistentSettings . daemonFlags = daemonFlags . text ;
}
}
2018-07-18 13:19:45 +00:00
}
RowLayout {
2019-09-05 22:11:12 +00:00
visible: ! persistentSettings . useRemoteNode
2018-07-18 13:19:45 +00:00
ColumnLayout {
Layout.fillWidth: true
MoneroComponents . RemoteNodeEdit {
id: bootstrapNodeEdit
2019-04-25 19:09:23 +00:00
Layout.minimumWidth: 100
Layout.bottomMargin: 20
2018-07-18 13:19:45 +00:00
2020-05-09 17:31:36 +00:00
daemonAddrLabelText: qsTr ( "Bootstrap Address" ) + translationManager . emptyString
daemonPortLabelText: qsTr ( "Bootstrap Port" ) + translationManager . emptyString
2020-07-02 13:29:27 +00:00
initialAddress: persistentSettings . bootstrapNodeAddress
2018-07-18 13:19:45 +00:00
onEditingFinished: {
2019-09-27 15:48:04 +00:00
if ( daemonAddrText == "auto" ) {
persistentSettings . bootstrapNodeAddress = daemonAddrText ;
} else {
persistentSettings . bootstrapNodeAddress = daemonAddrText ? bootstrapNodeEdit . getAddress ( ) : "" ;
}
2018-07-18 13:19:45 +00:00
console . log ( "setting bootstrap node to " + persistentSettings . bootstrapNodeAddress )
}
}
}
}
2021-04-03 10:45:02 +00:00
}
2018-07-18 13:19:45 +00:00
}
}