// Der Reiter "Trainer" (Plan 2026-11-19 trainer, Stufe 1 Schritt 6): Start/Stopp, alle // Einstellungen, die Sitzung in bb und der Abgleich "du gegen den Kern", neueste Hand zuerst. // Rust rechnet alles (src/trainer.rs), hier wird nur gezeichnet. Jede Eingabe geht als // eingabe(art, a, b) hinaus - die Codes stehen in trainer::Eingabe::aus_code. import { Farbe, Icon, Segmentschalter, Auswahl, Stepper, Toggle } from "bausteine.slint"; export struct TrainerD { laeuft: bool, status: string, status-farbe: color, knopf: string, knopf-aktiv: bool, meldung: string, meldung-ok: bool, text: string, leer: string, format-titel: [string], format-index: int, stake-da: bool, stake-titel: [string], stake-index: int, gegner-titel: [string], gegner-index: int, je-sitz: bool, rueck-titel: [string], rueck-index: int, schwelle: string, schwelle-auf: bool, schwelle-ab: bool, uhr-client: bool, uhr: string, uhr-auf: bool, uhr-ab: bool, tische: string, tische-auf: bool, tische-ab: bool, hinweis: bool, stimme: bool, sitzung: string, } export struct TSitz { name: string, titel: [string], index: int } export struct TKennzahl { titel: string, wert: string, farbe: color } export struct TZug { zeile: string, warum: string, quelle: string, kosten: string, farbe: color, gemeldet: bool } export struct THand { titel: string, urteil: string, urteil-farbe: color, zuege: [TZug] } component Karte inherits Rectangle { background: Farbe.karte; border-radius: 8px; border-width: 1px; border-color: Farbe.linie; } component Ueberschrift inherits Text { color: Farbe.gedaempft; font-size: 11px; font-weight: 700; } // Eine Zeile: Beschriftung links, das Bedienelement rechts. component Zeile inherits HorizontalLayout { in property titel; in property fuss; spacing: 10px; min-height: 34px; VerticalLayout { alignment: center; horizontal-stretch: 1; Text { text: root.titel; color: Farbe.text; font-size: 13px; vertical-alignment: center; } if root.fuss != "": Text { text: root.fuss; color: Farbe.gedaempft; font-size: 11px; wrap: word-wrap; } } @children } component Hauptknopf inherits Rectangle { in property text; in property laeuft; in property aktiv: true; callback geklickt(); height: 36px; border-radius: 4px; opacity: aktiv ? 1 : 0.5; background: root.laeuft ? (ta.pressed ? #9e2a22 : ta.has-hover ? #d23a2e : Farbe.rot) : (ta.pressed ? #005a9e : ta.has-hover ? #1a86d9 : Farbe.akzent-fuell); Text { text: root.text; color: #ffffff; font-size: 14px; font-weight: 600; horizontal-alignment: center; vertical-alignment: center; } ta := TouchArea { enabled: root.aktiv; clicked => { root.geklickt(); } } } export component TrainerInhalt inherits VerticalLayout { in property t; in property <[TSitz]> sitze; in property <[TKennzahl]> kennzahlen; in property <[THand]> haende; callback knopf(); callback eingabe(int, int, int); padding: 14px; padding-bottom: 18px; spacing: 12px; // ---- Kopf: Status und Start/Stopp ------------------------------------------------------ Karte { VerticalLayout { padding: 12px; spacing: 10px; HorizontalLayout { spacing: 8px; Icon { art: "lehrer"; farbe: Farbe.teal; groesse: 20px; y: (parent.height - self.height) / 2; } Text { text: "Trainer"; color: Farbe.text; font-size: 16px; font-weight: 700; vertical-alignment: center; horizontal-stretch: 1; } Rectangle { width: st.preferred-width + 14px; height: 20px; y: (parent.height - self.height) / 2; border-radius: 10px; background: root.t.status-farbe.transparentize(80%); st := Text { text: root.t.status; color: root.t.status-farbe; font-size: 11px; font-weight: 700; } } } if root.t.text != "": Text { text: root.t.text; color: Farbe.hell; font-size: 12px; wrap: word-wrap; } Hauptknopf { text: root.t.knopf; laeuft: root.t.laeuft; aktiv: root.t.knopf-aktiv; geklickt => { root.knopf(); } } if root.t.meldung != "": Text { text: root.t.meldung; color: root.t.meldung-ok ? Farbe.gruen : Farbe.rot-hell; font-size: 12px; wrap: word-wrap; } } } // ---- Sitzung ------------------------------------------------------------------------------- Ueberschrift { text: "SITZUNG"; } HorizontalLayout { spacing: 8px; for k in root.kennzahlen: Karte { horizontal-stretch: 1; VerticalLayout { padding: 10px; spacing: 2px; Text { text: k.titel; color: Farbe.gedaempft; font-size: 11px; } Text { text: k.wert; color: k.farbe; font-size: 18px; font-weight: 700; } } } } if root.t.sitzung != "": Text { text: root.t.sitzung; color: Farbe.gedaempft; font-size: 12px; wrap: word-wrap; } // ---- Einstellungen ------------------------------------------------------------------------ Ueberschrift { text: "EINSTELLUNGEN"; } if root.t.laeuft: Text { text: "Änderungen gelten ab dem nächsten Start."; color: Farbe.gedaempft; font-size: 11px; } Karte { VerticalLayout { padding: 12px; spacing: 6px; Text { text: "Format"; color: Farbe.text; font-size: 13px; } Segmentschalter { titel: root.t.format-titel; farben: [Farbe.akzent, Farbe.akzent, Farbe.akzent, Farbe.akzent]; aktuell: root.t.format-index; gewaehlt(i) => { root.eingabe(0, i, 0); } } if root.t.stake-da: Zeile { titel: "Stake"; Auswahl { width: 170px; y: (parent.height - self.height) / 2; optionen: root.t.stake-titel; index: root.t.stake-index; menue-breite: 170px; gewaehlt(i) => { root.eingabe(1, i, 0); } } } if !root.t.stake-da: Zeile { titel: "Stake"; fuss: "Turnier: kein Stake, gerechnet wird mit ICM"; } Zeile { titel: "Gegner"; Auswahl { width: 170px; y: (parent.height - self.height) / 2; optionen: root.t.gegner-titel; index: root.t.gegner-index; menue-breite: 170px; gewaehlt(i) => { root.eingabe(2, i, 0); } } } if root.t.je-sitz: VerticalLayout { padding-left: 12px; spacing: 4px; for s[i] in root.sitze: Zeile { titel: s.name; Auswahl { width: 150px; y: (parent.height - self.height) / 2; optionen: s.titel; index: s.index; gewaehlt(j) => { root.eingabe(3, i, j); } } } } Text { text: "Rückmeldung"; color: Farbe.text; font-size: 13px; } Segmentschalter { titel: root.t.rueck-titel; farben: [Farbe.akzent, Farbe.akzent, Farbe.akzent]; aktuell: root.t.rueck-index; gewaehlt(i) => { root.eingabe(4, i, 0); } } Zeile { titel: "Schwelle"; fuss: "erst ab dieser Abweichung meldet der Coach"; Stepper { text: root.t.schwelle; auf-ok: root.t.schwelle-auf; ab-ok: root.t.schwelle-ab; auf => { root.eingabe(5, 0, 0); } ab => { root.eingabe(6, 0, 0); } } } Zeile { titel: "Uhr des Clients"; fuss: root.t.uhr-client ? "" : "eigene Bedenkzeit je Zug"; Toggle { an: root.t.uhr-client; y: (parent.height - self.height) / 2; umgeschaltet => { root.eingabe(7, root.t.uhr-client ? 0 : 1, 0); } } } if !root.t.uhr-client: Zeile { titel: "Bedenkzeit"; Stepper { text: root.t.uhr; auf-ok: root.t.uhr-auf; ab-ok: root.t.uhr-ab; auf => { root.eingabe(8, 0, 0); } ab => { root.eingabe(9, 0, 0); } } } Zeile { titel: "Tische"; Stepper { text: root.t.tische; auf-ok: root.t.tische-auf; ab-ok: root.t.tische-ab; auf => { root.eingabe(10, 0, 0); } ab => { root.eingabe(11, 0, 0); } } } Zeile { titel: "Hinweis vor dem Zug"; fuss: "der Kern zeigt seine Empfehlung, bevor du klickst"; Toggle { an: root.t.hinweis; y: (parent.height - self.height) / 2; umgeschaltet => { root.eingabe(12, 0, 0); } } } Zeile { titel: "Stimme"; Toggle { an: root.t.stimme; y: (parent.height - self.height) / 2; umgeschaltet => { root.eingabe(13, 0, 0); } } } } } // ---- Abgleich ------------------------------------------------------------------------------ Ueberschrift { text: "ABGLEICH · DU GEGEN DEN KERN"; } if root.haende.length == 0: Text { text: root.t.leer != "" ? root.t.leer : "Noch keine Hand abgeglichen"; color: Farbe.gedaempft; font-size: 12px; } for h in root.haende: Karte { VerticalLayout { padding: 10px; spacing: 6px; HorizontalLayout { spacing: 8px; Text { text: h.titel; color: Farbe.text; font-size: 13px; font-weight: 600; horizontal-stretch: 1; overflow: elide; } Text { text: h.urteil; color: h.urteil-farbe; font-size: 12px; font-weight: 700; } } for z in h.zuege: HorizontalLayout { spacing: 8px; // gemeldete Abweichungen tragen links einen orangen Strich Rectangle { width: 3px; border-radius: 1.5px; background: z.gemeldet ? #f0a030 : Farbe.linie; } VerticalLayout { horizontal-stretch: 1; spacing: 2px; HorizontalLayout { spacing: 8px; Text { text: z.zeile; color: Farbe.hell; font-size: 12px; horizontal-stretch: 1; wrap: word-wrap; } Text { text: z.kosten; color: z.farbe; font-size: 12px; font-weight: 600; } } Text { text: z.quelle + (z.warum != "" ? ": " + z.warum : ""); color: Farbe.gedaempft; font-size: 11px; wrap: word-wrap; } } } } } }