|
1 /* This file is part of the KDE project. |
|
2 |
|
3 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
|
5 This library is free software: you can redistribute it and/or modify |
|
6 it under the terms of the GNU Lesser General Public License as published by |
|
7 the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
|
9 This library is distributed in the hope that it will be useful, |
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 GNU Lesser General Public License for more details. |
|
13 |
|
14 You should have received a copy of the GNU Lesser General Public License |
|
15 along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
|
17 */ |
|
18 |
|
19 #ifndef PHONON_MMF_EFFECTPARAMETER_H |
|
20 #define PHONON_MMF_EFFECTPARAMETER_H |
|
21 |
|
22 #include <phonon/effectparameter.h> |
|
23 |
|
24 QT_BEGIN_NAMESPACE |
|
25 |
|
26 namespace Phonon |
|
27 { |
|
28 namespace MMF |
|
29 { |
|
30 |
|
31 /** |
|
32 * @short Parameter value for an audio effect |
|
33 * |
|
34 * The base class is extended in order to work around a shortcoming |
|
35 * in Phonon::EffectWidget. This widget only displays sliders for |
|
36 * parameters with numeric values if the variant type of the parameter |
|
37 * is QReal and the range is exactly -1.0 to +1.0; otherwise, a |
|
38 * spinbox is used to set numeric parameters. This is rather |
|
39 * inconvenient for many effects, such as the audio equalizer, for |
|
40 * which a slider is a much more natural UI control. |
|
41 * |
|
42 * For many such parameters, we therefore report the type to be QReal |
|
43 * and the range to be -1.0 to +1.0. This class stores the actual |
|
44 * integer range for the parameter, and provides the toInternalValue |
|
45 * function for converting between the client-side floating point |
|
46 * value and the internal integer value. |
|
47 */ |
|
48 class EffectParameter : public Phonon::EffectParameter |
|
49 { |
|
50 public: |
|
51 EffectParameter(); |
|
52 EffectParameter(int parameterId, const QString &name, Hints hints, |
|
53 const QVariant &defaultValue, const QVariant &min = QVariant(), |
|
54 const QVariant &max = QVariant(), const QVariantList &values = QVariantList(), |
|
55 const QString &description = QString()); |
|
56 |
|
57 void setInternalRange(qint32 min, qint32 max); |
|
58 qint32 toInternalValue(qreal external) const; |
|
59 |
|
60 static qreal toExternalValue(qint32 value, qint32 min, qint32 max); |
|
61 |
|
62 private: |
|
63 bool m_hasInternalRange; |
|
64 QPair<qint32, qint32> m_internalRange; |
|
65 |
|
66 }; |
|
67 |
|
68 } |
|
69 } |
|
70 |
|
71 QT_END_NAMESPACE |
|
72 |
|
73 #endif |
|
74 |