Browse Source

If currently mining, automatically change number of threads when combobox changes

pull/112/head
Duke 1 year ago
parent
commit
c065d253a0
  1. 23
      src/mainwindow.cpp

23
src/mainwindow.cpp

@ -1566,6 +1566,29 @@ void MainWindow::setupMiningTab() {
button1->setObjectName("startmining");
button2->setObjectName("stopmining");
connect(combo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){
auto button1 = ui->tabWidget->findChild<QPushButton *>("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;

Loading…
Cancel
Save