All pastes #920711 Raw Edit

Miscellany

public text v1 · immutable
#920711 ·published 2008-02-27 15:51 UTC
rendered paste body
Index: objectdescription.cpp
===================================================================
--- objectdescription.cpp       (revision 779571)
+++ objectdescription.cpp       (working copy)
@@ -31,6 +31,11 @@
 namespace Phonon
 {

+ObjectDescriptionData::ObjectDescriptionData(int index, const QHash<QByteArray, QVariant> &properties)
+    : d(new ObjectDescriptionPrivate(index, properties))
+{
+}
+
 ObjectDescriptionData::ObjectDescriptionData(ObjectDescriptionPrivate *dd)
     : d(dd)
 {
@@ -105,7 +110,7 @@
         QList<int> indexes = iface->objectDescriptionIndexes(type);
         if (indexes.contains(index)) {
             QHash<QByteArray, QVariant> properties = iface->objectDescriptionProperties(type, index);
-            return new ObjectDescriptionData(new ObjectDescriptionPrivate(index, properties));
+            return new ObjectDescriptionData(index, properties);
         }
     }
     return new ObjectDescriptionData(0); // invalid
Index: objectdescription.h
===================================================================
--- objectdescription.h (revision 779571)
+++ objectdescription.h (working copy)
@@ -168,6 +168,7 @@
         ~ObjectDescriptionData();

         ObjectDescriptionData(ObjectDescriptionPrivate * = 0);
+        ObjectDescriptionData(int index, const QHash<QByteArray, QVariant> &properties);

     protected:
         ObjectDescriptionPrivate *const d;
@@ -265,6 +266,7 @@
         inline int index() const { return d->index(); } //krazy:exclude=inline

         ObjectDescription() : d(new ObjectDescriptionData(0)) {}
+        ObjectDescription(int index, const QHash<QByteArray, QVariant> &properties) : d(new ObjectDescriptionData(index, properties)) {}

     protected:
         friend class ObjectDescriptionModel<T>;