Port settings and automation to the Modern UI (by Codex)
This commit is contained in:
1 parent
8222926d9c
commit
adb4166a80
26 files changed
+2734
-179
No files matched your search
@@ -711,115 +711,6 @@ std::string App::render_camp() {
|
||||
btn("camp-remember", "Vormerken", "primary") + "</div></div>";
|
||||
return body;
|
||||
}
|
||||
std::string App::render_settings() {
|
||||
if (draft_preferences_.is_null())
|
||||
draft_preferences_ =
|
||||
source_ ? snap().state.at("preferences")
|
||||
: Json{{"theme", theme_}, {"volume", 80}, {"effects", true}};
|
||||
std::string nav;
|
||||
for (const auto &[key, label] :
|
||||
std::vector<std::pair<std::string, std::string>>{
|
||||
{"display", "Anzeige"},
|
||||
{"sound", "Sound"},
|
||||
{"game", "Spiel"},
|
||||
{"automation", "Automatik"}}) {
|
||||
if (scene_ == "main" && (key == "game" || key == "automation"))
|
||||
continue;
|
||||
nav += btn("settings-category", label,
|
||||
settings_category_ == key ? "primary" : "",
|
||||
"data-id=\"" + key +
|
||||
"\" "
|
||||
"style=\"display:flex;justify-content:flex-start;width:100%;"
|
||||
"height:100dp;margin-"
|
||||
"bottom:14dp;text-align:left;\"");
|
||||
}
|
||||
std::string pane = "<h2>" +
|
||||
std::string(settings_category_ == "display" ? "Anzeige"
|
||||
: settings_category_ == "sound" ? "Sound"
|
||||
: settings_category_ == "game" ? "Spiel"
|
||||
: "Automatik") +
|
||||
"</h2>";
|
||||
if (settings_category_ == "display") {
|
||||
pane +=
|
||||
"<h3 style=\"margin:40dp 0 24dp;\">Gestaltung</h3><div class=\"row\">";
|
||||
for (const auto &[id, name] :
|
||||
std::vector<std::pair<std::string, std::string>>{
|
||||
{"midnight", "Midnight Glass"},
|
||||
{"silver", "Silver Glass"},
|
||||
{"matchday", "Matchday"}})
|
||||
pane +=
|
||||
btn("settings-theme",
|
||||
img("background", 520, 270, false, true, 650) +
|
||||
"<p style=\"margin-top:20dp;\">" + name + "</p>",
|
||||
std::string("choice ") +
|
||||
(draft_preferences_.value("theme", theme_) == id ? "selected"
|
||||
: ""),
|
||||
"data-id=\"" + id + "\" style=\"width:570dp;padding:20dp;\"");
|
||||
pane +=
|
||||
"</div><h3 style=\"margin-top:50dp;\">Bildschirm</h3><div "
|
||||
"class=\"field-row\"><label>Modus</label>" +
|
||||
select("display-mode",
|
||||
{{"window", "Fenster"}, {"fullscreen", "Vollbild"}},
|
||||
draft_preferences_.value("mode", "window")) +
|
||||
"</div><div class=\"field-row\"><label>Auflösung</label>" +
|
||||
select("display-resolution",
|
||||
{{"1280x720", "1280 × 720"},
|
||||
{"1920x1080", "1920 × 1080"},
|
||||
{"2560x1440", "2560 × 1440"},
|
||||
{"3840x2160", "3840 × 2160"}},
|
||||
draft_preferences_.value("resolution", "1920x1080")) +
|
||||
"</div><div class=\"field-row\"><label>Skalierung</label>" +
|
||||
select("display-scale",
|
||||
{{"auto", "Auto"}, {"1", "1×"}, {"1.5", "1,5×"}, {"2", "2×"}},
|
||||
draft_preferences_.value("scale", "auto")) +
|
||||
"</div><div class=\"field-row\"><label>Sprache</label><select "
|
||||
"id=\"display-language\"><option value=\"de\" "
|
||||
"selected>Deutsch</option><option "
|
||||
"disabled>Englisch</option></select></div>";
|
||||
} else if (settings_category_ == "sound")
|
||||
pane +=
|
||||
"<div class=\"field-row\"><label>Lautstärke</label><input "
|
||||
"type=\"range\" min=\"0\" max=\"100\" value=\"" +
|
||||
std::to_string(draft_preferences_.value("volume", 80)) +
|
||||
"\" id=\"sound-volume\" data-input=\"sound-volume\"/><span "
|
||||
"id=\"volume-value\">" +
|
||||
std::to_string(draft_preferences_.value("volume", 80)) +
|
||||
" %</span></div><div class=\"field-row\"><label>Effekte</label><input "
|
||||
"type=\"checkbox\" id=\"sound-effects\" " +
|
||||
(draft_preferences_.value("effects", true) ? "checked" : "") +
|
||||
"/></div><div class=\"field-row\"><label>Effektstil</label>" +
|
||||
select("sound-style", {{"classic", "Klassisch"}, {"modern", "Modern"}},
|
||||
draft_preferences_.value("sound-style", "classic")) +
|
||||
"</div>";
|
||||
else if (settings_category_ == "automation") {
|
||||
pane += "<div class=\"field-row\"><label>Alles automatisch</label><input "
|
||||
"type=\"checkbox\" data-change=\"automation-all\"/></div>";
|
||||
for (const auto *name :
|
||||
{"Aufstellung", "Auswechslungen", "Taktik", "Manndeckung", "Training"})
|
||||
pane += "<div class=\"field-row\"><label>" + std::string(name) +
|
||||
"</label><input type=\"checkbox\"/></div>";
|
||||
} else
|
||||
pane +=
|
||||
std::string(
|
||||
"<div class=\"field-row\"><label>Spieloption suchen</label><input "
|
||||
"type=\"text\" id=\"settings-search\"/></div><div "
|
||||
"class=\"field-row\"><label>Reality-Modus</label><input "
|
||||
"type=\"checkbox\"/></div><div "
|
||||
"class=\"field-row\"><label>Spielszenen anzeigen</label><input "
|
||||
"type=\"checkbox\"/></div><div class=\"field-row\"><label>Desktop "
|
||||
"am Raster ausrichten</label><input type=\"checkbox\" ") +
|
||||
(desktop_.value("grid", true) ? "checked" : "") + "/></div>";
|
||||
return "<div class=\"panel\" "
|
||||
"style=\"position:absolute;left:0;top:0;width:370dp;bottom:150dp;"
|
||||
"padding:24dp 20dp;\">" +
|
||||
nav +
|
||||
"</div><div class=\"panel list\" "
|
||||
"style=\"position:absolute;left:410dp;right:0;top:0;bottom:150dp;"
|
||||
"padding:36dp;\">" +
|
||||
pane + "</div><div class=\"bottom-controls\">" +
|
||||
btn("close", "Abbrechen") +
|
||||
btn("settings-apply", "Anwenden", "primary") + "</div>";
|
||||
}
|
||||
std::string App::render_save(bool save) {
|
||||
const auto directory = user_dir() / "saves";
|
||||
std::string body = "<div class=\"panel list\" "
|
||||
|
||||
Reference in new issue
Block a user