| 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 VOLUMESLIDER_P_H |
| 24 |
#define VOLUMESLIDER_P_H |
| 25 |
|
| 26 |
#include "volumeslider.h" |
| 27 |
#include "swiftslider_p.h" |
| 28 |
#include <QtGui/QBoxLayout> |
| 29 |
#include <QtGui/QLabel> |
| 30 |
#include <QtGui/QPixmap> |
| 31 |
#include <QtGui/QToolButton> |
| 32 |
#include "factory_p.h" |
| 33 |
#include "audiooutput.h" |
| 34 |
#include <QtGui/QIcon> |
| 35 |
#include <QtCore/QPointer> |
| 36 |
#include "platform_p.h" |
| 37 |
|
| 38 |
QT_BEGIN_NAMESPACE |
| 39 |
|
| 40 |
#ifndef QT_NO_PHONON_VOLUMESLIDER |
| 41 |
|
| 42 |
namespace Phonon |
| 43 |
{ |
| 44 |
class VolumeSliderPrivate |
| 45 |
{ |
| 46 |
Q_DECLARE_PUBLIC(VolumeSlider) |
| 47 |
protected: |
| 48 |
VolumeSliderPrivate(VolumeSlider *parent) |
| 49 |
: q_ptr(parent), |
| 50 |
layout(QBoxLayout::LeftToRight, parent), |
| 51 |
slider(Qt::Horizontal, parent), |
| 52 |
muteButton(parent), |
| 53 |
volumeIcon(Platform::icon(QLatin1String("player-volume"), parent->style())), |
| 54 |
mutedIcon(Platform::icon(QLatin1String("player-volume-muted"), parent->style())), |
| 55 |
output(0), |
| 56 |
ignoreVolumeChange(false) |
| 57 |
{ |
| 58 |
slider.setRange(0, 100); |
| 59 |
slider.setPageStep(5); |
| 60 |
slider.setSingleStep(1); |
| 61 |
|
| 62 |
muteButton.setIcon(volumeIcon); |
| 63 |
muteButton.setAutoRaise(true); |
| 64 |
layout.setMargin(0); |
| 65 |
layout.setSpacing(2); |
| 66 |
layout.addWidget(&muteButton, 0, Qt::AlignVCenter); |
| 67 |
layout.addWidget(&slider, 0, Qt::AlignVCenter); |
| 68 |
|
| 69 |
slider.setEnabled(false); |
| 70 |
muteButton.setEnabled(false); |
| 71 |
|
| 72 |
if (volumeIcon.isNull()) { |
| 73 |
muteButton.setVisible(false); |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
VolumeSlider *q_ptr; |
| 78 |
|
| 79 |
void _k_sliderChanged(int); |
| 80 |
void _k_volumeChanged(qreal); |
| 81 |
void _k_mutedChanged(bool); |
| 82 |
void _k_buttonClicked(); |
| 83 |
|
| 84 |
private: |
| 85 |
QBoxLayout layout; |
| 86 |
SwiftSlider slider; |
| 87 |
QToolButton muteButton; |
| 88 |
QIcon volumeIcon; |
| 89 |
QIcon mutedIcon; |
| 90 |
|
| 91 |
QPointer<AudioOutput> output; |
| 92 |
bool ignoreVolumeChange; |
| 93 |
}; |
| 94 |
} // namespace Phonon |
| 95 |
|
| 96 |
#endif //QT_NO_PHONON_VOLUMESLIDER |
| 97 |
|
| 98 |
QT_END_NAMESPACE |
| 99 |
|
| 100 |
#endif // VOLUMESLIDER_P_H |
| 101 |
// vim: sw=4 sts=4 et tw=100 |