diff --git a/src/dialog/torinfodialog.cpp b/src/dialog/torinfodialog.cpp index 46a0dec..59ebbf5 100644 --- a/src/dialog/torinfodialog.cpp +++ b/src/dialog/torinfodialog.cpp @@ -7,9 +7,11 @@ #include #include #include +#include #include "utils/TorManager.h" #include "utils/os/tails.h" +#include "utils/Icons.h" TorInfoDialog::TorInfoDialog(QSharedPointer ctx, QWidget *parent) : QDialog(parent) @@ -46,6 +48,9 @@ TorInfoDialog::TorInfoDialog(QSharedPointer ctx, QWidget *parent) ui->label_changes->hide(); + ui->btn_configureInitSync->setIcon(icons()->icon("preferences.svg")); + connect(ui->btn_configureInitSync, &QPushButton::clicked, this, &TorInfoDialog::onShowInitSyncConfigDialog); + #ifndef HAS_TOR_BIN ui->check_useLocalTor->setChecked(true); ui->check_useLocalTor->setEnabled(false); @@ -146,6 +151,20 @@ void TorInfoDialog::onStopTor() { torManager()->stop(); } +void TorInfoDialog::onShowInitSyncConfigDialog() { + + int threshold = config()->get(Config::initSyncThreshold).toInt(); + + bool ok; + int newThreshold = QInputDialog::getInt(this, "Sync threshold", + "Synchronize over clearnet if wallet is behind more than x blocks: ", + threshold, 0, 10000, 10, &ok); + + if (ok) { + config()->set(Config::initSyncThreshold, newThreshold); + } +} + TorInfoDialog::~TorInfoDialog() { delete ui; } diff --git a/src/dialog/torinfodialog.h b/src/dialog/torinfodialog.h index 1ca0744..3b3847e 100644 --- a/src/dialog/torinfodialog.h +++ b/src/dialog/torinfodialog.h @@ -29,6 +29,7 @@ private slots: void onApplySettings(); void onSettingsChanged(); void onStopTor(); + void onShowInitSyncConfigDialog(); signals: void torSettingsChanged(); diff --git a/src/dialog/torinfodialog.ui b/src/dialog/torinfodialog.ui index 46b41ec..ffce23d 100644 --- a/src/dialog/torinfodialog.ui +++ b/src/dialog/torinfodialog.ui @@ -157,6 +157,19 @@ + + + + + 0 + 0 + + + + + + +