mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 19:49:28 +00:00
xmrig: allow adding additional command line options
This commit is contained in:
parent
f8a3df1489
commit
18fe61117b
6 changed files with 28 additions and 10 deletions
|
@ -90,6 +90,11 @@ XMRigWidget::XMRigWidget(Wallet *wallet, QWidget *parent)
|
||||||
this->updatePools();
|
this->updatePools();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui->lineEdit_solo->setText(config()->get(Config::xmrigDaemon).toString());
|
||||||
|
connect(ui->lineEdit_solo, &QLineEdit::textChanged, [this](){
|
||||||
|
config()->set(Config::xmrigDaemon, ui->lineEdit_solo->text());
|
||||||
|
});
|
||||||
|
|
||||||
// Network settings
|
// Network settings
|
||||||
connect(ui->check_tls, &QCheckBox::toggled, this, &XMRigWidget::onNetworkTLSToggled);
|
connect(ui->check_tls, &QCheckBox::toggled, this, &XMRigWidget::onNetworkTLSToggled);
|
||||||
connect(ui->relayTor, &QCheckBox::toggled, this, &XMRigWidget::onNetworkTorToggled);
|
connect(ui->relayTor, &QCheckBox::toggled, this, &XMRigWidget::onNetworkTorToggled);
|
||||||
|
@ -108,12 +113,7 @@ XMRigWidget::XMRigWidget(Wallet *wallet, QWidget *parent)
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
auto password = m_wallet->getCacheAttribute("feather.xmrig_password");
|
auto password = m_wallet->getCacheAttribute("feather.xmrig_password");
|
||||||
if (!password.isEmpty()) {
|
ui->lineEdit_password->setText(password);
|
||||||
ui->lineEdit_password->setText(password);
|
|
||||||
} else {
|
|
||||||
ui->lineEdit_password->setText("featherwallet");
|
|
||||||
m_wallet->setCacheAttribute("feather.xmrig_password", ui->lineEdit_password->text());
|
|
||||||
}
|
|
||||||
connect(ui->lineEdit_password, &QLineEdit::textChanged, [=]() {
|
connect(ui->lineEdit_password, &QLineEdit::textChanged, [=]() {
|
||||||
m_wallet->setCacheAttribute("feather.xmrig_password", ui->lineEdit_password->text());
|
m_wallet->setCacheAttribute("feather.xmrig_password", ui->lineEdit_password->text());
|
||||||
});
|
});
|
||||||
|
@ -208,9 +208,11 @@ void XMRigWidget::onStartClicked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int threads = ui->threadSlider->value();
|
int threads = ui->threadSlider->value();
|
||||||
|
bool solo = (ui->combo_miningMode->currentIndex() == Config::MiningMode::Solo);
|
||||||
|
QStringList extraOptions = ui->lineEdit_extraOptions->text().split(" ");
|
||||||
|
|
||||||
m_XMRig->start(xmrigPath, threads, address, username, password, ui->relayTor->isChecked(), ui->check_tls->isChecked(),
|
m_XMRig->start(xmrigPath, threads, address, username, password, ui->relayTor->isChecked(), ui->check_tls->isChecked(),
|
||||||
ui->radio_elevateYes->isChecked());
|
ui->radio_elevateYes->isChecked(), solo, extraOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XMRigWidget::onStopClicked() {
|
void XMRigWidget::onStopClicked() {
|
||||||
|
|
|
@ -419,6 +419,16 @@
|
||||||
<item row="7" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QLineEdit" name="lineEdit_password"/>
|
<widget class="QLineEdit" name="lineEdit_password"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Extra command-line options:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_extraOptions"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -35,7 +35,7 @@ void XmRig::stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmRig::start(const QString &path, int threads, const QString &address, const QString &username,
|
void XmRig::start(const QString &path, int threads, const QString &address, const QString &username,
|
||||||
const QString &password, bool tor, bool tls, bool elevated)
|
const QString &password, bool tor, bool tls, bool elevated, bool solo, const QStringList &extraOptions)
|
||||||
{
|
{
|
||||||
m_elevated = elevated;
|
m_elevated = elevated;
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ void XmRig::start(const QString &path, int threads, const QString &address, cons
|
||||||
arguments << path;
|
arguments << path;
|
||||||
}
|
}
|
||||||
arguments << "-o" << address;
|
arguments << "-o" << address;
|
||||||
arguments << "-a" << "rx/0";
|
|
||||||
arguments << "-u" << username;
|
arguments << "-u" << username;
|
||||||
if (!password.isEmpty()) {
|
if (!password.isEmpty()) {
|
||||||
arguments << "-p" << password;
|
arguments << "-p" << password;
|
||||||
|
@ -79,6 +78,11 @@ void XmRig::start(const QString &path, int threads, const QString &address, cons
|
||||||
if (tls) {
|
if (tls) {
|
||||||
arguments << "--tls";
|
arguments << "--tls";
|
||||||
}
|
}
|
||||||
|
if (solo) {
|
||||||
|
arguments << "--daemon";
|
||||||
|
}
|
||||||
|
arguments += extraOptions;
|
||||||
|
|
||||||
QString cmd = QString("%1 %2").arg(path, arguments.join(" "));
|
QString cmd = QString("%1 %2").arg(path, arguments.join(" "));
|
||||||
emit output(cmd.toUtf8());
|
emit output(cmd.toUtf8());
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit XmRig(const QString &configDir, QObject *parent = nullptr);
|
explicit XmRig(const QString &configDir, QObject *parent = nullptr);
|
||||||
|
|
||||||
void start(const QString &path, int threads, const QString &address, const QString &username, const QString &password, bool tor = false, bool tls = true, bool elevated = false);
|
void start(const QString &path, int threads, const QString &address, const QString &username, const QString &password, bool tor = false, bool tls = true, bool elevated = false, bool solo = false, const QStringList &extraOptions = {});
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -54,6 +54,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||||
{Config::xmrigElevated,{QS("xmrigElevated"), false}},
|
{Config::xmrigElevated,{QS("xmrigElevated"), false}},
|
||||||
{Config::xmrigThreads,{QS("xmrigThreads"), 1}},
|
{Config::xmrigThreads,{QS("xmrigThreads"), 1}},
|
||||||
{Config::xmrigPool,{QS("xmrigPool"), "pool.xmr.pt:9000"}},
|
{Config::xmrigPool,{QS("xmrigPool"), "pool.xmr.pt:9000"}},
|
||||||
|
{Config::xmrigDaemon,{QS("xmrigDaemon"), "127.0.0.1:18081"}},
|
||||||
{Config::xmrigNetworkTLS,{QS("xmrigNetworkTLS"), true}},
|
{Config::xmrigNetworkTLS,{QS("xmrigNetworkTLS"), true}},
|
||||||
{Config::xmrigNetworkTor,{QS("xmrigNetworkTor"), false}},
|
{Config::xmrigNetworkTor,{QS("xmrigNetworkTor"), false}},
|
||||||
{Config::pools,{QS("pools"), {}}},
|
{Config::pools,{QS("pools"), {}}},
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
xmrigElevated,
|
xmrigElevated,
|
||||||
xmrigThreads,
|
xmrigThreads,
|
||||||
xmrigPool,
|
xmrigPool,
|
||||||
|
xmrigDaemon,
|
||||||
xmrigNetworkTLS,
|
xmrigNetworkTLS,
|
||||||
xmrigNetworkTor,
|
xmrigNetworkTor,
|
||||||
pools,
|
pools,
|
||||||
|
|
Loading…
Reference in a new issue