| 1 |
/* This file is part of the KDE project |
| 2 |
Copyright (C) 2006-2007 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 |
#ifndef PHONON_UI_VOLUMESLIDER_H |
| 24 |
#define PHONON_UI_VOLUMESLIDER_H |
| 25 |
|
| 26 |
#include "phonon_export.h" |
| 27 |
#include "phonondefs.h" |
| 28 |
#include <QtGui/QWidget> |
| 29 |
|
| 30 |
QT_BEGIN_HEADER |
| 31 |
QT_BEGIN_NAMESPACE |
| 32 |
|
| 33 |
#ifndef QT_NO_PHONON_VOLUMESLIDER |
| 34 |
|
| 35 |
namespace Phonon |
| 36 |
{ |
| 37 |
class AudioOutput; |
| 38 |
class VolumeSliderPrivate; |
| 39 |
|
| 40 |
/** \class VolumeSlider volumeslider.h Phonon/VolumeSlider |
| 41 |
* \short Widget providing a slider to control the volume of an AudioOutput. |
| 42 |
* |
| 43 |
* \ingroup PhononWidgets |
| 44 |
* \author Matthias Kretz <kretz@kde.org> |
| 45 |
*/ |
| 46 |
class PHONON_EXPORT VolumeSlider : public QWidget |
| 47 |
{ |
| 48 |
Q_OBJECT |
| 49 |
K_DECLARE_PRIVATE(VolumeSlider) |
| 50 |
/** |
| 51 |
* This property holds the maximum volume that can be set with this slider. |
| 52 |
* |
| 53 |
* By default the maximum value is 1.0 (100%). |
| 54 |
*/ |
| 55 |
Q_PROPERTY(qreal maximumVolume READ maximumVolume WRITE setMaximumVolume) |
| 56 |
/** |
| 57 |
* This property holds the orientation of the slider. |
| 58 |
* |
| 59 |
* The orientation must be Qt::Vertical (the default) or Qt::Horizontal. |
| 60 |
*/ |
| 61 |
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) |
| 62 |
|
| 63 |
/** |
| 64 |
* This property holds whether slider tracking is enabled. |
| 65 |
* |
| 66 |
* If tracking is enabled (the default), the volume changes |
| 67 |
* while the slider is being dragged. If tracking is |
| 68 |
* disabled, the volume changes only when the user |
| 69 |
* releases the slider. |
| 70 |
*/ |
| 71 |
Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking) |
| 72 |
|
| 73 |
/** |
| 74 |
* This property holds the page step. |
| 75 |
* |
| 76 |
* The larger of two natural steps that a slider provides and |
| 77 |
* typically corresponds to the user pressing PageUp or PageDown. |
| 78 |
* |
| 79 |
* Defaults to 5 (5% of the voltage). |
| 80 |
*/ |
| 81 |
Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep) |
| 82 |
|
| 83 |
/** |
| 84 |
* This property holds the single step. |
| 85 |
* |
| 86 |
* The smaller of two natural steps that a slider provides and |
| 87 |
* typically corresponds to the user pressing an arrow key. |
| 88 |
* |
| 89 |
* Defaults to 1 (1% of the voltage). |
| 90 |
*/ |
| 91 |
Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep) |
| 92 |
|
| 93 |
/** |
| 94 |
* This property holds whether the mute button/icon next to the slider is visible. |
| 95 |
* |
| 96 |
* By default the mute button/icon is visible. |
| 97 |
*/ |
| 98 |
Q_PROPERTY(bool muteVisible READ isMuteVisible WRITE setMuteVisible) |
| 99 |
|
| 100 |
/** |
| 101 |
* \brief the icon size used for the mute button/icon. |
| 102 |
* |
| 103 |
* The default size is defined by the GUI style. |
| 104 |
*/ |
| 105 |
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) |
| 106 |
public: |
| 107 |
/** |
| 108 |
* Constructs a new volume slider with a \p parent. |
| 109 |
*/ |
| 110 |
explicit VolumeSlider(QWidget *parent = 0); |
| 111 |
explicit VolumeSlider(AudioOutput *, QWidget *parent = 0); |
| 112 |
~VolumeSlider(); |
| 113 |
|
| 114 |
bool hasTracking() const; |
| 115 |
void setTracking(bool tracking); |
| 116 |
int pageStep() const; |
| 117 |
void setPageStep(int milliseconds); |
| 118 |
int singleStep() const; |
| 119 |
void setSingleStep(int milliseconds); |
| 120 |
bool isMuteVisible() const; |
| 121 |
QSize iconSize() const; |
| 122 |
qreal maximumVolume() const; |
| 123 |
Qt::Orientation orientation() const; |
| 124 |
AudioOutput *audioOutput() const; |
| 125 |
|
| 126 |
public Q_SLOTS: |
| 127 |
void setMaximumVolume(qreal); |
| 128 |
void setOrientation(Qt::Orientation); |
| 129 |
void setMuteVisible(bool); |
| 130 |
void setIconSize(const QSize &size); |
| 131 |
|
| 132 |
/** |
| 133 |
* Sets the audio output object to be controlled by this slider. |
| 134 |
*/ |
| 135 |
void setAudioOutput(Phonon::AudioOutput *); |
| 136 |
|
| 137 |
protected: |
| 138 |
VolumeSliderPrivate *const k_ptr; |
| 139 |
|
| 140 |
private: |
| 141 |
Q_PRIVATE_SLOT(k_ptr, void _k_sliderChanged(int)) |
| 142 |
Q_PRIVATE_SLOT(k_ptr, void _k_volumeChanged(qreal)) |
| 143 |
Q_PRIVATE_SLOT(k_ptr, void _k_mutedChanged(bool)) |
| 144 |
Q_PRIVATE_SLOT(k_ptr, void _k_buttonClicked()) |
| 145 |
}; |
| 146 |
|
| 147 |
} // namespace Phonon |
| 148 |
|
| 149 |
#endif //QT_NO_PHONON_VOLUMESLIDER |
| 150 |
|
| 151 |
QT_END_NAMESPACE |
| 152 |
QT_END_HEADER |
| 153 |
|
| 154 |
// vim: sw=4 ts=4 et |
| 155 |
#endif // PHONON_UI_VOLUMESLIDER_H |