// SPDX-License-Identifier: GPL-3.0-only std::string App::render_desktop_tools(const std::string &key) { init_desktop(); if (key == "background") return "
" + img("background", 2200, 1240, false, true, 1800) + "

Stadion bei Nacht

Aktueller " "Hintergrund

"; if (key == "widgets") { std::string body = "
"; size_t i = 0; for (const auto &definition : widget_definitions()) { const auto &o = desktop_["objects"].at(definition.id); body += "

" + esc(definition.name) + "

"; for (auto [w, h] : definition.sizes) body += std::to_string(w) + " × " + std::to_string(h) + "   "; body += "

" + btn("widget-add", o.value("visible", false) ? "Bereits auf dem Desktop" : "Hinzufügen", {}, "data-id=\"" + definition.id + "\" " "style=\"position:absolute;left:30dp;right:30dp;bottom:" "30dp;\" " + (o.value("visible", false) ? "disabled" : "")) + "
"; ++i; } return body + "
"; } const bool saving = key == "view-save"; const auto directory = user_dir() / "layouts"; std::vector names; if (fs::exists(directory)) for (const auto &entry : fs::directory_iterator(directory)) if (entry.is_regular_file() && entry.path().extension() == ".json") names.push_back(editor::utf8(entry.path().stem())); std::sort(names.begin(), names.end()); std::string body = "
"; if (!saving) body += btn("view-default", "Standardansicht · fixiert", "choice", "style=\"width:100%;height:120dp;text-align:left;margin-bottom:" "18dp;\""); for (const auto &name : names) body += btn("view-select", esc(name), std::string("choice ") + (name == selections_["view"] ? "selected" : ""), "data-id=\"" + esc(name) + "\" " "style=\"width:100%;height:120dp;text-align:left;margin-" "bottom:18dp;\""); body += "

" + std::string(saving ? "Aktuelle Ansicht speichern" : selections_["view"].empty() ? "Ansicht auswählen" : esc(selections_["view"])) + "

"; if (!selections_["view"].empty()) { launch::ModLibrary::validate_name(selections_["view"]); auto preview = directory / editor::path(selections_["view"] + ".png"); if (fs::is_regular_file(preview)) body += ""; } if (saving) body += "
"; body += "
" + btn("view-delete", "Löschen", {}, selections_["view"].empty() ? "disabled" : "") + btn("close", "Abbrechen") + btn(saving ? "view-save-confirm" : "view-load-confirm", saving ? "Speichern" : "Laden", "primary", !saving && selections_["view"].empty() ? "disabled" : "") + "
"; return body; }