Settings: make dialog modal

This commit is contained in:
tobtoht 2021-10-22 13:05:40 +02:00
parent a958a54927
commit 6d00d444e1
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
3 changed files with 11 additions and 14 deletions

View file

@ -47,7 +47,6 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
// Ensure the destructor is called after closeEvent()
setAttribute(Qt::WA_DeleteOnClose);
m_windowSettings = new Settings(m_ctx, this);
m_windowCalc = new CalcWindow(this);
m_splashDialog = new SplashDialog(this);
@ -68,19 +67,12 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
#endif
websocketNotifier()->emitCache(); // Get cached data
// Settings
for (const auto &widget: m_priceTickerWidgets)
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, widget, &PriceTickerWidget::updateDisplay);
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, m_balanceTickerWidget, &BalanceTickerWidget::updateDisplay);
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, m_sendWidget, QOverload<>::of(&SendWidget::onPreferredFiatCurrencyChanged));
connect(m_windowSettings, &Settings::skinChanged, this, &MainWindow::skinChanged);
QTimer::singleShot(1, [this]{this->updateWidgetIcons();});
connect(m_windowManager, &WindowManager::torSettingsChanged, m_ctx.get(), &AppContext::onTorSettingsChanged);
connect(torManager(), &TorManager::connectionStateChanged, this, &MainWindow::onTorConnectionStateChanged);
this->onTorConnectionStateChanged(torManager()->torConnected);
ColorScheme::updateFromWidget(this);
QTimer::singleShot(1, [this]{this->updateWidgetIcons();});
// Timers
connect(&m_updateBytes, &QTimer::timeout, this, &MainWindow::updateNetStats);
@ -833,9 +825,14 @@ void MainWindow::menuAboutClicked() {
}
void MainWindow::menuSettingsClicked() {
m_windowSettings->raise();
m_windowSettings->show();
m_windowSettings->activateWindow();
Settings settings{m_ctx, this};
for (const auto &widget: m_priceTickerWidgets) {
connect(&settings, &Settings::preferredFiatCurrencyChanged, widget, &PriceTickerWidget::updateDisplay);
}
connect(&settings, &Settings::preferredFiatCurrencyChanged, m_balanceTickerWidget, &BalanceTickerWidget::updateDisplay);
connect(&settings, &Settings::preferredFiatCurrencyChanged, m_sendWidget, QOverload<>::of(&SendWidget::onPreferredFiatCurrencyChanged));
connect(&settings, &Settings::skinChanged, this, &MainWindow::skinChanged);
settings.exec();
}
void MainWindow::menuSignVerifyClicked() {

View file

@ -223,7 +223,6 @@ private:
WindowManager *m_windowManager;
QSharedPointer<AppContext> m_ctx;
Settings *m_windowSettings = nullptr;
CalcWindow *m_windowCalc = nullptr;
SplashDialog *m_splashDialog = nullptr;

View file

@ -465,11 +465,12 @@
</property>
<addaction name="actionAbout"/>
<addaction name="actionOfficialWebsite"/>
<addaction name="actionDonate_to_Feather"/>
<addaction name="separator"/>
<addaction name="actionDocumentation"/>
<addaction name="actionReport_bug"/>
<addaction name="actionShow_debug_info"/>
<addaction name="separator"/>
<addaction name="actionDonate_to_Feather"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">