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 <noreply@anthropic.com>
This commit is contained in:
1 parent
724f717421
commit
66905ef04f
3 files changed
+84
-6
No files matched your search
@@ -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);}
|
||||
@@ -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<std::string> 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<std::string> 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";
|
||||
|
||||
@@ -185,8 +185,21 @@ std::string App::render_settings_groups(int *count) const {
|
||||
"Suchbegriff.</small></p>";
|
||||
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<const char *, 4> c = theme == "midnight" ? std::array<const char *, 4>{"#23262d", "#f0ece2", "#e0a25f", "#30343d"}
|
||||
: theme == "matchday" ? std::array<const char *, 4>{"#e4eed6", "#1d2a16", "#3f7a3a", "#cfe0b8"}
|
||||
: std::array<const char *, 4>{"#f5ead8", "#201e1d", "#c67139", "#ebddc5"};
|
||||
return std::string("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 110\"><rect width=\"200\" height=\"110\" rx=\"12\" fill=\"") + c[0] + "\"/><rect x=\"14\" y=\"14\" width=\"80\" height=\"9\" rx=\"4\" fill=\"" + c[1] +
|
||||
"\"/><rect x=\"14\" y=\"32\" width=\"110\" height=\"5\" rx=\"2\" fill=\"" + c[1] + "\" opacity=\".5\"/><rect x=\"14\" y=\"44\" width=\"76\" height=\"52\" rx=\"8\" fill=\"" + c[3] + "\"/><rect x=\"100\" y=\"44\" width=\"86\" height=\"24\" rx=\"8\" fill=\"" + c[3] +
|
||||
"\"/><rect x=\"100\" y=\"76\" width=\"50\" height=\"20\" rx=\"10\" fill=\"" + c[2] + "\"/></svg>";
|
||||
}
|
||||
} // 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", "<span>" + std::string(label) + "</span>",
|
||||
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<std::string, std::pair<std::string, std::string>> 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", "<span class=\"set-theme-art\">" + picture(renderer_.diagram("settings-theme-" + type, settings_theme_svg(type), 640), 590, 324.5) + "</span><strong class=\"pg-h\" style=\"font-size:" + pg(16) + ";\">" + t[1] + "</strong>",
|
||||
std::string("pg-card set-theme") + (chosen ? " sel" : ""), "id=\"settings-theme-" + type + "\" data-id=\"" + type + "\" aria-pressed=\"" + (chosen ? "true" : "false") + "\"");
|
||||
continue;
|
||||
}
|
||||
const auto mini =
|
||||
"<div class=\"settings-theme-preview preview-" + type +
|
||||
"\"><div class=\"preview-background\">" +
|
||||
@@ -248,14 +267,16 @@ std::string App::render_settings() {
|
||||
(p.at("theme") == type ? "true" : "false") + "\"");
|
||||
}
|
||||
pane += "</div></div>";
|
||||
pane += "<div class=\"settings-group\"><h3>Bewegung</h3>" +
|
||||
pane += "<div class=\"settings-group\"><h3>" + std::string(page ? "Darstellung" : "Bewegung") + "</h3>" +
|
||||
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<std::string>(), "global", "display", "motion")) +
|
||||
"</div>";
|
||||
(page && engine_mode_ ? "" : "</div>");
|
||||
if (engine_mode_) {
|
||||
int width=0,height=0; SDL_GetWindowSize(video_.window,&width,&height);
|
||||
pane += "<div class=\"settings-group\"><h3>Fenster</h3><p>" + std::to_string(width) + " × " + std::to_string(height) + " · Automatische Anpassung</p></div>";
|
||||
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", "<span class=\"settings-readonly\">" + size + "</span>") + "</div>";
|
||||
else pane += "<div class=\"settings-group\"><h3>Fenster</h3><p>" + size + " · Automatische Anpassung</p></div>";
|
||||
} else {
|
||||
pane += "<div class=\"settings-group\"><h3>Bildschirm</h3>";
|
||||
const auto pref =
|
||||
@@ -370,6 +391,25 @@ std::string App::render_settings() {
|
||||
"</div><span id=\"settings-search-count\"></span></div>"
|
||||
: "";
|
||||
settings_restore_scroll_ = true;
|
||||
if (page) {
|
||||
// the headings of the panels in capitals, as on the other pages
|
||||
for (size_t at = pane.find("<h3>"); at != std::string::npos; at = pane.find("<h3>", at + 4)) {
|
||||
const auto end = pane.find("</h3>", 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("<div class=\"settings-jump-label\">"); at != std::string::npos) jump = head.substr(at);
|
||||
std::string out = "<section class=\"pg-page set-page\"><div class=\"pg-row\" style=\"align-items:flex-end;\"><div class=\"pg-grow\"><h2 class=\"pg-h\" style=\"font-size:" + pg(22) + ";line-height:" + pg(28) + ";\">" + captions.at(settings_category_).first +
|
||||
"</h2><span class=\"pg-mut\" style=\"display:block;\">" + captions.at(settings_category_).second + "</span></div><nav class=\"pg-tabs\" role=\"tablist\">" + nav + "</nav></div>";
|
||||
if (game)
|
||||
out += "<div class=\"pg-row set-search\"><input type=\"text\" id=\"settings-search\" maxlength=\"120\" value=\"" + esc(settings_query_) + "\" placeholder=\"Spieloption suchen …\" aria-label=\"Spieloption suchen\"/>" +
|
||||
pg_button("settings-search-clear", "×", "round", "id=\"settings-search-clear\" aria-label=\"Suche leeren\"") + "<span id=\"settings-search-count\" class=\"pg-mut\"></span>" + jump + "</div>";
|
||||
return out + "<div id=\"settings-options\" class=\"settings-scroll\" tabindex=\"0\">" + pane + "</div><nav class=\"pg-foot\"><span class=\"pg-status\" id=\"settings-draft-status\" role=\"status\"></span><span class=\"pg-sp\"></span>" +
|
||||
pg_button("settings-cancel", "Abbrechen", "", "id=\"settings-cancel\"") + pg_button("settings-apply", "Anwenden", "primary", "id=\"settings-apply\"") + "</nav></section>";
|
||||
}
|
||||
return "<section class=\"settings-layout\"><nav "
|
||||
"class=\"settings-categories\" role=\"tablist\" "
|
||||
"aria-orientation=\"vertical\">" +
|
||||
|
||||
Reference in new issue
Block a user