Phonon

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

KDE's Doxygen guidelines are available online.