mirror of
https://github.com/wownero/wowlet.git
synced 2026-11-01 05:38:44 +01:00
wowlet: solo-mining toggle — Wallet startMining/stopMining (RandomWOW via embedded node) + Wallet-menu action
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "constants.h"
|
||||
@@ -253,6 +254,22 @@ void MainWindow::initWidgets() {
|
||||
m_wallet->setCacheAttribute("wallet.notes", ui->notes->toPlainText());
|
||||
});
|
||||
|
||||
// [Mining] — wowlet: solo-mine to this wallet via the embedded local node (RandomWOW in wownerod)
|
||||
auto *mineAction = new QAction("Mine to this wallet", this);
|
||||
mineAction->setCheckable(true);
|
||||
ui->menuWallet->addAction(mineAction);
|
||||
connect(mineAction, &QAction::toggled, this, [this, mineAction](bool on) {
|
||||
if (on) {
|
||||
int threads = std::max(1, QThread::idealThreadCount() / 2);
|
||||
if (!m_wallet->startMining(threads)) {
|
||||
mineAction->setChecked(false);
|
||||
QMessageBox::warning(this, "Mining", "Could not start mining — make sure the node is connected and synced.");
|
||||
}
|
||||
} else {
|
||||
m_wallet->stopMining();
|
||||
}
|
||||
});
|
||||
|
||||
// [Plugins..]
|
||||
for (auto* plugin : m_plugins) {
|
||||
if (!plugin->hasParent()) {
|
||||
|
||||
Reference in New Issue
Block a user