1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-24 02:23:45 +01:00

LeftPanel: drop Advanced submenu items, use NavBar instead

This commit is contained in:
xiphon 2021-03-20 09:12:15 +00:00
parent 34df4e74d4
commit 7c881d0100
9 changed files with 167 additions and 161 deletions

View File

@ -58,12 +58,9 @@ Rectangle {
signal historyClicked()
signal transferClicked()
signal receiveClicked()
signal txkeyClicked()
signal sharedringdbClicked()
signal advancedClicked()
signal settingsClicked()
signal addressBookClicked()
signal miningClicked()
signal signClicked()
signal accountClicked()
function selectItem(pos) {
@ -72,10 +69,6 @@ Rectangle {
else if(pos === "Transfer") menuColumn.previousButton = transferButton
else if(pos === "Receive") menuColumn.previousButton = receiveButton
else if(pos === "AddressBook") menuColumn.previousButton = addressBookButton
else if(pos === "Mining") menuColumn.previousButton = miningButton
else if(pos === "TxKey") menuColumn.previousButton = txkeyButton
else if(pos === "SharedRingDB") menuColumn.previousButton = sharedringdbButton
else if(pos === "Sign") menuColumn.previousButton = signButton
else if(pos === "Settings") menuColumn.previousButton = settingsButton
else if(pos === "Advanced") menuColumn.previousButton = advancedButton
else if(pos === "Account") menuColumn.previousButton = accountButton
@ -480,6 +473,7 @@ Rectangle {
onClicked: {
parent.previousButton.checked = false
parent.previousButton = advancedButton
panel.advancedClicked()
}
}
@ -490,98 +484,6 @@ Rectangle {
anchors.leftMargin: 20
}
// ------------- Mining tab ---------------
MoneroComponents.MenuButton {
id: miningButton
visible: !isAndroid && !isIOS && appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Mining") + translationManager.emptyString
symbol: qsTr("M") + translationManager.emptyString
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = miningButton
panel.miningClicked()
}
}
MoneroComponents.MenuButtonDivider {
visible: miningButton.present && appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 20
}
// ------------- TxKey tab ---------------
MoneroComponents.MenuButton {
id: txkeyButton
visible: appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Prove/check") + translationManager.emptyString
symbol: qsTr("K") + translationManager.emptyString
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = txkeyButton
panel.txkeyClicked()
}
}
MoneroComponents.MenuButtonDivider {
visible: txkeyButton.present && appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 20
}
// ------------- Shared RingDB tab ---------------
MoneroComponents.MenuButton {
id: sharedringdbButton
visible: appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Shared RingDB") + translationManager.emptyString
symbol: qsTr("G") + translationManager.emptyString
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = sharedringdbButton
panel.sharedringdbClicked()
}
}
MoneroComponents.MenuButtonDivider {
visible: sharedringdbButton.present && appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 20
}
// ------------- Sign/verify tab ---------------
MoneroComponents.MenuButton {
id: signButton
visible: appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Sign/verify") + translationManager.emptyString
symbol: qsTr("I") + translationManager.emptyString
under: advancedButton
onClicked: {
parent.previousButton.checked = false
parent.previousButton = signButton
panel.signClicked()
}
}
MoneroComponents.MenuButtonDivider {
visible: signButton.present && appWindow.walletMode >= 2
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 20
}
// ------------- Settings tab ---------------
MoneroComponents.MenuButton {
id: settingsButton

View File

@ -56,12 +56,9 @@ Rectangle {
}
property Receive receiveView: Receive { }
property Merchant merchantView: Merchant { }
property TxKey txkeyView: TxKey { }
property SharedRingDB sharedringdbView: SharedRingDB { }
property History historyView: History { }
property Sign signView: Sign { }
property Advanced advancedView: Advanced { }
property Settings settingsView: Settings { }
property Mining miningView: Mining { }
property AddressBook addressBookView: AddressBook { }
property Keys keysView: Keys { }
property Account accountView: Account { }
@ -136,30 +133,18 @@ Rectangle {
name: "Merchant"
PropertyChanges { target: root; currentView: merchantView }
PropertyChanges { target: mainFlickable; contentHeight: merchantView.merchantHeight + 80 }
}, State {
name: "TxKey"
PropertyChanges { target: root; currentView: txkeyView }
PropertyChanges { target: mainFlickable; contentHeight: txkeyView.txkeyHeight + 80 }
}, State {
name: "SharedRingDB"
PropertyChanges { target: root; currentView: sharedringdbView }
PropertyChanges { target: mainFlickable; contentHeight: sharedringdbView.panelHeight + 80 }
}, State {
name: "AddressBook"
PropertyChanges { target: root; currentView: addressBookView }
PropertyChanges { target: mainFlickable; contentHeight: addressBookView.addressbookHeight + 80 }
}, State {
name: "Sign"
PropertyChanges { target: root; currentView: signView }
PropertyChanges { target: mainFlickable; contentHeight: signView.signHeight + 80 }
name: "Advanced"
PropertyChanges { target: root; currentView: advancedView }
PropertyChanges { target: mainFlickable; contentHeight: advancedView.panelHeight }
}, State {
name: "Settings"
PropertyChanges { target: root; currentView: settingsView }
PropertyChanges { target: mainFlickable; contentHeight: settingsView.settingsHeight }
}, State {
name: "Mining"
PropertyChanges { target: root; currentView: miningView }
PropertyChanges { target: mainFlickable; contentHeight: miningView.miningHeight + 80 }
}, State {
name: "Keys"
PropertyChanges { target: root; currentView: keysView }
@ -168,7 +153,7 @@ Rectangle {
name: "Account"
PropertyChanges { target: root; currentView: accountView }
PropertyChanges { target: mainFlickable; contentHeight: accountView.accountHeight + 80 }
}
}
]
ColumnLayout {

View File

@ -143,12 +143,8 @@ ApplicationWindow {
if(seq === "Ctrl+S") middlePanel.state = "Transfer"
else if(seq === "Ctrl+R") middlePanel.state = "Receive"
else if(seq === "Ctrl+K") middlePanel.state = "TxKey"
else if(seq === "Ctrl+H") middlePanel.state = "History"
else if(seq === "Ctrl+B") middlePanel.state = "AddressBook"
else if(seq === "Ctrl+M") middlePanel.state = "Mining"
else if(seq === "Ctrl+I") middlePanel.state = "Sign"
else if(seq === "Ctrl+G") middlePanel.state = "SharedRingDB"
else if(seq === "Ctrl+E") middlePanel.state = "Settings"
else if(seq === "Ctrl+D") middlePanel.state = "Advanced"
else if(seq === "Ctrl+T") middlePanel.state = "Account"
@ -168,11 +164,8 @@ ApplicationWindow {
else if(middlePanel.state === "Transfer") middlePanel.state = "AddressBook"
else if(middlePanel.state === "AddressBook") middlePanel.state = "Receive"
else if(middlePanel.state === "Receive") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "TxKey"
else if(middlePanel.state === "TxKey") middlePanel.state = "SharedRingDB"
else if(middlePanel.state === "SharedRingDB") middlePanel.state = "Sign"
else if(middlePanel.state === "Sign") middlePanel.state = "Settings"
else if(middlePanel.state === "History") middlePanel.state = "Advanced"
else if(middlePanel.state === "Advanced") middlePanel.state = "Settings"
} else if(seq === "Ctrl+Shift+Backtab" || seq === "Alt+Shift+Backtab") {
/*
if(middlePanel.state === "Settings") middlePanel.state = "Sign"
@ -184,11 +177,8 @@ ApplicationWindow {
else if(middlePanel.state === "TxKey") middlePanel.state = "Receive"
else if(middlePanel.state === "Receive") middlePanel.state = "Transfer"
*/
if(middlePanel.state === "Settings") middlePanel.state = "Sign"
else if(middlePanel.state === "Sign") middlePanel.state = "SharedRingDB"
else if(middlePanel.state === "SharedRingDB") middlePanel.state = "TxKey"
else if(middlePanel.state === "TxKey") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "History"
if(middlePanel.state === "Settings") middlePanel.state = "Advanced"
else if(middlePanel.state === "Advanced") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "Receive"
else if(middlePanel.state === "Receive") middlePanel.state = "AddressBook"
else if(middlePanel.state === "AddressBook") middlePanel.state = "Transfer"
@ -499,7 +489,7 @@ ApplicationWindow {
walletInitialized = true
// check if daemon was already mining and add mining logo if true
middlePanel.miningView.update();
middlePanel.advancedView.miningView.update();
}
}
@ -1692,18 +1682,6 @@ ApplicationWindow {
updateBalance();
}
onTxkeyClicked: {
middlePanel.state = "TxKey";
middlePanel.flickable.contentY = 0;
updateBalance();
}
onSharedringdbClicked: {
middlePanel.state = "SharedRingDB";
middlePanel.flickable.contentY = 0;
updateBalance();
}
onHistoryClicked: {
middlePanel.state = "History";
middlePanel.flickable.contentY = 0;
@ -1716,14 +1694,8 @@ ApplicationWindow {
updateBalance();
}
onMiningClicked: {
middlePanel.state = "Mining";
middlePanel.flickable.contentY = 0;
updateBalance();
}
onSignClicked: {
middlePanel.state = "Sign";
onAdvancedClicked: {
middlePanel.state = "Advanced";
middlePanel.flickable.contentY = 0;
updateBalance();
}

148
pages/Advanced.qml Normal file
View File

@ -0,0 +1,148 @@
// Copyright (c) 2021, 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.
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import "../components" as MoneroComponents
import "."
ColumnLayout {
id: root
Layout.fillWidth: true
Layout.preferredHeight: 900
spacing: 0
property int panelHeight: 900
property alias miningView: stateView.miningView
property alias state: stateView.state
MoneroComponents.Navbar {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: height
Layout.bottomMargin: height
MoneroComponents.NavbarItem {
active: state == "Mining"
text: qsTr("Mining") + translationManager.emptyString
onSelected: state = "Mining"
}
MoneroComponents.NavbarItem {
active: state == "Prove"
text: qsTr("Prove/check") + translationManager.emptyString
onSelected: state = "Prove"
}
MoneroComponents.NavbarItem {
active: state == "SharedRingDB"
text: qsTr("Shared RingDB") + translationManager.emptyString
onSelected: state = "SharedRingDB"
}
MoneroComponents.NavbarItem {
active: state == "Sign"
text: qsTr("Sign/verify") + translationManager.emptyString
onSelected: state = "Sign"
}
}
Rectangle{
id: stateView
property Item currentView
property Item previousView
property Mining miningView: Mining { }
property TxKey prooveView: TxKey { }
property SharedRingDB sharedRingDBView: SharedRingDB { }
property Sign signView: Sign { }
Layout.fillWidth: true
Layout.preferredHeight: panelHeight
color: "transparent"
state: "Mining"
onCurrentViewChanged: {
if (previousView) {
if (typeof previousView.onPageClosed === "function") {
previousView.onPageClosed();
}
}
previousView = currentView
if (currentView) {
stackView.replace(currentView)
if (typeof currentView.onPageCompleted === "function") {
currentView.onPageCompleted();
}
}
}
states: [
State {
name: "Mining"
PropertyChanges { target: stateView; currentView: stateView.miningView }
PropertyChanges { target: root; panelHeight: stateView.miningView.miningHeight + 140 }
}, State {
name: "Prove"
PropertyChanges { target: stateView; currentView: stateView.prooveView }
PropertyChanges { target: root; panelHeight: stateView.prooveView.txkeyHeight + 140 }
}, State {
name: "SharedRingDB"
PropertyChanges { target: stateView; currentView: stateView.sharedRingDBView }
PropertyChanges { target: root; panelHeight: stateView.sharedRingDBView.panelHeight + 140 }
}, State {
name: "Sign"
PropertyChanges { target: stateView; currentView: stateView.signView }
PropertyChanges { target: root; panelHeight: stateView.signView.signHeight + 140 }
}
]
StackView {
id: stackView
initialItem: stateView.miningView
anchors.fill: parent
clip: false // otherwise animation will affect left panel
delegate: StackViewDelegate {
pushTransition: StackViewTransition {
PropertyAnimation {
target: enterItem
property: "x"
from: 0 - target.width
to: 0
duration: 300
easing.type: Easing.OutCubic
}
PropertyAnimation {
target: exitItem
property: "x"
from: 0
to: target.width
duration: 300
easing.type: Easing.OutCubic
}
}
}
}
}
}

View File

@ -42,7 +42,7 @@ Rectangle {
id: mainLayout
Layout.fillWidth: true
anchors.margins: 20
anchors.topMargin: 40
anchors.topMargin: 0
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right

View File

@ -81,8 +81,7 @@ Rectangle {
id: mainLayout
Layout.fillWidth: true
anchors.margins: 20
anchors.topMargin: 40
anchors.topMargin: 0
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right

View File

@ -89,8 +89,7 @@ Rectangle {
id: mainLayout
Layout.fillWidth: true
anchors.margins: 20
anchors.topMargin: 40
anchors.topMargin: 0
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right

View File

@ -46,7 +46,7 @@ Rectangle {
ColumnLayout {
id: mainLayout
anchors.margins: 20
anchors.topMargin: 40
anchors.topMargin: 0
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right

View File

@ -17,6 +17,7 @@
<file>monero/utils/gpg_keys/fluffypony.asc</file>
<file>monero/utils/gpg_keys/luigi1111.asc</file>
<file>pages/Account.qml</file>
<file>pages/Advanced.qml</file>
<file>pages/Transfer.qml</file>
<file>pages/History.qml</file>
<file>pages/AddressBook.qml</file>