mirror of
https://github.com/monero-project/monero-gui
synced 2025-01-02 21:26:24 +01:00
Merge pull request #2182
73a3549
WalletManager: non-blocking mining status updates (xiphon)
This commit is contained in:
commit
189f905785
@ -258,14 +258,18 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
function onMiningStatus(isMining) {
|
||||
var daemonReady = walletManager.isDaemonLocal(appWindow.currentDaemonAddress) && appWindow.daemonSynced
|
||||
appWindow.isMining = walletManager.isMining()
|
||||
appWindow.isMining = isMining;
|
||||
updateStatusText()
|
||||
startSoloMinerButton.enabled = !appWindow.isMining && daemonReady
|
||||
stopSoloMinerButton.enabled = !startSoloMinerButton.enabled && daemonReady
|
||||
}
|
||||
|
||||
function update() {
|
||||
walletManager.miningStatusAsync();
|
||||
}
|
||||
|
||||
MoneroComponents.StandardDialog {
|
||||
id: errorPopup
|
||||
cancelVisible: false
|
||||
@ -286,4 +290,8 @@ Rectangle {
|
||||
function onPageClosed() {
|
||||
timer.running = false
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
walletManager.miningStatus.connect(onMiningStatus);
|
||||
}
|
||||
}
|
||||
|
@ -389,6 +389,13 @@ bool WalletManager::isMining() const
|
||||
return m_pimpl->isMining();
|
||||
}
|
||||
|
||||
void WalletManager::miningStatusAsync() const
|
||||
{
|
||||
QtConcurrent::run([this] {
|
||||
emit miningStatus(isMining());
|
||||
});
|
||||
}
|
||||
|
||||
bool WalletManager::startMining(const QString &address, quint32 threads, bool backgroundMining, bool ignoreBattery)
|
||||
{
|
||||
if(threads == 0)
|
||||
|
@ -159,7 +159,7 @@ public:
|
||||
Q_INVOKABLE bool localDaemonSynced() const;
|
||||
Q_INVOKABLE bool isDaemonLocal(const QString &daemon_address) const;
|
||||
|
||||
Q_INVOKABLE bool isMining() const;
|
||||
Q_INVOKABLE void miningStatusAsync() const;
|
||||
Q_INVOKABLE bool startMining(const QString &address, quint32 threads, bool backgroundMining, bool ignoreBattery);
|
||||
Q_INVOKABLE bool stopMining();
|
||||
|
||||
@ -201,12 +201,16 @@ signals:
|
||||
void deviceButtonPressed();
|
||||
void walletClosed(const QString &walletAddress);
|
||||
void checkUpdatesComplete(const QString &result) const;
|
||||
void miningStatus(bool isMining) const;
|
||||
|
||||
public slots:
|
||||
private:
|
||||
friend class WalletPassphraseListenerImpl;
|
||||
|
||||
explicit WalletManager(QObject *parent = 0);
|
||||
|
||||
bool isMining() const;
|
||||
|
||||
static WalletManager * m_instance;
|
||||
Monero::WalletManager * m_pimpl;
|
||||
mutable QMutex m_mutex;
|
||||
|
Loading…
Reference in New Issue
Block a user