From 0ab1c12b436f4363d03ace1420b91cba1b9b0d50 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Thu, 31 Dec 2020 16:48:22 +1100 Subject: Prevents URL bar styles appearing strange in settings dialog after changing theme. do this by removing style while settings window is open --- src/browsertab.cpp | 3 ++- src/mainwindow.cpp | 15 ++++++++++++++- src/mainwindow.hpp | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/browsertab.cpp b/src/browsertab.cpp index 1446f20..549f41a 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -1138,7 +1138,8 @@ void BrowserTab::updateUrlBarStyle() // or has an invalid URL. if (this->ui->url_bar->hasFocus() || !url.isValid() || - this->is_internal_location) + this->is_internal_location || + mainWindow->settings_visible) { // Disable styling setLineEditTextFormat(this->ui->url_bar, diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f59b110..5f2a7d2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -21,6 +21,7 @@ MainWindow::MainWindow(QApplication * app, QWidget *parent) : QMainWindow(parent), application(app), + settings_visible(false), ui(new Ui::MainWindow), url_status(new ElideLabel(this)), file_size(new QLabel(this)), @@ -289,11 +290,23 @@ void MainWindow::on_actionSettings_triggered() dialog.setGeminiSslTrust(kristall::trust::gemini); dialog.setHttpsSslTrust(kristall::trust::https); + // We use this to disable url bar styling + // while we view settings, so that theme + // stays applied. + settings_visible = true; + this->curTab()->updateUrlBarStyle(); + if(dialog.exec() != QDialog::Accepted) { kristall::setTheme(kristall::options.theme); + + settings_visible = false; + this->curTab()->updateUrlBarStyle(); + return; } + settings_visible = false; + kristall::trust::gemini = dialog.geminiSslTrust(); kristall::trust::https = dialog.httpsSslTrust(); kristall::options = dialog.options(); @@ -309,7 +322,7 @@ void MainWindow::on_actionSettings_triggered() // changes are instantly applied. for (int i = 0; i < this->ui->browser_tabs->count(); ++i) { - BrowserTab * tab = tabAt(i); + BrowserTab * tab = this->tabAt(i); tab->needs_rerender = true; tab->updateUrlBarStyle(); } diff --git a/src/mainwindow.hpp b/src/mainwindow.hpp index 6ac1066..f816281 100644 --- a/src/mainwindow.hpp +++ b/src/mainwindow.hpp @@ -101,6 +101,8 @@ private: public: QApplication * application; + + bool settings_visible; private: Ui::MainWindow *ui; -- cgit v1.2.3