mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-08 20:09:43 +00:00
TorInfoDialog: allow setting initSyncThreshold
This commit is contained in:
parent
01df614daa
commit
8ec65d8f07
3 changed files with 33 additions and 0 deletions
|
@ -7,9 +7,11 @@
|
|||
#include <QPushButton>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "utils/TorManager.h"
|
||||
#include "utils/os/tails.h"
|
||||
#include "utils/Icons.h"
|
||||
|
||||
TorInfoDialog::TorInfoDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
|
@ -46,6 +48,9 @@ TorInfoDialog::TorInfoDialog(QSharedPointer<AppContext> 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;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ private slots:
|
|||
void onApplySettings();
|
||||
void onSettingsChanged();
|
||||
void onStopTor();
|
||||
void onShowInitSyncConfigDialog();
|
||||
|
||||
signals:
|
||||
void torSettingsChanged();
|
||||
|
|
|
@ -157,6 +157,19 @@
|
|||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_configureInitSync">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in a new issue