diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5da98c9..20cb5bd 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1566,6 +1566,29 @@ void MainWindow::setupMiningTab() { button1->setObjectName("startmining"); button2->setObjectName("stopmining"); + connect(combo, QOverload::of(&QComboBox::currentIndexChanged), [=](int index){ + auto button1 = ui->tabWidget->findChild("startmining"); + if(button1 != nullptr) { + DEBUG("found start mining button and enabled=" << button1->isEnabled() ); + + if(button1->isEnabled()) { + // if start mining button is enabled, we are not currently mining, so do nothing + return; + } + } + + // if we are currently mining and thread count combo changes, change our genproclimit + // to that number of threads, instead of users have to stop and restart mining, which + // is dumb and non-intuitive + + DEBUG("combobox changed index=" << index); + int threads = index+1; + DEBUG("changing number of threads to " << threads); + rpc->setGenerate(threads, [=] (QJsonValue response){ + DEBUG("setgenerate response=" << response); + }); + }); + QObject::connect(button1, &QPushButton::clicked, [&] () { DEBUG("START MINING"); int threads = 1;