diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-07 10:46:23 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-07 10:46:23 +0200 |
| commit | 425f9d41cd337133d5677744eef937a8a2a61212 (patch) | |
| tree | 6cd5c2603e1499b89aae4fe5e56c6e650cb2117e /src/settingsdialog.cpp | |
| parent | ec95bb371e54116a2627c162eac3357ec13f06ad (diff) | |
| download | kristall-425f9d41cd337133d5677744eef937a8a2a61212.tar.gz | |
Adds support for light/dark widget theme, adds experiemental support for http style sheets.
Diffstat (limited to 'src/settingsdialog.cpp')
| -rw-r--r-- | src/settingsdialog.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 27a1c12..859f5dd 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -20,6 +20,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) : this->ui->auto_theme->addItem("Dark Theme", QVariant::fromValue<int>(GeminiStyle::AutoDarkTheme)); this->ui->auto_theme->addItem("Light Theme", QVariant::fromValue<int>(GeminiStyle::AutoLightTheme)); + this->ui->ui_theme->clear(); + this->ui->ui_theme->addItem("Light", QVariant::fromValue<QString>("light")); + this->ui->ui_theme->addItem("Dark", QVariant::fromValue<QString>("dark")); + setGeminiStyle(GeminiStyle { }); } @@ -114,7 +118,23 @@ void SettingsDialog::setProtocols(ProtocolSetup const & protocols) #define M(X) \ this->ui->enable_##X->setChecked(protocols.X); PROTOCOLS(M) -#undef M + #undef M +} + +QString SettingsDialog::uiTheme() const +{ + return this->ui->ui_theme->currentData().toString(); +} + +void SettingsDialog::setUiTheme(const QString &theme) +{ + if(theme == "light") + this->ui->ui_theme->setCurrentIndex(0); + else if(theme == "dark") + this->ui->ui_theme->setCurrentIndex(1); + else + this->ui->ui_theme->setCurrentIndex(0); + } void SettingsDialog::reloadStylePreview() @@ -144,10 +164,13 @@ Plain text document here. if(host.length() == 0) host = "preview"; + QUrl url { QUrl(QString("about://%1/foobar").arg(host)) }; + DocumentOutlineModel outline; - auto doc = GeminiRenderer { current_style }.render( + auto doc = GeminiRenderer::render( document, - QUrl(QString("about://%1/foobar").arg(host)), + url, + current_style.derive(url), outline ); |
