From 66905ef04f37eefedcb2b10cf0fd3c7860a9eb9d Mon Sep 17 00:00:00 2001 From: Weyoune Date: Sun, 15 Nov 2026 21:23:49 +0100 Subject: [PATCH] The settings as a page of the notebook, after the design The categories as tabs at the top, the skins as cards with a sketch, the options as rows with the page's switches, and status with the two buttons in the foot. From the main menu the older sheet stays. Co-Authored-By: Claude Fable 5.2 --- assets/modern/pages.rcss | 38 +++++++++++++++++++++++ src/modern/ui/pages.inc | 2 +- src/modern/ui/settings_screens.inc | 50 +++++++++++++++++++++++++++--- 3 files changed, 84 insertions(+), 6 deletions(-) diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss index 0fe9bec..c8fb1bd 100644 --- a/assets/modern/pages.rcss +++ b/assets/modern/pages.rcss @@ -572,3 +572,41 @@ body.midnight .sd-stage,body.matchday .sd-stage {background-color:var(--p-n2);} .fl-manager strong {display:block;font-size:31dp;font-weight:bold;} .fl-manager span {display:block;font-size:28dp;} .fl-error {display:block;margin-top:14dp;color:var(--p-a7);} + +/* --- settings: the older rows in the dress of the page --- */ +.pg-root .settings-scroll {position:relative;left:auto;right:auto;top:auto;bottom:auto;display:block;flex:1;min-height:0;width:2025dp;align-self:center;padding:0 18dp 0 0;overflow-y:auto;overflow-x:hidden;font-size:30dp;color:var(--p-text);} +.pg-root .settings-group,.pg-root .settings-automation-master {display:block;margin:0 0 27dp;padding:27dp 36dp 14dp;border:2dp var(--p-div);border-radius:45dp;background-color:var(--p-n1);} +.pg-root .settings-group h3 {margin:0;padding:0 0 9dp;border-bottom-width:0dp;font-family:Modern;font-size:24dp;font-weight:bold;letter-spacing:1.5dp;line-height:32dp;color:var(--p-a8);} +.pg-root .settings-group-help {margin:4dp 0 9dp;font-size:28dp;line-height:38dp;color:var(--p-n7);} +.pg-root .settings-group>p {font-size:28dp;color:var(--p-n7);} +.pg-root .settings-row {min-height:104dp;gap:45dp;padding:14dp 0;border-bottom:2dp var(--p-row);} +.pg-root .settings-row label>span {font-size:30dp;line-height:40dp;font-weight:bold;color:var(--p-text);} +.pg-root .settings-row label>small {margin-top:0;font-size:28dp;line-height:36dp;color:var(--p-n7);} +.pg-root .settings-automation-master {padding:9dp 36dp;background-color:var(--p-a1);border-color:var(--p-a4);} +.pg-root .settings-automation-master .settings-row {border-bottom-width:0dp;} +.pg-root .settings-switch,.pg-root .settings-switch:hover {border:2dp transparent;border-radius:24dp;background-color:var(--p-n4);decorator:none;} +.pg-root .settings-switch.checked,.pg-root .settings-switch.checked:hover {background-color:var(--p-accent);border-color:transparent;} +.pg-root .settings-switch.mixed,.pg-root .settings-switch.mixed:hover {background-color:var(--p-a5);} +.pg-root .settings-switch-knob,.pg-root .settings-switch.checked .settings-switch-knob {background-color:#ffffff;box-shadow:0dp 2dp 5dp #0003;} +.pg-root .settings-switch:disabled {opacity:.5;} +.pg-root .settings-select,.pg-root .settings-number {width:480dp;min-height:68dp;padding:10dp 27dp;border:2dp var(--p-div);border-radius:36dp;background-color:var(--p-bg);decorator:none;font-family:Modern;font-size:30dp;color:var(--p-text);} +.pg-root .settings-number {width:180dp;} +.pg-root .settings-readonly {font-family:Display;font-size:38dp;color:var(--p-text);padding:0;} +.pg-root .settings-competition {margin-top:18dp;} +.pg-root .settings-competition h4 {padding:11dp 27dp;border-radius:27dp;background-color:var(--p-n2);font-size:29dp;font-weight:bold;color:var(--p-n9);} +.pg-root .settings-competition .settings-row {padding-left:27dp;} +.pg-root .settings-volume>span {color:var(--p-a8);} +.pg-root .settings-search-empty {padding:90dp 24dp;font-size:32dp;color:var(--p-n8);} +.pg-root .settings-search-empty small {color:var(--p-n7);} +.pg-root .settings-theme-options {display:flex;gap:27dp;margin:9dp 0 18dp;} +.pg-root .pg-card.set-theme {flex:1;min-width:0;align-items:flex-start;} +.set-theme-art {display:block;width:590dp;height:324.5dp;overflow:hidden;border:2dp var(--p-n4);border-radius:27dp;} +.set-search {width:2025dp;align-self:center;gap:18dp;} +.pg-root #settings-search {display:block;flex:1;min-width:0;width:auto;height:76dp;padding:0 32dp;border:2dp var(--p-div);border-radius:38dp;background-color:var(--p-n1);decorator:none;font-family:Modern;font-size:30dp;line-height:72dp;color:var(--p-text);} +.pg-root #settings-search-clear {width:68dp;height:68dp;min-width:68dp;border:2dp var(--p-div);background-color:var(--p-n1);font-size:40dp;} +.pg-root #settings-search-count {width:auto;min-width:210dp;font-size:28dp;} +.pg-root .settings-jump-label {flex-direction:row;align-items:center;gap:14dp;font-size:28dp;color:var(--p-n7);} +.pg-root .settings-jump-label span {display:block;white-space:nowrap;} +.pg-root .settings-jump-label .settings-select {width:470dp;font-size:28dp;} +.pg-root #settings-apply,.pg-root #settings-apply:hover {background-color:var(--p-accent);border-color:var(--p-accent);color:var(--p-on-accent);opacity:1;} +.pg-root #settings-apply:disabled,.pg-root #settings-apply[disabled] {opacity:1;background-color:var(--p-n2);border-color:var(--p-div);color:var(--p-n5);} diff --git a/src/modern/ui/pages.inc b/src/modern/ui/pages.inc index 990ecfa..84100e1 100644 --- a/src/modern/ui/pages.inc +++ b/src/modern/ui/pages.inc @@ -5,7 +5,7 @@ // The menus that are laid out as a page of the notebook. Every other career menu is still a // sheet of the old format, shown scaled inside the book. bool App::page_native() const { - static const std::set native{"save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; + static const std::set native{"settings", "save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; if (menu_ == "calendar" || menu_ == "postpone" || menu_ == "lineup") return notebook_page() && engine_mode_; // a national coach arranges friendlies on the older sheet if (menu_ == "friendlies") return notebook_page() && engine_mode_ && engine_data_.contains("desktop") && engine_data_.at("desktop").at("meta").at("scope").at("role") == "club"; diff --git a/src/modern/ui/settings_screens.inc b/src/modern/ui/settings_screens.inc index e56ed76..38b6a77 100644 --- a/src/modern/ui/settings_screens.inc +++ b/src/modern/ui/settings_screens.inc @@ -185,8 +185,21 @@ std::string App::render_settings_groups(int *count) const { "Suchbegriff.

"; return out; } +namespace { +// A sketch of a skin for its card: paper, ink, a panel and the accent. +std::string settings_theme_svg(const std::string &theme) { + const std::array c = theme == "midnight" ? std::array{"#23262d", "#f0ece2", "#e0a25f", "#30343d"} + : theme == "matchday" ? std::array{"#e4eed6", "#1d2a16", "#3f7a3a", "#cfe0b8"} + : std::array{"#f5ead8", "#201e1d", "#c67139", "#ebddc5"}; + return std::string(""; +} +} // namespace std::string App::render_settings() { begin_settings(); + // in a career the settings are a page of the notebook; from the main menu the older sheet + const bool page = page_native(); settings_remember_scroll(); const auto &p = settings_draft_.at("global"); std::string nav, pane; @@ -200,13 +213,13 @@ std::string App::render_settings() { std::string(id) == "sound") && !(engine_mode_ && std::string(id) == "sound")) // a career has no sound options yet nav += btn("settings-category", "" + std::string(label) + "", - settings_category_ == id ? "active" : "", + settings_category_ == id ? "active on" : "", "id=\"settings-tab-" + std::string(id) + "\" role=\"tab\" aria-selected=\"" + (settings_category_ == id ? "true" : "false") + "\" data-id=\"" + id + "\""); const std::map> captions = { - {"display", {"Anzeige", "Bildschirm und Sprache"}}, + {"display", {"Anzeige", page && engine_mode_ ? "Gestaltung, Bewegung und Fenster" : "Bildschirm und Sprache"}}, {"sound", {"Sound", "Lautstärke, Effekte und Spielton"}}, {"game", {"Spiel", engine_mode_ ? "Spielablauf und Nachrichten" : "Spielablauf und Live-Ticker"}}, {"automation", @@ -226,6 +239,12 @@ std::string App::render_settings() { {{"matchday", "Spieltag", "Graphit, rote Akzente"}}}}; for (const auto &t : themes) { const std::string type = t[0]; + if (page) { + const bool chosen = p.at("theme") == type; + pane += btn("settings-theme", "" + picture(renderer_.diagram("settings-theme-" + type, settings_theme_svg(type), 640), 590, 324.5) + "" + t[1] + "", + std::string("pg-card set-theme") + (chosen ? " sel" : ""), "id=\"settings-theme-" + type + "\" data-id=\"" + type + "\" aria-pressed=\"" + (chosen ? "true" : "false") + "\""); + continue; + } const auto mini = "
" + @@ -248,14 +267,16 @@ std::string App::render_settings() { (p.at("theme") == type ? "true" : "false") + "\""); } pane += "
"; - pane += "

Bewegung

" + + pane += "

" + std::string(page ? "Darstellung" : "Bewegung") + "

" + settings_row("preference-motion", "Übergänge und Einblendungen", "Reduziert: Fenster, Karten und Tor-Einblendungen erscheinen ohne Bewegung.", settings_select("preference-motion", {{"full", "Voll"}, {"reduced", "Reduziert"}}, p.at("display").at("motion").get(), "global", "display", "motion")) + - "
"; + (page && engine_mode_ ? "" : "
"); if (engine_mode_) { int width=0,height=0; SDL_GetWindowSize(video_.window,&width,&height); - pane += "

Fenster

" + std::to_string(width) + " × " + std::to_string(height) + " · Automatische Anpassung

"; + const auto size = std::to_string(width) + " × " + std::to_string(height); + if (page) pane += settings_row("settings-window", "Fenster", "Größe, nur Anzeige · passt sich dem Fenster an", "" + size + "") + ""; + else pane += "

Fenster

" + size + " · Automatische Anpassung

"; } else { pane += "

Bildschirm

"; const auto pref = @@ -370,6 +391,25 @@ std::string App::render_settings() { "
" : ""; settings_restore_scroll_ = true; + if (page) { + // the headings of the panels in capitals, as on the other pages + for (size_t at = pane.find("

"); at != std::string::npos; at = pane.find("

", at + 4)) { + const auto end = pane.find("

", at); + if (end == std::string::npos) break; + const auto text = pane.substr(at + 4, end - at - 4); + if (text.find('&') == std::string::npos && text.find('<') == std::string::npos) pane.replace(at + 4, end - at - 4, pg_upper(text)); + } + const bool game = settings_category_ == "game"; + std::string jump; + if (const auto at = head.find("
"); at != std::string::npos) jump = head.substr(at); + std::string out = "

" + captions.at(settings_category_).first + + "

" + captions.at(settings_category_).second + "
"; + if (game) + out += "
" + + pg_button("settings-search-clear", "×", "round", "id=\"settings-search-clear\" aria-label=\"Suche leeren\"") + "" + jump + "
"; + return out + "
" + pane + "
"; + } return "