You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
3.2 KiB
89 lines
3.2 KiB
#include "Configurator.h"
|
|
#include "ui_Configurator.h"
|
|
#include "Config.h"
|
|
|
|
#include <QIcon>
|
|
|
|
Configurator::Configurator(QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::Configurator)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
// Basic settings
|
|
ui->lineMonerod->setText(config()->get(Config::pathToMonerod).toString());
|
|
ui->lineMonerod->setCursorPosition(0);
|
|
connect(ui->lineMonerod, &QLineEdit::textChanged, [this](const QString &text){
|
|
this->setConfig(Config::pathToMonerod, text);
|
|
});
|
|
|
|
ui->checkPruneBlockchain->setChecked(config()->get(Config::pruneBlockchain).toBool());
|
|
connect(ui->checkPruneBlockchain, &QCheckBox::toggled, [this](bool toggled){
|
|
this->setConfig(Config::pruneBlockchain, toggled);
|
|
});
|
|
|
|
ui->lineDataDir->setText(config()->get(Config::dataDir).toString());
|
|
connect(ui->lineDataDir, &QLineEdit::textChanged, [this](const QString &text){
|
|
this->setConfig(Config::dataDir, text);
|
|
});
|
|
|
|
ui->spinLimitSpeedDown->setValue(config()->get(Config::limitRateDown).toInt());
|
|
connect(ui->spinLimitSpeedDown, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value){
|
|
this->setConfig(Config::limitRateDown, value);
|
|
});
|
|
|
|
// Advanced settings
|
|
ui->comboNetwork->setCurrentIndex(config()->get(Config::network).toInt());
|
|
connect(ui->comboNetwork, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int value){
|
|
this->setConfig(Config::network, value);
|
|
});
|
|
|
|
ui->comboLogLevel->setCurrentIndex(config()->get(Config::logLevel).toInt());
|
|
connect(ui->comboLogLevel, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int value){
|
|
this->setConfig(Config::logLevel, value);
|
|
});
|
|
|
|
ui->checkNoZeroMQ->setChecked(config()->get(Config::noZeroMQ).toBool());
|
|
connect(ui->checkNoZeroMQ, &QCheckBox::toggled, [this](bool toggled){
|
|
this->setConfig(Config::noZeroMQ, toggled);
|
|
});
|
|
|
|
ui->lineRPCBindIP->setText(config()->get(Config::RPCBindIP).toString());
|
|
connect(ui->lineRPCBindIP, &QLineEdit::textChanged, [this](const QString &text){
|
|
this->setConfig(Config::RPCBindIP, text);
|
|
});
|
|
|
|
QString rpcPort = config()->get(Config::RPCBindPort).toString();
|
|
ui->lineRPCBindPort->setText(rpcPort == "0" ? "" : rpcPort);
|
|
connect(ui->lineP2PBindPort, &QLineEdit::textChanged, [this](const QString &text){
|
|
this->setConfig(Config::RPCBindPort, text);
|
|
});
|
|
|
|
ui->lineP2PBindIP->setText(config()->get(Config::P2PBindIP).toString());
|
|
connect(ui->lineP2PBindIP, &QLineEdit::textChanged, [this](const QString &text){
|
|
this->setConfig(Config::P2PBindIP, text);
|
|
});
|
|
|
|
QString p2pPort = config()->get(Config::P2PBindPort).toString();
|
|
ui->lineP2PBindPort->setText(p2pPort == "0" ? "" : p2pPort);
|
|
connect(ui->lineP2PBindPort, &QLineEdit::textChanged, [this](const QString &text){
|
|
this->setConfig(Config::P2PBindPort, text);
|
|
});
|
|
|
|
this->adjustSize();
|
|
}
|
|
|
|
bool Configurator::configUpdated() const {
|
|
return m_configUpdated;
|
|
}
|
|
|
|
void Configurator::setConfig(Config::ConfigKey configKey, const QVariant &value) {
|
|
this->m_configUpdated = true;
|
|
config()->set(configKey, value);
|
|
}
|
|
|
|
Configurator::~Configurator()
|
|
{
|
|
delete ui;
|
|
}
|