Merge pull request #3361

7c881d0 LeftPanel: drop Advanced submenu items, use NavBar instead (xiphon)
This commit is contained in:
luigi1111 2021-03-30 14:06:30 -04:00
commit a17b88d80a
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
9 changed files with 167 additions and 161 deletions

View file

@ -58,12 +58,9 @@ Rectangle {
signal historyClicked() signal historyClicked()
signal transferClicked() signal transferClicked()
signal receiveClicked() signal receiveClicked()
signal txkeyClicked() signal advancedClicked()
signal sharedringdbClicked()
signal settingsClicked() signal settingsClicked()
signal addressBookClicked() signal addressBookClicked()
signal miningClicked()
signal signClicked()
signal accountClicked() signal accountClicked()
function selectItem(pos) { function selectItem(pos) {
@ -72,10 +69,6 @@ Rectangle {
else if(pos === "Transfer") menuColumn.previousButton = transferButton else if(pos === "Transfer") menuColumn.previousButton = transferButton
else if(pos === "Receive") menuColumn.previousButton = receiveButton else if(pos === "Receive") menuColumn.previousButton = receiveButton
else if(pos === "AddressBook") menuColumn.previousButton = addressBookButton 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 === "Settings") menuColumn.previousButton = settingsButton
else if(pos === "Advanced") menuColumn.previousButton = advancedButton else if(pos === "Advanced") menuColumn.previousButton = advancedButton
else if(pos === "Account") menuColumn.previousButton = accountButton else if(pos === "Account") menuColumn.previousButton = accountButton
@ -480,6 +473,7 @@ Rectangle {
onClicked: { onClicked: {
parent.previousButton.checked = false parent.previousButton.checked = false
parent.previousButton = advancedButton parent.previousButton = advancedButton
panel.advancedClicked()
} }
} }
@ -490,98 +484,6 @@ Rectangle {
anchors.leftMargin: 20 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 --------------- // ------------- Settings tab ---------------
MoneroComponents.MenuButton { MoneroComponents.MenuButton {
id: settingsButton id: settingsButton

View file

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

View file

@ -143,12 +143,8 @@ ApplicationWindow {
if(seq === "Ctrl+S") middlePanel.state = "Transfer" if(seq === "Ctrl+S") middlePanel.state = "Transfer"
else if(seq === "Ctrl+R") middlePanel.state = "Receive" 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+H") middlePanel.state = "History"
else if(seq === "Ctrl+B") middlePanel.state = "AddressBook" 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+E") middlePanel.state = "Settings"
else if(seq === "Ctrl+D") middlePanel.state = "Advanced" else if(seq === "Ctrl+D") middlePanel.state = "Advanced"
else if(seq === "Ctrl+T") middlePanel.state = "Account" 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 === "Transfer") middlePanel.state = "AddressBook"
else if(middlePanel.state === "AddressBook") middlePanel.state = "Receive" else if(middlePanel.state === "AddressBook") middlePanel.state = "Receive"
else if(middlePanel.state === "Receive") middlePanel.state = "History" else if(middlePanel.state === "Receive") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "Mining" else if(middlePanel.state === "History") middlePanel.state = "Advanced"
else if(middlePanel.state === "Mining") middlePanel.state = "TxKey" else if(middlePanel.state === "Advanced") middlePanel.state = "Settings"
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(seq === "Ctrl+Shift+Backtab" || seq === "Alt+Shift+Backtab") { } else if(seq === "Ctrl+Shift+Backtab" || seq === "Alt+Shift+Backtab") {
/* /*
if(middlePanel.state === "Settings") middlePanel.state = "Sign" if(middlePanel.state === "Settings") middlePanel.state = "Sign"
@ -184,11 +177,8 @@ ApplicationWindow {
else if(middlePanel.state === "TxKey") middlePanel.state = "Receive" else if(middlePanel.state === "TxKey") middlePanel.state = "Receive"
else if(middlePanel.state === "Receive") middlePanel.state = "Transfer" else if(middlePanel.state === "Receive") middlePanel.state = "Transfer"
*/ */
if(middlePanel.state === "Settings") middlePanel.state = "Sign" if(middlePanel.state === "Settings") middlePanel.state = "Advanced"
else if(middlePanel.state === "Sign") middlePanel.state = "SharedRingDB" else if(middlePanel.state === "Advanced") middlePanel.state = "History"
else if(middlePanel.state === "SharedRingDB") middlePanel.state = "TxKey"
else if(middlePanel.state === "TxKey") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "Receive" else if(middlePanel.state === "History") middlePanel.state = "Receive"
else if(middlePanel.state === "Receive") middlePanel.state = "AddressBook" else if(middlePanel.state === "Receive") middlePanel.state = "AddressBook"
else if(middlePanel.state === "AddressBook") middlePanel.state = "Transfer" else if(middlePanel.state === "AddressBook") middlePanel.state = "Transfer"
@ -499,7 +489,7 @@ ApplicationWindow {
walletInitialized = true walletInitialized = true
// check if daemon was already mining and add mining logo if 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(); updateBalance();
} }
onTxkeyClicked: {
middlePanel.state = "TxKey";
middlePanel.flickable.contentY = 0;
updateBalance();
}
onSharedringdbClicked: {
middlePanel.state = "SharedRingDB";
middlePanel.flickable.contentY = 0;
updateBalance();
}
onHistoryClicked: { onHistoryClicked: {
middlePanel.state = "History"; middlePanel.state = "History";
middlePanel.flickable.contentY = 0; middlePanel.flickable.contentY = 0;
@ -1716,14 +1694,8 @@ ApplicationWindow {
updateBalance(); updateBalance();
} }
onMiningClicked: { onAdvancedClicked: {
middlePanel.state = "Mining"; middlePanel.state = "Advanced";
middlePanel.flickable.contentY = 0;
updateBalance();
}
onSignClicked: {
middlePanel.state = "Sign";
middlePanel.flickable.contentY = 0; middlePanel.flickable.contentY = 0;
updateBalance(); 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 id: mainLayout
Layout.fillWidth: true Layout.fillWidth: true
anchors.margins: 20 anchors.margins: 20
anchors.topMargin: 40 anchors.topMargin: 0
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right

View file

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

View file

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

View file

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

View file

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