monero-gui/pages/settings/Navbar.qml

427 lines
16 KiB
QML
Raw Normal View History

2018-07-18 13:16:08 +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 13:16:08 +00:00
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import "../../js/Windows.js" as Windows
import "../../js/Utils.js" as Utils
import "../../components" as MoneroComponents
import "../../pages"
import "."
import moneroComponents.Clipboard 1.0
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 96
color: "transparent"
ColumnLayout {
spacing: 0
Layout.preferredHeight: 32
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
GridLayout {
id: grid
2019-01-07 15:59:14 +00:00
Layout.alignment: Qt.AlignHCenter
2018-07-18 13:16:08 +00:00
columnSpacing: 0
2019-04-11 01:17:29 +00:00
property string fontColorActive: MoneroComponents.Style.blackTheme ? "white" : "white"
property string fontColorInActive: MoneroComponents.Style.blackTheme ? "white" : MoneroComponents.Style.dimmedFontColor
2019-04-25 19:09:23 +00:00
property int fontSize: 15
2018-07-18 13:16:08 +00:00
property bool fontBold: true
property var fontFamily: MoneroComponents.Style.fontRegular.name
2019-04-11 01:17:29 +00:00
property string borderColor: MoneroComponents.Style.blackTheme ? "#808080" : "#B9B9B9"
property int textMargin: {
// left-right margins for a given cell
if(isMobile){
return 10;
} else if(appWindow.width < 890){
return 32;
} else {
return 64;
}
}
2019-04-11 01:17:29 +00:00
Rectangle {
// navbar left side border
id: navBarLeft
property bool isActive: settingsStateView.state === "Wallet"
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: 2
Layout.preferredHeight: 32
2019-04-11 01:17:29 +00:00
color: "transparent"
Rectangle {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: 1
height: parent.height - 2
color: grid.borderColor
}
ColumnLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 1
spacing: 0
Rectangle {
Layout.preferredHeight: 1
Layout.preferredWidth: 1
color: grid.borderColor
}
Rectangle {
Layout.fillHeight: true
width: 1
color: navBarLeft.isActive ? grid.borderColor : "transparent"
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.preferredWidth: 1
2018-07-18 13:16:08 +00:00
}
}
}
2019-04-11 01:17:29 +00:00
2018-07-18 13:16:08 +00:00
ColumnLayout {
// WALLET
id: navWallet
2019-04-11 01:17:29 +00:00
property bool isActive: settingsStateView.state === "Wallet"
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: navWalletText.width + grid.textMargin
2019-04-25 19:09:23 +00:00
Layout.minimumWidth: 72
2018-07-18 13:16:08 +00:00
Layout.preferredHeight: 32
spacing: 0
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
Rectangle {
2019-04-11 01:17:29 +00:00
color: parent.isActive ? grid.borderColor : "transparent"
2019-04-25 19:09:23 +00:00
height: 30
2018-07-18 13:16:08 +00:00
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
MoneroComponents.TextPlain {
2018-07-18 13:16:08 +00:00
id: navWalletText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.family: grid.fontFamily
font.pixelSize: grid.fontSize
font.bold: grid.fontBold
text: qsTr("Wallet") + translationManager.emptyString
2019-04-11 01:17:29 +00:00
color: navWallet.isActive ? grid.fontColorActive : grid.fontColorInActive
themeTransition: false
2018-07-18 13:16:08 +00:00
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { settingsStateView.state = "Wallet" }
}
2018-07-18 13:16:08 +00:00
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
}
Rectangle{
Layout.preferredWidth: 1
Layout.preferredHeight: 32
color: grid.borderColor
}
ColumnLayout {
// UI
id: navUI
2019-04-11 01:17:29 +00:00
property bool isActive: settingsStateView.state === "UI"
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: navUIText.width + grid.textMargin
Layout.preferredHeight: 32
2019-04-25 19:09:23 +00:00
Layout.minimumWidth: 72
2018-07-18 13:16:08 +00:00
spacing: 0
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
Rectangle {
2019-04-11 01:17:29 +00:00
color: parent.isActive ? grid.borderColor : "transparent"
2019-04-25 19:09:23 +00:00
height: 30
2018-07-18 13:16:08 +00:00
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
MoneroComponents.TextPlain {
2018-07-18 13:16:08 +00:00
id: navUIText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.family: grid.fontFamily
font.pixelSize: grid.fontSize
font.bold: grid.fontBold
text: qsTr("Interface") + translationManager.emptyString
2019-04-11 01:17:29 +00:00
color: navUI.isActive ? grid.fontColorActive : grid.fontColorInActive
themeTransition: false
2018-07-18 13:16:08 +00:00
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { settingsStateView.state = "UI" }
}
2018-07-18 13:16:08 +00:00
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
}
Rectangle{
Layout.preferredWidth: 1
Layout.preferredHeight: 32
color: grid.borderColor
}
ColumnLayout {
// NODE
id: navNode
2019-04-11 01:17:29 +00:00
property bool isActive: settingsStateView.state === "Node"
2019-01-14 00:02:44 +00:00
visible: appWindow.walletMode >= 2
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: navNodeText.width + grid.textMargin
Layout.preferredHeight: 32
2019-04-25 19:09:23 +00:00
Layout.minimumWidth: 72
2018-07-18 13:16:08 +00:00
spacing: 0
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
Rectangle {
2019-04-11 01:17:29 +00:00
color: parent.isActive ? grid.borderColor : "transparent"
2019-04-25 19:09:23 +00:00
height: 30
2018-07-18 13:16:08 +00:00
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
MoneroComponents.TextPlain {
2018-07-18 13:16:08 +00:00
id: navNodeText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.family: grid.fontFamily
font.pixelSize: grid.fontSize
font.bold: grid.fontBold
text: qsTr("Node") + translationManager.emptyString
2019-04-11 01:17:29 +00:00
color: navNode.isActive ? grid.fontColorActive : grid.fontColorInActive
themeTransition: false
2018-07-18 13:16:08 +00:00
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { settingsStateView.state = "Node" }
}
2018-07-18 13:16:08 +00:00
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
}
Rectangle{
2019-01-14 00:02:44 +00:00
visible: appWindow.walletMode >= 2
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: 1
Layout.preferredHeight: 32
color: grid.borderColor
}
ColumnLayout {
// LOG
id: navLog
2019-04-11 01:17:29 +00:00
property bool isActive: settingsStateView.state === "Log"
2019-01-14 00:02:44 +00:00
visible: appWindow.walletMode >= 2
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: navLogText.width + grid.textMargin
Layout.preferredHeight: 32
2019-04-25 19:09:23 +00:00
Layout.minimumWidth: 72
2018-07-18 13:16:08 +00:00
spacing: 0
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
Rectangle {
2019-04-11 01:17:29 +00:00
color: parent.isActive ? grid.borderColor : "transparent"
2019-04-25 19:09:23 +00:00
height: 30
2018-07-18 13:16:08 +00:00
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
MoneroComponents.TextPlain {
2018-07-18 13:16:08 +00:00
id: navLogText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.family: grid.fontFamily
font.pixelSize: grid.fontSize
font.bold: grid.fontBold
text: qsTr("Log") + translationManager.emptyString
2019-04-11 01:17:29 +00:00
color: navLog.isActive ? grid.fontColorActive : grid.fontColorInActive
themeTransition: false
2018-07-18 13:16:08 +00:00
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { settingsStateView.state = "Log" }
}
2018-07-18 13:16:08 +00:00
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
}
Rectangle{
2019-01-14 00:02:44 +00:00
visible: appWindow.walletMode >= 2
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: 1
Layout.preferredHeight: 32
color: grid.borderColor
}
ColumnLayout {
// INFO
id: navInfo
2019-04-11 01:17:29 +00:00
property bool isActive: settingsStateView.state === "Info"
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: navInfoText.width + grid.textMargin
Layout.preferredHeight: 32
2019-04-25 19:09:23 +00:00
Layout.minimumWidth: 72
2018-07-18 13:16:08 +00:00
spacing: 0
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
Rectangle {
2019-04-11 01:17:29 +00:00
color: parent.isActive ? grid.borderColor : "transparent"
2019-04-25 19:09:23 +00:00
height: 30
2018-07-18 13:16:08 +00:00
Layout.fillWidth: true
2019-04-11 01:17:29 +00:00
MoneroComponents.TextPlain {
2018-07-18 13:16:08 +00:00
id: navInfoText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.family: grid.fontFamily
font.pixelSize: grid.fontSize
font.bold: grid.fontBold
text: qsTr("Info") + translationManager.emptyString
2019-04-11 01:17:29 +00:00
color: navInfo.isActive ? grid.fontColorActive : grid.fontColorInActive
themeTransition: false
2018-07-18 13:16:08 +00:00
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { settingsStateView.state = "Info" }
}
2018-07-18 13:16:08 +00:00
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.fillWidth: true
}
}
2019-04-11 01:17:29 +00:00
Rectangle {
// navbar right side border
id: navBarRight
property bool isActive: settingsStateView.state === "Info"
2018-07-18 13:16:08 +00:00
Layout.preferredWidth: 2
Layout.preferredHeight: 32
2019-04-11 01:17:29 +00:00
color: "transparent"
2018-07-18 13:16:08 +00:00
rotation: 180
2019-04-11 01:17:29 +00:00
Rectangle {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: 1
height: parent.height - 2
color: grid.borderColor
}
ColumnLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 1
spacing: 0
Rectangle {
Layout.preferredHeight: 1
Layout.preferredWidth: 1
color: grid.borderColor
}
Rectangle {
Layout.fillHeight: true
width: 1
color: navBarRight.isActive ? grid.borderColor : "transparent"
}
Rectangle {
color: grid.borderColor
Layout.preferredHeight: 1
Layout.preferredWidth: 1
}
}
2018-07-18 13:16:08 +00:00
}
2019-04-11 01:17:29 +00:00
2018-07-18 13:16:08 +00:00
Rectangle {
color: "transparent"
Layout.fillWidth: true
}
}
}
}