Populate native desktop status, fixture and news widgets from the session (by Codex)

This commit is contained in:
Codex committed 2026-10-29 13:58:57 +01:00
1 parent fd5c2b5330
commit dc911f3281
21 files changed
+419 -91

No files matched your search

+17 -2
View File
@@ -218,7 +218,7 @@ void App::engine_event(Rml::Event &event) {
if (type == "keydown" && event.GetParameter<int>("key_identifier", 0) == Rml::Input::KI_TAB) {
auto *root = !popup_.empty() ? element("popup") : !engine_player_.empty() ? element("engine-player-dialog") : !menu_.empty() ? doc_->QuerySelector(".window") : element("canvas"); Rml::ElementList controls;
if (!root) return;
root->QuerySelectorAll(controls, "button,input");
root->QuerySelectorAll(controls, "button,input,[data-engine-route]");
controls.erase(std::remove_if(controls.begin(), controls.end(), [](auto *node) { return !node->IsVisible(true) || node->HasAttribute("disabled"); }), controls.end());
if (!controls.empty()) {
const auto found = std::find(controls.begin(), controls.end(), context_->GetFocusElement());
@@ -251,7 +251,7 @@ void App::engine_event(Rml::Event &event) {
if(type=="keydown") {
const auto key=Rml::Input::KeyIdentifier(event.GetParameter<int>("key_identifier",0));
if(key==Rml::Input::KI_RETURN||key==Rml::Input::KI_SPACE) {
for(auto *node=target;node&&node!=doc_;node=node->GetParentNode())if(node->GetTagName()=="button") {
for(auto *node=target;node&&node!=doc_;node=node->GetParentNode())if(node->GetTagName()=="button"||node->HasAttribute("data-engine-route")) {
if(!node->HasAttribute("disabled"))node->DispatchEvent("click",{});
event.StopImmediatePropagation();return;
}
@@ -269,6 +269,21 @@ void App::engine_event(Rml::Event &event) {
if (action == "popup-confirm") { auto callback=std::move(confirm_);auto text_callback=std::move(text_accept_);const auto text=field("popup-text");popup_.clear();reset_popup();dirty_=true;if(text_callback)text_callback(text);else if(callback)callback(); }
return;
}
if (action == "engine-widget-warning" && menu_.empty() && !engine_busy_) {
const auto rows = engine_widgets_projection(engine_data_).at("warnings");
std::string text;
for (size_t i = 0; i < rows.size(); ++i) {
if (id != std::to_string(i) && id != "3,4" && id != "5,6") continue;
if ((id == "3,4" && i != 3 && i != 4) || (id == "5,6" && i != 5 && i != 6)) continue;
const auto &row = rows[i];
if (!text.empty()) text += "\n";
text += row.at("name").get<std::string>() + ": ";
text += row.at("attention").is_null() ? "Nicht bekannt." : row.at("attention") == true
? row.at("description").get<std::string>() : "Kein Hinweis.";
}
if (!text.empty()) message(text);
return;
}
if(files_native_&&files_action(action,node))return;
if(action.starts_with("rankings-")&&menu_=="scorers"){rankings_action(action,node);return;}
if (engine_reports_action(action,node)) return;