File indexing completed on 2024-04-21 04:43:15

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation 
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public 
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 */
0022 
0023 #include "effectparameter.h"
0024 #include "effectparameter_p.h"
0025 
0026 #ifndef QT_NO_PHONON_EFFECT
0027 
0028 namespace Phonon
0029 {
0030 
0031 uint qHash(const Phonon::EffectParameter &param)
0032 {
0033     return param.id();
0034 }
0035 
0036 EffectParameter::EffectParameter()
0037     : d(new EffectParameterPrivate)
0038 {
0039 }
0040 
0041 EffectParameter::EffectParameter(int parameterId, const QString &name, Hints hints,
0042         const QVariant &defaultValue, const QVariant &min, const QVariant &max,
0043         const QVariantList &values, const QString &description)
0044     : d(new EffectParameterPrivate)
0045 {
0046     d->parameterId = parameterId;
0047     d->min = min;
0048     d->max = max;
0049     d->defaultValue = defaultValue;
0050     d->name = name;
0051     d->possibleValues = values;
0052     d->description = description;
0053     d->hints = hints;
0054 }
0055 
0056 EffectParameter::~EffectParameter()
0057 {
0058 }
0059 
0060 EffectParameter::EffectParameter(const EffectParameter &rhs)
0061     : d(rhs.d)
0062 {
0063 }
0064 
0065 EffectParameter &EffectParameter::operator=(const EffectParameter &rhs)
0066 {
0067     d = rhs.d;
0068     return *this;
0069 }
0070 
0071 bool EffectParameter::operator<(const EffectParameter &rhs) const
0072 {
0073     return d->parameterId < rhs.d->parameterId;
0074 }
0075 
0076 bool EffectParameter::operator==(const EffectParameter &rhs) const
0077 {
0078     return d->parameterId == rhs.d->parameterId;
0079 }
0080 
0081 bool EffectParameter::operator>(const EffectParameter &rhs) const
0082 {
0083     return d->parameterId > rhs.d->parameterId;
0084 }
0085 
0086 const QString &EffectParameter::name() const
0087 {
0088     return d->name;
0089 }
0090 
0091 const QString &EffectParameter::description() const
0092 {
0093     return d->description;
0094 }
0095 
0096 bool EffectParameter::isLogarithmicControl() const
0097 {
0098     return d->hints  & LogarithmicHint;
0099 }
0100 
0101 QVariant::Type EffectParameter::type() const
0102 {
0103     if (d->possibleValues.isEmpty()) {
0104         return d->defaultValue.type();
0105     }
0106     return QVariant::String;
0107 }
0108 
0109 QVariantList EffectParameter::possibleValues() const
0110 {
0111     return d->possibleValues;
0112 }
0113 
0114 QVariant EffectParameter::minimumValue() const
0115 {
0116     return d->min;
0117 }
0118 
0119 QVariant EffectParameter::maximumValue() const
0120 {
0121     return d->max;
0122 }
0123 
0124 QVariant EffectParameter::defaultValue() const
0125 {
0126     return d->defaultValue;
0127 }
0128 
0129 int EffectParameter::id() const
0130 {
0131     return d->parameterId;
0132 }
0133 
0134 }
0135 
0136 #endif //QT_NO_PHONON_EFFECT
0137 
0138 // vim: sw=4 ts=4