mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-24 12:39:25 +00:00
Replaced Loader with StackView; Fixed payment id generation
This commit is contained in:
parent
0ff3fd3212
commit
56c3579501
2 changed files with 72 additions and 52 deletions
|
@ -30,35 +30,72 @@ import QtQuick 2.2
|
||||||
import QtQml 2.0
|
import QtQml 2.0
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
import "pages"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
property Transfer transferView: Transfer { }
|
||||||
|
property Receive receiveView: Receive { }
|
||||||
|
property History historyView: History { }
|
||||||
|
property Item currentView
|
||||||
|
|
||||||
|
onCurrentViewChanged: {
|
||||||
|
if (currentView) {
|
||||||
|
stackView.replace(currentView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
color: "#F0EEEE"
|
color: "#F0EEEE"
|
||||||
signal paymentClicked(string address, string paymentId, double amount, int mixinCount, int priority)
|
signal paymentClicked(string address, string paymentId, double amount, int mixinCount, int priority)
|
||||||
signal generatePaymentIdInvoked()
|
signal generatePaymentIdInvoked()
|
||||||
|
|
||||||
|
// states: [
|
||||||
|
// State {
|
||||||
|
// name: "Dashboard"
|
||||||
|
// PropertyChanges { target: loader; source: "pages/Dashboard.qml" }
|
||||||
|
// }, State {
|
||||||
|
// name: "History"
|
||||||
|
// PropertyChanges { target: loader; source: "pages/History.qml" }
|
||||||
|
// }, State {
|
||||||
|
// name: "Transfer"
|
||||||
|
// PropertyChanges { target: loader; source: "pages/Transfer.qml" }
|
||||||
|
// }, State {
|
||||||
|
// name: "Receive"
|
||||||
|
// PropertyChanges { target: loader; source: "pages/Receive.qml" }
|
||||||
|
// }, State {
|
||||||
|
// name: "AddressBook"
|
||||||
|
// PropertyChanges { target: loader; source: "pages/AddressBook.qml" }
|
||||||
|
// }, State {
|
||||||
|
// name: "Settings"
|
||||||
|
// PropertyChanges { target: loader; source: "pages/Settings.qml" }
|
||||||
|
// }, State {
|
||||||
|
// name: "Mining"
|
||||||
|
// PropertyChanges { target: loader; source: "pages/Mining.qml" }
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "Dashboard"
|
name: "Dashboard"
|
||||||
PropertyChanges { target: loader; source: "pages/Dashboard.qml" }
|
PropertyChanges { }
|
||||||
}, State {
|
}, State {
|
||||||
name: "History"
|
name: "History"
|
||||||
PropertyChanges { target: loader; source: "pages/History.qml" }
|
PropertyChanges { target: root; currentView: historyView }
|
||||||
}, State {
|
}, State {
|
||||||
name: "Transfer"
|
name: "Transfer"
|
||||||
PropertyChanges { target: loader; source: "pages/Transfer.qml" }
|
PropertyChanges { target: root; currentView: transferView }
|
||||||
}, State {
|
}, State {
|
||||||
name: "Receive"
|
name: "Receive"
|
||||||
PropertyChanges { target: loader; source: "pages/Receive.qml" }
|
PropertyChanges { target: root; currentView: receiveView }
|
||||||
}, State {
|
}, State {
|
||||||
name: "AddressBook"
|
name: "AddressBook"
|
||||||
PropertyChanges { target: loader; source: "pages/AddressBook.qml" }
|
PropertyChanges { /*TODO*/ }
|
||||||
}, State {
|
}, State {
|
||||||
name: "Settings"
|
name: "Settings"
|
||||||
PropertyChanges { target: loader; source: "pages/Settings.qml" }
|
PropertyChanges { /*TODO*/ }
|
||||||
}, State {
|
}, State {
|
||||||
name: "Mining"
|
name: "Mining"
|
||||||
PropertyChanges { target: loader; source: "pages/Mining.qml" }
|
PropertyChanges { /*TODO*/ }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -75,34 +112,18 @@ Rectangle {
|
||||||
Rectangle { height: 4; width: parent.width / 5; color: "#FF4F41" }
|
Rectangle { height: 4; width: parent.width / 5; color: "#FF4F41" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StackView {
|
||||||
|
id: stackView
|
||||||
// TODO: replace loader with StackView
|
initialItem: transferView
|
||||||
|
anchors.fill: parent
|
||||||
// StackView {
|
anchors.margins: 4
|
||||||
// id: stackView
|
clip: true // otherwise animation will affect left panel
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.right: parent.right
|
|
||||||
// anchors.top: styledRow.bottom
|
|
||||||
// anchors.bottom: parent.bottom
|
|
||||||
// }
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: loader
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: styledRow.bottom
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
onLoaded: {
|
|
||||||
console.log("Loaded " + item);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* connect "payment" click */
|
/* connect "payment" click */
|
||||||
Connections {
|
Connections {
|
||||||
ignoreUnknownSignals: false
|
ignoreUnknownSignals: false
|
||||||
target: loader.item
|
target: transferView
|
||||||
onPaymentClicked : {
|
onPaymentClicked : {
|
||||||
console.log("MiddlePanel: paymentClicked")
|
console.log("MiddlePanel: paymentClicked")
|
||||||
paymentClicked(address, paymentId, amount, mixinCount, priority)
|
paymentClicked(address, paymentId, amount, mixinCount, priority)
|
||||||
|
|
|
@ -43,15 +43,14 @@ Rectangle {
|
||||||
|
|
||||||
function updatePaymentId() {
|
function updatePaymentId() {
|
||||||
var payment_id = appWindow.persistentSettings.payment_id
|
var payment_id = appWindow.persistentSettings.payment_id
|
||||||
if (payment_id.length === 0) {
|
if (typeof appWindow.currentWallet !== 'undefined') {
|
||||||
payment_id = appWindow.wallet.generatePaymentId()
|
payment_id = appWindow.currentWallet.generatePaymentId()
|
||||||
appWindow.persistentSettings.payment_id = payment_id
|
appWindow.persistentSettings.payment_id = payment_id
|
||||||
appWindow.currentWallet.payment_id = payment_id
|
|
||||||
}
|
|
||||||
paymentIdLine.text = payment_id
|
|
||||||
addressLine.text = appWindow.currentWallet.address
|
addressLine.text = appWindow.currentWallet.address
|
||||||
integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id)
|
integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id)
|
||||||
}
|
}
|
||||||
|
paymentIdLine.text = payment_id
|
||||||
|
}
|
||||||
|
|
||||||
Clipboard { id: clipboard }
|
Clipboard { id: clipboard }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue