All pastes #794827 Raw Edit

Someone

public text v1 · immutable
#794827 ·published 2007-11-23 13:20 UTC
rendered paste body
Index: effectparameter.cpp
===================================================================
--- effectparameter.cpp (revision 740499)
+++ effectparameter.cpp (working copy)
@@ -23,7 +23,7 @@
 namespace Phonon
 {

-uint qHash (const EffectParameter &param)
+uint qHash(const Phonon::EffectParameter &param)
 {
     return param.id();
 }
@@ -95,7 +95,10 @@

 QVariant::Type EffectParameter::type() const
 {
-    return d->defaultValue.type();
+    if (d->possibleValues.isEmpty()) {
+        return d->defaultValue.type();
+    }
+    return QVariant::List;
 }

 QVariantList EffectParameter::possibleValues() const
Index: effectparameter.h
===================================================================
--- effectparameter.h   (revision 740499)
+++ effectparameter.h   (working copy)
@@ -22,9 +22,8 @@

 #include "phonon_export.h"

-
+#include <QtCore/QExplicitlySharedDataPointer>
 #include <QtCore/QVariant>
-#include <QtCore/QSharedData>

 namespace Phonon
 {
@@ -71,18 +70,18 @@
         /**
          * Returns the parameter type.
          *
-         * usually it will be QVariant::Int or QVariant::Double or QVariant::Bool
+         * Common types are QVariant::Int, QVariant::Double, QVariant::Bool and QVariant::List. When
+         * QVariant::List is returned you get the possible values from possibleValues.
          */
         QVariant::Type type() const;

         /**
          * Returns whether the parameter should be
-         * displayed in a logarithmic scale. This is particularly useful for
+         * displayed using a logarithmic scale. This is particularly useful for
          * frequencies and gains.
          */
         bool isLogarithmicControl() const;

-
         /**
          * The minimum value to be used for the control to edit the parameter.
          *
@@ -210,10 +209,13 @@
         QExplicitlySharedDataPointer<EffectParameterPrivate> d;
 };

-uint PHONON_EXPORT qHash (const EffectParameter &param);
+uint PHONON_EXPORT qHash(const Phonon::EffectParameter &param);

 } // namespace Phonon

+// will code outside of the Phonon namespace be able to make use of the above qHash function?
+//inline uint qHash(const Phonon::EffectParameter &param) { return Phonon::qHash(param); }
+
 Q_DECLARE_OPERATORS_FOR_FLAGS(Phonon::EffectParameter::Hints)

 #endif // PHONON_EFFECTPARAMETER_H