aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-10-02 23:54:05 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-10-10 00:15:17 +0300
commit56c3579501f5d9f477b075d56d38baad58b468e6 (patch)
tree436cf32b862556165381ea56c0a90c2c04ff4897
parent0ff3fd32122a22d7c56a289faa6402351f425873 (diff)
downloadmonzero-gui-56c3579501f5d9f477b075d56d38baad58b468e6.tar.gz
monzero-gui-56c3579501f5d9f477b075d56d38baad58b468e6.tar.xz
monzero-gui-56c3579501f5d9f477b075d56d38baad58b468e6.zip
Replaced Loader with StackView; Fixed payment id generation
-rw-r--r--MiddlePanel.qml115
-rw-r--r--pages/Receive.qml9
2 files changed, 72 insertions, 52 deletions
diff --git a/MiddlePanel.qml b/MiddlePanel.qml
index 2a117081..43fbed47 100644
--- a/MiddlePanel.qml
+++ b/MiddlePanel.qml
@@ -30,37 +30,74 @@ import QtQuick 2.2
import QtQml 2.0
import QtQuick.Controls 2.0
import QtGraphicalEffects 1.0
+import "pages"
Rectangle {
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"
signal paymentClicked(string address, string paymentId, double amount, int mixinCount, int priority)
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: [
+// 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: [
+ State {
+ name: "Dashboard"
+ PropertyChanges { }
+ }, State {
+ name: "History"
+ PropertyChanges { target: root; currentView: historyView }
+ }, State {
+ name: "Transfer"
+ PropertyChanges { target: root; currentView: transferView }
+ }, State {
+ name: "Receive"
+ PropertyChanges { target: root; currentView: receiveView }
+ }, State {
+ name: "AddressBook"
+ PropertyChanges { /*TODO*/ }
+ }, State {
+ name: "Settings"
+ PropertyChanges { /*TODO*/ }
+ }, State {
+ name: "Mining"
+ PropertyChanges { /*TODO*/ }
+ }
+ ]
Row {
id: styledRow
@@ -75,34 +112,18 @@ Rectangle {
Rectangle { height: 4; width: parent.width / 5; color: "#FF4F41" }
}
-
-
- // TODO: replace loader with StackView
-
-// StackView {
-// id: stackView
-// 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);
- }
-
+ StackView {
+ id: stackView
+ initialItem: transferView
+ anchors.fill: parent
+ anchors.margins: 4
+ clip: true // otherwise animation will affect left panel
}
/* connect "payment" click */
Connections {
ignoreUnknownSignals: false
- target: loader.item
+ target: transferView
onPaymentClicked : {
console.log("MiddlePanel: paymentClicked")
paymentClicked(address, paymentId, amount, mixinCount, priority)
diff --git a/pages/Receive.qml b/pages/Receive.qml
index 208cf25a..18486d34 100644
--- a/pages/Receive.qml
+++ b/pages/Receive.qml
@@ -43,14 +43,13 @@ Rectangle {
function updatePaymentId() {
var payment_id = appWindow.persistentSettings.payment_id
- if (payment_id.length === 0) {
- payment_id = appWindow.wallet.generatePaymentId()
+ if (typeof appWindow.currentWallet !== 'undefined') {
+ payment_id = appWindow.currentWallet.generatePaymentId()
appWindow.persistentSettings.payment_id = payment_id
- appWindow.currentWallet.payment_id = payment_id
+ addressLine.text = appWindow.currentWallet.address
+ integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id)
}
paymentIdLine.text = payment_id
- addressLine.text = appWindow.currentWallet.address
- integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id)
}
Clipboard { id: clipboard }