feat: Sport-Theme, Küren-Verwaltung und Sync-Konflikte

- zentrales Sport-Theme für das Weißbrett
- Küren im Sync umbenennen, löschen und Musikzuordnung aufräumen
- Konfliktbereinigung mit Vorschau und gezieltem Löschen
- Sync nutzt saved_at aus der Kür statt Gerätezeit
- Schrittsequenzen über Mehrfachauswahl gruppieren
- Startskript aktualisiert den class_name-Cache bei Änderungen
This commit is contained in:
torsten 2026-11-11 13:14:14 +01:00
parent dbcba27ebd
commit 6172d311bc
25 changed files with 2993 additions and 820 deletions

View file

@ -300,19 +300,18 @@ Fahrtrichtung.
ihre Reihenfolge. Der Marker wird direkt ausgewählt; der Button
„Element“ öffnet den Inspector für Typ, Kürzel und Level. Im
Auswahlmodus lässt sich der Marker über seinen Griff verschieben.
Das **Sequenz-Symbol** startet den Sequenz-Zeichenmodus: Die erste
gezeichnete Strecke wird Lead eines Bereichs, weitere Strecken treten über
dieselbe `element_group_id` bei. Die Gruppe zählt in Prüfung, Basiswert,
Adult-Regeln, Timeline und Export als **ein** Element. Ein beliebiges
Mitglied lässt sich auswählen; der Inspector bearbeitet immer das Lead-
Segment. Beim Löschen des Leads übernimmt das nächste Mitglied die
Schrittsequenzen entstehen durch **Mehrfachauswahl** (Knopf im
Abschnittsbereich oder Shift/Cmd/Ctrl-Klick) und das **Sequenz-Symbol**
(geschweifte Klammer mit Plus) in der Werkzeugleiste: Das gruppiert
zusammenhängende Segmente über eine gemeinsame `element_group_id`. Der
Controller prüft Lücken, Marker und bestehende Elemente, bevor er den
Undo-fähigen Gruppenschritt ausführt. Die Gruppe zählt in Prüfung,
Basiswert, Adult-Regeln, Timeline und Export als **ein** Element. Ein
beliebiges Mitglied lässt sich auswählen; der Inspector bearbeitet immer
das Lead-Segment. Beim Löschen des Leads übernimmt das nächste Mitglied die
Elementdaten. `RoutineSection.get_elements()` löst Einzelelemente und
Gruppen zu `ResolvedElement`-Sichten auf; alle Wertungs- und Anzeigepfade
iterieren darüber statt über die Rohsegmente. Die **Mehrfachauswahl**
(Knopf im Abschnittsbereich oder Shift/Cmd/Ctrl-Klick) erlaubt das
nachträgliche Gruppieren zusammenhängender Segmente über
„Sequenz gruppieren“; der Controller prüft Lücken, Marker und bestehende
Elemente, bevor er den Undo-fähigen Gruppenschritt ausführt. Punktmarker haben eine
iterieren darüber statt über die Rohsegmente. Punktmarker haben eine
**Standzeit** (`element_duration_seconds`)
mit Typ-Defaults (Sprung 0,7 s, Pirouette 4 s, Sequenz 0 s), die im
Inspector übersteuert wird und in die Timeline eingeht. Pirouetten tragen
@ -392,8 +391,9 @@ Fahrtrichtung.
auf das 1,85-Fache, um die Luftphase zu zeigen. Während
des Playbacks wird die aktuelle Section hervorgehoben,
ohne die Bearbeitungs-Section zu wechseln. Ein **▶** markiert sie in der
Abschnittsliste; ihr Name erscheint kurz oben auf der Eisfläche und blendet
sich innerhalb von zwei Sekunden aus. Steuerung: Icon-Knöpfe für
Abschnittsliste; ihr Name erscheint als große Sport-TV-Bauchbinde bündig
am oberen Rand der Eisfläche und gleitet nach 2,6 Sekunden wieder aus.
Steuerung: Icon-Knöpfe für
Start/Pause und Reset (Rekorder-Symbole, Tooltips nennen die Aktion),
Timeline-Scrubbing und Geschwindigkeit 0,25×–2,0×. Ein optionales
Musikstück liegt neben der Kür-JSON in `user://routines/` und läuft über
@ -402,8 +402,9 @@ Fahrtrichtung.
benannte ISO-Container werden auf macOS mit `afconvert` zu mono
PCM-WAV (44,1 kHz) konvertiert. Beim Kopieren in den Kür-Ordner wird der
Inhalt verglichen: identische Tracks werden wiederverwendet (auch die
bereits referenzierte Datei der Kür bleibt erhalten), nur bei
abweichendem Inhalt gleichen Namens entsteht ein nummerierter Name. Start,
bereits referenzierte Datei der Kür bleibt erhalten). Bei gleichem Namen
und abweichendem Inhalt fragt ein Dialog, ob die vorhandene Datei verwendet
oder überschrieben wird; nummerierte Namen entstehen nicht mehr. Start,
Pause, Reset, Scrubbing und Geschwindigkeit wirken auf Bild und Ton. Über
der Timeline liegt eine Label-Spur: Labels von Segmenten und Kürzel von
Elementen ohne Freitext erscheinen schräg an ihrem Startzeitpunkt (auch
@ -453,24 +454,39 @@ die Bildschirm-Skalierung (`DisplayServer.screen_get_scale()`). Auf dem
Tablet (DPR ≈ 2,6) entspricht eine Layout-Einheit damit einem CSS-Pixel und
wird trotzdem in Gerätepixeln gerendert:
- Ein 56-px-Button ist auf dem Tablet wirklich 56 CSS-Pixel groß, statt durch
- Ein 48-px-Button ist auf dem Tablet wirklich 48 CSS-Pixel groß, statt durch
eine feste Designauflösung kleingerechnet zu werden.
- Das Rink bleibt in Metern; nur die Pixelabbildung ändert sich.
- Der PNG-Export ist unabhängig davon (eigener `SubViewport`, 2560 × 1600).
### Sport-Theme
`src/ui/sport_theme.gd` baut das zentrale `Theme` zur Laufzeit und wird im
Controller auf das Whiteboard und alle Dialoge/Popups angewendet:
- Tiefes Marineblau (`#070b12`/`#0b1320`) mit Cyan-Akzenten (`#38c6f4`),
flache Panels mit dünnen Rahmen statt runder UI-Boxen.
- Buttons, Eingabefelder, Menüs, Tabs, Slider und Scrollbars teilen sich
dieselben Zustände (normal/hover/pressed/disabled/focus).
- Überschriften erhalten eine kräftigere `FontVariation`; „RINKPLANNER“,
„ABSCHNITTE“ und „TIMING“ laufen in Großbuchstaben mit Akzentfarbe.
- Die Hauptleisten wurden vertikal verdichtet: Kopfzeile 80 → 60 px, Timing
72 → 60 px, Playback 124 → 92 px, Status 64 → 52 px; Bedienelemente
56 → 48 px. Dadurch bleibt deutlich mehr Höhe für das Rink.
### Responsive Leiste
- Die Werkzeuge liegen als Icon-Leiste in der Kopfzeile: Mauszeiger für
„Auswählen“, Linie, linker und rechter Bogen sowie drei Element-Icons
(springendes Strichmännchen mit Pfeil = Sprung, hockendes mit Kreispfeil =
Pirouette, gehendes = Sequenz). Beim Start ist „Auswählen“ aktiv. Das aktive
Werkzeug wird erhellt (weißes Icon) und mit einem weißen Rahmen markiert;
Werkzeug wird mit einem cyanfarbenen Rahmen und einer Akzentkante markiert;
Tooltips nennen den Namen.
- Ab 1390 px Breite: volle Beschriftungen („Rinkplanner“, „Vorwärts“,
„Rückgängig“, „Wiederholen“, „Kalibrieren“).
- Unter 1390 px: kompakte Beschriftungen („Undo“, „Redo“, „Vor“, „Rück“,
„Fit“, „Kalib.“), der Titel entfällt, die Werkzeug-Icons werden 44 statt
48 px breit, das Sections-Panel 260 statt 300 px.
„Fit“, „Kalib.“), der Titel entfällt, die Werkzeug-Icons werden 36 statt
44 px breit, das Sections-Panel 260 statt 300 px.
- Die Timing-Leiste ist ein `HFlowContainer` und bricht bei Bedarf um, statt
seitlich abgeschnitten zu werden.
- Geprüfte Landschaftsbreiten: 1024 px (kleine Tablets) und 1400 px
@ -564,11 +580,18 @@ ggf. eines nach `touchend` (300-ms-Guard).
Jeder Nutzer verbindet sein eigenes Dropbox-Konto; das
Google-Drive-Backend ist vorbereitet, aber derzeit nicht freigeschaltet.
Refresh-Tokens liegen in `user://sync.cfg`, der letzte gemeinsame Stand in
`user://sync_state.cfg`. Beim ersten Abgleich einer beidseitig vorhandenen
Datei übernimmt die Cloud-Fassung den Namen, die lokale bleibt als
`(Lokal …)`-Kopie; bei einem echten Konflikt bleibt die lokale Fassung
Hauptdatei und die Cloud-Fassung kommt als `(Server …)`-Kopie dazu.
Konfliktnamen behalten die jeweilige Endung.
`user://sync_state.cfg`. Sind Dateien beidseitig vorhanden, lädt der Sync
die Cloud-Fassung in eine temporäre Datei und vergleicht den
Inhalt-Zeitstempel (`saved_at` in der Kür-JSON); bei Legacy-`.tres` und
Musikdateien dienen die Dateizeiten als Ersatz. Die neuere Fassung behält
den normalen Namen, die ältere wird nach `user://conflicts/` kopiert
(ein Archivplatz pro Dateiname). Bei Gleichstand übernimmt beim ersten
Abgleich die Cloud, bei einem echten Konflikt die lokale Fassung. Sichtbare
`(Server …)`-/`(Lokal …)`-Kopien aus früheren Versionen findet und entfernt
**Datei → Küren verwalten… → Konfliktkopien** nach Bestätigung; die Kopien
landen dabei im Konfliktarchiv. Derselbe Dialog löscht normale Küren lokal
und auf Wunsch auch im Cloud-Konto; dabei werden der Sync-Stand und
ungenutzte Musikdateien bereinigt.
## 7. Tests
@ -620,28 +643,32 @@ Aktueller Stand:
- **History:** 53 Assertions für Undo/Redo von Segmenten, Kanten, Labels, Sections,
Zeichengesten und Griff-Bearbeitung, Toolbar-Buttons, Erhalt der Ansicht
sowie das Zurücksetzen der Historie.
- **Playback:** 99 Assertions für Dauer/Timeline, Vorwärts-/Rückwärts-
- **Playback:** 121 Assertions für Dauer/Timeline, Vorwärts-/Rückwärts-
Blickrichtung, Section-Hervorhebung und -Banner, Play/Pause/Reset inklusive
Button-Verdrahtung, Scrubbing, Geschwindigkeitswechsel, Standzeiten von
Elementen, Markerrotation in einer Pirouette sowie Timeline-Tooltips.
Elementen, Markerrotation in einer Pirouette, Timeline-Tooltips und den
Musikimport mit Dialog für gleichnamige Dateien.
- **Timing:** 41 Assertions für Dauer-/Tempo-Kopplung, Level-Presets,
Kalibrierung, Undo, Persistenz und Schema-1-Migration.
- **Export:** 31 Assertions für SVG-Struktur, Titel-Escaping, Segment-Labels,
Element-Marker, strukturierte Sprungkombinationen, Section-Filter,
Segmentfarben/-strichelung und das Schreiben der Exportdatei.
- **Touch/Tablet:** 28 Assertions für Ein-Finger-Zeichnen, Zwei-Finger-Pan,
- **Touch/Tablet:** 35 Assertions für Ein-Finger-Zeichnen, Zwei-Finger-Pan,
Pinch-Zoom, Tipp-Auswahl, Griff-Bearbeitung, Element-Marker per Tipp,
Abbruch bei zweitem Finger,
Unterdrückung synthetischer Maus-Events aus Chrome sowie das responsive
Leistenlayout bei 1024 und 1400 px.
Unterdrückung synthetischer Maus-Events aus Chrome, das responsive
Leistenlayout bei 1024 und 1400 px sowie die kompakten Haupthöhen.
- **Performance:** Stresstest mit 480 Segmenten in 12 Sections; die mittlere
Redraw-Zeit muss unter 120 ms bleiben (aktuell ca. 7–10 ms).
- **Sync:** 59 Assertions für Vergleichsregeln, Konfliktnamen (JSON und
Legacy-`.tres`), Zeitstempel, URL/PKCE-Helfer, Cloud-Pfade, App-Konfiguration,
Sync-Stand und die Einstellungs-Verdrahtung. Die echten Cloud-APIs werden
nicht in den automatischen Tests angesprochen (OAuth erfordert ein
Testkonto); der Ablauf ist in `docs/cloud-setup.md` beschrieben.
- **3D-Assets:** 57 Assertions für Manifest-Schema, Pfade, FTP-Pfade,
- **Sync:** 123 Assertions für Vergleichsregeln, die Neuere-gewinnt-Auflösung
(inklusive Archiv und Fake-Cloud), das Aufräumen alter Konfliktkopien,
gezieltes Löschen (lokal und Cloud), Umbenennen inklusive Cloud,
Zeitstempel, URL/PKCE-Helfer,
Cloud-Pfade, App-Konfiguration, Sync-Stand und die
Einstellungs-Verdrahtung. Die echten Cloud-APIs werden nicht in den
automatischen Tests angesprochen (OAuth erfordert ein Testkonto); der
Ablauf ist in `docs/cloud-setup.md` beschrieben.
- **3D-Assets:** 58 Assertions für Manifest-Schema, Pfade, FTP-Pfade,
Platzierung, Rig-Metadaten, Animationen, Hashes und – falls synchronisiert
– Größe, SHA-256 sowie die 8-Bone-Gewichte der GLB-Datei.
- **3D-Vorschau:** 61 Assertions für Koordinatenabbildung, Rink-Geometrie,

View file

@ -252,8 +252,8 @@ auf `tools/sync_assets.sh --sync` ab. Für einen reinen Starttest ohne
## Kontosync
Der manuelle Sync über Dropbox lädt die neuesten
`.json`-Dateien (Legacy-`.tres` weiterhin) je Kür hoch bzw. herunter,
Konflikte bleiben als Kopien mit Zeitstempel erhalten. Jedes Gerät verbindet
das eigene Dropbox-Konto; Refresh-Tokens liegen in den App-Einstellungen
(`user://`), nicht im Repository. Details in `docs/sync.md` und
`docs/cloud-setup.md`.
`.json`-Dateien (Legacy-`.tres` weiterhin) je Kür hoch bzw. herunter. Sind
beide Seiten geändert, gewinnt die neuere Fassung; die ältere bleibt im
Konfliktarchiv. Jedes Gerät verbindet das eigene Dropbox-Konto;
Refresh-Tokens liegen in den App-Einstellungen (`user://`), nicht im
Repository. Details in `docs/sync.md` und `docs/cloud-setup.md`.

View file

@ -77,3 +77,21 @@ Jedes erneute Laden desselben Stücks legte bisher eine neue Kopie an
Tests in `run_playback_tests.gd`: zweimal dasselbe Stück laden behält den
Namen und erzeugt kein `… 2.wav`; ein anderes Stück gleichen Namens bekommt
eine Nummer, die beim erneuten Laden stabil bleibt.
## Nachtrag (2026-11-11): Entscheidungsdialog statt Nummern-Suffix
Der nummerierte Name bei abweichendem Inhalt entfällt. Der Import zeigt
jetzt einen Dialog mit **Bestehende verwenden**, **Überschreiben** und
**Abbrechen**:
- **Bestehende verwenden** referenziert die vorhandene Datei, ohne sie zu
verändern.
- **Überschreiben** ersetzt die vorhandene Datei atomar unter demselben
Namen.
- **Abbrechen** lässt Datei und Kür unverändert.
- Identischer Inhalt wird weiterhin ohne Nachfrage wiederverwendet.
- Ein Zahlen-Suffix wie `… 2.mp3` wird nie mehr erzeugt.
`_resolve_music_copy_name()` ist dafür zur Coroutine geworden und wartet auf
das Signal `music_conflict_decided`; die eigentliche Kopie übernimmt
`_store_music_copy()` über eine temporäre Datei und `.bak`-Rotation.

View file

@ -60,3 +60,11 @@ gemeinsame `element_group_id` darauf.
4. **Punktmarker:** Sprung/Pirouette bleiben Einzelelemente mit einem
Ankersegment. Eine vollständige `RoutineElement`-Ablage (Option B) ist
weiterhin der langfristige Umbau.
## Nachtrag (2026-11-11)
Im Nutzertest erwies sich der Sequenz-Zeichenmodus als schwer zugänglich.
Er wurde entfernt; Schrittsequenzen entstehen jetzt ausschließlich über
**Mehrfachauswahl** und das **Sequenz-Symbol** (geschweifte Klammer mit
Plus) in der Werkzeugleiste. Es ersetzt an derselben Stelle das alte
Sequenz-Werkzeug und nennt die Auswahlgröße im Tooltip.

View file

@ -15,6 +15,21 @@ App über den Button **?** in der Statusleiste erreichbar.
6. Optional **3D** in der oberen Leiste öffnen, um die Kür als Vorschau
abzuspielen.
## Küren verwalten
**Datei → Küren verwalten…** bündelt die Dateipflege:
- **Küren:** Lokale Kürdateien öffnen, umbenennen oder gezielt löschen.
Beim Umbenennen werden Dateiname und Titel geändert; ist ein Cloud-Konto
verbunden, wird die Cloud-Kopie auf Wunsch mit umbenannt. Beim Löschen kann
die Kopie im Cloud-Konto mit entfernt werden. Die Musikdatei wird nur
gelöscht, wenn keine andere Kür sie verwendet. Die gerade geöffnete Kür
lässt sich nicht löschen – dafür zuerst eine andere Kür öffnen.
- **Konfliktkopien:** Alte sichtbare Kopien wie
`Kür (Server 2026-10-30 1050).json` suchen und nach Bestätigung ins
Konfliktarchiv verschieben. Echte Sync-Konflikte löst die App automatisch
nach dem neuesten Speicherstand auf; die ältere Fassung bleibt im Archiv.
## Laufwege zeichnen
- **Linie** und die beiden **Bogen**-Werkzeuge erzeugen eine gerade Strecke
@ -41,9 +56,10 @@ App über den Button **?** in der Statusleiste erreichbar.
## Elemente platzieren
Die Werkzeuge **Sprung**, **Pirouette** und **Sequenz** setzen per Tipp einen
Element-Marker. Wo der Marker in der Kür erscheint, entscheidet die gezeichnete
Laufspur:
Die Werkzeuge **Sprung** und **Pirouette** setzen per Tipp einen Element-Marker.
Schrittsequenzen entstehen dagegen durch Gruppieren gezeichneter
Teilstrecken (siehe unten). Wo der Marker in der Kür erscheint, entscheidet die
gezeichnete Laufspur:
- Ein Tipp am **Anfang** der Spur setzt das Element an den Abschnittsanfang.
- Ein Tipp **zwischen zwei Segmenten** fügt das Element an dieser Stelle ein.
@ -56,42 +72,33 @@ an der getippten Stelle auf dem Eis und lässt sich im Auswahlmodus verschieben.
### Schrittsequenzen als Bereich
Eine Schrittsequenz besteht oft aus mehreren Teilstrecken, zählt aber als
**ein** Element mit einem Kürzel, einem Level und einem Basiswert.
**ein** Element mit einem Kürzel, einem Level und einem Basiswert. In der App
entsteht sie, indem die Teilstrecken gezeichnet und anschließend gruppiert
werden:
- Das **Sequenz-Symbol** in der Werkzeugleiste startet den Sequenz-Zeichenmodus.
- Mit **Linie**, **Bogen** oder **Freeline** werden die Teilstrecken
gezeichnet. Die erste Strecke wird das Lead-Segment, alle weiteren treten
derselben Sequenz bei.
- Erneut **Sequenz** drücken oder ein anderes Werkzeug als Linie/Bogen/
Freeline wählen beendet den Bereich. Neue Strecken danach gehören nicht
mehr dazu.
- Eine bestehende Sequenz lässt sich fortsetzen, solange sie am Abschnittsende
liegt: ein Mitglied auswählen, das Sequenz-Symbol drücken und
weiterzeichnen.
- Klickt man ein beliebiges Mitglied an, öffnet der **Element**-Dialog die
ganze Sequenz. Kürzel, Level und Features gelten einmal für alle Teilstrecken.
- Wird das Lead-Segment gelöscht, übernimmt das nächste Mitglied automatisch
die Elementdaten. **Kein Element** im Dialog löst die Gruppe auf; die
gezeichneten Teilstrecken bleiben erhalten.
- Neue Sequenzbereiche starten mit dem Kürzel `StSq` und Level Base; beides
lässt sich im Element-Dialog ändern.
### Nachträglich gruppieren
Bestehende Teilstrecken lassen sich ohne Neuzeichnen zu einer Sequenz
zusammenfassen:
1. **Mehrfachauswahl** im Abschnittsbereich aktivieren.
2. Die gewünschten Segmente antippen. Erneutes Antippen entfernt ein Segment
1. Die Teilstrecken mit **Linie**, **Bogen** oder **Freeline** zeichnen.
2. **Mehrfachauswahl** im Abschnittsbereich aktivieren.
3. Die gewünschten Segmente antippen. Erneutes Antippen entfernt ein Segment
wieder aus der Auswahl. Auf dem Desktop funktioniert auch
**Shift/Cmd/Ctrl + Klick** ohne aktivierte Mehrfachauswahl.
3. **Sequenz gruppieren (N)** drücken.
4. Das **Sequenz-Symbol** (geschweifte Klammer mit Plus) in der
Werkzeugleiste drücken.
Die Auswahl muss aus mindestens zwei **zusammenhängenden** Pfadsegmenten
bestehen und darf keine bestehenden Elemente oder Sprung-/Pirouettenmarker
enthalten. Nach dem Gruppieren wird das Lead-Segment ausgewählt und die
Mehrfachauswahl beendet. Esc bricht die Mehrfachauswahl ab.
- Klickt man ein beliebiges Mitglied an, öffnet der **Element**-Dialog die
ganze Sequenz. Kürzel, Level und Features gelten einmal für alle Teilstrecken.
- Wird das Lead-Segment gelöscht, übernimmt das nächste Mitglied automatisch
die Elementdaten. **Kein Element** im Dialog löst die Gruppe auf; die
gezeichneten Teilstrecken bleiben erhalten.
- Neue Sequenzen starten mit dem Kürzel `StSq` und Level Base; beides lässt
sich im Element-Dialog ändern.
- Einzelne Segmente lassen sich im Element-Dialog auch direkt als Sequenz
taggen; für mehrere Teilstrecken ist das Gruppieren der vorgesehene Weg.
## 3D-Vorschau
Der Button **3D** in der oberen Leiste wechselt in eine schreibgeschützte
@ -160,12 +167,16 @@ Dateiname vermerkt.
- **×** entfernt die Musik aus der Kür, löscht die Datei aber nicht. So
bleibt sie für andere Kürdateien erhalten.
- Dasselbe Stück kann beliebig oft geladen werden: Ist der Inhalt schon im
Kür-Ordner vorhanden, wird die vorhandene Datei weiterverwendet. Eine
Nummer im Namen (`… 2.mp3`) entsteht nur bei echt unterschiedlichem Inhalt
gleichen Namens.
Kür-Ordner vorhanden, wird die vorhandene Datei ohne Nachfrage
weiterverwendet. Gibt es eine gleichnamige Datei mit anderem Inhalt, fragt
die App: **Bestehende verwenden**, **Überschreiben** oder **Abbrechen**.
Nummerierte Kopien wie `… 2.mp3` werden nicht mehr erzeugt.
- Beim **Sync** wird die Musikdatei wie die Kür-JSON hoch- und
heruntergeladen. Fehlt sie auf einem Gerät, zeigt die Leiste
„(fehlt)“; nach dem nächsten Sync ist sie verfügbar.
„(fehlt)“; nach dem nächsten Sync ist sie verfügbar. Ist sie auf beiden
Geräten unterschiedlich, gewinnt die neuere Dateizeit; die ältere Fassung
landet im Konfliktarchiv (Datei → Küren verwalten… → Konfliktkopien →
Konfliktarchiv öffnen).
## Timeline-Labels
@ -193,8 +204,9 @@ läuft sie ab dieser Stelle weiter. Die Position berücksichtigt alle davor lieg
Abschnitte inklusive Element-Standzeiten.
Während der Wiedergabe markiert ein **▶** den aktuellen Abschnitt in der
Liste rechts. Der Name des Abschnitts erscheint kurz oben auf der Eisfläche
und blendet sich innerhalb von zwei Sekunden weich aus.
Liste rechts. Der Name des Abschnitts erscheint als große, schräge
Sport-TV-Bauchbinde bündig am oberen Rand der Eisfläche und gleitet nach
2,6 Sekunden wieder aus.
## Export

View file

@ -1,6 +1,6 @@
# Rinkplanner – Roadmap
Stand: 2026-11-10 (ISU 2026/27, Adult-Kategorien Gold/Silver/Bronze; JSON-Dateiformat, Export-Smoke-Test und Quality-Meilenstein ergänzt; Cloud-Sync vorerst nur mit Dropbox)
Stand: 2026-11-11 (ISU 2026/27, Adult-Kategorien Gold/Silver/Bronze; JSON-Dateiformat, Export-Smoke-Test und Quality-Meilenstein ergänzt; Sport-Theme mit kompakteren Leisten, UI-Gliederung und mehr Rink-Fläche auf dem Tablet als Quality-Ziel aufgenommen; Sequenz-Erstellung auf Gruppieren umgestellt; Sync-Konflikte automatisch nach Inhalt-Zeitstempel aufgelöst, alter Kopienzoo aufräumbar sowie Küren zentral verwaltbar und umbenennbar; Cloud-Sync vorerst nur mit Dropbox)
Diese Reihenfolge ist die verbindliche Arbeitsgrundlage für Phase 1. Änderungen
nur bewusst und nach Rücksprache. Letzte Erkenntnisse:
`docs/findings-2026-10-31-arm-gewichte.md`.
@ -103,12 +103,17 @@ Voraussetzung für Phase 1.
Refresh-Tokens unter `user://`
- [x] Manueller Sync: `.json` je Kür laden/hochladen (Legacy-`.tres` weiterhin),
Sync-Stand lokal
- [x] Konflikte als Kopien mit Server-Zeitstempel behalten
- [x] Konflikte automatisch nach Inhalt-Zeitstempel auflösen; die ältere
Fassung bleibt im Konfliktarchiv (`user://conflicts/`)
- [x] Küren verwalten: gezieltes Löschen (lokal und optional Cloud) mit
Bereinigung des Sync-Stands
- [x] Küren umbenennen: Dateiname und Titel, optional auch in der Cloud
- [x] Geführter Aufräumdialog für alte `(Server …)`-/`(Lokal …)`-Kopien
- [x] Fortschritt und Zusammenfassung in der Oberfläche
- [x] Google-Drive- und Dropbox-Backend ohne externe Bibliothek
- [x] Pro-Nutzer-OAuth (Google Device Flow, Dropbox PKCE)
- [ ] Automatischer Sync im Hintergrund (später)
- [ ] Konflikt-Zusammenführung in der Oberfläche (später)
- [ ] Manuelles Zusammenführen mit der archivierten Fassung (später)
Aktuell ist **Dropbox** der produktive Sync-Anbieter (auch auf der
Webseite). Das Google-Drive-Backend ist im Code vorhanden, aber die
@ -134,7 +139,8 @@ OAuth-App ist nicht veröffentlicht. Google Drive und OneDrive stehen unter
- [x] `element_group_id` am Segment, Lead trägt die Elementdaten
- [x] `RoutineSection.get_elements()` / `ResolvedElement` als Auflösungsschicht
- [x] Validator, Adult-Regeln und Basiswert zählen eine Gruppe einmal
- [x] Sequenz-Zeichenmodus und Fortsetzen einer bestehenden Gruppe
- [x] Sequenz erstellen über Mehrfachauswahl und das Sequenz-Symbol in der
Werkzeugleiste; der frühere Zeichenmodus entfällt (in Tests verworfen)
- [x] Ein Gruppenlabel in Canvas und SVG
- [x] Schema 5 mit additivem `element_group_id`
- [x] Mehrfachauswahl und nachträgliches Gruppieren in der UI
@ -190,8 +196,8 @@ Oberfläche reichen für Tests; Komfort und Optik werden erst nach der
fachlichen Validierung angefasst.
- [ ] Automatischer Sync beim Start/Beenden
- [ ] Konflikt-Zusammenführung in der Oberfläche
- [ ] Löschweitergabe mit Bestätigung
- [ ] Manuelles Zusammenführen mit der archivierten Fassung
- [x] Löschweitergabe für einzelne Küren mit Bestätigung (Küren verwalten)
- [ ] Optional: Sync-Ordner pro Anbieter getrennt konfigurieren
- [ ] Hochformat-, Multi-Window- und DeX-Layout (obere Leiste umbruchfähig)
- [ ] Visuelles UI-Refactoring (z. B. Buttons statt Comboboxen) inklusive
@ -261,8 +267,13 @@ Schritte.
### Danach
- [ ] Theme-Ressource + zentrale UI-Texte (`tr()`/CSV), kompakte Labels nicht
mehr im Controller; Dark/Light und skalierbare Schriftgrößen.
- [ ] UI in logische Bereiche gliedern (Werkzeuge, Eigenschaften, Timeline) und
Screen Estate zugunsten der Rink-Fläche maximieren – vor allem auf dem
Tablet mehr Rink-Fläche durch kompakte, einklappbare Leisten und Panels.
- [x] Sport-Theme (dunkel, Cyan-Akzente, kräftige Typografie) und vertikal
kompaktere Leisten für mehr Rink-Fläche
- [ ] Zentrale UI-Texte (`tr()`/CSV), Light-Theme und skalierbare
Schriftgrößen; kompakte Labels nicht mehr im Controller.
- [ ] Canvas: Culling/Dirty-Regions, Kurven-Cache auch für Pan/Zoom;
Perf-Test mit realistischem Budget (< 16 ms bei 480 Segmenten).
- [ ] Doku konsolidieren: 18 `findings-*.md` nach `docs/notes/` oder ins

View file

@ -43,9 +43,49 @@ gemeinsamen App-Ordner.
| nur in der Cloud | herunterladen |
| seit dem letzten Sync nur lokal geändert | hochladen |
| seit dem letzten Sync nur in der Cloud geändert | herunterladen |
| beidseitig geändert (seit dem letzten Sync) | **Konflikt**: lokale Fassung bleibt Hauptdatei, Cloud-Fassung kommt als `(Server …)`-Kopie dazu |
| beidseitig geändert (seit dem letzten Sync) | **neueste Fassung gewinnt**: ältere Fassung wandert ins Konfliktarchiv |
| Datei auf einer Seite gelöscht | nichts tun (keine Löschweitergabe) |
| erster Sync, Datei auf beiden Seiten | **Cloud übernimmt**: Cloud-Fassung wird Hauptdatei, lokale Fassung bleibt als `(Lokal …)`-Kopie |
| erster Sync, Datei auf beiden Seiten | **neueste Fassung gewinnt**: ältere Fassung wandert ins Konfliktarchiv |
### Wie entscheidet der Sync, welche Fassung neuer ist?
- Bei `.json`-Küren zählt der **Inhalt**: Jede Speicherung schreibt
`saved_at` (Unix-Zeit) in die Datei. Der Sync lädt die Cloud-Fassung in eine
temporäre Datei und vergleicht beide Zeitstempel. Damit sind
Geräte-Dateizeiten und Upload-Zeitpunkte unerheblich.
- Bei Legacy-`.tres`- und Musikdateien gibt es keinen Inhalt-Zeitstempel.
Dort vergleicht der Sync die lokale Dateizeit mit der Cloud-Änderungszeit.
- Bei Gleichstand oder unbekannten Zeiten gilt: Beim ersten Abgleich ohne
gemeinsamen Stand übernimmt die Cloud-Fassung, bei einem echten Konflikt
bleibt die lokale Fassung.
Kürdateien aus älteren Versionen haben noch kein `saved_at`. Dort greift beim
ersten Abgleich die Dateizeit als Ersatz; ab der nächsten Speicherung trägt
die JSON den Inhalt-Zeitstempel.
Die unterlegene Fassung wird nicht mehr sichtbar neben die Kür gelegt. Sie
landet unter `user://conflicts/<dateiname>` – ein Archivplatz pro Datei, der
bei der nächsten Auflösung überschrieben wird. Erreichbar über
**Datei → Küren verwalten… → Konfliktkopien → Konfliktarchiv öffnen**. So
entstehen keine `(Server …)`-/`(Lokal …)`-Kopien mehr in der Kürliste.
Alte Kopien aus früheren Versionen bleiben zunächst liegen. Über
**Datei → Küren verwalten… → Konfliktkopien → Konfliktkopien suchen…** sucht
der Sync nach solchen Kopien, deren Hauptdatei noch existiert, zeigt sie in
einem Dialog und verschiebt sie nach Bestätigung ins Konfliktarchiv.
Cloud-Kopien werden dabei aus dem Cloud-Ordner gelöscht, damit sie nicht beim
nächsten Sync zurückkommen. Kopien ohne Hauptdatei werden nicht angefasst –
sie könnten die einzige erhaltene Fassung sein.
Normale, nicht mehr benötigte Küren lassen sich ebenfalls über
**Datei → Küren verwalten…** löschen. Die Cloud-Kopie wird auf Wunsch
mitgelöscht; die Musikdatei nur, wenn keine andere Kür sie verwendet.
**Umbenennen** ändert Dateinamen und Titel der Kür. Mit verbundenem
Cloud-Konto wird auch die Cloud-Kopie umbenannt und der alte Sync-Stand
entfernt. Ohne Cloud-Verbindung bleibt die alte Cloud-Kopie bestehen; der
Sync holt sie dank des bisherigen Sync-Stands nicht als zweite Kür zurück,
lädt aber die neue lokale Fassung hoch.
### Wie kommt eine Kür vom Desktop aufs Tablet?
@ -55,28 +95,20 @@ gemeinsamen App-Ordner.
Wichtig: Der Abgleich ordnet Dateien über den **Dateinamen** zu (der aus dem
Kür-Titel entsteht). Eine Kür mit demselben Namen auf beiden Geräten ist
kein „Update“, sondern eine Kollision:
- **Erster Sync einer Datei auf beiden Seiten** (kein gemeinsamer Stand):
Die **Cloud-Fassung übernimmt den Namen**, die lokale Fassung bleibt als
`name (Lokal JJJJ-MM-TT HHMM).json` daneben. So bekommt ein neues Gerät die
gemeinsame Version, ohne die lokale Arbeit zu verlieren.
- **Beide Seiten seit dem letzten Sync geändert**: Die lokale Fassung bleibt
Hauptdatei, die Cloud-Fassung kommt als
`name (Server JJJJ-MM-TT HHMM).json` dazu. Beim nächsten Sync wird diese
Kopie als neue Kür hochgeladen. Zusammenführen musst du selbst.
Die Kopien behalten die Endung der Ausgangsdatei; bei Legacy-`.tres`
entstehen also weiterhin `.tres`-Kopien.
kein „Update“, sondern eine Kollision. Der Sync löst sie anhand des
Inhalt-Zeitstempels auf; die ältere Fassung bleibt im Konfliktarchiv, statt
die Kürliste zu füllen. Bereits vorhandene alte `(Server …)`-/`(Lokal …)`-
Kopien werden nicht automatisch gelöscht.
Wenn du auf dem Tablet also eine leere „Testkür1“ anlegst, obwohl es die
Desktop-Version schon gibt, hast du nach dem Sync zwei Dateien: die
Desktop-Version unter dem normalen Namen und deine leere Fassung als
`testkür1 (Lokal …).json`. Besser: erst synchronisieren, dann die vorhandene
Kür öffnen und bearbeiten.
Desktop-Version schon gibt, gewinnt nach dem Sync die Fassung mit dem
neueren `saved_at`. Besser: erst synchronisieren, dann die vorhandene Kür
öffnen und bearbeiten.
- Vor dem Sync wird eine geänderte, bereits gespeicherte Kür automatisch
gespeichert. Eine noch nie gespeicherte Kür öffnet zuerst „Speichern unter“.
- Läuft der Sync, zeigt die Statusleiste den Fortschritt; danach erscheint
eine Zusammenfassung (hochgeladen / heruntergeladen / Konflikte / Fehler).
eine Zusammenfassung (hochgeladen / heruntergeladen / aufgelöste Konflikte /
Fehler).
- Ist die geöffnete Kür vom Download betroffen und ungespeichert, wird sie
**nicht** überschrieben – es erscheint ein Hinweis.
@ -91,7 +123,7 @@ Kür öffnen und bearbeiten.
| `src/core/sync/cloud_auth.gd` | Refresh-Token, Access-Token-Erneuerung |
| `src/core/sync/cloud_oauth_job.gd` | Google-Device-Flow und Dropbox-PKCE-Flow |
| `src/core/sync/sync_app_config.gd` | App-Client-ID/App-Key laden |
| `src/core/sync/sync_plan.gd` | reine Vergleichslogik, Konfliktnamen, Zeitstempel |
| `src/core/sync/sync_plan.gd` | reine Vergleichslogik, Zeitstempel, Gleichstandsregel |
| `src/core/sync/routine_sync.gd` | Ablauf, Datei-Ersetzung, Sync-Stand |
- Der Sync läuft in einem `Thread`; die Oberfläche bleibt bedienbar und
@ -108,8 +140,9 @@ Kür öffnen und bearbeiten.
- Musikdateien werden als normale Anhänge der Kür behandelt: Die JSON nennt
nur den Dateinamen (`music_file`), die Datei liegt daneben. Ändert sich die
Musik auf einem Gerät, lädt der nächste Sync sie hoch; auf dem anderen Gerät
wird sie heruntergeladen und beim Öffnen der Kür verwendet. Konfliktkopien
behalten die Audio-Endung (z. B. `kuer (Server …).mp3`).
wird sie heruntergeladen und beim Öffnen der Kür verwendet. Bei einer
Kollision gewinnt die neuere Dateizeit; die ältere landet unter
`user://conflicts/`.
- Eigene Timeline-Labels stehen in der Kür-JSON (`timeline_labels`) und
werden ohne Zusatzdateien mit der Kür übertragen.
- Refresh-Tokens liegen in `user://sync.cfg` (Klartext, app-privat). Auf
@ -140,8 +173,8 @@ Werte in `docs/credentials.txt` stehen in
## Grenzen
- Kein automatischer Sync, kein Push, kein Locking. Zwei Geräte, die
gleichzeitig synchronisieren, können sich überholen; der Konfliktfall
verhindert dann Datenverlust, nicht aber doppelte Dateien.
gleichzeitig synchronisieren, können sich überholen; der Sync behält dann
die neuere Fassung und legt die ältere ins Konfliktarchiv.
- Löschungen werden nicht übertragen (bewusst, um Versehen nicht zu
multiplizieren).
- Umbenennen einer Kür wirkt wie „neu lokal“ + „nur Cloud“: beide Fassungen

View file

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 32 32">
<g fill="none" stroke="#ffffff" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
<path d="M15 5 C12.5 5, 12 7.5, 12 10 C12 13, 10 15, 8 16 C10 17, 12 19, 12 22 C12 24.5, 12.5 27, 15 27"/>
<line x1="19.5" y1="16" x2="27.5" y2="16"/>
<line x1="23.5" y1="12" x2="23.5" y2="20"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 406 B

View file

@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dm65exomx8acb"
path="res://.godot/imported/sequence.svg-2594bba866634b1c2c616d1b6b266a8e.ctex"
uid="uid://dyj1jgwdydnu6"
path="res://.godot/imported/group_sequence.svg-aad18208bd30d9917d12778d4da938b4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icons/tools/sequence.svg"
dest_files=["res://.godot/imported/sequence.svg-2594bba866634b1c2c616d1b6b266a8e.ctex"]
source_file="res://assets/icons/tools/group_sequence.svg"
dest_files=["res://.godot/imported/group_sequence.svg-aad18208bd30d9917d12778d4da938b4.ctex"]
[params]

View file

@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 32 32">
<g fill="none" stroke="#ffffff" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
<circle cx="15" cy="7" r="2.9"/>
<path d="M15 10 L14.5 17"/>
<path d="M9.5 12.5 L14.5 13.5 L20 16"/>
<path d="M14.5 17 L9.5 20.5 L8 26"/>
<path d="M14.5 17 L19 20.5 L22 25.5"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 396 B

File diff suppressed because it is too large Load diff

View file

@ -101,6 +101,7 @@ static func save(routine: Routine, path: String) -> String:
return "Der Zielpfad ist leer."
if routine.schema_version <= 0:
routine.schema_version = Routine.CURRENT_SCHEMA_VERSION
routine.saved_at = int(Time.get_unix_time_from_system())
return _write_atomic(json_path(path), encode(routine))
@ -169,6 +170,7 @@ static func decode_json(text: String) -> Dictionary:
routine.routine_id = _text(data, "routine_id", "routine").left(MAX_TEXT_LENGTH)
routine.title = _text(data, "title", "").left(MAX_TEXT_LENGTH)
routine.skater_name = _text(data, "skater_name", "").left(MAX_TEXT_LENGTH)
routine.saved_at = maxi(0, int(_number(data, "saved_at", 0.0)))
routine.music_file = safe_music_file_name(_text(data, "music_file", ""))
routine.adult_category = (
_text(data, "adult_category", "").left(MAX_TEXT_LENGTH)
@ -229,6 +231,44 @@ static func decode_json(text: String) -> Dictionary:
return {"routine": routine, "error": ""}
## Reads only the content timestamp from a JSON routine. Returns 0 for legacy
## `.tres`, audio files and unreadable/invalid JSON. The sync uses it to pick
## the newer version without trusting device file times. The path does not
## need a `.json` suffix, so temporary download files work as well.
static func read_saved_at(path: String) -> int:
var data := _read_routine_header(path)
return maxi(0, int(_number(data, "saved_at", 0.0)))
## Reads the music attachment name from a routine without loading all sections.
## Returns "" for legacy `.tres`, audio files and invalid JSON.
static func read_music_file(path: String) -> String:
var data := _read_routine_header(path)
return safe_music_file_name(_text(data, "music_file", ""))
static func _read_routine_header(path: String) -> Dictionary:
if not FileAccess.file_exists(path):
return {}
var file := FileAccess.open(path, FileAccess.READ)
if file == null:
return {}
if file.get_length() > MAX_FILE_BYTES:
file.close()
return {}
var text := file.get_as_text()
file.close()
var json := JSON.new()
if json.parse(text) != OK:
return {}
var data: Variant = json.data
if not data is Dictionary:
return {}
if str(data.get("format", "")) != FORMAT_NAME:
return {}
return data
## Stores a routine as pretty-printed JSON. Exposed separately so tests can
## inspect the serialized form without touching the filesystem.
static func encode(routine: Routine) -> String:
@ -239,6 +279,7 @@ static func encode(routine: Routine) -> String:
"routine_id": routine.routine_id,
"title": routine.title,
"skater_name": routine.skater_name,
"saved_at": routine.saved_at,
"music_file": safe_music_file_name(routine.music_file),
"adult_category": routine.adult_category,
"assumed_pcs_average": routine.assumed_pcs_average,

View file

@ -10,6 +10,9 @@ const CURRENT_SCHEMA_VERSION := 6
@export var routine_id: String = ""
@export var title: String = ""
@export var skater_name: String = ""
## Unix time (seconds) when the routine content was last saved. Used by the
## sync to pick the newer version without relying on device file times.
@export var saved_at: int = 0
## File name of the music track inside `user://routines/`. The file is kept
## next to the routine JSON so the routine sync transfers it with the routine.
@export var music_file: String = ""

View file

@ -10,6 +10,7 @@ extends RefCounted
## server and never sees credentials of other users.
const LOCAL_DIR := "user://routines"
const CONFLICT_DIR := "user://conflicts"
const STATE_PATH := "user://sync_state.cfg"
const TEMP_SUFFIX := ".part"
## New routines are JSON; legacy `.tres` files stay in the sync so existing
@ -24,22 +25,45 @@ const SYNC_EXTENSIONS := [
]
const PROVIDERS := ["dropbox", "google_drive"]
enum Task {
SYNC,
SCAN_OLD_CONFLICTS,
CLEAN_OLD_CONFLICTS,
DELETE_ROUTINES,
RENAME_ROUTINES,
}
var progress: String = ""
var error: String = ""
var result: Dictionary = {}
var provider: String = ""
## Task selected by the UI; defaults to the normal routine sync.
var task: Task = Task.SYNC
## File names confirmed in the cleanup dialog. The cleanup task only touches
## these entries; the UI always fills the list after the user confirms.
var cleanup_names: PackedStringArray = PackedStringArray()
## Routines and attachments selected for deletion in "Küren verwalten".
var delete_names: PackedStringArray = PackedStringArray()
var delete_attachments: PackedStringArray = PackedStringArray()
## Parallel arrays: rename_from[i] becomes rename_to[i] in the cloud. Legacy
## `.tres` entries are deleted instead of renamed because the local rename
## migrates them to JSON.
var rename_from: PackedStringArray = PackedStringArray()
var rename_to: PackedStringArray = PackedStringArray()
func run(settings: Dictionary) -> void:
result = {
"uploaded": [],
"downloaded": [],
"conflicts": [],
"conflict_sources": [],
"adopted": [],
"local_backups": [],
"resolved": [],
"skipped": [],
"errors": [],
"cleanup_candidates": [],
"cleanup_skipped": [],
"cleanup_done": [],
"deleted": [],
"renamed": [],
}
error = ""
provider = str(settings.get("provider", "")).strip_edges()
@ -87,13 +111,25 @@ func run(settings: Dictionary) -> void:
return
var local := local_files()
if task == Task.DELETE_ROUTINES:
_delete_routines(store, local, remote)
store.close()
progress = "Fertig."
return
if task == Task.RENAME_ROUTINES:
_rename_routines(store, remote)
store.close()
progress = "Fertig."
return
if task != Task.SYNC:
_run_cleanup_task(store, local, remote)
store.close()
progress = "Fertig."
return
var state := load_state(STATE_PATH)
var plan := SyncPlan.build(local, remote, state)
var used_names: Dictionary = {}
for name: String in local.keys():
used_names[name] = true
var transferred := false
for item: Dictionary in plan:
var name: String = item["name"]
@ -115,13 +151,23 @@ func run(settings: Dictionary) -> void:
else:
result["errors"].append(download_error)
SyncPlan.Action.CONFLICT:
var conflict_error := _keep_both(store, name, used_names)
var conflict_error := _resolve_newest(
store,
name,
int(remote[name].get("modify", 0)),
false
)
if conflict_error.is_empty():
transferred = true
else:
result["errors"].append(conflict_error)
SyncPlan.Action.TAKE_SERVER:
var adopt_error := _take_server(store, name, used_names)
var adopt_error := _resolve_newest(
store,
name,
int(remote[name].get("modify", 0)),
true
)
if adopt_error.is_empty():
transferred = true
else:
@ -153,66 +199,328 @@ func _download(store: RemoteStore, name: String) -> String:
return _replace_file(temporary, target)
## First sync of a file that exists on both sides (no common state): the
## cloud copy keeps the normal name, the local copy is preserved next to it.
func _take_server(store: RemoteStore, name: String, used_names: Dictionary) -> String:
## Resolves a file that exists on both sides. The cloud copy is downloaded so
## both content timestamps can be compared. The newer version keeps the normal
## name; the older one is copied into `user://conflicts` (one slot per name).
func _resolve_newest(
store: RemoteStore,
name: String,
remote_modify: int,
prefer_server_on_tie: bool
) -> String:
var target := _local_path(name)
var temporary := target + TEMP_SUFFIX
var temporary := target + ".remote" + TEMP_SUFFIX
var err := store.download(name, temporary)
if not err.is_empty():
return "Übernahme %s: %s" % [name, err]
return "Konflikt %s: %s" % [name, err]
var backup_name := ""
if FileAccess.file_exists(target):
backup_name = SyncPlan.unique_name(
SyncPlan.local_backup_file_name(name, SyncPlan.timestamp_label()),
used_names
)
var backup_path := _local_path(backup_name)
var rename_error := DirAccess.rename_absolute(
ProjectSettings.globalize_path(target),
ProjectSettings.globalize_path(backup_path)
)
if rename_error != OK:
DirAccess.remove_absolute(ProjectSettings.globalize_path(temporary))
return "Lokale Fassung nicht sicherbar: %s" % name
used_names[backup_name] = true
err = _replace_file(temporary, target)
if not err.is_empty():
if not backup_name.is_empty():
DirAccess.rename_absolute(
ProjectSettings.globalize_path(_local_path(backup_name)),
ProjectSettings.globalize_path(target)
)
return "Übernahme %s: %s" % [name, err]
result["adopted"].append(name)
if not backup_name.is_empty():
result["local_backups"].append(backup_name)
return ""
func _keep_both(store: RemoteStore, name: String, used_names: Dictionary) -> String:
var stamp := SyncPlan.timestamp_label()
var conflict_name := SyncPlan.unique_name(
SyncPlan.conflict_file_name(name, stamp),
used_names
var local_time := 0
var remote_time := 0
if name.to_lower().ends_with(RoutineFile.JSON_EXTENSION):
local_time = _content_saved_at(target)
remote_time = _content_saved_at(temporary)
if local_time <= 0:
local_time = FileAccess.get_modified_time(target)
if remote_time <= 0:
remote_time = remote_modify
var take_remote := SyncPlan.remote_wins(
local_time, remote_time, prefer_server_on_tie
)
var target := _local_path(conflict_name)
if take_remote:
var archive_error := _archive_file(target, name)
if not archive_error.is_empty():
DirAccess.remove_absolute(ProjectSettings.globalize_path(temporary))
return archive_error
err = _replace_file(temporary, target)
if not err.is_empty():
return "Konflikt %s: %s" % [name, err]
result["downloaded"].append(name)
else:
var archive_error := _archive_file(temporary, name)
if not archive_error.is_empty():
DirAccess.remove_absolute(ProjectSettings.globalize_path(temporary))
return archive_error
DirAccess.remove_absolute(ProjectSettings.globalize_path(temporary))
err = _upload(store, name)
if not err.is_empty():
return err
result["uploaded"].append(name)
result["resolved"].append({
"name": name,
"winner": "cloud" if take_remote else "local",
"timestamp": remote_time if take_remote else local_time,
"archive": name,
})
return ""
## Copies the losing version into the conflict archive. One slot per file name
## keeps repeated conflicts from growing a second pile of duplicates.
func _archive_file(source: String, name: String) -> String:
if not FileAccess.file_exists(source):
return ""
if not DirAccess.dir_exists_absolute(CONFLICT_DIR):
if DirAccess.make_dir_recursive_absolute(CONFLICT_DIR) != OK:
return "Konfliktarchiv nicht anlegbar: %s" % CONFLICT_DIR
var target := archive_path(name)
if FileAccess.file_exists(target):
DirAccess.remove_absolute(ProjectSettings.globalize_path(target))
var err := DirAccess.copy_absolute(
ProjectSettings.globalize_path(source),
ProjectSettings.globalize_path(target)
)
if err != OK:
return "Konfliktarchiv nicht beschreibbar: %s" % name
return ""
## Preserves a copy that only exists in the cloud before it is deleted there.
func _download_to_archive(store: RemoteStore, name: String) -> String:
if not DirAccess.dir_exists_absolute(CONFLICT_DIR):
if DirAccess.make_dir_recursive_absolute(CONFLICT_DIR) != OK:
return "Konfliktarchiv nicht anlegbar: %s" % CONFLICT_DIR
var target := archive_path(name)
var temporary := target + TEMP_SUFFIX
var err := store.download(name, temporary)
if not err.is_empty():
return "Konflikt %s: %s" % [name, err]
return "Konfliktkopie %s: %s" % [name, err]
return _replace_file(temporary, target)
err = _replace_file(temporary, target)
if not err.is_empty():
return "Konflikt %s: %s" % [name, err]
used_names[conflict_name] = true
result["conflicts"].append(conflict_name)
result["conflict_sources"].append(name)
return ""
static func archive_path(name: String) -> String:
return CONFLICT_DIR.path_join(name)
## Reads the content timestamp that [RoutineFile] stores in JSON routines;
## legacy `.tres` and audio files return 0 and fall back to file times.
static func _content_saved_at(path: String) -> int:
return RoutineFile.read_saved_at(path)
func _run_cleanup_task(
store: RemoteStore,
local: Dictionary,
remote: Dictionary
) -> void:
var report := _old_conflict_report(local, remote)
result["cleanup_candidates"] = report["candidates"]
result["cleanup_skipped"] = report["skipped"]
if task == Task.SCAN_OLD_CONFLICTS:
return
_clean_old_conflicts(store, local, remote)
## Finds the visible copies created by older versions. A copy is only a
## candidate when the routine it belongs to still exists locally or in the
## cloud; otherwise the copy may be the only surviving version.
func _old_conflict_report(
local: Dictionary,
remote: Dictionary
) -> Dictionary:
var names: Array[String] = []
for name: String in local.keys():
if not SyncPlan.old_conflict_base(name).is_empty():
names.append(name)
for name: String in remote.keys():
if (
not names.has(name)
and not SyncPlan.old_conflict_base(name).is_empty()
):
names.append(name)
names.sort()
var candidates: Array[Dictionary] = []
var skipped: Array[String] = []
for name: String in names:
var base := SyncPlan.old_conflict_base(name)
if base.is_empty():
continue
if local.has(base) or remote.has(base):
candidates.append({
"name": name,
"base": base,
"local": local.has(name),
"remote": remote.has(name),
})
else:
skipped.append(name)
return {"candidates": candidates, "skipped": skipped}
func _clean_old_conflicts(
store: RemoteStore,
local: Dictionary,
remote: Dictionary
) -> void:
var report := _old_conflict_report(local, remote)
result["cleanup_candidates"] = report["candidates"]
result["cleanup_skipped"] = report["skipped"]
for entry: Dictionary in report["candidates"]:
var name: String = entry["name"]
if not cleanup_names.has(name):
continue
# Delete the cloud copy first so it cannot come back on the next sync.
if entry["remote"]:
if not entry["local"]:
var archive_error := _download_to_archive(store, name)
if not archive_error.is_empty():
result["errors"].append(archive_error)
continue
var delete_error := store.delete_file(name)
if not delete_error.is_empty():
result["errors"].append(
"Konfliktkopie %s: %s" % [name, delete_error]
)
continue
if entry["local"]:
var archive_error := _archive_file(_local_path(name), name)
if not archive_error.is_empty():
result["errors"].append(archive_error)
continue
var remove_error := DirAccess.remove_absolute(
ProjectSettings.globalize_path(_local_path(name))
)
if remove_error != OK:
result["errors"].append(
"Konfliktkopie nicht entfernbar: %s" % name
)
continue
result["cleanup_done"].append(name)
## Deletes the confirmed routines and attachments in the cloud and locally.
## A file is only removed locally after its cloud copy was deleted (or was
## never there), so a failed cloud request leaves a retryable state.
func _delete_routines(
store: RemoteStore,
_local: Dictionary,
remote: Dictionary
) -> void:
var local_names := PackedStringArray()
for name: String in delete_names:
if remote.has(name):
var delete_error := store.delete_file(name)
if not delete_error.is_empty():
result["errors"].append(
"Löschen %s: %s" % [name, delete_error]
)
continue
local_names.append(name)
result["deleted"].append(name)
for name: String in delete_attachments:
if remote.has(name):
var delete_error := store.delete_file(name)
if not delete_error.is_empty():
result["errors"].append(
"Löschen %s: %s" % [name, delete_error]
)
continue
local_names.append(name)
result["errors"].append_array(delete_local_files(local_names))
## Renames the cloud copy. The local rename already happened in the
## controller; this keeps the cloud in step and clears the old sync state so
## the new name is uploaded normally. Legacy `.tres` twins are deleted
## because the local rename migrates them to JSON.
func _rename_routines(store: RemoteStore, remote: Dictionary) -> void:
var count := mini(rename_from.size(), rename_to.size())
for index: int in range(count):
var old_name := rename_from[index]
var new_name := rename_to[index]
if old_name == new_name:
if old_name.to_lower().ends_with(RoutineFile.LEGACY_EXTENSION):
if remote.has(old_name):
var cleanup_error := store.delete_file(old_name)
if not cleanup_error.is_empty():
result["errors"].append(
"Umbenennen %s: %s" % [old_name, cleanup_error]
)
continue
else:
var unchanged_local := _local_path(new_name)
if FileAccess.file_exists(unchanged_local):
var unchanged_upload := store.upload(
unchanged_local,
new_name
)
if not unchanged_upload.is_empty():
result["errors"].append(
"Hochladen %s: %s" % [new_name, unchanged_upload]
)
forget_state(PackedStringArray([old_name]))
result["renamed"].append(old_name)
continue
if old_name.to_lower().ends_with(RoutineFile.LEGACY_EXTENSION):
if remote.has(old_name):
var delete_error := store.delete_file(old_name)
if not delete_error.is_empty():
result["errors"].append(
"Umbenennen %s: %s" % [old_name, delete_error]
)
continue
else:
if remote.has(old_name):
if remote.has(new_name):
result["errors"].append(
"Umbenennen %s: Ziel existiert bereits in der Cloud"
% old_name
)
continue
var rename_error := store.rename(old_name, new_name)
if not rename_error.is_empty():
result["errors"].append(
"Umbenennen %s: %s" % [old_name, rename_error]
)
continue
var local_new := _local_path(new_name)
if FileAccess.file_exists(local_new):
var upload_error := store.upload(local_new, new_name)
if not upload_error.is_empty():
result["errors"].append(
"Hochladen %s: %s" % [new_name, upload_error]
)
forget_state(PackedStringArray([old_name, new_name]))
result["renamed"].append(old_name)
## Removes local files and forgets their sync state. Missing files count as
## deleted; files that cannot be removed are reported and keep their state.
static func delete_local_files(
names: PackedStringArray,
state_path: String = STATE_PATH
) -> Array[String]:
var errors: Array[String] = []
var forgotten := PackedStringArray()
for name: String in names:
var path := _local_path(name)
if not FileAccess.file_exists(path):
forgotten.append(name)
continue
var err := DirAccess.remove_absolute(ProjectSettings.globalize_path(path))
if err != OK:
errors.append("Datei nicht löschbar: %s" % name)
continue
forgotten.append(name)
forget_state(forgotten, state_path)
return errors
static func forget_state(
names: PackedStringArray,
path: String = STATE_PATH
) -> void:
if names.is_empty():
return
var state := load_state(path)
var changed := false
for name: String in names:
if state.erase(name):
changed = true
if changed:
save_state(path, state)
## Replaces [param target] with [param temporary] without losing the target if
@ -247,8 +555,6 @@ func _save_state(store: RemoteStore, state: Dictionary) -> void:
var touched: Array = []
touched.append_array(result["uploaded"])
touched.append_array(result["downloaded"])
touched.append_array(result["conflict_sources"])
touched.append_array(result["adopted"])
for name: String in touched:
if not local_after.has(name) or not remote_after.has(name):

View file

@ -10,11 +10,10 @@ extends RefCounted
## state: {"local_mtime": int, "remote_modify": int}
##
## Without a state entry (first sync of a device, or a reset sync state) there
## is no common ancestor. In that case the server copy is the shared, established
## version: it takes the normal file name and the local variant is kept as a
## "(Lokal ...)" copy. Only a real conflict (both sides changed since the last
## sync) keeps the local file under its name and stores the server variant as a
## "(Server ...)" copy.
## is no common ancestor. Both sides existing and both sides changed since the
## last sync are marked as a decision: [RoutineSync] downloads the cloud copy,
## compares the content timestamps and keeps the newer version under the normal
## name. The older version is archived instead of creating a visible copy.
enum Action {
UPLOAD,
@ -27,8 +26,8 @@ enum Action {
const ACTION_NAMES := {
Action.UPLOAD: "upload",
Action.DOWNLOAD: "download",
Action.CONFLICT: "conflict",
Action.TAKE_SERVER: "take_server",
Action.CONFLICT: "resolve",
Action.TAKE_SERVER: "resolve",
Action.SKIP: "skip",
}
@ -91,29 +90,52 @@ static func action_name(action: Action) -> String:
return ACTION_NAMES.get(action, "unknown")
## "kuer.json" -> "kuer (Server 2026-10-30 1050).json"
static func conflict_file_name(file_name: String, stamp: String) -> String:
return "%s (Server %s)%s" % [
file_name.get_basename(),
stamp,
_extension_suffix(file_name),
]
## "kuer.json" -> "kuer (Lokal 2026-10-30 1050).json"
static func local_backup_file_name(file_name: String, stamp: String) -> String:
return "%s (Lokal %s)%s" % [
file_name.get_basename(),
stamp,
_extension_suffix(file_name),
]
static func _extension_suffix(file_name: String) -> String:
## Recognizes the old visible conflict copies such as
## "kuer (Server 2026-10-30 1050).json" or "kuer (Lokal ...) 2.mp3" and
## returns the normal name they belong to. Returns "" for regular files.
static func old_conflict_base(file_name: String) -> String:
var extension := file_name.get_extension()
if extension.is_empty():
return ""
return "." + extension
var stem := file_name.get_basename()
var stripped := false
var regex := _conflict_copy_regex()
while true:
var found := regex.search(stem)
if found == null:
break
stem = found.get_string(1)
stripped = true
if not stripped:
return ""
return "%s.%s" % [stem, extension]
static var _conflict_copy_pattern: RegEx
static func _conflict_copy_regex() -> RegEx:
if _conflict_copy_pattern == null:
_conflict_copy_pattern = RegEx.new()
_conflict_copy_pattern.compile(
"^(.+) \\((?:Server|Lokal) \\d{4}-\\d{2}-\\d{2} \\d{4}\\)(?: \\d+)?$"
)
return _conflict_copy_pattern
## True when the cloud copy is newer. Equal or unknown times fall back to the
## established side: the server on a first sync, the local file when both
## sides changed since the last sync.
static func remote_wins(
local_time: int,
remote_time: int,
prefer_server_on_tie: bool
) -> bool:
if remote_time > local_time:
return true
if local_time > remote_time:
return false
return prefer_server_on_tie
static func timestamp_label(unix_time: int = -1) -> String:
@ -131,18 +153,3 @@ static func timestamp_label(unix_time: int = -1) -> String:
int(parts["hour"]),
int(parts["minute"]),
]
## Returns a name that is not yet used locally.
static func unique_name(file_name: String, used: Dictionary) -> String:
if not used.has(file_name):
return file_name
var base := file_name.get_basename()
var extension := _extension_suffix(file_name)
var index := 2
while true:
var candidate := "%s %d%s" % [base, index, extension]
if not used.has(candidate):
return candidate
index += 1
return file_name

View file

@ -0,0 +1,255 @@
class_name SportTheme
extends RefCounted
## Central dark "sports broadcast" theme for the whiteboard UI. Built in code so
## the flat panels, cyan accents and tighter controls stay in one place.
const BG := Color("#070b12")
const SURFACE := Color("#0b1320")
const SURFACE_ALT := Color("#112033")
const ACCENT := Color("#38c6f4")
const ACCENT_DARK := Color("#0e3448")
const BORDER := Color("#1b2c42")
const BORDER_STRONG := Color("#2b4a66")
const TEXT := Color("#f2f7ff")
const TEXT_MUTED := Color("#93a8c2")
const TEXT_DIM := Color("#5f748c")
const DANGER := Color("#ff5c77")
static var _body_font: FontVariation
static var _button_font: FontVariation
static var _display_font: FontVariation
static func build() -> Theme:
var theme := Theme.new()
theme.default_font = body_font()
theme.default_font_size = 15
_build_button(theme)
_build_fields(theme)
_build_panels(theme)
_build_menu(theme)
_build_tabs(theme)
_build_slider(theme)
_build_scrollbar(theme)
_build_misc(theme)
return theme
static func body_font() -> FontVariation:
if _body_font == null:
_body_font = FontVariation.new()
_body_font.base_font = ThemeDB.fallback_font
_body_font.variation_embolden = 0.12
return _body_font
static func button_font() -> FontVariation:
if _button_font == null:
_button_font = FontVariation.new()
_button_font.base_font = ThemeDB.fallback_font
_button_font.variation_embolden = 0.45
return _button_font
static func display_font() -> FontVariation:
if _display_font == null:
_display_font = FontVariation.new()
_display_font.base_font = ThemeDB.fallback_font
_display_font.variation_embolden = 0.85
_display_font.spacing_glyph = 1
return _display_font
static func _build_button(theme: Theme) -> void:
var normal := _box(SURFACE, BORDER, 1, 2, 7, 3)
var hover := _box(SURFACE_ALT, BORDER_STRONG, 1, 2, 7, 3)
var pressed := _box(ACCENT_DARK, ACCENT, 1, 2, 7, 3)
pressed.border_width_bottom = 2
var disabled := _box(BG, BORDER, 1, 2, 7, 3)
var focus := _box(Color(0, 0, 0, 0), ACCENT, 1, 2, 7, 3)
for type: String in ["Button", "OptionButton", "MenuButton"]:
theme.set_stylebox("normal", type, normal)
theme.set_stylebox("hover", type, hover)
theme.set_stylebox("pressed", type, pressed)
theme.set_stylebox("hover_pressed", type, pressed)
theme.set_stylebox("disabled", type, disabled)
theme.set_stylebox("focus", type, focus)
theme.set_font("font", type, button_font())
theme.set_font_size("font_size", type, 14)
theme.set_color("font_color", type, TEXT)
theme.set_color("font_hover_color", type, TEXT)
theme.set_color("font_pressed_color", type, TEXT)
theme.set_color("font_focus_color", type, TEXT)
theme.set_color("font_disabled_color", type, TEXT_DIM)
theme.set_color("icon_normal_color", type, TEXT_MUTED)
theme.set_color("icon_hover_color", type, TEXT)
theme.set_color("icon_pressed_color", type, TEXT)
theme.set_color("icon_focus_color", type, TEXT)
theme.set_color("icon_disabled_color", type, TEXT_DIM)
theme.set_constant("h_separation", type, 6)
theme.set_constant("icon_max_width", type, 24)
var check_normal := _box(Color(0, 0, 0, 0), Color(0, 0, 0, 0), 0, 0, 4, 2)
var check_hover := _box(SURFACE_ALT, BORDER_STRONG, 1, 2, 4, 2)
var check_pressed := _box(ACCENT_DARK, ACCENT, 1, 2, 4, 2)
theme.set_stylebox("normal", "CheckBox", check_normal)
theme.set_stylebox("hover", "CheckBox", check_hover)
theme.set_stylebox("pressed", "CheckBox", check_pressed)
theme.set_stylebox("hover_pressed", "CheckBox", check_pressed)
theme.set_stylebox("disabled", "CheckBox", check_normal)
theme.set_stylebox("focus", "CheckBox", focus)
theme.set_font("font", "CheckBox", body_font())
theme.set_font_size("font_size", "CheckBox", 14)
theme.set_color("font_color", "CheckBox", TEXT)
theme.set_color("font_hover_color", "CheckBox", TEXT)
theme.set_color("font_pressed_color", "CheckBox", TEXT)
theme.set_color("font_disabled_color", "CheckBox", TEXT_DIM)
static func _build_fields(theme: Theme) -> void:
var normal := _box(BG, BORDER, 1, 2, 8, 3)
var focus := _box(BG, ACCENT, 1, 2, 8, 3)
var read_only := _box(SURFACE, BORDER, 1, 2, 8, 3)
theme.set_stylebox("normal", "LineEdit", normal)
theme.set_stylebox("focus", "LineEdit", focus)
theme.set_stylebox("read_only", "LineEdit", read_only)
theme.set_font("font", "LineEdit", body_font())
theme.set_font_size("font_size", "LineEdit", 15)
theme.set_color("font_color", "LineEdit", TEXT)
theme.set_color("font_placeholder_color", "LineEdit", TEXT_DIM)
theme.set_color("font_uneditable_color", "LineEdit", TEXT_MUTED)
theme.set_color("selection_color", "LineEdit", ACCENT_DARK)
theme.set_color("caret_color", "LineEdit", ACCENT)
static func _build_panels(theme: Theme) -> void:
var panel := _box(SURFACE, BORDER, 1, 3, 8, 6)
theme.set_stylebox("panel", "PanelContainer", panel)
theme.set_stylebox("panel", "Panel", panel)
theme.set_stylebox("panel", "AcceptDialog", panel)
theme.set_stylebox("panel", "PopupPanel", panel)
theme.set_stylebox("panel", "TooltipPanel", _box(SURFACE_ALT, ACCENT, 1, 2, 8, 4))
theme.set_color("font_color", "TooltipLabel", TEXT)
theme.set_font("font", "TooltipLabel", body_font())
theme.set_font_size("font_size", "TooltipLabel", 13)
static func _build_menu(theme: Theme) -> void:
var panel := _box(SURFACE, BORDER_STRONG, 1, 3, 6, 4)
var hover := _box(ACCENT_DARK, ACCENT, 1, 2, 6, 3)
var separator := StyleBoxLine.new()
separator.color = BORDER
separator.thickness = 1
theme.set_stylebox("panel", "PopupMenu", panel)
theme.set_stylebox("hover", "PopupMenu", hover)
theme.set_stylebox("separator", "PopupMenu", separator)
theme.set_font("font", "PopupMenu", body_font())
theme.set_font_size("font_size", "PopupMenu", 14)
theme.set_color("font_color", "PopupMenu", TEXT)
theme.set_color("font_hover_color", "PopupMenu", TEXT)
theme.set_color("font_disabled_color", "PopupMenu", TEXT_DIM)
theme.set_color("font_separator_color", "PopupMenu", TEXT_MUTED)
theme.set_constant("v_separation", "PopupMenu", 4)
theme.set_constant("item_start_padding", "PopupMenu", 8)
theme.set_constant("item_end_padding", "PopupMenu", 8)
static func _build_tabs(theme: Theme) -> void:
var panel := _box(SURFACE, BORDER, 1, 2, 6, 6)
var selected := _box(ACCENT_DARK, ACCENT, 1, 2, 10, 4)
selected.border_width_bottom = 2
var unselected := _box(Color(0, 0, 0, 0), Color(0, 0, 0, 0), 0, 0, 10, 4)
var hovered := _box(SURFACE_ALT, BORDER_STRONG, 1, 2, 10, 4)
for type: String in ["TabContainer", "TabBar"]:
theme.set_stylebox("panel", type, panel)
theme.set_stylebox("tab_selected", type, selected)
theme.set_stylebox("tab_unselected", type, unselected)
theme.set_stylebox("tab_hovered", type, hovered)
theme.set_stylebox("tab_disabled", type, unselected)
theme.set_stylebox("tab_focus", type, hovered)
theme.set_color("font_selected_color", type, TEXT)
theme.set_color("font_unselected_color", type, TEXT_MUTED)
theme.set_color("font_hovered_color", type, TEXT)
theme.set_color("font_disabled_color", type, TEXT_DIM)
theme.set_font("font", type, button_font())
theme.set_font_size("font_size", type, 14)
theme.set_constant("side_margin", type, 6)
theme.set_constant("tab_separation", type, 2)
static func _build_slider(theme: Theme) -> void:
var track := _box(BG, BORDER, 1, 2, 0, 0)
track.content_margin_top = 2
track.content_margin_bottom = 2
var fill := _box(ACCENT, ACCENT, 0, 2, 0, 0)
fill.content_margin_top = 2
fill.content_margin_bottom = 2
theme.set_stylebox("slider", "HSlider", track)
theme.set_stylebox("grabber_area", "HSlider", fill)
theme.set_stylebox("grabber_area_highlight", "HSlider", fill)
static func _build_scrollbar(theme: Theme) -> void:
var scroll := _box(BG, Color(0, 0, 0, 0), 0, 2, 0, 0)
var grabber := _box(BORDER_STRONG, Color(0, 0, 0, 0), 0, 4, 0, 0)
var grabber_hover := _box(ACCENT, Color(0, 0, 0, 0), 0, 4, 0, 0)
for type: String in ["VScrollBar", "HScrollBar"]:
theme.set_stylebox("scroll", type, scroll)
theme.set_stylebox("scroll_focus", type, scroll)
theme.set_stylebox("grabber", type, grabber)
theme.set_stylebox("grabber_highlight", type, grabber_hover)
theme.set_stylebox("grabber_pressed", type, grabber_hover)
static func _build_misc(theme: Theme) -> void:
theme.set_color("font_color", "Label", TEXT)
theme.set_font("font", "Label", body_font())
theme.set_font_size("font_size", "Label", 15)
theme.set_color("default_color", "RichTextLabel", TEXT)
theme.set_font("normal_font", "RichTextLabel", body_font())
theme.set_font_size("normal_font_size", "RichTextLabel", 15)
theme.set_color("title_color", "Window", ACCENT)
theme.set_font("title_font", "Window", display_font())
theme.set_font_size("title_font_size", "Window", 16)
var separator := StyleBoxLine.new()
separator.color = BORDER
separator.thickness = 1
theme.set_stylebox("separator", "VSeparator", separator)
theme.set_stylebox("separator", "HSeparator", separator)
theme.set_constant("separation", "HBoxContainer", 6)
theme.set_constant("separation", "VBoxContainer", 6)
theme.set_constant("h_separation", "HFlowContainer", 6)
theme.set_constant("v_separation", "HFlowContainer", 4)
theme.set_constant("h_separation", "GridContainer", 8)
theme.set_constant("v_separation", "GridContainer", 6)
static func _box(
background: Color,
border: Color,
border_width: int,
radius: int,
margin_h: float,
margin_v: float
) -> StyleBoxFlat:
var box := StyleBoxFlat.new()
box.bg_color = background
box.border_color = border
box.border_width_left = border_width
box.border_width_top = border_width
box.border_width_right = border_width
box.border_width_bottom = border_width
box.corner_radius_top_left = radius
box.corner_radius_top_right = radius
box.corner_radius_bottom_right = radius
box.corner_radius_bottom_left = radius
box.content_margin_left = margin_h
box.content_margin_right = margin_h
box.content_margin_top = margin_v
box.content_margin_bottom = margin_v
return box

View file

@ -0,0 +1 @@
uid://bhax7bgaqc7h5

File diff suppressed because it is too large Load diff

View file

@ -75,11 +75,16 @@ const FREEHAND_HANDLE_LIMIT := 64
const FREEHAND_POINT_RADIUS_PX := 3.2
const FREEHAND_POINT_HIT_RADIUS_PX := 12.0
const TOUCH_MOUSE_GUARD_MSEC := 300
const SECTION_BANNER_DURATION := 2.0
const SECTION_BANNER_FADE_IN := 0.15
const SECTION_BANNER_FADE_OUT := 0.6
const SECTION_BANNER_TOP := 18.0
const SECTION_BANNER_FONT_SIZE := 22
const SECTION_BANNER_DURATION := 2.6
const SECTION_BANNER_FADE_IN := 0.22
const SECTION_BANNER_FADE_OUT := 0.55
const SECTION_BANNER_FONT_SIZE := 50
const SECTION_BANNER_MIN_FONT_SIZE := 26
const SECTION_BANNER_KICKER_SIZE := 15
const SECTION_BANNER_MIN_WIDTH := 520.0
const SECTION_BANNER_SIDE_MARGIN := 24.0
const SECTION_BANNER_SKEW := 22.0
const SECTION_BANNER_HEIGHT_EXTRA := 58.0
@export var fit_padding_px: float = 32.0
@export var drawing_enabled: bool = true
@ -128,6 +133,8 @@ var _section_banner_text: String = ""
var _section_banner_elapsed: float = 0.0
var _section_banner_remaining: float = 0.0
var _section_banner_duration: float = 0.0
var _banner_main_font: FontVariation
var _banner_kicker_font: FontVariation
# Screen-space polyline cache. During playback only the marker moves, so the
# sampled paths can be reused instead of re-baking every curve each frame.
@ -303,8 +310,9 @@ func get_playback_marker_scale() -> float:
return _playback_marker_scale
## Shows the current section name at the top of the rink. It fades in briefly,
## stays readable and fades out before [param duration] seconds are over.
## Shows the current section name as a broadcast-style strap that is flush
## with the top edge of the rink. It slides in briefly, stays readable and
## slides out before [param duration] seconds are over.
func show_section_banner(text: String, duration: float = SECTION_BANNER_DURATION) -> void:
var cleaned := text.strip_edges()
if cleaned.is_empty():
@ -583,54 +591,150 @@ func _draw_section_banner() -> void:
var alpha := _banner_alpha()
if alpha <= 0.0:
return
var font := ThemeDB.fallback_font
var text_size := font.get_string_size(
_section_banner_text,
_ensure_banner_fonts()
var main_font := _banner_main_font
var kicker_font := _banner_kicker_font
var title := _section_banner_text.to_upper()
var max_width := maxf(
size.x - SECTION_BANNER_SIDE_MARGIN * 2.0,
320.0
)
var main_size := SECTION_BANNER_FONT_SIZE
var text_limit := clampf(
size.x * 0.66,
SECTION_BANNER_MIN_WIDTH,
max_width
) - 150.0
var text_width := main_font.get_string_size(
title,
HORIZONTAL_ALIGNMENT_LEFT,
-1,
SECTION_BANNER_FONT_SIZE
main_size
).x
if text_width > text_limit and text_width > 0.0:
main_size = maxi(
SECTION_BANNER_MIN_FONT_SIZE,
int(floor(main_size * text_limit / text_width))
)
text_width = main_font.get_string_size(
title,
HORIZONTAL_ALIGNMENT_LEFT,
-1,
main_size
).x
var width := clampf(
text_width + 150.0,
SECTION_BANNER_MIN_WIDTH,
max_width
)
var padding := Vector2(20.0, 9.0)
var box := Vector2(
text_size.x + padding.x * 2.0,
SECTION_BANNER_FONT_SIZE + padding.y * 2.0
)
var rise := (1.0 - smoothstep(0.0, SECTION_BANNER_FADE_IN, _section_banner_elapsed)) * 8.0
var top_left := Vector2(
(size.x - box.x) * 0.5,
SECTION_BANNER_TOP + rise
)
var rect := Rect2(top_left, box)
var background := Color(0.035, 0.065, 0.12, 0.82 * alpha)
var border := Color(0.55, 0.72, 0.94, 0.85 * alpha)
var accent := Color(0.38, 0.65, 0.98, alpha)
var text_color := Color(0.96, 0.98, 1.0, alpha)
var shadow := Color(0.0, 0.0, 0.0, 0.35 * alpha)
var height := maxf(96.0, float(main_size) + SECTION_BANNER_HEIGHT_EXTRA)
draw_rect(Rect2(rect.position + Vector2(2.0, 3.0), rect.size), shadow, true)
draw_rect(rect, background, true)
draw_rect(rect, border, false, 1.5)
draw_rect(
Rect2(
Vector2(rect.position.x, rect.end.y - 3.0),
Vector2(rect.size.x, 3.0)
),
var entry := 1.0 - smoothstep(
0.0,
SECTION_BANNER_FADE_IN,
_section_banner_elapsed
)
var exit_progress := 1.0 - clampf(
_section_banner_remaining / SECTION_BANNER_FADE_OUT,
0.0,
1.0
)
var top_y := -height * (0.65 * entry + 0.75 * exit_progress)
var left_x := (size.x - width) * 0.5
var skew := SECTION_BANNER_SKEW
var points := PackedVector2Array([
Vector2(left_x + skew, top_y),
Vector2(left_x + width, top_y),
Vector2(left_x + width - skew, top_y + height),
Vector2(left_x, top_y + height),
])
var background := PackedColorArray([
Color(0.02, 0.05, 0.10, 0.94 * alpha),
Color(0.035, 0.12, 0.20, 0.90 * alpha),
Color(0.04, 0.15, 0.24, 0.88 * alpha),
Color(0.015, 0.04, 0.08, 0.96 * alpha),
])
var shadow_points := PackedVector2Array()
for point: Vector2 in points:
shadow_points.append(point + Vector2(0.0, 5.0))
draw_colored_polygon(shadow_points, Color(0.0, 0.0, 0.0, 0.35 * alpha))
draw_polygon(points, background)
var accent := Color(0.20, 0.82, 1.0, alpha)
var bright := Color(0.70, 0.95, 1.0, 0.95 * alpha)
var white := Color(0.97, 0.99, 1.0, alpha)
var stripe_left_top := left_x + skew + 16.0
var stripe_left_bottom := left_x + 16.0
var stripe := PackedVector2Array([
Vector2(stripe_left_top, top_y),
Vector2(stripe_left_top + 9.0, top_y),
Vector2(stripe_left_bottom + 9.0, top_y + height),
Vector2(stripe_left_bottom, top_y + height),
])
draw_colored_polygon(stripe, accent)
draw_line(
Vector2(left_x + skew + 2.0, top_y + height - 2.0),
Vector2(left_x + width - skew - 2.0, top_y + height - 2.0),
bright,
2.0,
true
)
var text_x := left_x + skew + 42.0
var kicker_y := top_y + 33.0
draw_line(
Vector2(text_x, kicker_y - 5.0),
Vector2(text_x + 22.0, kicker_y - 5.0),
accent,
2.0,
true
)
draw_string(
font,
Vector2(
rect.position.x + padding.x,
rect.position.y + padding.y + font.get_ascent(SECTION_BANNER_FONT_SIZE)
),
_section_banner_text,
kicker_font,
Vector2(text_x + 32.0, kicker_y),
"ABSCHNITT",
HORIZONTAL_ALIGNMENT_LEFT,
-1,
SECTION_BANNER_FONT_SIZE,
text_color
SECTION_BANNER_KICKER_SIZE,
Color(0.55, 0.90, 1.0, 0.95 * alpha)
)
var main_baseline := top_y + height - 22.0
draw_string(
main_font,
Vector2(text_x + 1.0, main_baseline + 2.0),
title,
HORIZONTAL_ALIGNMENT_LEFT,
-1,
main_size,
Color(0.0, 0.0, 0.0, 0.45 * alpha)
)
draw_string(
main_font,
Vector2(text_x, main_baseline),
title,
HORIZONTAL_ALIGNMENT_LEFT,
-1,
main_size,
white
)
func _ensure_banner_fonts() -> void:
if _banner_main_font != null:
return
_banner_main_font = FontVariation.new()
_banner_main_font.base_font = ThemeDB.fallback_font
_banner_main_font.variation_embolden = 0.7
_banner_kicker_font = FontVariation.new()
_banner_kicker_font.base_font = ThemeDB.fallback_font
_banner_kicker_font.variation_embolden = 0.45
_banner_kicker_font.spacing_glyph = 3
func _draw_section(section: RoutineSection, alpha: float) -> void:
var step_px := GHOST_SAMPLE_STEP_PX if alpha < 1.0 else CURVE_SAMPLE_STEP_PX

View file

@ -279,6 +279,15 @@ func _test_atomic_write() -> void:
_check(FileAccess.file_exists(JSON_PATH), "JSON file exists")
_check(not FileAccess.file_exists(JSON_PATH + ".tmp"), "no temp file remains")
_check(not FileAccess.file_exists(JSON_PATH + ".bak"), "no backup remains")
_check(routine.saved_at > 0, "saving stamps the routine content time")
_check(
RoutineFile.read_saved_at(JSON_PATH) == routine.saved_at,
"the content timestamp can be read without loading the routine"
)
_check(
RoutineFile.read_music_file(JSON_PATH) == routine.music_file,
"the music attachment can be read without loading the routine"
)
routine.title = "Zweite Fassung"
_check(
@ -291,6 +300,10 @@ func _test_atomic_write() -> void:
loaded != null and loaded.title == "Zweite Fassung",
"atomic replacement writes the new content"
)
_check(
loaded != null and loaded.saved_at == routine.saved_at,
"the content timestamp survives a save/load roundtrip"
)
func _test_legacy_roundtrip() -> void:

View file

@ -189,10 +189,10 @@ func _run() -> void:
controller._section_buttons[section_two.section_id].text.begins_with("▶ "),
"section list marks the second section"
)
controller.rink_canvas._process(2.1)
controller.rink_canvas._process(2.7)
_check(
controller.rink_canvas.get_section_banner_text().is_empty(),
"section banner fades out within two seconds"
"section banner fades out after its display time"
)
_check(
controller.rink_canvas.get_section_banner_alpha() == 0.0,
@ -545,7 +545,7 @@ func _run() -> void:
DirAccess.remove_absolute(ProjectSettings.globalize_path(old_path))
_write_test_wav(music_source)
_check(
controller.load_music_from_path(music_source),
await controller.load_music_from_path(music_source),
"music file is loaded into the routine"
)
_check(
@ -562,9 +562,9 @@ func _run() -> void:
"playback bar shows the music file"
)
# Loading the very same track again must not create a numbered duplicate.
# Loading the very same track again must not create a duplicate.
_check(
controller.load_music_from_path(music_source),
await controller.load_music_from_path(music_source),
"the same music file can be loaded again"
)
_check(
@ -576,36 +576,70 @@ func _run() -> void:
"reloading identical music creates no numbered duplicate"
)
# A different track with the same name still gets its own numbered copy.
# A different track with the same name opens a decision dialog. Choosing
# the existing file must not overwrite it or create a numbered copy.
var alt_dir := "user://music_alt"
DirAccess.make_dir_recursive_absolute(
ProjectSettings.globalize_path(alt_dir)
)
var alt_source := alt_dir.path_join("test_music.wav")
_write_test_wav(alt_source, 16000)
controller.load_music_from_path(alt_source)
await process_frame
_check(
controller.load_music_from_path(alt_source),
"a different track with the same name loads"
)
_check(
controller.get_music_file_name() == "test_music 2.wav",
"a different track is stored under a numbered name"
)
_check(
controller.load_music_from_path(alt_source),
"the numbered track can be loaded again"
)
_check(
controller.get_music_file_name() == "test_music 2.wav",
"reloading the numbered track keeps its name"
)
_check(
controller.load_music_from_path(music_source),
"switching back to the first track works"
controller.music_conflict_dialog.visible,
"a different track with the same name opens a decision dialog"
)
controller._decide_music_conflict("use_existing")
await process_frame
_check(
controller.get_music_file_name() == "test_music.wav",
"switching back reuses the existing first copy"
"keeping the existing file uses the known name"
)
_check(
not FileAccess.file_exists("user://routines/test_music 2.wav"),
"keeping the existing file creates no numbered duplicate"
)
# Overwriting replaces the existing file under the same name.
controller.load_music_from_path(alt_source)
await process_frame
_check(
controller.music_conflict_dialog.visible,
"the decision dialog appears again for the same name"
)
controller._decide_music_conflict("replace")
await process_frame
_check(
controller.get_music_file_name() == "test_music.wav",
"overwriting keeps the clean file name"
)
_check(
FileAccess.get_sha256("user://routines/test_music.wav")
== FileAccess.get_sha256(alt_source),
"overwriting replaces the existing music content"
)
_check(
not FileAccess.file_exists("user://routines/test_music 2.wav"),
"overwriting creates no numbered duplicate"
)
# Cancel leaves the current file untouched.
var before_cancel_hash := FileAccess.get_sha256(
"user://routines/test_music.wav"
)
controller.load_music_from_path(music_source)
await process_frame
_check(
controller.music_conflict_dialog.visible,
"the decision dialog appears for the original track again"
)
controller._decide_music_conflict("cancel")
await process_frame
_check(
FileAccess.get_sha256("user://routines/test_music.wav")
== before_cancel_hash,
"cancelling the decision leaves the existing file untouched"
)
controller.seek_playback(0.5)

View file

@ -9,6 +9,46 @@ extends SceneTree
const WhiteboardScene := preload("res://scenes/whiteboard/whiteboard.tscn")
## Minimal in-memory cloud used to exercise the newest-wins resolution without
## network access.
class FakeRemoteStore extends RemoteStore:
var remote_files: Dictionary = {}
var uploads: Array[String] = []
var deleted: Array[String] = []
var renames: Array[Dictionary] = []
func download(remote_name: String, local_path: String) -> String:
if not remote_files.has(remote_name):
return "Datei fehlt in der Test-Cloud"
var file := FileAccess.open(local_path, FileAccess.WRITE)
if file == null:
return "Temporäre Datei nicht schreibbar"
file.store_string(str(remote_files[remote_name]))
file.close()
return ""
func upload(local_path: String, remote_name: String) -> String:
var file := FileAccess.open(local_path, FileAccess.READ)
if file == null:
return "Lokale Datei nicht lesbar"
remote_files[remote_name] = file.get_as_text()
file.close()
uploads.append(remote_name)
return ""
func delete_file(remote_name: String) -> String:
deleted.append(remote_name)
remote_files.erase(remote_name)
return ""
func rename(from_name: String, to_name: String) -> String:
if not remote_files.has(from_name):
return "Datei fehlt in der Test-Cloud"
remote_files[to_name] = remote_files[from_name]
remote_files.erase(from_name)
renames.append({"from": from_name, "to": to_name})
return ""
var _assertions: int = 0
var _failures: PackedStringArray = PackedStringArray()
@ -19,7 +59,11 @@ func _init() -> void:
func _run() -> void:
_test_plan()
_test_naming()
_test_resolution()
_test_resolution_files()
_test_cleanup_files()
_test_delete_files()
_test_rename_files()
_test_cloud_helpers()
_test_app_config()
_test_state_roundtrip()
@ -91,32 +135,58 @@ func _test_plan() -> void:
)
func _test_naming() -> void:
func _test_resolution() -> void:
_check(
SyncPlan.conflict_file_name("kuer.json", "2026-10-30 1050")
== "kuer (Server 2026-10-30 1050).json",
"Konfliktname enthält Zeitstempel"
)
var used := {"kuer (Server 2026-10-30 1050).json": true}
_check(
SyncPlan.unique_name("kuer (Server 2026-10-30 1050).json", used)
== "kuer (Server 2026-10-30 1050) 2.json",
"Konfliktname wird bei Bedarf durchnummeriert"
SyncPlan.remote_wins(100, 200, false),
"die neuere Cloud-Fassung gewinnt"
)
_check(
SyncPlan.unique_name("frei.json", used) == "frei.json",
"freier Name bleibt unverändert"
not SyncPlan.remote_wins(200, 100, true),
"die neuere lokale Fassung gewinnt"
)
_check(
SyncPlan.local_backup_file_name("kuer.json", "2026-10-30 1050")
== "kuer (Lokal 2026-10-30 1050).json",
"lokale Sicherung trägt den Lokal-Zeitstempel"
SyncPlan.remote_wins(100, 100, true),
"Gleichstand beim ersten Sync übernimmt die Cloud"
)
_check(
SyncPlan.conflict_file_name("alt.tres", "2026-10-30 1050")
== "alt (Server 2026-10-30 1050).tres",
"Legacy-Dateien behalten ihre .tres-Endung"
not SyncPlan.remote_wins(100, 100, false),
"Gleichstand im Konflikt behält die lokale Fassung"
)
_check(
SyncPlan.remote_wins(0, 0, true),
"unbekannte Zeiten fallen beim ersten Sync auf die Cloud zurück"
)
_check(
RoutineSync.archive_path("kuer.json")
== "user://conflicts/kuer.json",
"das Konfliktarchiv liegt außerhalb der Kürliste"
)
_check(
RoutineSync.archive_path("kuer.mp3")
== "user://conflicts/kuer.mp3",
"Audio-Konflikte behalten ihren Dateinamen im Archiv"
)
_check(
SyncPlan.old_conflict_base("kuer (Server 2026-10-30 1050).json")
== "kuer.json",
"alte Server-Kopien werden erkannt"
)
_check(
SyncPlan.old_conflict_base("kuer (Lokal 2026-10-30 1050) 2.mp3")
== "kuer.mp3",
"alte Lokal-Kopien mit Nummer werden erkannt"
)
_check(
SyncPlan.old_conflict_base(
"kuer (Server 2026-10-30 1050) (Lokal 2026-10-31 1200).json"
) == "kuer.json",
"mehrfach gestapelte Konfliktkopien werden aufgelöst"
)
_check(
SyncPlan.old_conflict_base("kuer.json").is_empty(),
"normale Kürnamen gelten nicht als Konfliktkopie"
)
_check(
RoutineSync.is_routine_file("kuer.json")
and RoutineSync.is_routine_file("alt.tres")
@ -130,11 +200,6 @@ func _test_naming() -> void:
and not RoutineSync.is_synced_file("notizen.txt"),
"der Sync akzeptiert Musikdateien der Kür"
)
_check(
SyncPlan.conflict_file_name("kuer.mp3", "2026-10-30 1050")
== "kuer (Server 2026-10-30 1050).mp3",
"Konfliktnamen behalten die Audio-Endung"
)
var label := SyncPlan.timestamp_label(0)
_check(
label.length() == 15 and label.contains("-") and label.contains(" "),
@ -142,6 +207,323 @@ func _test_naming() -> void:
)
func _test_resolution_files() -> void:
DirAccess.make_dir_recursive_absolute(
ProjectSettings.globalize_path(RoutineSync.LOCAL_DIR)
)
var names: Array[String] = []
names.append(_check_resolution(
"sync-test-local-newer.json", 200, "lokal", 100, "cloud", false,
"lokal", true
))
names.append(_check_resolution(
"sync-test-cloud-newer.json", 100, "lokal", 200, "cloud", false,
"cloud", false
))
names.append(_check_resolution(
"sync-test-tie-first.json", 100, "lokal", 100, "cloud", true,
"cloud", false
))
names.append(_check_resolution(
"sync-test-tie-conflict.json", 100, "lokal", 100, "cloud", false,
"lokal", true
))
for name: String in names:
for path: String in [
RoutineSync.LOCAL_DIR.path_join(name),
RoutineSync.archive_path(name),
]:
if FileAccess.file_exists(path):
DirAccess.remove_absolute(ProjectSettings.globalize_path(path))
DirAccess.remove_absolute(
ProjectSettings.globalize_path(RoutineSync.CONFLICT_DIR)
)
## Runs one resolution case and returns the file name for cleanup.
func _check_resolution(
name: String,
local_saved_at: int,
local_title: String,
remote_saved_at: int,
remote_title: String,
prefer_server: bool,
expected_main: String,
expect_upload: bool
) -> String:
var local_path := RoutineSync.LOCAL_DIR.path_join(name)
_write_text(local_path, _routine_content(local_saved_at, local_title))
var store := FakeRemoteStore.new()
store.remote_files[name] = _routine_content(remote_saved_at, remote_title)
var job := RoutineSync.new()
job.result = {
"uploaded": [],
"downloaded": [],
"resolved": [],
}
var err := job._resolve_newest(store, name, 0, prefer_server)
_check(err.is_empty(), "%s wird ohne Fehler aufgelöst" % name)
_check(
_routine_title(local_path) == expected_main,
"%s behält die neuere Fassung (%s)" % [name, expected_main]
)
_check(
job.result["uploaded"].has(name) == expect_upload,
"%s lädt die lokale Fassung genau dann hoch, wenn sie gewinnt" % name
)
var archived := RoutineSync.archive_path(name)
_check(
FileAccess.file_exists(archived),
"%s legt die unterlegene Fassung ins Konfliktarchiv" % name
)
if FileAccess.file_exists(archived):
var expected_archive := (
remote_title if expect_upload else local_title
)
_check(
_routine_title(archived) == expected_archive,
"%s archiviert die unterlegene Fassung" % name
)
return name
func _routine_content(saved_at: int, title: String, music: String = "") -> String:
var routine := Routine.new()
routine.routine_id = "sync-test"
routine.title = title
routine.saved_at = saved_at
routine.music_file = music
return RoutineFile.encode(routine)
func _write_text(path: String, content: String) -> void:
var file := FileAccess.open(path, FileAccess.WRITE)
if file == null:
return
file.store_string(content)
file.close()
func _routine_title(path: String) -> String:
var result := RoutineFile.load_file(path)
var routine: Routine = result.get("routine", null)
return routine.title if routine != null else ""
func _test_delete_files() -> void:
DirAccess.make_dir_recursive_absolute(
ProjectSettings.globalize_path(RoutineSync.LOCAL_DIR)
)
var routine_name := "sync-test-delete.json"
var music_name := "sync-test-delete.mp3"
_write_text(
RoutineSync.LOCAL_DIR.path_join(routine_name),
_routine_content(300, "delete")
)
_write_text(RoutineSync.LOCAL_DIR.path_join(music_name), "ID3")
var state_path := "user://test_delete_state.cfg"
RoutineSync.save_state(state_path, {
routine_name: {"local_mtime": 1, "remote_modify": 2},
music_name: {"local_mtime": 1, "remote_modify": 2},
})
var errors := RoutineSync.delete_local_files(
PackedStringArray([routine_name, music_name]),
state_path
)
_check(errors.is_empty(), "lokales Löschen meldet keinen Fehler")
_check(
not FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(routine_name))
and not FileAccess.file_exists(
RoutineSync.LOCAL_DIR.path_join(music_name)
),
"Kür und Musik werden lokal entfernt"
)
_check(
RoutineSync.load_state(state_path).is_empty(),
"gelöschte Dateien verschwinden aus dem Sync-Stand"
)
DirAccess.remove_absolute(ProjectSettings.globalize_path(state_path))
var cloud_name := "sync-test-delete-cloud.json"
_write_text(
RoutineSync.LOCAL_DIR.path_join(cloud_name),
_routine_content(300, "cloud-delete")
)
var store := FakeRemoteStore.new()
store.remote_files[cloud_name] = _routine_content(300, "cloud-delete")
var job := RoutineSync.new()
job.result = {"deleted": [], "errors": []}
job.delete_names = PackedStringArray([cloud_name])
job._delete_routines(
store,
RoutineSync.local_files(),
{cloud_name: {"modify": 1, "size": 1}}
)
_check(
store.deleted.has(cloud_name),
"Löschen entfernt die Cloud-Kopie"
)
_check(
job.result["deleted"].has(cloud_name),
"Löschen meldet die entfernte Kür"
)
_check(
not FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(cloud_name)),
"Löschen entfernt die lokale Kür nach der Cloud-Kopie"
)
_check(job.result["errors"].is_empty(), "Cloud-Löschen meldet keinen Fehler")
if FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(cloud_name)):
DirAccess.remove_absolute(
ProjectSettings.globalize_path(
RoutineSync.LOCAL_DIR.path_join(cloud_name)
)
)
func _test_rename_files() -> void:
var old_json := "sync-test-rename-old.json"
var new_json := "sync-test-rename-new.json"
var old_tres := "sync-test-rename-old.tres"
var store := FakeRemoteStore.new()
store.remote_files[old_json] = _routine_content(1, "old")
store.remote_files[old_tres] = "legacy"
DirAccess.make_dir_recursive_absolute(
ProjectSettings.globalize_path(RoutineSync.LOCAL_DIR)
)
_write_text(
RoutineSync.LOCAL_DIR.path_join(new_json),
_routine_content(2, "neu")
)
var job := RoutineSync.new()
job.result = {"renamed": [], "errors": []}
job.rename_from = PackedStringArray([old_json, old_tres])
job.rename_to = PackedStringArray([
new_json,
"sync-test-rename-new.tres",
])
job._rename_routines(store, {
old_json: {"modify": 1, "size": 1},
old_tres: {"modify": 1, "size": 1},
})
_check(
store.remote_files.has(new_json),
"Cloud-Umbenennen legt den neuen Namen an"
)
_check(
not store.remote_files.has(old_json),
"Cloud-Umbenennen entfernt den alten Namen"
)
_check(
not store.remote_files.has(old_tres) and store.deleted.has(old_tres),
"Legacy-.tres wird in der Cloud entfernt"
)
_check(
job.result["renamed"].has(old_json),
"Umbenennen meldet die umbenannte Datei"
)
_check(
store.uploads.has(new_json),
"Umbenennen lädt den neuen Inhalt in die Cloud"
)
_check(job.result["errors"].is_empty(), "Cloud-Umbenennen meldet keinen Fehler")
if FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(new_json)):
DirAccess.remove_absolute(
ProjectSettings.globalize_path(
RoutineSync.LOCAL_DIR.path_join(new_json)
)
)
func _test_cleanup_files() -> void:
DirAccess.make_dir_recursive_absolute(
ProjectSettings.globalize_path(RoutineSync.LOCAL_DIR)
)
var base_name := "sync-test-cleanup.json"
var copy_name := "sync-test-cleanup (Server 2026-10-30 1050).json"
var orphan_name := "sync-test-orphan (Lokal 2026-10-30 1050).json"
var unconfirmed := "sync-test-cleanup (Lokal 2026-10-31 1200).json"
var remote_only := "sync-test-remote (Server 2026-10-30 1050).json"
_write_text(RoutineSync.LOCAL_DIR.path_join(base_name), _routine_content(300, "base"))
_write_text(RoutineSync.LOCAL_DIR.path_join(copy_name), _routine_content(100, "old"))
_write_text(RoutineSync.LOCAL_DIR.path_join(orphan_name), _routine_content(100, "orphan"))
_write_text(RoutineSync.LOCAL_DIR.path_join(unconfirmed), _routine_content(100, "keep"))
var store := FakeRemoteStore.new()
store.remote_files[copy_name] = _routine_content(100, "old-cloud")
store.remote_files[remote_only] = _routine_content(100, "remote-only")
store.remote_files["sync-test-remote.json"] = _routine_content(300, "remote-base")
var local := RoutineSync.local_files()
var remote := {
copy_name: {"modify": 1, "size": 1},
remote_only: {"modify": 1, "size": 1},
"sync-test-remote.json": {"modify": 2, "size": 1},
}
var job := RoutineSync.new()
job.result = {
"cleanup_candidates": [],
"cleanup_skipped": [],
"cleanup_done": [],
"errors": [],
}
job.cleanup_names = PackedStringArray([copy_name, remote_only])
job._clean_old_conflicts(store, local, remote)
_check(
not FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(copy_name)),
"bestätigte lokale Konfliktkopie wird entfernt"
)
_check(
FileAccess.file_exists(RoutineSync.archive_path(copy_name)),
"entfernte Kopie liegt im Konfliktarchiv"
)
_check(store.deleted.has(copy_name), "Cloud-Konfliktkopie wird gelöscht")
_check(
FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(base_name)),
"Hauptdatei bleibt beim Aufräumen erhalten"
)
_check(
store.deleted.has(remote_only),
"nur in der Cloud liegende Kopie wird gelöscht"
)
_check(
FileAccess.file_exists(RoutineSync.archive_path(remote_only))
and _routine_title(RoutineSync.archive_path(remote_only)) == "remote-only",
"nur in der Cloud liegende Kopie wird vorher lokal archiviert"
)
_check(
FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(unconfirmed)),
"nicht bestätigte Kopie bleibt erhalten"
)
_check(
job.result["cleanup_done"].size() == 2,
"Aufräumen meldet beide erledigten Kopien"
)
_check(
job.result["cleanup_skipped"].has(orphan_name),
"Kopie ohne Hauptdatei wird übersprungen"
)
_check(
FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(orphan_name)),
"verwaiste Kopie bleibt als einzige Fassung erhalten"
)
for name: String in [base_name, orphan_name, unconfirmed, copy_name]:
var path := RoutineSync.LOCAL_DIR.path_join(name)
if FileAccess.file_exists(path):
DirAccess.remove_absolute(ProjectSettings.globalize_path(path))
if FileAccess.file_exists(RoutineSync.archive_path(copy_name)):
DirAccess.remove_absolute(
ProjectSettings.globalize_path(RoutineSync.archive_path(copy_name))
)
if FileAccess.file_exists(RoutineSync.archive_path(remote_only)):
DirAccess.remove_absolute(
ProjectSettings.globalize_path(RoutineSync.archive_path(remote_only))
)
DirAccess.remove_absolute(
ProjectSettings.globalize_path(RoutineSync.CONFLICT_DIR)
)
func _test_cloud_helpers() -> void:
var url := CloudHttp.parse_url(
"https://api.dropboxapi.com/2/files/list_folder?limit=10"
@ -373,6 +755,176 @@ func _test_controller_wiring() -> void:
controller.sync_connect_button.text == "Trennen",
"Verbundenes Konto bietet Trennen an"
)
var manager_item := -1
var popup := controller.file_menu_button.get_popup()
for index: int in range(popup.item_count):
if popup.get_item_text(index) == "Küren verwalten…":
manager_item = index
_check(manager_item >= 0, "das Dateimenü bietet die Kürenverwaltung an")
_check(
controller.routine_manager_dialog != null
and controller.delete_routine_dialog != null,
"Verwaltungs- und Löschdialog sind in der Szene verdrahtet"
)
_check(
controller.cleanup_conflicts_dialog != null,
"der Aufräumdialog ist in der Szene verdrahtet"
)
var summary := controller._format_sync_summary({
"uploaded": [],
"downloaded": [],
"skipped": [],
"errors": [],
"resolved": [
{
"name": "kuer.json",
"winner": "cloud",
"timestamp": 0,
"archive": "kuer.json",
},
],
})
_check(
summary.contains("Automatisch aufgelöste Konflikte: 1")
and summary.contains("Cloud-Fassung")
and summary.contains("Konfliktarchiv"),
"die Sync-Zusammenfassung nennt Gewinner und Konfliktarchiv"
)
# "Küren verwalten": rows expose open/delete, the music stay-check works.
controller.sync_settings_dialog.hide()
DirAccess.make_dir_recursive_absolute(
ProjectSettings.globalize_path(RoutineSync.LOCAL_DIR)
)
var manager_file := "sync-test-manager.json"
var manager_file_two := "sync-test-manager-two.json"
var shared_music := "sync-test-shared.mp3"
_write_text(
RoutineSync.LOCAL_DIR.path_join(manager_file),
_routine_content(1, "manager", shared_music)
)
_write_text(
RoutineSync.LOCAL_DIR.path_join(manager_file_two),
_routine_content(1, "manager two", shared_music)
)
_write_text(
RoutineSync.LOCAL_DIR.path_join("sync-test-manager.tres"),
"legacy twin"
)
_check(
controller._routine_variants(manager_file).size() == 2,
"Löschen erfasst JSON und Legacy-.tres derselben Kür"
)
DirAccess.remove_absolute(
ProjectSettings.globalize_path(
RoutineSync.LOCAL_DIR.path_join("sync-test-manager.tres")
)
)
controller._refresh_routine_manager()
controller.routine_manager_dialog.show()
_check(
controller.routine_manager_dialog.visible,
"der Verwaltungsdialog lässt sich öffnen"
)
var manager_row: HBoxContainer = null
for child: Node in controller.routine_manager_list.get_children():
if child is HBoxContainer:
var open_button := child.get_child(0) as Button
if open_button != null and open_button.text == "sync-test-manager":
manager_row = child
break
_check(
manager_row != null and manager_row.get_child_count() == 3,
"die Kürenverwaltung zeigt Öffnen, Umbenennen und Löschen je Kür"
)
controller._open_rename_routine_dialog(manager_file)
_check(
controller.rename_routine_dialog.visible
and controller.rename_routine_edit.text == "sync-test-manager",
"der Umbenennen-Dialog ist mit dem aktuellen Namen gefüllt"
)
controller.rename_routine_dialog.hide()
controller._pending_rename_name = ""
controller._open_delete_routine_dialog(manager_file)
_check(
controller.delete_routine_dialog.visible
and controller.delete_routine_text.text.contains("sync-test-manager"),
"der Löschdialog nennt die gewählte Kür"
)
controller.delete_routine_dialog.hide()
controller._pending_delete_name = ""
_check(
controller._orphan_music_for(manager_file).is_empty(),
"gemeinsam genutzte Musik wird nicht als verwaist markiert"
)
_write_text(
RoutineSync.LOCAL_DIR.path_join(manager_file_two),
_routine_content(1, "manager two")
)
_check(
controller._orphan_music_for(manager_file)
== PackedStringArray([shared_music]),
"ungenutzte Musik wird beim Löschen erkannt"
)
controller.delete_routine_cloud_check.disabled = true
controller.delete_routine_cloud_check.button_pressed = false
controller._pending_delete_name = manager_file_two
controller._on_delete_routine_confirmed()
_check(
not FileAccess.file_exists(
RoutineSync.LOCAL_DIR.path_join(manager_file_two)
),
"die Kürenverwaltung löscht eine Kür lokal"
)
controller.message_dialog.hide()
var rename_file := "sync-test-rename-ui.json"
var rename_tres := "sync-test-rename-ui.tres"
var renamed_file := "sync-test-rename-ui-neu.json"
_write_text(
RoutineSync.LOCAL_DIR.path_join(rename_file),
_routine_content(1, "Alte Kür")
)
_write_text(RoutineSync.LOCAL_DIR.path_join(rename_tres), "legacy")
var rename_error := controller._rename_local_routine(
rename_file,
"sync-test-rename-ui-neu",
"Neue Kür",
false
)
_check(rename_error.is_empty(), "lokales Umbenennen meldet keinen Fehler")
_check(
FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(renamed_file)),
"Umbenennen legt die Kür unter dem neuen Namen ab"
)
_check(
not FileAccess.file_exists(
RoutineSync.LOCAL_DIR.path_join(rename_file)
)
and not FileAccess.file_exists(
RoutineSync.LOCAL_DIR.path_join(rename_tres)
),
"Umbenennen entfernt alten JSON- und Legacy-Namen"
)
_check(
_routine_title(RoutineSync.LOCAL_DIR.path_join(renamed_file))
== "Neue Kür",
"Umbenennen schreibt den neuen Titel in die Kür"
)
if FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(renamed_file)):
DirAccess.remove_absolute(
ProjectSettings.globalize_path(
RoutineSync.LOCAL_DIR.path_join(renamed_file)
)
)
for name: String in [manager_file, manager_file_two]:
if FileAccess.file_exists(RoutineSync.LOCAL_DIR.path_join(name)):
DirAccess.remove_absolute(
ProjectSettings.globalize_path(
RoutineSync.LOCAL_DIR.path_join(name)
)
)
controller._refresh_routine_manager()
controller.routine_manager_dialog.hide()
controller.sync_settings_dialog.hide()
# Ohne Refresh-Token öffnet "Jetzt synchronisieren" die Einstellungen.

View file

@ -28,6 +28,11 @@ func _run() -> void:
if controller == null:
_finish()
return
_check(controller.theme != null, "the sport theme is applied")
_check(
controller.title_label.text == "RINKPLANNER",
"the app title uses the sport branding"
)
var canvas := controller.rink_canvas
var view := canvas.get_view_transform()
@ -297,6 +302,12 @@ func _run() -> void:
playback_bar.get_combined_minimum_size().x <= 1024.0,
"playback bar fits a 1024 px landscape tablet"
)
_check(
top_bar.custom_minimum_size.y <= 60.0
and timing_bar.custom_minimum_size.y <= 60.0
and playback_bar.custom_minimum_size.y <= 92.0,
"the main bars stay vertically compact for more rink space"
)
scene.queue_free()
await process_frame

View file

@ -241,7 +241,6 @@ func _run() -> void:
controller.get_node("%FreeLineToolButton"),
controller.get_node("%JumpToolButton"),
controller.get_node("%SpinToolButton"),
controller.get_node("%SequenceToolButton"),
]
var arc_right_button: Button = controller.get_node("%ArcRightToolButton")
arc_right_button.pressed.emit()
@ -282,22 +281,23 @@ func _run() -> void:
"%s is the only highlighted element icon" % entry[0]
)
# The sequence icon starts drawing mode instead of placing a point marker.
controller.set_tool(WhiteboardController.Tool.ARC_LEFT)
var sequence_button: Button = controller.get_node("%SequenceToolButton")
sequence_button.pressed.emit()
# The group action replaces the former sequence drawing tool and sits in
# the same top tool bar, without joining the tool button group.
var group_button: Button = controller.get_node("%GroupSequenceButton")
var select_tool_button: Button = controller.get_node("%SelectToolButton")
_check(
controller.is_sequence_mode()
and controller.get_element_type() == PathSegment.ElementType.SEQUENCE,
"the sequence icon starts sequence drawing mode"
group_button.get_parent() == controller.get_node("%ToolButtons"),
"the group action lives in the top tool bar"
)
_check(
sequence_button.button_pressed
and (controller.get_node("%ArcLeftToolButton") as Button).button_pressed,
"sequence mode keeps the current path tool active"
group_button.icon != null and group_button.text.is_empty(),
"the group action is an icon button"
)
sequence_button.pressed.emit()
_check(not controller.is_sequence_mode(), "the sequence icon finishes sequence mode")
_check(
group_button.button_group != select_tool_button.button_group,
"the group action does not join the tool button group"
)
controller.set_element_type(PathSegment.ElementType.JUMP)
controller.set_tool(WhiteboardController.Tool.ARC_LEFT)
_mouse_button(canvas, view.model_to_screen(Vector2(-15.0, 5.0)), true)
@ -1952,37 +1952,50 @@ func _run() -> void:
"a tap behind the last segment appends the marker"
)
# Sequence drawing mode: consecutive drags become one sequence range.
# Grouping consecutive segments creates one sequence range.
controller.new_routine()
controller.set_tool(WhiteboardController.Tool.LINE)
var sequence_view := canvas.get_view_transform()
var range_sequence_button: Button = controller.get_node("%SequenceToolButton")
range_sequence_button.pressed.emit()
_check(controller.is_sequence_mode(), "sequence drawing mode can be started")
var sequence_section := controller.get_active_section()
for x_start: float in [-15.0, -5.0, 5.0]:
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(x_start, 0.0)), true)
_mouse_motion(canvas, sequence_view.model_to_screen(Vector2(x_start + 10.0, 0.0)))
_mouse_button(
canvas,
sequence_view.model_to_screen(Vector2(x_start + 10.0, 0.0)),
false
)
_check(
sequence_section.segments.size() == 3,
"the sequence fixture has three segments"
)
controller.set_tool(WhiteboardController.Tool.LINE)
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(-15.0, 0.0)), true)
_mouse_motion(canvas, sequence_view.model_to_screen(Vector2(-5.0, 0.0)))
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(-5.0, 0.0)), false)
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(-5.0, 0.0)), true)
_mouse_motion(canvas, sequence_view.model_to_screen(Vector2(5.0, 0.0)))
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(5.0, 0.0)), false)
controller.set_tool(WhiteboardController.Tool.SELECT)
controller.set_multi_select_enabled(true)
controller.clear_selection()
for x_mid: float in [-10.0, 0.0, 10.0]:
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(x_mid, 0.0)), true)
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(x_mid, 0.0)), false)
_check(
controller.get_selected_segment_ids().size() == 3,
"the sequence fixture selects all three segments"
)
controller.group_sequence_button.pressed.emit()
var sequence_elements := sequence_section.get_elements()
_check(
sequence_elements.size() == 1,
"two drawn segments resolve to one sequence element"
"three grouped segments resolve to one sequence element"
)
if sequence_elements.size() == 1:
var sequence_element: ResolvedElement = sequence_elements[0]
_check(
sequence_element.segments.size() == 2,
"the sequence group contains both drawn segments"
sequence_element.segments.size() == 3,
"the sequence group contains all grouped segments"
)
_check(
sequence_element.get_lead() == sequence_section.segments[0],
"the first drawn segment is the sequence lead"
"the first grouped segment is the sequence lead"
)
_check(
sequence_element.get_code() == "StSq",
@ -1990,47 +2003,26 @@ func _run() -> void:
)
_check(
sequence_element.is_sequence_range(),
"the drawn group is a sequence range, not a point marker"
"the grouped range is a sequence range, not a point marker"
)
_check(
controller.timeline_label_lane.get_element_label_count() == 1,
"the sequence group shows one timeline label"
)
# Finish the group, then continue it from a member at the section tail.
range_sequence_button.pressed.emit()
_check(not controller.is_sequence_mode(), "the sequence button finishes the group")
var tail_member := sequence_section.segments[1]
controller.select_segment(tail_member.segment_id)
range_sequence_button.pressed.emit()
_check(
controller.is_sequence_mode(),
"sequence mode continues a group that ends at the section tail"
)
# Later segments do not join the group unless they are grouped again.
controller.set_tool(WhiteboardController.Tool.LINE)
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(-15.0, 5.0)), true)
_mouse_motion(canvas, sequence_view.model_to_screen(Vector2(-5.0, 5.0)))
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(-5.0, 5.0)), false)
_check(
sequence_section.get_elements().size() == 1
and sequence_section.get_elements()[0].segments.size() == 3,
"a drawn segment continues the selected sequence group"
)
range_sequence_button.pressed.emit()
# Leaving sequence mode must not pull later path segments into the group.
controller.set_tool(WhiteboardController.Tool.LINE)
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(-15.0, 10.0)), true)
_mouse_motion(canvas, sequence_view.model_to_screen(Vector2(-5.0, 10.0)))
_mouse_button(canvas, sequence_view.model_to_screen(Vector2(-5.0, 10.0)), false)
_check(
sequence_section.segments.size() == 4,
"a segment drawn after the group is added to the section"
"a segment drawn after grouping is added to the section"
)
_check(
sequence_section.get_elements().size() == 1
and sequence_section.get_elements()[0].segments.size() == 3,
"a segment after sequence mode stays outside the group"
"a segment drawn after grouping stays outside the group"
)
# Selecting a member shows and edits the lead element.
@ -2121,9 +2113,8 @@ func _run() -> void:
)
_check(group_section.is_valid(), "the section stays valid with marker and group")
# A legacy single-segment sequence becomes a group when it is continued.
# A single segment can be tagged as a sequence range without a group id.
controller.new_routine()
var legacy_section := controller.get_active_section()
var legacy_range := controller.add_segment(
Vector2(-10.0, 0.0),
Vector2(0.0, 0.0),
@ -2143,73 +2134,6 @@ func _run() -> void:
legacy_range.element_group_id.is_empty(),
"a single tagged segment needs no group id yet"
)
var legacy_button: Button = controller.get_node("%SequenceToolButton")
legacy_button.pressed.emit()
controller.set_tool(WhiteboardController.Tool.LINE)
var legacy_view := canvas.get_view_transform()
_mouse_button(canvas, legacy_view.model_to_screen(Vector2(0.0, 0.0)), true)
_mouse_motion(canvas, legacy_view.model_to_screen(Vector2(10.0, 0.0)))
_mouse_button(canvas, legacy_view.model_to_screen(Vector2(10.0, 0.0)), false)
var legacy_elements := legacy_section.get_elements()
_check(
legacy_elements.size() == 1 and legacy_elements[0].segments.size() == 2,
"drawing after a legacy range turns it into a group"
)
if legacy_elements.size() == 1:
_check(
not legacy_elements[0].get_group_id().is_empty(),
"the continued legacy range gets a group id"
)
_check(
legacy_elements[0].segments[0].element_group_id
== legacy_elements[0].segments[1].element_group_id,
"both continued segments share the group id"
)
legacy_button.pressed.emit()
# Undo removes one drawn part at a time and keeps the group consistent.
controller.new_routine()
controller.set_tool(WhiteboardController.Tool.LINE)
var undo_sequence_button: Button = controller.get_node("%SequenceToolButton")
undo_sequence_button.pressed.emit()
controller.set_tool(WhiteboardController.Tool.LINE)
var undo_view := canvas.get_view_transform()
_mouse_button(canvas, undo_view.model_to_screen(Vector2(-10.0, 0.0)), true)
_mouse_motion(canvas, undo_view.model_to_screen(Vector2(0.0, 0.0)))
_mouse_button(canvas, undo_view.model_to_screen(Vector2(0.0, 0.0)), false)
_mouse_button(canvas, undo_view.model_to_screen(Vector2(0.0, 0.0)), true)
_mouse_motion(canvas, undo_view.model_to_screen(Vector2(10.0, 0.0)))
_mouse_button(canvas, undo_view.model_to_screen(Vector2(10.0, 0.0)), false)
var undo_section := controller.get_active_section()
_check(
undo_section.get_elements().size() == 1
and undo_section.get_elements()[0].segments.size() == 2,
"the undo fixture has one two-part sequence"
)
_check(controller.undo(), "the last sequence part can be undone")
var undone_section := controller.get_active_section()
_check(
undone_section.get_elements().size() == 1
and undone_section.get_elements()[0].segments.size() == 1,
"undo leaves a valid one-part sequence"
)
_check(controller.undo(), "the first sequence part can be undone")
undone_section = controller.get_active_section()
_check(
undone_section.get_elements().is_empty(),
"undo removes the empty sequence group"
)
# Sequence drawing mode also accepts freehand strokes.
controller.set_tool(WhiteboardController.Tool.SELECT)
var freehand_sequence_button: Button = controller.get_node("%SequenceToolButton")
freehand_sequence_button.pressed.emit()
controller.set_tool(WhiteboardController.Tool.FREELINE)
_check(
controller.is_sequence_mode(),
"sequence mode stays active when switching to freeline"
)
freehand_sequence_button.pressed.emit()
# Multi-selection groups existing segments into a sequence.
controller.new_routine()
@ -2266,8 +2190,8 @@ func _run() -> void:
"the group button is enabled for a valid selection"
)
_check(
controller.group_sequence_button.text.contains("3"),
"the group button shows the selection count"
controller.group_sequence_button.tooltip_text.contains("3"),
"the group button tooltip shows the selection count"
)
controller.group_sequence_button.pressed.emit()
var grouped_elements := controller.get_active_section().get_elements()

View file

@ -45,4 +45,13 @@ if [[ ! -f "$PROJECT_DIR/project.godot" ]]; then
exit 1
fi
# Neue class_name-Skripte landen erst durch den Import im globalen
# Klassen-Cache. Ist der Cache älter als die Quellen, meldet der Editor beim
# Start "Identifier ... not declared". Deshalb vor dem Start headless
# importieren – aber nur, wenn sich wirklich etwas geändert hat.
CLASS_CACHE="$PROJECT_DIR/.godot/global_script_class_cache.cfg"
if [[ -f "$CLASS_CACHE" ]] && [[ -n "$(find "$PROJECT_DIR/src" -name '*.gd' -newer "$CLASS_CACHE" -print -quit)" ]]; then
"$GODOT_BIN" --headless --path "$PROJECT_DIR" --import >/dev/null 2>&1 || true
fi
exec "$GODOT_BIN" --path "$PROJECT_DIR" "$@"