Fixing bugs related to property changes in history with enum, object & list properties
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2022-01-28 18:19:30 +01:00
parent 7a25ba2f7a
commit 0e2c1bdae4
Signed by: Ad5001
GPG key ID: 7251B1AF90B960F9
9 changed files with 69 additions and 46 deletions

View file

@ -569,27 +569,27 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen"
<context>
<name>historylib</name>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="78"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="79"/>
<source>New %1 %2 created.</source>
<translation>Neu %1 %2 erstellt.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="95"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="96"/>
<source>%1 %2 deleted.</source>
<translation>%1 %2 gelöscht.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="149"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="172"/>
<source>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</source>
<translation>%1 von %2 %3 wurde von &quot;%4&quot; auf &quot;%5&quot; geändert.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="166"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="189"/>
<source>%1 %2 shown.</source>
<translation>%1 %2 angezeigt.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="168"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="191"/>
<source>%1 %2 hidden.</source>
<translation>%1 %2 ausgeblendet.</translation>
</message>

View file

@ -569,27 +569,27 @@ These settings can be changed at any time from the &quot;Settings&quot; menu.</t
<context>
<name>historylib</name>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="78"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="79"/>
<source>New %1 %2 created.</source>
<translation>New %1 %2 created.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="95"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="96"/>
<source>%1 %2 deleted.</source>
<translation>%1 %2 deleted.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="149"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="172"/>
<source>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</source>
<translation>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="166"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="189"/>
<source>%1 %2 shown.</source>
<translation>%1 %2 shown.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="168"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="191"/>
<source>%1 %2 hidden.</source>
<translation>%1 %2 hidden.</translation>
</message>

View file

@ -568,27 +568,27 @@ These settings can be changed at any time from the &quot;Settings&quot; menu.</s
<context>
<name>historylib</name>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="78"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="79"/>
<source>New %1 %2 created.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="95"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="96"/>
<source>%1 %2 deleted.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="149"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="172"/>
<source>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="166"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="189"/>
<source>%1 %2 shown.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="168"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="191"/>
<source>%1 %2 hidden.</source>
<translation type="unfinished"></translation>
</message>

View file

@ -578,27 +578,27 @@ These settings can always be changed at any time from the &quot;Settings&quot; m
<context>
<name>historylib</name>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="78"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="79"/>
<source>New %1 %2 created.</source>
<translation>Nouveau %1 %2 créé(e).</translation>
<translation>Nouvel objet %1 %2 créé.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="95"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="96"/>
<source>%1 %2 deleted.</source>
<translation>%1 %2 supprimé(e).</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="149"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="172"/>
<source>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</source>
<translation>%1 de %2 %3 modifiée de &quot;%4&quot; à &quot;%5&quot;.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="166"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="189"/>
<source>%1 %2 shown.</source>
<translation>%1 %2 affiché(e).</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="168"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="191"/>
<source>%1 %2 hidden.</source>
<translation>%1 %2 cachée(e).</translation>
</message>

View file

@ -569,27 +569,27 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben.
<context>
<name>historylib</name>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="78"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="79"/>
<source>New %1 %2 created.</source>
<translation>Új %1 %2 létrehozva.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="95"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="96"/>
<source>%1 %2 deleted.</source>
<translation>%1 %2 törölve.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="149"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="172"/>
<source>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</source>
<translation>%1/%2 %3 megváltozott. Régi érték: %4, új érték: %5.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="166"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="189"/>
<source>%1 %2 shown.</source>
<translation>%1 %2 megjelenítve.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="168"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="191"/>
<source>%1 %2 hidden.</source>
<translation>%1 %2 rejtve.</translation>
</message>

View file

@ -569,27 +569,27 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen.</tr
<context>
<name>historylib</name>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="78"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="79"/>
<source>New %1 %2 created.</source>
<translation>Ny %1 %2 opprettet.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="95"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="96"/>
<source>%1 %2 deleted.</source>
<translation>%1 %2 slettet.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="149"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="172"/>
<source>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</source>
<translation>%1 av %2 %3 endret fra «%4» til «%5».</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="166"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="189"/>
<source>%1 %2 shown.</source>
<translation>%1 %2 vist.</translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="168"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="191"/>
<source>%1 %2 hidden.</source>
<translation>%1 %2 skjult.</translation>
</message>

View file

@ -568,27 +568,27 @@ These settings can be changed at any time from the &quot;Settings&quot; menu.</s
<context>
<name>historylib</name>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="78"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="79"/>
<source>New %1 %2 created.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="95"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="96"/>
<source>%1 %2 deleted.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="149"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="172"/>
<source>%1 of %2 %3 changed from &quot;%4&quot; to &quot;%5&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="166"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="189"/>
<source>%1 %2 shown.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="168"/>
<location filename="../qml/eu/ad5001/LogarithmPlotter/js/historylib.js" line="191"/>
<source>%1 %2 hidden.</source>
<translation type="unfinished"></translation>
</message>

View file

@ -33,7 +33,7 @@ D.Dialog {
property var obj: Objects.currentObjects[objType][objIndex]
property QtObject editingRow: QtObject{}
property var objectLists
title: `LogarithmPlotter`
title: "LogarithmPlotter"
width: 350
height: 400

View file

@ -21,6 +21,7 @@
.pragma library
.import "objects.js" as Objects
.import "parameters.js" as P
.import "objs/common.js" as Common
.import "utils.js" as Utils
.import "mathlib.js" as MathLib
@ -103,14 +104,15 @@ class EditedProperty extends Action {
constructor(targetName = "", targetType = "Point", targetProperty = "visible", previousValue = false, newValue = true, valueIsExpressionNeedingImport = false) {
super(targetName, targetType)
this.targetProperty = targetProperty
this.targetPropertyReadable = Utils.camelCase2readable(this.targetProperty)
this.targetPropertyReadable = qsTranslate("prop", this.targetProperty)
this.previousValue = previousValue
this.newValue = newValue
this.propertyType = Objects.types[targetType].properties()[targetProperty]
if(valueIsExpressionNeedingImport) {
if(targetType == "Expression") {
if(propertyType == "Expression") {
this.previousValue = new MathLib.Expression(this.previousValue);
this.newValue = new MathLib.Expression(this.newValue);
} else if(targetType == "Domain") {
} else if(propertyType == "Domain") {
this.previousValue = MathLib.parseDomain(this.previousValue);
this.newValue = MathLib.parseDomain(this.newValue);
} else {
@ -140,12 +142,33 @@ class EditedProperty extends Action {
}
getReadableString() {
var prev = this.previousValue == null ? "null" : this.previousValue.toString()
var next = this.newValue == null ? "null" : this.newValue.toString()
if(prev == "[object Object]") // Oh no!
let prev = "";
let next = "";
if(this.propertyType instanceof Object) {
console.log(this.propertyType.type)
switch(this.propertyType.type) {
case "Enum":
console.log(this.propertyType.translatedValues, this.previousValue, this.propertyType.values.indexOf(this.previousValue))
prev = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.previousValue)]
next = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.newValue)]
break;
case "ObjectType":
prev = this.previousValue.name
next = this.newValue.name
break;
case "List":
prev = this.previousValue.join(",")
next = this.newValue.name.join(",")
break;
case "Dict":
prev = JSON.stringify(this.previousValue).replace("'", "\\'").replace('"', "'")
if(next == "[object Object]") // Oh no!
next = JSON.stringify(this.previousValue).replace("'", "\\'").replace('"', "'")
next = JSON.stringify(this.newValue).replace("'", "\\'").replace('"', "'")
break;
}
} else {
prev = this.previousValue == null ? "null" : this.previousValue.toString()
next = this.newValue == null ? "null" : this.newValue.toString()
}
return qsTr('%1 of %2 %3 changed from "%4" to "%5".')
.arg(this.targetPropertyReadable)
.arg(Objects.types[this.targetType].displayType())