mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 19:49:28 +00:00
settings: fix proxy switch crash
This commit is contained in:
parent
b030c7d032
commit
9483325a68
4 changed files with 11 additions and 11 deletions
|
@ -89,9 +89,7 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
|
||||||
connect(m_windowManager, &WindowManager::websocketStatusChanged, this, &MainWindow::onWebsocketStatusChanged);
|
connect(m_windowManager, &WindowManager::websocketStatusChanged, this, &MainWindow::onWebsocketStatusChanged);
|
||||||
this->onWebsocketStatusChanged(!conf()->get(Config::disableWebsocket).toBool());
|
this->onWebsocketStatusChanged(!conf()->get(Config::disableWebsocket).toBool());
|
||||||
|
|
||||||
connect(m_windowManager, &WindowManager::proxySettingsChanged, [this]{
|
connect(m_windowManager, &WindowManager::proxySettingsChanged, this, &MainWindow::onProxySettingsChangedConnect);
|
||||||
this->onProxySettingsChanged();
|
|
||||||
});
|
|
||||||
connect(m_windowManager, &WindowManager::updateBalance, m_wallet, &Wallet::updateBalance);
|
connect(m_windowManager, &WindowManager::updateBalance, m_wallet, &Wallet::updateBalance);
|
||||||
connect(m_windowManager, &WindowManager::offlineMode, this, &MainWindow::onOfflineMode);
|
connect(m_windowManager, &WindowManager::offlineMode, this, &MainWindow::onOfflineMode);
|
||||||
connect(m_windowManager, &WindowManager::manualFeeSelectionEnabled, this, &MainWindow::onManualFeeSelectionEnabled);
|
connect(m_windowManager, &WindowManager::manualFeeSelectionEnabled, this, &MainWindow::onManualFeeSelectionEnabled);
|
||||||
|
@ -183,7 +181,7 @@ void MainWindow::initStatusBar() {
|
||||||
m_statusBtnProxySettings = new StatusBarButton(icons()->icon("tor_logo_disabled.png"), "Proxy settings", this);
|
m_statusBtnProxySettings = new StatusBarButton(icons()->icon("tor_logo_disabled.png"), "Proxy settings", this);
|
||||||
connect(m_statusBtnProxySettings, &StatusBarButton::clicked, this, &MainWindow::menuProxySettingsClicked);
|
connect(m_statusBtnProxySettings, &StatusBarButton::clicked, this, &MainWindow::menuProxySettingsClicked);
|
||||||
this->statusBar()->addPermanentWidget(m_statusBtnProxySettings);
|
this->statusBar()->addPermanentWidget(m_statusBtnProxySettings);
|
||||||
this->onProxySettingsChanged(false);
|
this->onProxySettingsChanged();
|
||||||
|
|
||||||
m_statusBtnHwDevice = new StatusBarButton(this->hardwareDevicePairedIcon(), this->getHardwareDevice(), this);
|
m_statusBtnHwDevice = new StatusBarButton(this->hardwareDevicePairedIcon(), this->getHardwareDevice(), this);
|
||||||
connect(m_statusBtnHwDevice, &StatusBarButton::clicked, this, &MainWindow::menuHwDeviceClicked);
|
connect(m_statusBtnHwDevice, &StatusBarButton::clicked, this, &MainWindow::menuHwDeviceClicked);
|
||||||
|
@ -651,11 +649,12 @@ void MainWindow::onWebsocketStatusChanged(bool enabled) {
|
||||||
m_sendWidget->setWebsocketEnabled(enabled);
|
m_sendWidget->setWebsocketEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onProxySettingsChanged(bool connect) {
|
void MainWindow::onProxySettingsChangedConnect() {
|
||||||
if (connect) {
|
|
||||||
m_nodes->connectToNode();
|
m_nodes->connectToNode();
|
||||||
}
|
this->onProxySettingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onProxySettingsChanged() {
|
||||||
int proxy = conf()->get(Config::proxy).toInt();
|
int proxy = conf()->get(Config::proxy).toInt();
|
||||||
|
|
||||||
if (proxy == Config::Proxy::Tor) {
|
if (proxy == Config::Proxy::Tor) {
|
||||||
|
|
|
@ -165,7 +165,8 @@ private slots:
|
||||||
void tryStoreWallet();
|
void tryStoreWallet();
|
||||||
void onWebsocketStatusChanged(bool enabled);
|
void onWebsocketStatusChanged(bool enabled);
|
||||||
void showUpdateNotification();
|
void showUpdateNotification();
|
||||||
void onProxySettingsChanged(bool connect = true);
|
void onProxySettingsChangedConnect();
|
||||||
|
void onProxySettingsChanged();
|
||||||
void onOfflineMode(bool offline);
|
void onOfflineMode(bool offline);
|
||||||
void onManualFeeSelectionEnabled(bool enabled);
|
void onManualFeeSelectionEnabled(bool enabled);
|
||||||
void onSubtractFeeFromAmountEnabled(bool enabled);
|
void onSubtractFeeFromAmountEnabled(bool enabled);
|
||||||
|
|
|
@ -378,6 +378,7 @@ void Settings::onProxySettingsChanged() {
|
||||||
ui->closeButton->addButton(QDialogButtonBox::Apply);
|
ui->closeButton->addButton(QDialogButtonBox::Apply);
|
||||||
connect(ui->closeButton->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, [this](){
|
connect(ui->closeButton->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, [this](){
|
||||||
ui->proxyWidget->setProxySettings();
|
ui->proxyWidget->setProxySettings();
|
||||||
|
m_nodes->updateModels();
|
||||||
emit proxySettingsChanged();
|
emit proxySettingsChanged();
|
||||||
ui->closeButton->removeButton(ui->closeButton->button(QDialogButtonBox::Apply));
|
ui->closeButton->removeButton(ui->closeButton->button(QDialogButtonBox::Apply));
|
||||||
});
|
});
|
||||||
|
|
|
@ -134,7 +134,6 @@ struct FeatherNode {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AppContext;
|
|
||||||
class Nodes : public QObject {
|
class Nodes : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -144,6 +143,7 @@ public:
|
||||||
|
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
void allowConnection();
|
void allowConnection();
|
||||||
|
void updateModels();
|
||||||
|
|
||||||
NodeSource source();
|
NodeSource source();
|
||||||
FeatherNode connection();
|
FeatherNode connection();
|
||||||
|
@ -190,7 +190,6 @@ private:
|
||||||
bool useI2PNodes();
|
bool useI2PNodes();
|
||||||
bool useSocks5Proxy(const FeatherNode &node);
|
bool useSocks5Proxy(const FeatherNode &node);
|
||||||
|
|
||||||
void updateModels();
|
|
||||||
void resetLocalState();
|
void resetLocalState();
|
||||||
void exhausted();
|
void exhausted();
|
||||||
int modeHeight(const QList<FeatherNode> &nodes);
|
int modeHeight(const QList<FeatherNode> &nodes);
|
||||||
|
|
Loading…
Reference in a new issue