diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js index d474b1b..4f957df 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/historylib.js @@ -134,16 +134,22 @@ class EditedProperty extends Action { return [this.targetName, this.targetType, this.targetProperty, this.previousValue.toEditableString(), this.newValue.toEditableString(), true] } else if(this.previousValue instanceof Common.DrawableObject) { return [this.targetName, this.targetType, this.targetProperty, this.previousValue.name, this.newValue.name, true] - } else { return [this.targetName, this.targetType, this.targetProperty, this.previousValue, this.newValue, false] } } getReadableString() { - var prev = this.previousValue == null ? ""+this.previousValue : this.previousValue.toString() - var next = this.newValue == null ? ""+this.newValue : this.newValue.toString() - return qsTr('%1 of %2 %3 changed from "%4" to "%5".').arg(this.targetPropertyReadable).arg(Objects.types[this.targetType].displayType()).arg(this.targetName).arg(prev).arg(next) + var prev = this.previousValue == null ? "null" : this.previousValue.toString() + var next = this.newValue == null ? "null" : this.newValue.toString() + if(prev == "[object Object]") // Oh no! + prev = JSON.stringify(this.previousValue).replace("'", "\\'").replace('"', "'") + if(next == "[object Object]") // Oh no! + next = JSON.stringify(this.previousValue).replace("'", "\\'").replace('"', "'") + return qsTr('%1 of %2 %3 changed from "%4" to "%5".') + .arg(this.targetPropertyReadable) + .arg(Objects.types[this.targetType].displayType()) + .arg(this.targetName).arg(prev).arg(next) } }