Merge pull request #217

3752ec7 send page: check daemon status after every refresh (Jaquee)
01549a3 walletManager: coding conventions (Jaquee)
0ae3d67 daemon console -> log + adjusted height (Jaquee)
0e8cd14 Wallet: add m_initialized (Jaquee)
c7232e1 set wallet connection status before querying sync status (Jaquee)
3f8e05d Wallet: Cache connection status query (Jaquee)
36a6b89 connect onWalletConnectionStatusChanged() (Jaquee)
93a8200 Transfer: new connectionStatus handling + show status msg (Jaquee)
76e6ae8 remove reference to old pw-dialog (Jaquee)
18b7a67 Wallet: add connectionStatusChanged signal (Jaquee)
d9f4ab4 daemonManager: wait for daemon stop on app close (Jaquee)
f62bb68 daemonManagerDialog: use new ConnectionStatus enum (Jaquee)
dd01f59 hide daemon sync progress after disconnecting wallet (Jaquee)
8d19a03 DaemonManager: add stateChanged() (Jaquee)
760e01b daemonManagerDialog: show processdialog when starting (Jaquee)
bb881d9 show processingSplash when starting/stopping daemon (Jaquee)
8361dda resolve rebase conflict (Jaquee)
8dfa79e Shutdown daemon and close wallet properly on app exit (Jaquee)
7876957 DaemonManager::closing() (Jacob Brydolf)
065b060 main: debug messages (Jacob Brydolf)
b4eb489 DaemonManager: forward command line arguments to monerod (Jacob Brydolf)
752ff26 forward command line arguments to DaemonManager (Jaquee)
7840dab DaemonManager: console debug output (Jacob Brydolf)
14a5bd5 settings: added daemon console (Jacob Brydolf)
b53ef00 history tx details: resized popup (Jacob Brydolf)
b4f29b2 StandardDialog: changed default sizes (Jacob Brydolf)
5855700 daemonManagerDialog: added starting signal (Jacob Brydolf)
3a43154 DaemonManager: added console updated signals (Jacob Brydolf)
3df9e44 DaemonManager: windows support (Jacob Brydolf)
5da9f8f standardDialog: close window before continue (Jacob Brydolf)
5a110f4 replace message dialog with custom dialog (Jacob Brydolf)
d465780 resized standard dialog (Jacob Brydolf)
482bd30 settings: enable/disable daemon start/stop buttons (Jacob Brydolf)
4e7de8c proper daemon shutdown on app exit (Jaquee)
48471f3 onDaemonStarted/stopped signals/slots (Jaquee)
de635cb pw dialog: close popup before continue (Jacob Brydolf)
86772be added standardDialog component (Jacob Brydolf)
ae977af settings: add daemon manager (Jacob Brydolf)
2775124 small error in daemon manager dialog (Jacob Brydolf)
82c39e0 WalletManager: include dependencies (Jaquee)
1c6884e Show daemon manager dialog if daemon isnt started (Jacob Brydolf)
9fbfbc4 daemonManager: embed as context property (Jaquee)
4cdc258 WalletManager: basic functionality (Jacob Brydolf)
This commit is contained in:
Riccardo Spagni
2016-12-08 23:54:50 +02:00
16 changed files with 567 additions and 38 deletions

View File

@@ -59,6 +59,7 @@ ApplicationWindow {
property int restoreHeight:0
property bool daemonSynced: false
property int maxWindowHeight: (Screen.height < 900)? 720 : 800;
property bool daemonRunning: false
// true if wallet ever synchronized
property bool walletInitialized : false
@@ -212,6 +213,7 @@ ApplicationWindow {
currentWallet.moneySpent.disconnect(onWalletMoneySent)
currentWallet.moneyReceived.disconnect(onWalletMoneyReceived)
currentWallet.transactionCreated.disconnect(onTransactionCreated)
currentWallet.connectionStatusChanged.disconnect(onWalletConnectionStatusChanged)
currentWallet.refreshed.connect(onWalletRefresh)
currentWallet.updated.connect(onWalletUpdate)
@@ -219,6 +221,7 @@ ApplicationWindow {
currentWallet.moneySpent.connect(onWalletMoneySent)
currentWallet.moneyReceived.connect(onWalletMoneyReceived)
currentWallet.transactionCreated.connect(onTransactionCreated)
currentWallet.connectionStatusChanged.connect(onWalletConnectionStatusChanged)
console.log("initializing with daemon address: ", persistentSettings.daemon_address)
@@ -232,6 +235,11 @@ ApplicationWindow {
return wallet_path;
}
function onWalletConnectionStatusChanged(){
console.log("Wallet connection status changed")
middlePanel.updateStatus();
}
function onWalletOpened(wallet) {
console.log(">>> wallet opened: " + wallet)
if (wallet.status !== Wallet.Status_Ok) {
@@ -280,18 +288,23 @@ ApplicationWindow {
hideProcessingSplash()
}
// Daemon connected
leftPanel.networkStatus.connected = currentWallet.connected
// Check daemon status
var dCurrentBlock = currentWallet.daemonBlockChainHeight();
var dTargetBlock = currentWallet.daemonBlockChainTargetHeight();
leftPanel.daemonProgress.updateProgress(dCurrentBlock,dTargetBlock);
// Daemon connected
leftPanel.networkStatus.connected = currentWallet.connected
// Daemon fully synced
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced
daemonSynced = (currentWallet.connected != Wallet.ConnectionStatus_Disconnected && dCurrentBlock >= dTargetBlock)
leftPanel.daemonProgress.updateProgress(dCurrentBlock,dTargetBlock);
middlePanel.updateStatus();
// If wallet isnt connected and no daemon is running - Ask
if(currentWallet.connected === Wallet.ConnectionStatus_Disconnected && !daemonManager.running() && !walletInitialized){
daemonManagerDialog.open();
}
// Refresh is succesfull if blockchain height > 1
if (currentWallet.blockChainHeight() > 1){
@@ -317,10 +330,29 @@ ApplicationWindow {
walletInitialized = true
}
onWalletUpdate();
}
function startDaemon(){
appWindow.showProcessingSplash(qsTr("Waiting for daemon to start..."))
daemonManager.start();
}
function stopDaemon(){
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."))
daemonManager.stop();
}
function onDaemonStarted(){
console.log("daemon started");
daemonRunning = true;
}
function onDaemonStopped(){
console.log("daemon stopped");
daemonRunning = false;
}
function onWalletNewBlock(blockHeight) {
if (splash.visible) {
var currHeight = blockHeight
@@ -633,6 +665,9 @@ ApplicationWindow {
walletManager.walletOpened.connect(onWalletOpened);
walletManager.walletClosed.connect(onWalletClosed);
daemonManager.daemonStarted.connect(onDaemonStarted);
daemonManager.daemonStopped.connect(onDaemonStopped);
if(!walletsFound()) {
rootItem.state = "wizard"
} else {
@@ -668,11 +703,11 @@ ApplicationWindow {
// TODO: replace with customized popups
// Information dialog
MessageDialog {
StandardDialog {
// dynamically change onclose handler
property var onCloseCallback
id: informationPopup
standardButtons: StandardButton.Ok
cancelVisible: false
onAccepted: {
if (onCloseCallback) {
onCloseCallback()
@@ -681,10 +716,10 @@ ApplicationWindow {
}
// Confrirmation aka question dialog
MessageDialog {
StandardDialog {
id: transactionConfirmationPopup
standardButtons: StandardButton.Ok + StandardButton.Cancel
onAccepted: {
close();
handleTransactionConfirmed()
}
}
@@ -721,6 +756,10 @@ ApplicationWindow {
}
DaemonManagerDialog {
id: daemonManagerDialog
}
ProcessingSplash {
id: splash
@@ -1032,10 +1071,13 @@ ApplicationWindow {
}
}
onClosing: {
// Close and save to disk on app close
if (currentWallet != undefined) {
walletManager.closeWallet(currentWallet);
currentWallet = undefined
}
// Make sure wallet is closed before app exit (~Wallet() isn't always invoked)
// Daemon shutdown is handled with signal/slot in main.cpp
if (currentWallet != undefined) {
walletManager.closeWallet(currentWallet);
currentWallet = undefined
}
// Stop daemon
daemonManager.stop();
}
}