mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-02-25 20:35:24 +02:00
Merge pull request #2348
a01ffc6
daemon: async daemon status check, don't freeze on wallet startup (xiphon)
This commit is contained in:
commit
0724dd0043
6
main.qml
6
main.qml
@ -496,9 +496,13 @@ ApplicationWindow {
|
|||||||
middlePanel.transferView.updatePriorityDropdown();
|
middlePanel.transferView.updatePriorityDropdown();
|
||||||
|
|
||||||
// If wallet isnt connected, advanced wallet mode and no daemon is running - Ask
|
// If wallet isnt connected, advanced wallet mode and no daemon is running - Ask
|
||||||
if(!isMobile && appWindow.walletMode >= 2 && walletManager.isDaemonLocal(currentDaemonAddress) && !walletInitialized && status === Wallet.ConnectionStatus_Disconnected && !daemonManager.running(persistentSettings.nettype)){
|
if (!isMobile && appWindow.walletMode >= 2 && walletManager.isDaemonLocal(currentDaemonAddress) && !walletInitialized && status === Wallet.ConnectionStatus_Disconnected) {
|
||||||
|
daemonManager.runningAsync(persistentSettings.nettype, function(running) {
|
||||||
|
if (!running) {
|
||||||
daemonManagerDialog.open();
|
daemonManagerDialog.open();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
// initialize transaction history once wallet is initialized first time;
|
// initialize transaction history once wallet is initialized first time;
|
||||||
if (!walletInitialized) {
|
if (!walletInitialized) {
|
||||||
currentWallet.history.refresh(currentWallet.currentSubaddressAccount)
|
currentWallet.history.refresh(currentWallet.currentSubaddressAccount)
|
||||||
|
@ -243,6 +243,14 @@ bool DaemonManager::running(NetworkType::Type nettype) const
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DaemonManager::runningAsync(NetworkType::Type nettype, const QJSValue& callback) const
|
||||||
|
{
|
||||||
|
m_scheduler.run([this, nettype] {
|
||||||
|
return QJSValueList({running(nettype)});
|
||||||
|
}, callback);
|
||||||
|
}
|
||||||
|
|
||||||
bool DaemonManager::sendCommand(const QString &cmd, NetworkType::Type nettype) const
|
bool DaemonManager::sendCommand(const QString &cmd, NetworkType::Type nettype) const
|
||||||
{
|
{
|
||||||
QString message;
|
QString message;
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
Q_INVOKABLE bool stop(NetworkType::Type nettype);
|
Q_INVOKABLE bool stop(NetworkType::Type nettype);
|
||||||
|
|
||||||
// return true if daemon process is started
|
// return true if daemon process is started
|
||||||
Q_INVOKABLE bool running(NetworkType::Type nettype) const;
|
Q_INVOKABLE void runningAsync(NetworkType::Type nettype, const QJSValue& callback) const;
|
||||||
// Send daemon command from qml and prints output in console window.
|
// Send daemon command from qml and prints output in console window.
|
||||||
Q_INVOKABLE bool sendCommand(const QString &cmd, NetworkType::Type nettype) const;
|
Q_INVOKABLE bool sendCommand(const QString &cmd, NetworkType::Type nettype) const;
|
||||||
Q_INVOKABLE void exit();
|
Q_INVOKABLE void exit();
|
||||||
@ -56,6 +56,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
bool running(NetworkType::Type nettype) const;
|
||||||
bool sendCommand(const QString &cmd, NetworkType::Type nettype, QString &message) const;
|
bool sendCommand(const QString &cmd, NetworkType::Type nettype, QString &message) const;
|
||||||
bool startWatcher(NetworkType::Type nettype) const;
|
bool startWatcher(NetworkType::Type nettype) const;
|
||||||
bool stopWatcher(NetworkType::Type nettype) const;
|
bool stopWatcher(NetworkType::Type nettype) const;
|
||||||
@ -82,7 +83,7 @@ private:
|
|||||||
bool m_has_daemon = true;
|
bool m_has_daemon = true;
|
||||||
bool m_app_exit = false;
|
bool m_app_exit = false;
|
||||||
|
|
||||||
FutureScheduler m_scheduler;
|
mutable FutureScheduler m_scheduler;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DAEMONMANAGER_H
|
#endif // DAEMONMANAGER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user