Present fixed live ticker settings while preserving all stored options (by Codex)
This commit is contained in:
1 parent
e710937ca9
commit
9dd8731c66
6 files changed
+158
-8
No files matched your search
@@ -72,3 +72,30 @@ Automatikabgleich, Revisionen, atomare Fehler, Migration und unabhängige global
|
||||
Dateien. Bild- und Bedienungsnachweise inklusive UI-Demoständen liegen privat
|
||||
unter `bmh_4k_ui/docs/qa/settings-batch-2026-10-25/`; sie ersetzen keine
|
||||
Windows-/macOS-Laufzeitabnahme.
|
||||
|
||||
## Erste native Übertragungsart: Live-Ticker
|
||||
|
||||
Die native Präsentation bietet eine feste Übertragungsart Live-Ticker an; es gibt
|
||||
keine Grafik-/Reality-/Animationsauswahl. Der Hinweis steht in Anzeige neben der
|
||||
bestehenden Gestaltung. Theme-, Bildschirm- und Soundpräferenzen bleiben
|
||||
vorhanden. Sportschau und Animationen sowie klar grafikbezogene Einzelzeilen
|
||||
werden ausschließlich in der lesenden Präsentationskopie ausgeblendet.
|
||||
Sportschau-Ergebniszeilen bleiben für diese erste Version verborgen, ohne ihnen
|
||||
eine neue Regelbedeutung zu geben.
|
||||
|
||||
Sinnvolle Spielregeln, TOTO, Auslosungen, Pausen, Karten und Chancen bleiben
|
||||
sichtbar. Die bisherigen Radio-Informationszeilen heißen für dieselben Inhalte
|
||||
nun Gelbe Karten, Rote Karten beziehungsweise Chancen im Live-Ticker. Alle drei
|
||||
Original-Spieltonadressen bleiben erhalten. Der ursprüngliche Katalog und die
|
||||
Validierung werden nicht gekürzt: alle180Zellen einschließlich verborgener alter
|
||||
Grafikwerte überleben Import, erneutes Speichern und Änderungen anderer Zeilen.
|
||||
Die fünf Automatikwerte bleiben dieselben Benutzerwahlen, keine Engineaktionen.
|
||||
|
||||
Suchtreffer, sichtbare Gesamtzahl und Sprungliste verwenden denselben gefilterten
|
||||
Katalog; verborgene Gruppen tauchen dort nicht als scheinbar wählbare Abschnitte
|
||||
auf. Ein synthetischer Präsentationstest prüft Originalkatalog-Unverändertheit,
|
||||
beibehaltene Regel-/Karten-/Chancenadressen, drei Soundadressen und unveränderte
|
||||
179andere Zellen beim Editieren einer sichtbaren Option. Der gezielte native
|
||||
Inputlauf bestätigt den festen Hinweis, ausgeblendete Gruppen/Choices,
|
||||
keine Reality-Suchtreffer, Entwurf/Apply sowie erhaltene verborgene Werte.
|
||||
Daraus folgt weder eine Änderung realer Spielregeln noch eine Engine-Anbindung.
|
||||
@@ -18,7 +18,7 @@ void App::settings_after_render() {
|
||||
if (auto *label = element("settings-search-count"))
|
||||
label->SetInnerRML(std::to_string(count) + (settings_query_.empty()
|
||||
? " Optionen"
|
||||
: " von 142 Optionen"));
|
||||
: " von "+std::to_string(live_settings_option_count())+" Optionen"));
|
||||
}
|
||||
if (settings_restore_scroll_) {
|
||||
context_->Update();
|
||||
@@ -107,12 +107,12 @@ void App::settings_filter() {
|
||||
if (auto *label = element("settings-search-count"))
|
||||
label->SetInnerRML(std::to_string(count) + (settings_query_.empty()
|
||||
? " Optionen"
|
||||
: " von 142 Optionen"));
|
||||
: " von "+std::to_string(live_settings_option_count())+" Optionen"));
|
||||
if (auto *select = dynamic_cast<Rml::ElementFormControlSelect *>(
|
||||
element("settings-jump"))) {
|
||||
std::string choices;
|
||||
std::string first;
|
||||
for (const auto &g : settings_catalogue().at("groups")) {
|
||||
for (const auto &g : live_settings_catalogue().at("groups")) {
|
||||
const auto id = g.at("id").get<std::string>();
|
||||
const bool shown = element("settings-group-" + id) != nullptr;
|
||||
if (shown && first.empty())
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include "modern/ui/demo_settings.hpp"
|
||||
#include <set>
|
||||
namespace bmh::modern_ui {
|
||||
// A read-only presentation copy. Stored cells and original validation remain
|
||||
// intact.
|
||||
inline const Json &live_settings_catalogue() {
|
||||
static const Json view = [] {
|
||||
auto out = settings_catalogue();
|
||||
Json groups = Json::array();
|
||||
const std::set<std::string> hidden = {"B5", "C5", "D5", "K5", "N7",
|
||||
"P7", "I5", "G6", "F9", "G9",
|
||||
"H9", "K9", "P9"};
|
||||
const auto options = [&](const Json &rows) {
|
||||
Json shown = Json::array();
|
||||
for (auto row : rows) {
|
||||
const auto code = row.value("code", "");
|
||||
if (hidden.contains(code) ||
|
||||
row.value("label", "").find("Sportschau") != std::string::npos)
|
||||
continue;
|
||||
if (code == "L5")
|
||||
row["label"] = "Gelbe Karten im Live-Ticker";
|
||||
if (code == "M5")
|
||||
row["label"] = "Rote Karten im Live-Ticker";
|
||||
if (code == "N5")
|
||||
row["label"] = "Chancen im Live-Ticker";
|
||||
shown.push_back(std::move(row));
|
||||
}
|
||||
return shown;
|
||||
};
|
||||
for (auto group : out.at("groups")) {
|
||||
const auto id = group.value("id", "");
|
||||
if (id == "sportschau" || id == "animations")
|
||||
continue;
|
||||
if (group.contains("options"))
|
||||
group["options"] = options(group.at("options"));
|
||||
else
|
||||
for (auto &competition : group["competitions"])
|
||||
competition["options"] = options(competition.at("options"));
|
||||
groups.push_back(std::move(group));
|
||||
}
|
||||
out["groups"] = std::move(groups);
|
||||
for (auto &row : out["sound"])
|
||||
if (row.value("code", "") == "A5")
|
||||
row["label"] = "Spielton";
|
||||
for (auto &row : out["automation"])
|
||||
if (row[0] == "marking")
|
||||
row[2] = "Die Zuordnung der Gegenspieler automatisch übernehmen.";
|
||||
return out;
|
||||
}();
|
||||
return view;
|
||||
}
|
||||
inline int live_settings_option_count() {
|
||||
int total = 0;
|
||||
for (const auto &group : live_settings_catalogue().at("groups")) {
|
||||
if (group.contains("options"))
|
||||
total += int(group.at("options").size());
|
||||
else
|
||||
for (const auto &competition : group.at("competitions"))
|
||||
total += int(competition.at("options").size());
|
||||
}
|
||||
return total;
|
||||
}
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -124,7 +124,7 @@ std::string App::render_settings_groups(int *count) const {
|
||||
terms.push_back(word);
|
||||
int found = 0;
|
||||
std::string out;
|
||||
for (const auto &group : settings_catalogue().at("groups")) {
|
||||
for (const auto &group : live_settings_catalogue().at("groups")) {
|
||||
std::string rows;
|
||||
const auto matches = [&](const Json &o, const std::string &competition) {
|
||||
const auto text = settings_search_key(
|
||||
@@ -193,13 +193,14 @@ std::string App::render_settings() {
|
||||
const std::map<std::string, std::pair<std::string, std::string>> captions = {
|
||||
{"display", {"Anzeige", "Bildschirm und Sprache"}},
|
||||
{"sound", {"Sound", "Lautstärke, Effekte und Spielton"}},
|
||||
{"game", {"Spiel", "Spielablauf und Darstellung nach dem Handbuch"}},
|
||||
{"game", {"Spiel", "Spielablauf und Live-Ticker"}},
|
||||
{"automation",
|
||||
{"Automatik",
|
||||
"Aufstellung, Wechsel, Taktik, Manndeckung und Training"}}};
|
||||
std::string head = "<div><h2>" + captions.at(settings_category_).first +
|
||||
"</h2><p>" + captions.at(settings_category_).second +
|
||||
"</p></div>";
|
||||
if(settings_category_=="display")head+="<span id=\"settings-transmission-style\" style=\"font-size:28dp;color:var(--muted);\">Live-Ticker · feste Darstellungsart</span>";
|
||||
if (settings_category_ == "display") {
|
||||
pane =
|
||||
"<div class=\"settings-group\"><h3>Gestaltung</h3><p "
|
||||
@@ -283,7 +284,7 @@ std::string App::render_settings() {
|
||||
"</div>";
|
||||
if (!settings_global_only()) {
|
||||
pane += "<div class=\"settings-group\"><h3>Ton im Spiel</h3>";
|
||||
for (const auto &o : settings_catalogue().at("sound"))
|
||||
for (const auto &o : live_settings_catalogue().at("sound"))
|
||||
pane += settings_option(o);
|
||||
pane += "</div>";
|
||||
}
|
||||
@@ -302,7 +303,7 @@ std::string App::render_settings() {
|
||||
"abgeben</h3><p class=\"settings-group-help\">Die fünf "
|
||||
"Automatikfunktionen des Originals. Änderungen werden erst mit "
|
||||
"„Anwenden“ übernommen.</p>";
|
||||
for (const auto &o : settings_catalogue().at("automation")) {
|
||||
for (const auto &o : live_settings_catalogue().at("automation")) {
|
||||
const auto key = o[0].get<std::string>();
|
||||
pane += settings_row("automation-" + key, o[1].get<std::string>(),
|
||||
o[2].get<std::string>(),
|
||||
@@ -312,7 +313,7 @@ std::string App::render_settings() {
|
||||
pane += "</div>";
|
||||
} else {
|
||||
std::vector<std::pair<std::string, std::string>> groups;
|
||||
for (const auto &g : settings_catalogue().at("groups"))
|
||||
for (const auto &g : live_settings_catalogue().at("groups"))
|
||||
groups.emplace_back(g.at("id").get<std::string>(),
|
||||
g.at("title").get<std::string>());
|
||||
head += "<div class=\"settings-jump-label\"><span>Zum Abschnitt</span>" +
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "modern/ui/demo_statistics.hpp"
|
||||
#include "modern/ui/demo_news.hpp"
|
||||
#include "modern/ui/demo_settings.hpp"
|
||||
#include "modern/ui/settings_presentation.hpp"
|
||||
#include "modern/ui/ui_preferences.hpp"
|
||||
#include "modern/ui/desktop.hpp"
|
||||
#include "modern/ui/demo_widgets.hpp"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "modern/ui/demo_settings.hpp"
|
||||
#include "modern/ui/desktop.hpp"
|
||||
#include "modern/ui/model.hpp"
|
||||
#include "modern/ui/settings_presentation.hpp"
|
||||
#include "modern/ui/ui_preferences.hpp"
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
@@ -260,10 +261,65 @@ void source(Fixture &f) {
|
||||
require(unrelated == old, "Settings modified unrelated presentation fields");
|
||||
}
|
||||
} // namespace
|
||||
namespace {
|
||||
void presentation(Fixture &f) {
|
||||
const auto original = settings_catalogue().dump();
|
||||
const auto &view = live_settings_catalogue();
|
||||
std::set<std::string> ids;
|
||||
for (const auto &g : view.at("groups")) {
|
||||
require(g.at("id") != "sportschau" && g.at("id") != "animations",
|
||||
"Graphic group still visible");
|
||||
if (g.contains("options"))
|
||||
for (const auto &o : g.at("options"))
|
||||
ids.insert(o.at("code"));
|
||||
else
|
||||
for (const auto &c : g.at("competitions"))
|
||||
for (const auto &o : c.at("options"))
|
||||
ids.insert(o.at("code"));
|
||||
}
|
||||
for (const auto *code :
|
||||
{"B5", "C5", "D5", "K5", "B7", "B8", "G8", "H9", "K9"})
|
||||
require(!ids.contains(code), "Graphics-only row still presented");
|
||||
for (const auto *code :
|
||||
{"P5", "Q5", "R5", "I8", "J8", "L5", "M5", "N5", "G5", "H5", "M9", "N9"})
|
||||
require(ids.contains(code), "Meaningful rule/card/chance option removed");
|
||||
require(live_settings_option_count() == int(ids.size()) && ids.size() < 142,
|
||||
"Visible count disagrees with presentation");
|
||||
require(view.at("sound").size() == 3,
|
||||
"Original sound option addresses removed");
|
||||
require(settings_catalogue().dump() == original,
|
||||
"Presentation filter mutated original catalogue");
|
||||
DemoSource source(f.world);
|
||||
auto selected = source.snapshot().state.at("settings");
|
||||
selected["cells"][size_t(settings_index("B5"))] = 1;
|
||||
selected["cells"][size_t(settings_index("G8"))] = 3;
|
||||
require(source.apply({source.snapshot().revision, "settings", selected}).ok,
|
||||
"Hidden old settings rejected");
|
||||
auto data = source.snapshot().state;
|
||||
data["desktop"] = default_desktop();
|
||||
DemoSource imported(f.world);
|
||||
imported.load_data(data);
|
||||
require(imported.snapshot().state.at("settings") == selected &&
|
||||
selected.at("cells").size() == 180,
|
||||
"Hidden cells lost on import");
|
||||
auto visible = selected;
|
||||
visible["cells"][size_t(settings_index("P5"))] =
|
||||
selected["cells"][size_t(settings_index("P5"))] == 1 ? 0 : 1;
|
||||
require(
|
||||
imported.apply({imported.snapshot().revision, "settings", visible}).ok,
|
||||
"Visible option edit rejected");
|
||||
const auto after = imported.snapshot().state.at("settings").at("cells");
|
||||
for (int i = 0; i < 180; ++i)
|
||||
if (i != settings_index("P5"))
|
||||
require(after[size_t(i)] == selected.at("cells")[size_t(i)],
|
||||
"Unrelated old cell changed by visible edit");
|
||||
}
|
||||
} // namespace
|
||||
int main() {
|
||||
try {
|
||||
Fixture f;
|
||||
provider();
|
||||
presentation(f);
|
||||
preferences(f);
|
||||
source(f);
|
||||
std::cout << "modern settings UI tests passed\n";
|
||||
|
||||
Reference in new issue
Block a user