diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-01-01 19:26:15 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-01-01 15:02:42 +0100 |
| commit | 19c8bf98885074617f9cc0a0b2f60ebf47ddf714 (patch) | |
| tree | 570b591a687e574bddd0c79009e2829d9f496f78 /src/main.cpp | |
| parent | 808288ce691a3c1520db513c7cff79fd22d3c53f (diff) | |
| download | kristall-19c8bf98885074617f9cc0a0b2f60ebf47ddf714.tar.gz | |
Added UI density option.
'Compact' is the default - saves screen space a bit. The old layout is available in the 'Classic' option
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 780933f..2b5e635 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,7 @@ QString toFingerprintString(QSslCertificate const & certificate) static QSettings * app_settings_ptr; static QApplication * app; +static MainWindow * main_window = nullptr; #define SSTR(X) STR(X) #define STR(X) #X @@ -269,6 +270,7 @@ int main(int argc, char *argv[]) kristall::setTheme(kristall::options.theme); MainWindow w(&app); + main_window = &w; auto urls = cli_parser.positionalArguments(); if(urls.size() > 0) { @@ -335,6 +337,12 @@ void GenericSettings::load(QSettings &settings) else theme = Theme::os_default; + QString density = settings.value("ui_density", "compact").toString(); + if(density == "compact") + ui_density = UIDensity::compact; + else if (density == "classic") + ui_density = UIDensity::classic; + if(settings.value("gophermap_display", "rendered").toString() == "rendered") gophermap_display = FormattedText; else @@ -363,8 +371,15 @@ void GenericSettings::save(QSettings &settings) const case Theme::light: theme_name = "light"; break; case Theme::os_default: theme_name = "os_default"; break; } - settings.setValue("theme", theme_name); + + QString density = "compact"; + switch(ui_density) { + case UIDensity::compact: density = "compact"; break; + case UIDensity::classic: density = "classic"; break; + } + settings.setValue("ui_density", density); + settings.setValue("gophermap_display", (gophermap_display == FormattedText) ? "rendered" : "text"); settings.setValue("use_os_scheme_handler", use_os_scheme_handler); settings.setValue("show_hidden_files_in_dirs", show_hidden_files_in_dirs); @@ -437,3 +452,10 @@ void kristall::setTheme(Theme theme) QIcon::setThemeName("dark"); } } + +void kristall::setUiDensity(UIDensity density, bool previewing) +{ + assert(app != nullptr); + assert(main_window != nullptr); + main_window->setUiDensity(density, previewing); +} |
