diff --git a/BasicPanel.qml b/BasicPanel.qml
index 20a07d64..5698316f 100644
--- a/BasicPanel.qml
+++ b/BasicPanel.qml
@@ -35,6 +35,8 @@ Rectangle {
color: "#F0EEEE"
border.width: 1
border.color: "#DBDBDB"
+ property alias balanceText : balanceText.text;
+ property alias unlockedBalanceText : availableBalanceText.text;
Rectangle {
id: header
@@ -63,6 +65,7 @@ Rectangle {
columns: 3
Text {
+
width: 116
height: 20
font.family: "Arial"
diff --git a/LeftPanel.qml b/LeftPanel.qml
index 6bd400a8..1eddf019 100644
--- a/LeftPanel.qml
+++ b/LeftPanel.qml
@@ -31,6 +31,10 @@ import "components"
Rectangle {
id: panel
+
+ property alias unlockedBalanceText: unlockedBalanceText.text
+ property alias balanceText: balanceText.text
+
signal dashboardClicked()
signal historyClicked()
signal transferClicked()
@@ -90,7 +94,7 @@ Rectangle {
spacing: 6
Label {
- text: qsTr("Locked balance")
+ text: qsTr("Balance")
anchors.left: parent.left
anchors.leftMargin: 50
tipText: qsTr("Test tip 1
line 2")
@@ -109,11 +113,12 @@ Rectangle {
}
Text {
+ id: balanceText
anchors.verticalCenter: parent.verticalCenter
font.family: "Arial"
font.pixelSize: 26
color: "#000000"
- text: "78.9239845"
+ text: "78.9245"
}
}
@@ -124,19 +129,20 @@ Rectangle {
}
Label {
- text: qsTr("Unlocked")
+ text: qsTr("Unlocked balance")
anchors.left: parent.left
anchors.leftMargin: 50
tipText: qsTr("Test tip 2
line 2")
}
Text {
+ id: unlockedBalanceText
anchors.left: parent.left
anchors.leftMargin: 50
font.family: "Arial"
font.pixelSize: 18
color: "#000000"
- text: "2324.9239845"
+ text: "2324.9245"
}
}
diff --git a/main.qml b/main.qml
index 0eb87b2e..3b79d1ec 100644
--- a/main.qml
+++ b/main.qml
@@ -30,7 +30,8 @@ import QtQuick 2.2
import QtQuick.Window 2.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
-
+import Qt.labs.settings 1.0
+import Bitmonero.Wallet 1.0
import "components"
import "wizard"
@@ -43,12 +44,16 @@ ApplicationWindow {
property bool ctrlPressed: false
property bool rightPanelExpanded: true
property bool osx: false
+ property alias persistentSettings : persistentSettings
+ property var wallet;
function altKeyReleased() { ctrlPressed = false; }
+
function showPageRequest(page) {
middlePanel.state = page
leftPanel.selectItem(page)
}
+
function sequencePressed(obj, seq) {
if(seq === undefined)
return
@@ -112,6 +117,37 @@ ApplicationWindow {
}
+
+ function initialize() {
+
+ if (typeof wizard.settings['wallet'] !== 'undefined') {
+ wallet = wizard.settings['wallet'];
+ } else {
+ var wallet_path = persistentSettings.wallet_path + "/" + persistentSettings.account_name + "/"
+ + persistentSettings.account_name;
+ console.log("opening wallet at: ", wallet_path);
+ // TODO: wallet password dialog
+ wallet = walletManager.openWallet(wallet_path, "", persistentSettings.testnet);
+ if (wallet.status !== Wallet.Status_Ok) {
+ console.log("Error opening wallet: ", wallet.errorString);
+ return;
+ }
+ console.log("Wallet opened successfully: ", wallet.errorString);
+ }
+
+ if (!wallet.init(persistentSettings.daemon_address, 0)) {
+ console.log("Error initialize wallet: ", wallet.errorString);
+ return
+ }
+ // TODO: refresh asynchronously without blocking UI, implement signal(s)
+ wallet.refresh();
+
+ console.log("wallet balance: ", wallet.balance)
+ leftPanel.unlockedBalanceText = walletManager.displayAmount(wallet.unlockedBalance);
+ leftPanel.balanceText = walletManager.displayAmount(wallet.balance);
+ }
+
+
function walletsFound() {
var wallets = walletManager.findWallets(moneroAccountsDir);
if (wallets.length === 0) {
@@ -133,6 +169,21 @@ ApplicationWindow {
y = (Screen.height - height) / 2
//
rootItem.state = walletsFound() ? "normal" : "wizard";
+ if (rootItem.state === "normal") {
+ initialize(persistentSettings)
+ }
+ }
+
+ Settings {
+ id: persistentSettings
+ property string language
+ property string account_name
+ property string wallet_path
+ property bool auto_donations_enabled : true
+ property int auto_donations_amount : 50
+ property bool allow_background_mining : true
+ property bool testnet: true
+ property string daemon_address: "localhost:38081"
}
Item {
@@ -344,7 +395,10 @@ ApplicationWindow {
WizardMain {
id: wizard
anchors.fill: parent
- onUseMoneroClicked: rootItem.state = "normal"
+ onUseMoneroClicked: {
+ rootItem.state = "normal" // TODO: listen for this state change in appWindow;
+ appWindow.initialize();
+ }
}
property int maxWidth: leftPanel.width + 655 + rightPanel.width
diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml
index 940243cb..3c4103ce 100644
--- a/wizard/WizardMain.qml
+++ b/wizard/WizardMain.qml
@@ -146,32 +146,33 @@ Rectangle {
settings['wallet_filename'] = new_wallet_filename;
// persist settings
- persistentSettings.language = settings.language
- persistentSettings.account_name = settings.account_name
- persistentSettings.wallet_path = settings.wallet_path
- persistentSettings.allow_background_mining = settings.allow_background_mining
- persistentSettings.auto_donations_enabled = settings.auto_donations_enabled
- persistentSettings.auto_donations_amount = settings.auto_donations_amount
+ appWindow.persistentSettings.language = settings.language
+ appWindow.persistentSettings.account_name = settings.account_name
+ appWindow.persistentSettings.wallet_path = settings.wallet_path
+ appWindow.persistentSettings.allow_background_mining = settings.allow_background_mining
+ appWindow.persistentSettings.auto_donations_enabled = settings.auto_donations_enabled
+ appWindow.persistentSettings.auto_donations_amount = settings.auto_donations_amount
}
// reading settings from persistent storage
Component.onCompleted: {
- settings['allow_background_mining'] = persistentSettings.allow_background_mining
- settings['auto_donations_enabled'] = persistentSettings.auto_donations_enabled
- settings['auto_donations_amount'] = persistentSettings.auto_donations_amount
+ console.log("rootItem: ", appWindow);
+ settings['allow_background_mining'] = appWindow.persistentSettings.allow_background_mining
+ settings['auto_donations_enabled'] = appWindow.persistentSettings.auto_donations_enabled
+ settings['auto_donations_amount'] = appWindow.persistentSettings.auto_donations_amount
}
- Settings {
- id: persistentSettings
+// Settings {
+// id: persistentSettings
- property string language
- property string account_name
- property string wallet_path
- property bool auto_donations_enabled : true
- property int auto_donations_amount : 50
- property bool allow_background_mining : true
- }
+// property string language
+// property string account_name
+// property string wallet_path
+// property bool auto_donations_enabled : true
+// property int auto_donations_amount : 50
+// property bool allow_background_mining : true
+// }
Rectangle {
id: nextButton
diff --git a/wizard/WizardPassword.qml b/wizard/WizardPassword.qml
index 6b14dae9..4825c02d 100644
--- a/wizard/WizardPassword.qml
+++ b/wizard/WizardPassword.qml
@@ -44,7 +44,9 @@ Item {
onOpacityChanged: visible = opacity !== 0
function onPageClosed(settingsObject) {
- settingsObject.wallet.setPassword(passwordItem.password)
+ // TODO: set password on the final page
+ // settingsObject.wallet.setPassword(passwordItem.password)
+ settingsObject['wallet_password'] = passwordItem.password
return true
}