Browse Source

add consolidation,deletetx and zindex as checkbox to Settings/Troubleshooting

pull/163/head
DenioD 4 years ago
parent
commit
66e3fbdf5c
  1. 16
      src/connection.cpp
  2. 3
      src/connection.h
  3. 85
      src/mainwindow.cpp

16
src/connection.cpp

@ -656,6 +656,7 @@ std::shared_ptr<ConnectionConfig> ConnectionLoader::autoDetectZcashConf() {
zcashconf->usingZcashConf = true;
zcashconf->zcashDir = QFileInfo(confLocation).absoluteDir().absolutePath();
zcashconf->zcashDaemon = false;
Settings::getInstance()->setUsingZcashConf(confLocation);
@ -679,6 +680,15 @@ std::shared_ptr<ConnectionConfig> ConnectionLoader::autoDetectZcashConf() {
}
if (name == "proxy") {
zcashconf->proxy = value;
}
if (name == "consolidation") {
zcashconf->consolidation = value;
}
if (name == "deletetx") {
zcashconf->deletetx = value;
}
if (name == "zindex") {
zcashconf->zindex = value;
}
if (name == "testnet" &&
value == "1" &&
@ -706,12 +716,12 @@ std::shared_ptr<ConnectionConfig> ConnectionLoader::loadFromSettings() {
auto host = s.value("connection/host").toString();
auto port = s.value("connection/port").toString();
auto username = s.value("connection/rpcuser").toString();
auto password = s.value("connection/rpcpassword").toString();
auto password = s.value("connection/rpcpassword").toString();
if (username.isEmpty() || password.isEmpty())
return nullptr;
auto uiConfig = new ConnectionConfig{ host, port, username, password, false, false, "", "", ConnectionType::UISettingsZCashD};
auto uiConfig = new ConnectionConfig{ host, port, username, password, false, false,"","" "", "","","", ConnectionType::UISettingsZCashD};
return std::shared_ptr<ConnectionConfig>(uiConfig);
}

3
src/connection.h

@ -24,6 +24,9 @@ struct ConnectionConfig {
bool zcashDaemon;
QString zcashDir;
QString proxy;
QString consolidation;
QString deletetx;
QString zindex;
ConnectionType connType;
};

85
src/mainwindow.cpp

@ -350,6 +350,40 @@ void MainWindow::setupSettingsModal() {
settings.lblTor->setToolTip(tooltip);
}
//Use Consolidation
bool isUsingConsolidation = false;
if (rpc->getConnection() != nullptr) {
isUsingConsolidation = !rpc->getConnection()->config->consolidation.isEmpty() == true;
}
settings.chkConso->setChecked(isUsingConsolidation);
if (rpc->getEZcashD() == nullptr) {
settings.chkConso->setEnabled(false);
}
//Use Deletetx
bool isUsingDeletetx = false;
if (rpc->getConnection() != nullptr) {
isUsingDeletetx = !rpc->getConnection()->config->deletetx.isEmpty() == true;
}
settings.chkDeletetx->setChecked(isUsingDeletetx);
if (rpc->getEZcashD() == nullptr) {
settings.chkDeletetx->setEnabled(false);
}
//Use Zindex
bool isUsingZindex = false;
if (rpc->getConnection() != nullptr) {
isUsingZindex = !rpc->getConnection()->config->zindex.isEmpty() == true;
}
settings.chkzindex->setChecked(isUsingZindex);
if (rpc->getEZcashD() == nullptr) {
settings.chkzindex->setEnabled(false);
}
// Connection Settings
QIntValidator validator(0, 65535);
settings.port->setValidator(&validator);
@ -361,16 +395,15 @@ void MainWindow::setupSettingsModal() {
settings.hostname->setEnabled(false);
settings.port->setEnabled(false);
settings.rpcuser->setEnabled(false);
settings.rpcpassword->setEnabled(false);
settings.rpcpassword->setEnabled(false);
} else {
settings.confMsg->setText("No local HUSH3.conf found. Please configure connection manually.");
settings.hostname->setEnabled(true);
settings.port->setEnabled(true);
settings.rpcuser->setEnabled(true);
settings.rpcpassword->setEnabled(true);
settings.rpcpassword->setEnabled(true);
}
// Load current values into the dialog
// Load current values into the dialog
auto conf = Settings::getInstance()->getSettings();
settings.hostname->setText(conf.host);
@ -466,8 +499,52 @@ void MainWindow::setupSettingsModal() {
showRestartInfo = true;
}
if (!rpc->getConnection()->config->consolidation.isEmpty()==false) {
if (settings.chkConso->isChecked()) {
Settings::addToZcashConf(zcashConfLocation, "consolidation=1");
showRestartInfo = true;
}
}
if (!rpc->getConnection()->config->consolidation.isEmpty()) {
if (settings.chkConso->isChecked() == false) {
Settings::removeFromZcashConf(zcashConfLocation, "consolidation");
showRestartInfo = true;
}
}
if (!rpc->getConnection()->config->deletetx.isEmpty() == false) {
if (settings.chkDeletetx->isChecked()) {
Settings::addToZcashConf(zcashConfLocation, "deletetx=1");
showRestartInfo = true;
}
}
if (!rpc->getConnection()->config->deletetx.isEmpty()) {
if (settings.chkDeletetx->isChecked() == false) {
Settings::removeFromZcashConf(zcashConfLocation, "deletetx");
showRestartInfo = true;
}
}
if (!rpc->getConnection()->config->zindex.isEmpty() == false) {
if (settings.chkzindex->isChecked()) {
Settings::addToZcashConf(zcashConfLocation, "zindex=1");
Settings::addToZcashConf(zcashConfLocation, "reindex=1");
showRestartInfo = true;
}
}
if (!rpc->getConnection()->config->zindex.isEmpty()) {
if (settings.chkzindex->isChecked() == false) {
Settings::removeFromZcashConf(zcashConfLocation, "zindex");
Settings::addToZcashConf(zcashConfLocation, "reindex=1");
showRestartInfo = true;
}
}
if (showRestartInfo) {
auto desc = tr("SilentDragon needs to restart to rescan/reindex. SilentDragon will now close, please restart SilentDragon to continue");
auto desc = tr("SilentDragon needs to restart to rescan,reindex,consolidation or deletetx. SilentDragon will now close, please restart SilentDragon to continue");
QMessageBox::information(this, tr("Restart SilentDragon"), desc, QMessageBox::Ok);
QTimer::singleShot(1, [=]() { this->close(); });

Loading…
Cancel
Save