Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
prefs.hpp
Go to the documentation of this file.
1// ui::prefs — what the user chose for Cadran's look: the language, the
2// theme, the text size, the effects and the sidebar. The app keeps them in its own
3// settings and hands them over with use_prefs() at start-up, before the
4// first screen; the pickers (ui::pick_language…) change them there, then
5// save them through ui::hooks::get().save_prefs.
6// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
7#pragma once
8
9#include <string>
10
11namespace ui
12{
13
16struct Prefs
17{
18 std::string language = "system";
19 std::string theme = "dark";
24 std::string theme_file;
25 std::string text_size = "auto";
26 std::string effects = "auto";
27 bool glow = true;
31 std::string rail = "auto";
32};
33
34constexpr const char* LANGUAGES[] = { "system", "en-US", "fr", "fr-CA", "de", "es", "es-419", "it", "nl",
35 "pt", "pt-BR", "ru", "ja", "ko", "zh-Hans", "zh-Hant" };
36constexpr const char* THEMES[] = { "system", "light", "dark" };
37constexpr const char* TEXT_SIZES[] = { "auto", "normal", "large", "largest" };
38constexpr const char* EFFECTS[] = { "auto", "full", "reduced" };
39constexpr const char* RAILS[] = { "auto", "open", "icons" };
40
45
48bool env_flag(const char* name);
49
50} // namespace ui
Definition effects.hpp:14
Definition text_size.hpp:14
Definition action_sheet.hpp:11
constexpr const char * TEXT_SIZES[]
Definition prefs.hpp:37
constexpr const char * RAILS[]
Definition prefs.hpp:39
void use_prefs(Prefs &p)
From now on, prefs() is p, which must outlive every screen.
constexpr const char * EFFECTS[]
Definition prefs.hpp:38
Prefs & prefs()
The ones in use: the app's (use_prefs), else defaults of their own.
bool env_flag(const char *name)
constexpr const char * THEMES[]
Definition prefs.hpp:36
constexpr const char * LANGUAGES[]
Definition prefs.hpp:34
Definition prefs.hpp:17
std::string theme_file
Definition prefs.hpp:24
bool glow
Definition prefs.hpp:27
std::string language
"system" or one of LANGUAGES
Definition prefs.hpp:18
std::string rail
Definition prefs.hpp:31
std::string theme
Definition prefs.hpp:19