void MiningPage::minerFinished() { if (getMiningType() == ClientModel::SoloMining) reportToList("Solo mining stopped.", ERROR, NULL); else reportToList("Miner exited.", ERROR, NULL); ui->list->addItem(""); minerActive = false; resetMiningButton(); model->setMining(getMiningType(), false, initThreads, 0); }
void MiningPage::minerStarted() { if (!minerActive) if (getMiningType() == ClientModel::SoloMining) reportToList("Solo mining started.", ERROR, NULL); else reportToList("Miner started. You might not see any output for a few minutes.", STARTED, NULL); minerActive = true; resetMiningButton(); model->setMining(getMiningType(), true, initThreads, 0); }
void MiningPage::startPoolMining() { QStringList args; QString url = ui->serverLine->currentText(); if(url.length() == 0){ reportToList(tr("please input the sever address"), ERROR, NULL); return; } if(ui->usernameLine->text().length() == 0){ reportToList(tr("use name should not be empty"), ERROR, NULL); return; } if (!url.contains("http://")){ url.prepend("http://"); } QString urlLine = QString("%1:%2").arg(url, ui->portLine->text().length() == 0 ? "80" : ui->portLine->text()); args << "--algo" << "scrypt-jane"; if(ui->passwordLine->text().length() == 0){ args << "--user" << ui->usernameLine->text().toAscii(); }else{ args << "--userpass" << QString("%1:%2").arg(ui->usernameLine->text(), ui->passwordLine->text()).toAscii(); } args << "--scantime" << ui->scantimeBox->text().toAscii(); args << "--url" << urlLine.toAscii(); args << "--threads" << ui->threadsBox->text().toAscii(); args << "--retries" << "-1"; // Retry forever. args << "-P"; // This is needed for this to work correctly on Windows. Extra protocol dump helps flush the buffer quicker. threadSpeed.clear(); acceptedShares = 0; rejectedShares = 0; roundAcceptedShares = 0; roundRejectedShares = 0; // If minerd is in current path, then use that. Otherwise, assume minerd is in the path somewhere. //QString program = QDir::current().filePath("minerd"); QString program = QDir(QCoreApplication::applicationDirPath()).filePath("minerd"); if (!QFile::exists(program)) program = "minerd"; if (ui->debugCheckBox->isChecked()) ui->list->addItem(args.join(" ").prepend(" ").prepend(program)); ui->mineSpeedLabel->setText("Speed: N/A"); ui->shareCount->setText("Accepted: 0 - Rejected: 0"); minerProcess->start(program,args); minerProcess->waitForStarted(-1); readTimer->start(500); }
void MiningPage::minerError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { reportToList("Miner failed to start. Make sure you have the minerd executable and libraries in the same directory as wwhcoin-qt.", ERROR, NULL); } }
void MiningPage::minerError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { reportToList("No mining, fail", ERROR, NULL); } }
void MiningPage::minerError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { reportToList("Event Caching failed to start! You need Pooler's minerd.exe located in the same folder as GeoCoin", ERROR, NULL); } }
void MiningPage::minerError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { reportToList("Mining failed to start. Make sure you have the correct ingredients in the same directory as WakkaCoin-Qt.", ERROR, NULL); } }
int MiningPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: startPressed(); break; case 1: startPoolMining(); break; case 2: stopPoolMining(); break; case 3: updateSpeed(); break; case 4: loadSettings(); break; case 5: saveSettings(); break; case 6: reportToList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break; case 7: minerStarted(); break; case 8: minerError((*reinterpret_cast< QProcess::ProcessError(*)>(_a[1]))); break; case 9: minerFinished(); break; case 10: readProcessOutput(); break; case 11: { QString _r = getTime((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 12: enableMiningControls((*reinterpret_cast< bool(*)>(_a[1]))); break; case 13: enablePoolMiningControls((*reinterpret_cast< bool(*)>(_a[1]))); break; case 14: { ClientModel::MiningType _r = getMiningType(); if (_a[0]) *reinterpret_cast< ClientModel::MiningType*>(_a[0]) = _r; } break; case 15: typeChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 16: debugToggled((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 17; } return _id; }
void MiningPage::startPoolMining() { QStringList args; QString url = ui->serverLine->text(); if (!url.contains("http://")) url.prepend("http://"); QString urlLine = QString("%1:%2").arg(url, ui->portLine->text()); QString userpassLine = QString("%1:%2").arg(ui->usernameLine->text(), ui->passwordLine->text()); args << "--algo" << "dcrypt"; #if QT_VERSION < 0x050000 args << "--scantime" << ui->scantimeBox->text().toAscii(); args << "--url" << urlLine.toAscii(); args << "--userpass" << userpassLine.toAscii(); args << "--threads" << ui->threadsBox->text().toAscii(); #else args << "--scantime" << ui->scantimeBox->text().toLatin1(); args << "--url" << urlLine.toLatin1(); args << "--userpass" << userpassLine.toLatin1(); args << "--threads" << ui->threadsBox->text().toLatin1(); #endif args << "--retries" << "-1"; // Retry forever. args << "-P"; // This is needed for this to work correctly on Windows. Extra protocol dump helps flush the buffer quicker. threadSpeed.clear(); acceptedShares = 0; rejectedShares = 0; roundAcceptedShares = 0; roundRejectedShares = 0; // If minerd is in current path, then use that. Otherwise, assume minerd is in the path somewhere. QString program = QDir::current().filePath("minerd"); if (!QFile::exists(program)) { program = "minerd"; reportToList("Assuming local minerd.", STARTED, NULL); } if (ui->debugCheckBox->isChecked()) ui->list->addItem(args.join(" ").prepend(" ").prepend(program)); ui->mineSpeedLabel->setText("Speed: N/A"); ui->shareCount->setText("Accepted: 0 - Rejected: 0"); minerProcess->start(program, args); minerProcess->waitForStarted(-1); readTimer->start(500); }
void MiningPage::readProcessOutput() { QByteArray output; minerProcess->reset(); output = minerProcess->readAll(); QString outputString(output); if (!outputString.isEmpty()) { QStringList list = outputString.split("\n", QString::SkipEmptyParts); int i; for (i=0; i<list.size(); i++) { QString line = list.at(i); // Ignore protocol dump if (!line.startsWith("[") || line.contains("JSON protocol") || line.contains("HTTP hdr")) continue; if (ui->debugCheckBox->isChecked()) { ui->list->addItem(line.trimmed()); ui->list->scrollToBottom(); } if (line.contains("(yay!!!)")) reportToList("Share accepted", SHARE_SUCCESS, getTime(line)); else if (line.contains("(booooo)")) reportToList("Share rejected", SHARE_FAIL, getTime(line)); else if (line.contains("LONGPOLL detected new block")) reportToList("LONGPOLL detected a new block", LONGPOLL, getTime(line)); else if (line.contains("Supported options:")) reportToList("Miner didn't start properly. Try checking your settings.", ERROR, NULL); else if (line.contains("The requested URL returned error: 403")) reportToList("Couldn't connect. Please check your username and password.", ERROR, NULL); else if (line.contains("HTTP request failed")) reportToList("Couldn't connect. Please check pool server and port.", ERROR, NULL); else if (line.contains("JSON-RPC call failed")) reportToList("Couldn't communicate with server. Retrying in 30 seconds.", ERROR, NULL); else if (line.contains("thread ") && line.contains("khash/s")) { QString threadIDstr = line.at(line.indexOf("thread ")+7); int threadID = threadIDstr.toInt(); int threadSpeedindx = line.indexOf(","); QString threadSpeedstr = line.mid(threadSpeedindx); threadSpeedstr.chop(8); threadSpeedstr.remove(", "); threadSpeedstr.remove(" "); threadSpeedstr.remove('\n'); double speed=0; speed = threadSpeedstr.toDouble(); threadSpeed[threadID] = speed; updateSpeed(); } } } }