1 | /* This file is part of the KDE project |
2 | Copyright (C) 2006 Matthias Kretz <kretz@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2.1 of the License, or (at your option) version 3, or any |
8 | later version accepted by the membership of KDE e.V. (or its |
9 | successor approved by the membership of KDE e.V.), Nokia Corporation |
10 | (or its successors, if any) and the KDE Free Qt Foundation, which shall |
11 | act as a proxy defined in Section 6 of version 3 of the license. |
12 | |
13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Lesser General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Lesser General Public |
19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
20 | |
21 | */ |
22 | |
23 | #include "effectparameter.h" |
24 | #include "effectparameter_p.h" |
25 | |
26 | #ifndef QT_NO_PHONON_EFFECT |
27 | |
28 | namespace Phonon |
29 | { |
30 | |
31 | uint qHash(const Phonon::EffectParameter ¶m) |
32 | { |
33 | return param.id(); |
34 | } |
35 | |
36 | EffectParameter::EffectParameter() |
37 | : d(new EffectParameterPrivate) |
38 | { |
39 | } |
40 | |
41 | EffectParameter::EffectParameter(int parameterId, const QString &name, Hints hints, |
42 | const QVariant &defaultValue, const QVariant &min, const QVariant &max, |
43 | const QVariantList &values, const QString &description) |
44 | : d(new EffectParameterPrivate) |
45 | { |
46 | d->parameterId = parameterId; |
47 | d->min = min; |
48 | d->max = max; |
49 | d->defaultValue = defaultValue; |
50 | d->name = name; |
51 | d->possibleValues = values; |
52 | d->description = description; |
53 | d->hints = hints; |
54 | } |
55 | |
56 | EffectParameter::~EffectParameter() |
57 | { |
58 | } |
59 | |
60 | EffectParameter::EffectParameter(const EffectParameter &rhs) |
61 | : d(rhs.d) |
62 | { |
63 | } |
64 | |
65 | EffectParameter &EffectParameter::operator=(const EffectParameter &rhs) |
66 | { |
67 | d = rhs.d; |
68 | return *this; |
69 | } |
70 | |
71 | bool EffectParameter::operator<(const EffectParameter &rhs) const |
72 | { |
73 | return d->parameterId < rhs.d->parameterId; |
74 | } |
75 | |
76 | bool EffectParameter::operator==(const EffectParameter &rhs) const |
77 | { |
78 | return d->parameterId == rhs.d->parameterId; |
79 | } |
80 | |
81 | bool EffectParameter::operator>(const EffectParameter &rhs) const |
82 | { |
83 | return d->parameterId > rhs.d->parameterId; |
84 | } |
85 | |
86 | const QString &EffectParameter::name() const |
87 | { |
88 | return d->name; |
89 | } |
90 | |
91 | const QString &EffectParameter::description() const |
92 | { |
93 | return d->description; |
94 | } |
95 | |
96 | bool EffectParameter::isLogarithmicControl() const |
97 | { |
98 | return d->hints & LogarithmicHint; |
99 | } |
100 | |
101 | QVariant::Type EffectParameter::type() const |
102 | { |
103 | if (d->possibleValues.isEmpty()) { |
104 | return d->defaultValue.type(); |
105 | } |
106 | return QVariant::String; |
107 | } |
108 | |
109 | QVariantList EffectParameter::possibleValues() const |
110 | { |
111 | return d->possibleValues; |
112 | } |
113 | |
114 | QVariant EffectParameter::minimumValue() const |
115 | { |
116 | return d->min; |
117 | } |
118 | |
119 | QVariant EffectParameter::maximumValue() const |
120 | { |
121 | return d->max; |
122 | } |
123 | |
124 | QVariant EffectParameter::defaultValue() const |
125 | { |
126 | return d->defaultValue; |
127 | } |
128 | |
129 | int EffectParameter::id() const |
130 | { |
131 | return d->parameterId; |
132 | } |
133 | |
134 | } |
135 | |
136 | #endif //QT_NO_PHONON_EFFECT |
137 | |
138 | // vim: sw=4 ts=4 |
139 | |