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
QT_BEGIN_NAMESPACE
27
28
#ifndef QT_NO_PHONON_EFFECT
29
30
namespace Phonon
31
{
32
33
uint qHash(const Phonon::EffectParameter &param)
34
{
35
    return param.id();
36
}
37
38
EffectParameter::EffectParameter()
39
    : d(new EffectParameterPrivate)
40
{
41
}
42
43
EffectParameter::EffectParameter(int parameterId, const QString &name, Hints hints,
44
        const QVariant &defaultValue, const QVariant &min, const QVariant &max,
45
        const QVariantList &values, const QString &description)
46
    : d(new EffectParameterPrivate)
47
{
48
    d->parameterId = parameterId;
49
    d->min = min;
50
    d->max = max;
51
    d->defaultValue = defaultValue;
52
    d->name = name;
53
    d->possibleValues = values;
54
    d->description = description;
55
    d->hints = hints;
56
}
57
58
EffectParameter::~EffectParameter()
59
{
60
}
61
62
EffectParameter::EffectParameter(const EffectParameter &rhs)
63
    : d(rhs.d)
64
{
65
}
66
67
EffectParameter &EffectParameter::operator=(const EffectParameter &rhs)
68
{
69
    d = rhs.d;
70
    return *this;
71
}
72
73
bool EffectParameter::operator<(const EffectParameter &rhs) const
74
{
75
    return d->parameterId < rhs.d->parameterId;
76
}
77
78
bool EffectParameter::operator==(const EffectParameter &rhs) const
79
{
80
    return d->parameterId == rhs.d->parameterId;
81
}
82
83
bool EffectParameter::operator>(const EffectParameter &rhs) const
84
{
85
    return d->parameterId > rhs.d->parameterId;
86
}
87
88
const QString &EffectParameter::name() const
89
{
90
    return d->name;
91
}
92
93
const QString &EffectParameter::description() const
94
{
95
    return d->description;
96
}
97
98
bool EffectParameter::isLogarithmicControl() const
99
{
100
    return d->hints  & LogarithmicHint;
101
}
102
103
QVariant::Type EffectParameter::type() const
104
{
105
    if (d->possibleValues.isEmpty()) {
106
        return d->defaultValue.type();
107
    }
108
    return QVariant::String;
109
}
110
111
QVariantList EffectParameter::possibleValues() const
112
{
113
    return d->possibleValues;
114
}
115
116
QVariant EffectParameter::minimumValue() const
117
{
118
    return d->min;
119
}
120
121
QVariant EffectParameter::maximumValue() const
122
{
123
    return d->max;
124
}
125
126
QVariant EffectParameter::defaultValue() const
127
{
128
    return d->defaultValue;
129
}
130
131
int EffectParameter::id() const
132
{
133
    return d->parameterId;
134
}
135
136
}
137
138
#endif //QT_NO_PHONON_EFFECT
139
140
QT_END_NAMESPACE
141
142
// vim: sw=4 ts=4