Permalink
Browse files

Added d-pointer to UiQuickUndoPropertyCommand impl.

Also fixed some minor code style and redundant typedefs.

Change-Id: I9dd32769ea9c3f9a5c7081cfa9643ead9ded0382
Signed-off-by: Daker Fernandes Pinheiro <daker.pinheiro@openbossa.org>
Reviewed-by: Luis Gabriel Lima <luis.gabriel@openbossa.org>
  • Loading branch information...
dakerfp authored and luisgabriel committed Mar 28, 2012
1 parent 293c87b commit 8dd33a7b8dbfc3fd725bec8394f4462b7d74b00e
Showing with 29 additions and 5 deletions.
  1. +23 −4 src/imports/undo/uiquickundopropertycommand.cpp
  2. +6 −1 src/imports/undo/uiquickundopropertycommand_p.h
@@ -44,6 +44,19 @@
typedef QPair<QByteArray, QVariant> PropertyState;
typedef QList<PropertyState> TargetState;
+class UiQuickUndoPropertyCommandPrivate
+{
+public:
+ UiQuickUndoPropertyCommandPrivate();
+
+ QVariantList properties;
+};
+
+UiQuickUndoPropertyCommandPrivate::UiQuickUndoPropertyCommandPrivate()
+ : properties()
+{
+}
+
class UndoPropertyCommand : public BaseUndoCommand
{
public:
@@ -113,7 +126,7 @@ bool UndoPropertyCommand::delayPush() const
UiQuickUndoPropertyCommand::UiQuickUndoPropertyCommand(QObject *parent)
: UiQuickBaseUndoCommand(parent)
- , m_properties(QVariantList())
+ , d_ptr(new UiQuickUndoPropertyCommandPrivate())
{
}
@@ -123,17 +136,23 @@ UiQuickUndoPropertyCommand::~UiQuickUndoPropertyCommand()
QVariantList UiQuickUndoPropertyCommand::properties() const
{
- return m_properties;
+ Q_D(const UiQuickUndoPropertyCommand);
+
+ return d->properties;
}
void UiQuickUndoPropertyCommand::setProperties(const QVariantList& prop)
{
- m_properties = prop;
+ Q_D(UiQuickUndoPropertyCommand);
+
+ if (prop == d->properties)
+ return;
+
+ d->properties = prop;
emit propertiesChanged();
}
BaseUndoCommand *UiQuickUndoPropertyCommand::create(QObject *target)
{
return new UndoPropertyCommand(target, this);
}
-
@@ -47,6 +47,8 @@
QT_USE_NAMESPACE_UIHELPERS;
+class UiQuickUndoPropertyCommandPrivate;
+
class UiQuickUndoPropertyCommand : public UiQuickBaseUndoCommand
{
Q_OBJECT
@@ -66,7 +68,10 @@ class UiQuickUndoPropertyCommand : public UiQuickBaseUndoCommand
void propertiesChanged();
private:
- QVariantList m_properties;
+ Q_DISABLE_COPY(UiQuickUndoPropertyCommand)
+ Q_DECLARE_PRIVATE(UiQuickUndoPropertyCommand)
+
+ QScopedPointer<UiQuickUndoPropertyCommandPrivate> d_ptr;
};
#endif // UIQUICKUNDOPROPERTYCOMMAND_H

0 comments on commit 8dd33a7

Please sign in to comment.