From a61b5c1bd58225bd06c06679207796b3a1d84a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 17 Jul 2024 15:26:05 +0200 Subject: [PATCH] Added property names to undo commands * Set Property 'foo' * Add Property 'foo' * Remove Property 'foo' Currently I haven't touched "Rename Property" because I think it would get a little too verbose if we mentioned two names. However, the name does mention the full path of a property if it is nested, separated by dots. Also addressed a old occurrence of 'Type' which should have been renamed to 'Class' in Tiled 1.9. --- src/tiled/changeproperties.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tiled/changeproperties.cpp b/src/tiled/changeproperties.cpp index 613c3022ec..d95a9de242 100644 --- a/src/tiled/changeproperties.cpp +++ b/src/tiled/changeproperties.cpp @@ -34,7 +34,7 @@ ChangeClassName::ChangeClassName(Document *document, QUndoCommand *parent) : ChangeValue(document, objects, className, parent) { - setText(QCoreApplication::translate("Undo Commands", "Change Type")); + setText(QCoreApplication::translate("Undo Commands", "Change Class")); } void ChangeClassName::undo() @@ -146,10 +146,12 @@ SetProperty::SetProperty(Document *document, mProperties.append(prop); } + const auto fullName = mPath.join(QLatin1Char('.')); + if (mObjects.size() > 1 || mObjects.at(0)->hasProperty(mName)) - setText(QCoreApplication::translate("Undo Commands", "Set Property")); + setText(QCoreApplication::translate("Undo Commands", "Set Property '%1'").arg(fullName)); else - setText(QCoreApplication::translate("Undo Commands", "Add Property")); + setText(QCoreApplication::translate("Undo Commands", "Add Property '%1'").arg(fullName)); } void SetProperty::undo() @@ -201,7 +203,7 @@ RemoveProperty::RemoveProperty(Document *document, for (Object *obj : objects) mPreviousValues.append(obj->property(mName)); - setText(QCoreApplication::translate("Undo Commands", "Remove Property")); + setText(QCoreApplication::translate("Undo Commands", "Remove Property '%1'").arg(name)); } void RemoveProperty::undo()