mirror of
https://github.com/wownero/wowlet.git
synced 2026-11-29 11:33:57 +01:00
settings: fix proxy switch crash
This commit is contained in:
+7
-8
@@ -89,9 +89,7 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
|
||||
connect(m_windowManager, &WindowManager::websocketStatusChanged, this, &MainWindow::onWebsocketStatusChanged);
|
||||
this->onWebsocketStatusChanged(!conf()->get(Config::disableWebsocket).toBool());
|
||||
|
||||
connect(m_windowManager, &WindowManager::proxySettingsChanged, [this]{
|
||||
this->onProxySettingsChanged();
|
||||
});
|
||||
connect(m_windowManager, &WindowManager::proxySettingsChanged, this, &MainWindow::onProxySettingsChangedConnect);
|
||||
connect(m_windowManager, &WindowManager::updateBalance, m_wallet, &Wallet::updateBalance);
|
||||
connect(m_windowManager, &WindowManager::offlineMode, this, &MainWindow::onOfflineMode);
|
||||
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);
|
||||
connect(m_statusBtnProxySettings, &StatusBarButton::clicked, this, &MainWindow::menuProxySettingsClicked);
|
||||
this->statusBar()->addPermanentWidget(m_statusBtnProxySettings);
|
||||
this->onProxySettingsChanged(false);
|
||||
this->onProxySettingsChanged();
|
||||
|
||||
m_statusBtnHwDevice = new StatusBarButton(this->hardwareDevicePairedIcon(), this->getHardwareDevice(), this);
|
||||
connect(m_statusBtnHwDevice, &StatusBarButton::clicked, this, &MainWindow::menuHwDeviceClicked);
|
||||
@@ -651,11 +649,12 @@ void MainWindow::onWebsocketStatusChanged(bool enabled) {
|
||||
m_sendWidget->setWebsocketEnabled(enabled);
|
||||
}
|
||||
|
||||
void MainWindow::onProxySettingsChanged(bool connect) {
|
||||
if (connect) {
|
||||
m_nodes->connectToNode();
|
||||
}
|
||||
void MainWindow::onProxySettingsChangedConnect() {
|
||||
m_nodes->connectToNode();
|
||||
this->onProxySettingsChanged();
|
||||
}
|
||||
|
||||
void MainWindow::onProxySettingsChanged() {
|
||||
int proxy = conf()->get(Config::proxy).toInt();
|
||||
|
||||
if (proxy == Config::Proxy::Tor) {
|
||||
|
||||
+2
-1
@@ -165,7 +165,8 @@ private slots:
|
||||
void tryStoreWallet();
|
||||
void onWebsocketStatusChanged(bool enabled);
|
||||
void showUpdateNotification();
|
||||
void onProxySettingsChanged(bool connect = true);
|
||||
void onProxySettingsChangedConnect();
|
||||
void onProxySettingsChanged();
|
||||
void onOfflineMode(bool offline);
|
||||
void onManualFeeSelectionEnabled(bool enabled);
|
||||
void onSubtractFeeFromAmountEnabled(bool enabled);
|
||||
|
||||
@@ -378,6 +378,7 @@ void Settings::onProxySettingsChanged() {
|
||||
ui->closeButton->addButton(QDialogButtonBox::Apply);
|
||||
connect(ui->closeButton->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, [this](){
|
||||
ui->proxyWidget->setProxySettings();
|
||||
m_nodes->updateModels();
|
||||
emit proxySettingsChanged();
|
||||
ui->closeButton->removeButton(ui->closeButton->button(QDialogButtonBox::Apply));
|
||||
});
|
||||
|
||||
+1
-2
@@ -134,7 +134,6 @@ struct FeatherNode {
|
||||
}
|
||||
};
|
||||
|
||||
class AppContext;
|
||||
class Nodes : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -144,6 +143,7 @@ public:
|
||||
|
||||
void loadConfig();
|
||||
void allowConnection();
|
||||
void updateModels();
|
||||
|
||||
NodeSource source();
|
||||
FeatherNode connection();
|
||||
@@ -190,7 +190,6 @@ private:
|
||||
bool useI2PNodes();
|
||||
bool useSocks5Proxy(const FeatherNode &node);
|
||||
|
||||
void updateModels();
|
||||
void resetLocalState();
|
||||
void exhausted();
|
||||
int modeHeight(const QList<FeatherNode> &nodes);
|
||||
|
||||
Reference in New Issue
Block a user