From 448d94fee35d574832d73ed2195ce1fa35ae4d45 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Fri, 11 Oct 2024 02:03:27 +0200 Subject: [PATCH] Fixed many issues with new History module, including saved status. + Fixed (old) bug that label content wasn't being saved. --- assets/i18n/lp_de.ts | 112 ++++++++-------- assets/i18n/lp_en.ts | 112 ++++++++-------- assets/i18n/lp_es.ts | 116 ++++++++-------- assets/i18n/lp_fr.ts | 112 ++++++++-------- assets/i18n/lp_hu.ts | 112 ++++++++-------- assets/i18n/lp_nb_NO.ts | 114 ++++++++-------- assets/i18n/lp_template.ts | 125 +++++++----------- common/src/module/history.mjs | 17 ++- common/src/module/interface.mjs | 1 - common/src/module/io.mjs | 49 +++++-- common/src/objs/bodephase.mjs | 2 +- .../eu/ad5001/LogarithmPlotter/AppMenuBar.qml | 2 +- .../History/HistoryBrowser.qml | 2 +- .../LogarithmPlotter/LogarithmPlotter.qml | 22 ++- .../ObjectLists/Editor/CustomPropertyList.qml | 16 ++- .../ObjectLists/Editor/Dialog.qml | 8 +- .../ObjectLists/ObjectCreationGrid.qml | 4 +- .../ObjectLists/ObjectRow.qml | 6 +- .../LogarithmPlotter/PickLocationOverlay.qml | 6 +- 19 files changed, 479 insertions(+), 459 deletions(-) diff --git a/assets/i18n/lp_de.ts b/assets/i18n/lp_de.ts index 4876e02..59a9725 100644 --- a/assets/i18n/lp_de.ts +++ b/assets/i18n/lp_de.ts @@ -67,22 +67,22 @@ &Lösen - + &Redo &Wiederherstellen - + &Copy plot Grafik &Kopieren - + &Preferences &Einstellung - + &Create &Erstellen @@ -123,52 +123,52 @@ Syntaktische Färbung - + &Help &Hilfe - + &Source code &Quellcode - + &Report a bug Fehler &Melden - + &User manual &Benutzerhandbuch - + &Changelog &Changelog - + &Help translating! &Hilfe beim Übersetzen! - + &Thanks &Danksagungen - + &About &Übrigens - + Save unsaved changes? Änderungen speichern? - + This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? Diese Grafik enthält ungespeicherte Änderungen. Dadurch gehen alle ungespeicherten Daten verloren. Fortfahren? @@ -205,12 +205,12 @@ CustomPropertyList - + + Create new %1 + Neues %1objekt erstellen - + Pick on graph Aufnehmen auf Graph @@ -238,9 +238,8 @@ Name - Label content - Etikett + Etikett @@ -405,24 +404,20 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" HistoryBrowser - Filter... - Filtern… + Filtern… - Redo > - Wiederherstellen > + Wiederherstellen > - > Now - > Aktueller Stand + > Aktueller Stand - < Undo - < Rückgängig + < Rückgängig @@ -475,17 +470,17 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" Geladene Datei '%1'. - + Copied plot screenshot to clipboard! Grafik in die Zwischenablage kopiert! - + &Update &Aktualisieren - + &Update LogarithmPlotter LogarithmPlotter &aktualisieren @@ -613,109 +608,109 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" Settings - + X Zoom Zoom auf X - + Y Zoom Zoom auf Y - + Min X Minimum X - + Max Y Maximum Y - + Max X Maximum X - + Min Y Minimum Y - + X Axis Step X-Achsen-Schritt - + Y Axis Step Y-Achsen-Schritt - + Line width Linienbreite - + Text size (px) Textgröße (px) - + X Label Etikett der X-Achse - + Y Label Etikett der Y-Achse - + X Log scale Logarithmische Skala in X - + Show X graduation X-Teilung anzeigen - + Show Y graduation Y-Teilung anzeigen - + Copy to clipboard Kopieren in die Zwischenablage - + Save plot Grafik speichern… - + Save plot as Grafik speichern unter… - + Load plot Grafik laden… @@ -1160,7 +1155,7 @@ Evaluated expression: %3 Ausdruck analysiert: %3 - + Error while attempting to draw %1 %2: %3 @@ -1191,7 +1186,7 @@ Evaluated expression: %3 Ausdruck analysiert: %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Fehler @@ -1308,27 +1303,27 @@ Ausdruck analysiert: %3 Verlauf - + Saved plot to '%1'. Gespeicherte Grafik auf '%1'. - + Loading file '%1'. Laden der Datei '%1'. - + Unknown object type: %1. Unbekannter Objekttyp: %1. - + Invalid file provided. Ungültige Datei angegeben. - + Could not load file: Datei konnte nicht geladen werden: @@ -1337,7 +1332,7 @@ Ausdruck analysiert: %3 Die Datei konnte nicht gespeichert werden: - + Loaded file '%1'. Geladene Datei '%1'. @@ -1731,6 +1726,11 @@ Bitte vergewissern Sie sich, dass Ihre LaTeX-Installation korrekt ist, und melde color Farbe + + + labelContent + Etikett + repartition diff --git a/assets/i18n/lp_en.ts b/assets/i18n/lp_en.ts index b2dfaff..5f653a7 100644 --- a/assets/i18n/lp_en.ts +++ b/assets/i18n/lp_en.ts @@ -67,22 +67,22 @@ &Undo - + &Redo &Redo - + &Copy plot &Copy plot - + &Preferences &Preferences - + &Create &Create @@ -123,52 +123,52 @@ Color Scheme - + &Help &Help - + &Source code &Source code - + &Report a bug &Report a bug - + &User manual &User manual - + &Changelog &Changelog - + &Help translating! &Help translating! - + &Thanks &Thanks - + &About &About - + Save unsaved changes? Save unsaved changes? - + This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? @@ -205,12 +205,12 @@ CustomPropertyList - + + Create new %1 + Create new %1 - + Pick on graph Pick on graph @@ -238,9 +238,8 @@ Name - Label content - Label content + Label content @@ -405,24 +404,20 @@ These settings can be changed at any time from the "Settings" menu. HistoryBrowser - Filter... - Filter… + Filter… - Redo > - Redo > + Redo > - > Now - > Now + > Now - < Undo - < Undo + < Undo @@ -475,17 +470,17 @@ These settings can be changed at any time from the "Settings" menu.Loaded file '%1'. - + Copied plot screenshot to clipboard! Copied plot screenshot to clipboard! - + &Update &Update - + &Update LogarithmPlotter &Update LogarithmPlotter @@ -613,109 +608,109 @@ These settings can be changed at any time from the "Settings" menu.Settings - + X Zoom X Zoom - + Y Zoom Y Zoom - + Min X Min X - + Max Y Max Y - + Max X Max X - + Min Y Min Y - + X Axis Step X Axis Step - + Y Axis Step Y Axis Step - + Line width Line width - + Text size (px) Text size (px) - + X Label X Label - + Y Label Y Label - + X Log scale X Log scale - + Show X graduation Show X graduation - + Show Y graduation Show Y graduation - + Copy to clipboard Copy to clipboard - + Save plot Save plot… - + Save plot as Save plot as… - + Load plot Open plot… @@ -1160,7 +1155,7 @@ Evaluated expression: %3 Evaluated expression: %3 - + Error while attempting to draw %1 %2: %3 @@ -1191,7 +1186,7 @@ Evaluated expression: %3 Evaluated expression: %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Drawing error @@ -1308,27 +1303,27 @@ Evaluated expression: %3 History - + Saved plot to '%1'. Saved plot to '%1'. - + Loading file '%1'. Loading file '%1'. - + Unknown object type: %1. Unknown object type: %1. - + Invalid file provided. Invalid file provided. - + Could not load file: Could not load file: @@ -1337,7 +1332,7 @@ Evaluated expression: %3 Could not save file: - + Loaded file '%1'. Loaded file '%1'. @@ -1731,6 +1726,11 @@ Please make sure your LaTeX installation is correct and report a bug if so.color Color + + + labelContent + Label content + repartition diff --git a/assets/i18n/lp_es.ts b/assets/i18n/lp_es.ts index ef79648..7a736b5 100644 --- a/assets/i18n/lp_es.ts +++ b/assets/i18n/lp_es.ts @@ -67,22 +67,22 @@ &Cancelar - + &Redo &Reiniciar - + &Copy plot &Copiar el gráfico - + &Preferences &Preferencias - + &Create &Crear @@ -119,52 +119,52 @@ Esquema de colores - + &Help &Ayuda - + &Source code &Código fuente - + &Report a bug &Informar de un error - + &User manual &Manual del usuario - + &Changelog &Registro de cambios - + &Help translating! &¡Ayuda a la traducción! - + &Thanks &Agradecimientos - + &About &Acerca de - + Save unsaved changes? ¿Guardar los cambios no guardados? - + This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? Este gráfico contiene cambios sin guardar. Al hacer esto, se perderán todos los datos no guardados. ¿Continuar? @@ -205,12 +205,12 @@ CustomPropertyList - + + Create new %1 + Crear nuevo %1 - + Pick on graph Elegir en el gráfico @@ -237,11 +237,6 @@ Name - - - Label content - - null @@ -405,24 +400,16 @@ Estos ajustes se pueden cambiar en cualquier momento desde el menú “Ajustes HistoryBrowser - - Filter... - - - - Redo > - Rehacer > + Rehacer > - > Now - > Ahora + > Ahora - < Undo - < Deshacer + < Deshacer @@ -451,17 +438,17 @@ Estos ajustes se pueden cambiar en cualquier momento desde el menú “Ajustes Historial - + Copied plot screenshot to clipboard! ¡Captura de pantalla del gráfico copiada al portapapeles! - + &Update &Actualizar - + &Update LogarithmPlotter &Actualizar LogarithmPlotter @@ -613,109 +600,109 @@ Estos ajustes se pueden cambiar en cualquier momento desde el menú “Ajustes Settings - + X Zoom - + Y Zoom - + Min X - + Max Y - + Max X - + Min Y - + X Axis Step Paso por eje X - + Y Axis Step Paso por eje Y - + Line width Anchura de la línea - + Text size (px) Tamaño del texto (px) - + X Label - + Y Label - + X Log scale Escala logarítmica en X - + Show X graduation Mostrar graduación del eje X - + Show Y graduation Mostrar graduación del eje Y - + Copy to clipboard Copiar al portapapeles - + Save plot Guardar gráfico… - + Save plot as Guardar gráfico como… - + Load plot Abrir gráfico… @@ -1147,7 +1134,7 @@ Evaluated expression: %3 Expresión evaluada: %3 - + Error while attempting to draw %1 %2: %3 @@ -1191,7 +1178,7 @@ Evaluated expression: %3 Expresión evaluada: %3 - + LogarithmPlotter - Drawing error @@ -1320,27 +1307,27 @@ Expresión evaluada: %3 Objetos - + Saved plot to '%1'. Gráfico guardado en '%1'. - + Loading file '%1'. Cargando el archivo '%1'. - + Unknown object type: %1. Tipo de objeto desconocido: %1 . - + Invalid file provided. Se ha proporcionado un archivo no válido. - + Could not load file: No se pudo cargar el archivo: @@ -1349,7 +1336,7 @@ Expresión evaluada: %3 No se ha podido guardar el archivo: - + Loaded file '%1'. Archivo cargado '%1'. @@ -1731,6 +1718,11 @@ Por favor, asegúrese de que su instalación de LaTeX es correcta e informe de u baseValues Valores de inicialización + + + labelContent + Contenido de la etiqueta + repartition diff --git a/assets/i18n/lp_fr.ts b/assets/i18n/lp_fr.ts index 2b1a26d..b693568 100644 --- a/assets/i18n/lp_fr.ts +++ b/assets/i18n/lp_fr.ts @@ -67,22 +67,22 @@ &Annuler - + &Redo &Rétablir - + &Copy plot &Copier le graphe - + &Preferences &Préférences - + &Create &Créer @@ -124,52 +124,52 @@ Coloration Syntaxique - + &Help &Aide - + &Source code &Code source - + &Report a bug &Rapport de bug - + &User manual Manuel d'&utilisation - + &Changelog &Historique des modifications - + &Help translating! &Aider à la traduction ! - + &Thanks &Remerciements - + &About &À propos - + Save unsaved changes? Sauvegarder les modifications ? - + This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? Ce graphe contient des modifications non sauvegardées. En faisant cela, toutes les données non sauvegardées seront perdues. Continuer ? @@ -206,12 +206,12 @@ CustomPropertyList - + + Create new %1 + Créer un nouvel objet %1 - + Pick on graph Prendre la position sur le graphe @@ -239,9 +239,8 @@ Nom - Label content - Étiquette + Étiquette @@ -407,24 +406,20 @@ Ces paramètres peuvent être modifiés à tout moment à partir du menu "P HistoryBrowser - Filter... - Filtrer… + Filtrer… - Redo > - Rétablir > + Rétablir > - > Now - > État actuel + > État actuel - < Undo - < Annuler + < Annuler @@ -477,17 +472,17 @@ Ces paramètres peuvent être modifiés à tout moment à partir du menu "P Fichier '%1' chargé. - + Copied plot screenshot to clipboard! Image du graphe copiée dans le presse-papiers ! - + &Update &Mise à jour - + &Update LogarithmPlotter &Mettre à jour LogarithmPlotter @@ -615,109 +610,109 @@ Ces paramètres peuvent être modifiés à tout moment à partir du menu "P Settings - + X Zoom Zoom en X - + Y Zoom Zoom en Y - + Min X Min X - + Max Y Max Y - + Max X Max X - + Min Y Min Y - + X Axis Step Pas de l'axe X - + Y Axis Step Pas de l'axe Y - + Line width Taille des lignes - + Text size (px) Taille du texte (px) - + X Label Label de l'axe X - + Y Label Label de l'axe Y - + X Log scale Échelle logarithmique en X - + Show X graduation Montrer la graduation de l'axe X - + Show Y graduation Montrer la graduation de l'axe Y - + Copy to clipboard Copier vers le presse-papiers - + Save plot Sauvegarder le graphe… - + Save plot as Sauvegarder le graphe sous… - + Load plot Ouvrir un graphe… @@ -1163,7 +1158,7 @@ Evaluated expression: %3 Formule analysée : %3 - + Error while attempting to draw %1 %2: %3 @@ -1194,7 +1189,7 @@ Evaluated expression: %3 Formule analysée : %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Erreur @@ -1323,27 +1318,27 @@ Formule analysée : %3 &Mettre à jour LogarithmPlotter - + Saved plot to '%1'. Graphe sauvegardé dans '%1'. - + Loading file '%1'. Chargement du fichier '%1'. - + Unknown object type: %1. Type d'objet inconnu : %1. - + Invalid file provided. Fichier fourni invalide. - + Could not load file: Impossible de charger le fichier : @@ -1352,7 +1347,7 @@ Formule analysée : %3 Impossible de sauvegarder le fichier : - + Loaded file '%1'. Fichier '%1' chargé. @@ -1734,6 +1729,11 @@ Vérifiez que votre installation de LaTeX est correcte et signalez un bogue si c color Couleur + + + labelContent + Étiquette + repartition diff --git a/assets/i18n/lp_hu.ts b/assets/i18n/lp_hu.ts index 975c600..a43da4d 100644 --- a/assets/i18n/lp_hu.ts +++ b/assets/i18n/lp_hu.ts @@ -67,22 +67,22 @@ &Visszavonás - + &Redo &Ismétlés - + &Copy plot Ábra má&solása - + &Preferences &Beállítások - + &Create &Létrehozás @@ -123,52 +123,52 @@ Színséma - + &Help &Súgó - + &Source code &Forráskód - + &Report a bug &Hiba bejelentése - + &User manual &Használati utasítás - + &Changelog &Változásnapló - + &Help translating! &Segítség a fordításban! - + &Thanks &Köszönjük - + &About &Névjegy - + Save unsaved changes? Menti a változtatásokat? - + This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? Ez az ábra nem mentett változtatásokat tartalmaz. Ezzel az összes nem mentett adat elveszik. Folytatja? @@ -205,12 +205,12 @@ CustomPropertyList - + + Create new %1 + Új %1 létrehozása - + Pick on graph Ábra kijelölése @@ -238,9 +238,8 @@ Név - Label content - Címketartalom + Címketartalom @@ -405,24 +404,20 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. HistoryBrowser - Filter... - Szűrő… + Szűrő… - Redo > - Ismétlés > + Ismétlés > - > Now - > Most + > Most - < Undo - < Visszavonás + < Visszavonás @@ -475,17 +470,17 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. A(z) „%1” fájl betöltve. - + Copied plot screenshot to clipboard! Ábra képernyőkép vágólapra másolva! - + &Update &Frissítés - + &Update LogarithmPlotter A LogarithmPlotter &frissítése @@ -613,109 +608,109 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. Settings - + X Zoom X-nagyítás - + Y Zoom Y-nagyítás - + Min X Legkisebb X - + Max Y Legnagyobb Y - + Max X Legnagyobb X - + Min Y Legkisebb Y - + X Axis Step X tengely lépésköze - + Y Axis Step Y tengely lépésköze - + Line width Vonalvastagság - + Text size (px) Szövegméret (képpont) - + X Label X címke - + Y Label Y címke - + X Log scale X tengely logaritmikus skálával - + Show X graduation X érettségi megjelenítése - + Show Y graduation Y érettségi megjelenítése - + Copy to clipboard Másolás a vágólapra - + Save plot Ábra mentése… - + Save plot as Ábra mentése másként… - + Load plot Ábra megnyitása… @@ -1160,7 +1155,7 @@ Evaluated expression: %3 Kiértékelt kifejezés: %3 - + Error while attempting to draw %1 %2: %3 @@ -1191,7 +1186,7 @@ Evaluated expression: %3 Kiértékelt kifejezés: %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Rajzolási hiba @@ -1304,27 +1299,27 @@ Kiértékelt kifejezés: %3 Előzmények - + Saved plot to '%1'. Ábra mentve ide: „%1”. - + Loading file '%1'. A(z) „%1” fájl betöltése folyamatban van. - + Unknown object type: %1. Ismeretlen objektumtípus: %1. - + Invalid file provided. A megadott fájl érvénytelen. - + Could not load file: @@ -1333,7 +1328,7 @@ Kiértékelt kifejezés: %3 A fájl mentése nem sikerült: - + Loaded file '%1'. A(z) „%1” fájl betöltve. @@ -1731,6 +1726,11 @@ Kérjük, ellenőrizze, hogy a LaTeX telepítése helyes-e, és ha igen, jelents color Szín + + + labelContent + Címketartalom + repartition diff --git a/assets/i18n/lp_nb_NO.ts b/assets/i18n/lp_nb_NO.ts index d278f03..79657f6 100644 --- a/assets/i18n/lp_nb_NO.ts +++ b/assets/i18n/lp_nb_NO.ts @@ -67,22 +67,22 @@ &Angre - + &Redo &Gjenta - + &Copy plot &Kopier plott - + &Preferences - + &Create &Opprett @@ -99,52 +99,52 @@ Tilbakestill angrehistorikk automatisk - + &Help &Hjelp - + &Source code - + &Report a bug &Rapporter en feil - + &User manual - + &Changelog &Endringslogg - + &Help translating! &Hjelp til å oversette! - + &Thanks &Erkjennelser - + &About &Om - + Save unsaved changes? Lagre ikke-lagrede endringer? - + This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? Dette plottet inneholder ikke-lagrede endringer. Hvis du gjør dette, vil alle ikke-lagrede data gå tapt. Fortsette? @@ -181,12 +181,12 @@ CustomPropertyList - + + Create new %1 + Opprett nytt %1 - + Pick on graph @@ -214,9 +214,8 @@ Navn - Label content - Etikett-innhold + Etikett-innhold @@ -361,24 +360,16 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen. HistoryBrowser - - Filter... - - - - Redo > - Angre > + Angre > - > Now - > Nå + > Nå - < Undo - < Angre + < Angre @@ -431,17 +422,17 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen.Lastet inn filen «%1». - + Copied plot screenshot to clipboard! Kopierte plott-skjermavbildning til utklippstavlen! - + &Update &Oppdater - + &Update LogarithmPlotter &Installer ny versjon av LogartimePlotter @@ -569,109 +560,109 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen.Settings - + X Zoom X-forstørrelse - + Y Zoom Y-forstørrelse - + Min X Min. X - + Max Y Maks. Y - + Max X Maks. X - + Min Y Min. Y - + X Axis Step X-aksesteg - + Y Axis Step Y-aksesteg - + Line width Linjebredde - + Text size (px) Tekststørrelse (piksler) - + X Label Navn på X-akse - + Y Label Navn på Y-akse - + X Log scale Logaritmisk skala i x - + Show X graduation Vis X-inndeling - + Show Y graduation Vis Y-inndeling - + Copy to clipboard Kopier til utklippstavle - + Save plot Lagre plott - + Save plot as Lagre plott som - + Load plot Last inn plott @@ -971,7 +962,7 @@ Evaluated expression: %3 - + Error while attempting to draw %1 %2: %3 @@ -1122,7 +1113,7 @@ Evaluated expression: %3 - + LogarithmPlotter - Drawing error @@ -1235,27 +1226,27 @@ Evaluated expression: %3 Historikk - + Saved plot to '%1'. Lagret plott i «%1». - + Loading file '%1'. Laster inn «%1»-fil. - + Unknown object type: %1. Ukjent objekttype: %1. - + Invalid file provided. Ugyldig fil angitt. - + Could not load file: @@ -1264,7 +1255,7 @@ Evaluated expression: %3 Kunne ikke lagre fil: - + Loaded file '%1'. Lastet inn filen «%1». @@ -1641,6 +1632,11 @@ Please make sure your latex installation is correct and report a bug if so.targetValuePosition + + + labelContent + Etikett-innhold + repartition diff --git a/assets/i18n/lp_template.ts b/assets/i18n/lp_template.ts index 0981f1b..81221dd 100644 --- a/assets/i18n/lp_template.ts +++ b/assets/i18n/lp_template.ts @@ -67,72 +67,72 @@ - + &Redo - + &Copy plot - + &Preferences - + &Create - + &Help - + &Source code - + &Report a bug - + &User manual - + &Changelog - + &Help translating! - + &Thanks - + &About - + Save unsaved changes? - + This plot contains unsaved changes. By doing this, all unsaved data will be lost. Continue? @@ -162,12 +162,12 @@ CustomPropertyList - + + Create new %1 - + Pick on graph @@ -194,11 +194,6 @@ Name - - - Label content - - null @@ -294,29 +289,6 @@ - - HistoryBrowser - - - Filter... - - - - - Redo > - - - - - > Now - - - - - < Undo - - - ListSetting @@ -343,17 +315,17 @@ - + Copied plot screenshot to clipboard! - + &Update - + &Update LogarithmPlotter @@ -457,109 +429,109 @@ Settings - + X Zoom - + Y Zoom - + Min X - + Max Y - + Max X - + Min Y - + X Axis Step - + Y Axis Step - + Line width - + Text size (px) - + X Label - + Y Label - + X Log scale - + Show X graduation - + Show Y graduation - + Copy to clipboard - + Save plot - + Save plot as - + Load plot @@ -859,7 +831,7 @@ Evaluated expression: %3 - + Error while attempting to draw %1 %2: %3 @@ -1010,7 +982,7 @@ Evaluated expression: %3 - + LogarithmPlotter - Drawing error @@ -1069,32 +1041,32 @@ Evaluated expression: %3 io - + Saved plot to '%1'. - + Loading file '%1'. - + Unknown object type: %1. - + Invalid file provided. - + Could not load file: - + Loaded file '%1'. @@ -1448,6 +1420,11 @@ Please make sure your latex installation is correct and report a bug if so.targetValuePosition + + + labelContent + + sequence diff --git a/common/src/module/history.mjs b/common/src/module/history.mjs index 7406925..2a38730 100644 --- a/common/src/module/history.mjs +++ b/common/src/module/history.mjs @@ -23,9 +23,16 @@ import { Action, Actions } from "../history/index.mjs" -class UpdatedEvent extends BaseEvent { +class ClearedEvent extends BaseEvent { constructor() { - super("updated") + super("cleared") + } +} + +class AddedEvent extends BaseEvent { + constructor(action) { + super("added") + this.action = action } } @@ -44,7 +51,7 @@ class RedoneEvent extends BaseEvent { } class HistoryAPI extends Module { - static emits = ["updated", "undone", "redone"] + static emits = ["cleared", "added", "undone", "redone"] #helper @@ -113,7 +120,7 @@ class HistoryAPI extends Module { if(!this.initialized) throw new Error("Attempting clear before initialize!") this.undoStack = [] this.redoStack = [] - this.emit(new UpdatedEvent()) + this.emit(new ClearedEvent()) } /** @@ -127,7 +134,7 @@ class HistoryAPI extends Module { this.undoStack.push(action) if(this.#helper.getSettingBool("reset_redo_stack")) this.redoStack = [] - this.emit(new UpdatedEvent()) + this.emit(new AddedEvent(action)) } } diff --git a/common/src/module/interface.mjs b/common/src/module/interface.mjs index 1ee65a3..db65ea2 100644 --- a/common/src/module/interface.mjs +++ b/common/src/module/interface.mjs @@ -79,7 +79,6 @@ export class CanvasInterface extends Interface { export class RootInterface extends Interface { width = NUMBER height = NUMBER - updateObjectsLists = FUNCTION } export class DialogInterface extends Interface { diff --git a/common/src/module/io.mjs b/common/src/module/io.mjs index 8ca4b2b..360a8fc 100644 --- a/common/src/module/io.mjs +++ b/common/src/module/io.mjs @@ -22,26 +22,59 @@ import History from "./history.mjs" import Canvas from "./canvas.mjs" import Settings from "./settings.mjs" import { DialogInterface, RootInterface } from "./interface.mjs" +import { BaseEvent } from "../events.mjs" +class LoadedEvent extends BaseEvent { + constructor() { + super("loaded") + } +} + +class SavedEvent extends BaseEvent { + constructor() { + super("saved") + } +} + +class ModifiedEvent extends BaseEvent { + constructor() { + super("modified") + } +} + class IOAPI extends Module { + static emits = ["loaded", "saved", "modified"] + /** @type {RootInterface} */ #rootElement /** @type {{show: function(string)}} */ #alert + #saved = true constructor() { super("IO", { alert: DialogInterface, root: RootInterface }) - /** - * Path of the currently opened file. Empty if no file is opened. - * @type {string} - */ - this.saveFileName = "" + + // Settings.on("changed", this.__emitModified.bind(this)) + console.log("Init IO", this) + History.on("added undone redone", this.__emitModified.bind(this)) } + __emitModified() { + this.#saved = false + this.emit(new ModifiedEvent()) + } + + + /** + * True if no changes have been made since last save, false otherwise. + * @return {boolean} + */ + get saved() { return this.#saved } + /** * Initializes module with QML elements. * @param {RootInterface} root @@ -92,7 +125,7 @@ class IOAPI extends Module { } Helper.write(filename, JSON.stringify(settings)) this.#alert.show(qsTranslate("io", "Saved plot to '%1'.").arg(filename.split("/").pop())) - History.history.saved = true + this.emit(new SavedEvent()) } /** @@ -159,8 +192,6 @@ class IOAPI extends Module { if("history" in data) History.unserialize(...data["history"]) - // Refreshing sidebar - this.#rootElement.updateObjectsLists() } else { error = qsTranslate("io", "Invalid file provided.") } @@ -172,7 +203,7 @@ class IOAPI extends Module { } Canvas.redraw() this.#alert.show(qsTranslate("io", "Loaded file '%1'.").arg(basename)) - History.history.saved = true + this.emit(new LoadedEvent()) } } diff --git a/common/src/objs/bodephase.mjs b/common/src/objs/bodephase.mjs index 9c93bba..800671e 100644 --- a/common/src/objs/bodephase.mjs +++ b/common/src/objs/bodephase.mjs @@ -63,7 +63,7 @@ export default class BodePhase extends ExecutableObject { // Create new point om_0 = Objects.createNewRegisteredObject("Point", [Objects.getNewName("ω"), this.color, "name"]) om_0.labelPosition = this.phase.execute() >= 0 ? "above" : "below" - History.history.addToHistory(new CreateNewObject(om_0.name, "Point", om_0.export())) + History.addToHistory(new CreateNewObject(om_0.name, "Point", om_0.export())) labelPosition = "below" } om_0.requiredBy.push(this) diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml index 8c3f2d1..f4e2f35 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml @@ -117,7 +117,7 @@ MenuBar { icon.color: sysPalette.buttonText onTriggered: { var newObj = Modules.Objects.createNewRegisteredObject(modelData) - history.addToHistory(new JS.HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export())) + Modules.History.addToHistory(new JS.HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export())) objectLists.update() } } diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/HistoryBrowser.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/HistoryBrowser.qml index d79cc84..aca7943 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/HistoryBrowser.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/HistoryBrowser.qml @@ -225,7 +225,7 @@ Item { imageDepth: Screen.devicePixelRatio, fontSize: 14 }) - Modules.History.on("updated undone redone", () => { + Modules.History.on("cleared added undone redone", () => { undoCount = Modules.History.undoStack.length redoCount = Modules.History.redoStack.length }) diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index 51abb46..33967aa 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -42,7 +42,7 @@ ApplicationWindow { width: 1000 height: 500 color: sysPalette.window - title: "LogarithmPlotter" + title: qsTr("untitled") SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active } SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled } @@ -50,9 +50,7 @@ ApplicationWindow { menuBar: appMenu.trueItem AppMenuBar {id: appMenu} - - History { id: history } - + Popup.GreetScreen {} Popup.Preferences {id: preferences} @@ -185,7 +183,7 @@ ApplicationWindow { } onClosing: function(close) { - if(!history.saved) { + if(!Modules.History.saved) { close.accepted = false appMenu.openSaveUnsavedChangesDialog() } @@ -254,8 +252,20 @@ ApplicationWindow { if(evt.property === "saveFilename") { const fileName = evt.newValue.split('/').pop().split('\\').pop() if(fileName !== "") - title = `${fileName}` + title = fileName } }) + Modules.IO.on("saved loaded", (evt) => { + // Refreshing sidebar + console.log(evt.name) + updateObjectsLists() + if(title.endsWith("*")) + title = title.substring(0, title.length-1) + }) + Modules.IO.on("modified", () => { + console.log("modified") + if(!title.endsWith("*")) + title = title+"*" + }) } } diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml index 57ea4ae..1ca75e4 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml @@ -80,7 +80,7 @@ Repeater { variables: propertyType.variables onChanged: function(newExpr) { if(obj[propertyName].toString() != newExpr.toString()) { - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( obj.name, objType, propertyName, obj[propertyName], newExpr )) @@ -123,7 +123,7 @@ Repeater { // Ensuring old and new values are different to prevent useless adding to history. if(obj[propertyName] != newValueParsed) { - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( obj.name, objType, propertyName, obj[propertyName], newValueParsed )) @@ -168,7 +168,7 @@ Repeater { return obj[propertyName] } onClicked: { - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( obj.name, objType, propertyName, obj[propertyName], this.checked )) @@ -209,7 +209,9 @@ Repeater { if(selectedObj == null) { // Creating new object. selectedObj = Modules.Objects.createNewRegisteredObject(propertyType.objType) - history.addToHistory(new JS.HistoryLib.CreateNewObject(selectedObj.name, propertyType.objType, selectedObj.export())) + Modules.History.addToHistory( + new JS.HistoryLib.CreateNewObject(selectedObj.name, propertyType.objType, selectedObj.export()) + ) baseModel = Modules.Objects.getObjectsName(propertyType.objType).concat( isRealObject ? [qsTr("+ Create new %1").arg(Modules.Objects.types[propertyType.objType].displayType())] : []) @@ -219,14 +221,14 @@ Repeater { //Modules.Objects.currentObjects[objType][objIndex].requiredBy = obj[propertyName].filter((obj) => obj.name != obj.name) } obj.requiredBy = obj.requiredBy.filter((obj) => obj.name != obj.name) - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( obj.name, objType, propertyName, obj[propertyName], selectedObj )) obj[propertyName] = selectedObj } else if(baseModel[newIndex] != obj[propertyName]) { // Ensuring new property is different to not add useless history entries. - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( obj.name, objType, propertyName, obj[propertyName], baseModel[newIndex] )) @@ -256,7 +258,7 @@ Repeater { onChanged: { var exported = exportModel() - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( obj.name, objType, propertyName, obj[propertyName], exported )) diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml index e2b149b..715602a 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml @@ -112,7 +112,7 @@ Popup.BaseDialog { if(newName in Modules.Objects.currentObjectsByName) { invalidNameDialog.showDialog(newName) } else { - history.addToHistory(new JS.HistoryLib.NameChanged( + Modules.History.addToHistory(new JS.HistoryLib.NameChanged( objEditor.obj.name, objEditor.objType, newName )) Modules.Objects.renameObject(obj.name, newName) @@ -127,13 +127,17 @@ Popup.BaseDialog { id: labelContentProperty height: 30 width: dlgProperties.width - label: qsTr("Label content") + label: qsTranslate("prop", "labelContent") model: [qsTr("null"), qsTr("name"), qsTr("name + value")] property var idModel: ["null", "name", "name + value"] icon: "common/label.svg" currentIndex: idModel.indexOf(objEditor.obj.labelContent) onActivated: function(newIndex) { if(idModel[newIndex] != objEditor.obj.labelContent) { + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( + obj.name, objType, "labelContent", + objEditor.obj.labelContent, idModel[newIndex] + )) objEditor.obj.labelContent = idModel[newIndex] objEditor.obj.update() objectListList.update() diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml index 7aa9574..e8d4912 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectCreationGrid.qml @@ -104,7 +104,9 @@ Column { onClicked: { let newObj = Modules.Objects.createNewRegisteredObject(modelData) - history.addToHistory(new JS.HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export())) + Modules.History.addToHistory(new JS.HistoryLib.CreateNewObject( + newObj.name, modelData, newObj.export() + )) objectLists.update() let hasXProp = newObj.constructor.properties().hasOwnProperty('x') diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml index 5018e5e..9624d23 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectRow.qml @@ -72,7 +72,7 @@ Item { anchors.left: parent.left anchors.leftMargin: 5 onClicked: { - history.addToHistory(new JS.HistoryLib.EditedVisibility( + Modules.History.addToHistory(new JS.HistoryLib.EditedVisibility( obj.name, obj.type, this.checked )) obj.visible = this.checked @@ -212,7 +212,7 @@ Item { selectedColor: obj.color title: qsTr("Pick new color for %1 %2").arg(obj.constructor.displayType()).arg(obj.name) onAccepted: { - history.addToHistory(new JS.HistoryLib.ColorChanged( + Modules.History.addToHistory(new JS.HistoryLib.ColorChanged( obj.name, obj.type, obj.color, selectedColor.toString() )) obj.color = selectedColor.toString() @@ -231,7 +231,7 @@ Item { // Object still exists // Temporary fix for objects require not being propertly updated. object.requiredBy = [] - history.addToHistory(new JS.HistoryLib.DeleteObject( + Modules.History.addToHistory(new JS.HistoryLib.DeleteObject( object.name, object.type, object.export() )) Modules.Objects.deleteObject(object.name) diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml index 680c310..b364e73 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml @@ -115,7 +115,7 @@ Item { let obj = Modules.Objects.currentObjectsByName[objName] // Set values if(parent.userPickX && parent.userPickY) { - history.addToHistory(new JS.HistoryLib.EditedPosition( + Modules.History.addToHistory(new JS.HistoryLib.EditedPosition( objName, objType, obj[propertyX], newValueX, obj[propertyY], newValueY )) obj[propertyX] = newValueX @@ -124,7 +124,7 @@ Item { objectLists.update() pickerRoot.picked(obj) } else if(parent.userPickX) { - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( objName, objType, propertyX, obj[propertyX], newValueX )) obj[propertyX] = newValueX @@ -132,7 +132,7 @@ Item { objectLists.update() pickerRoot.picked(obj) } else if(parent.userPickY) { - history.addToHistory(new JS.HistoryLib.EditedProperty( + Modules.History.addToHistory(new JS.HistoryLib.EditedProperty( objName, objType, propertyY, obj[propertyY], newValueY )) obj[propertyY] = newValueY