| 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_SEEKSLIDER_H |
| 24 |
#define PHONON_UI_SEEKSLIDER_H |
| 25 |
|
| 26 |
#include "phonon_export.h" |
| 27 |
#include "phonondefs.h" |
| 28 |
#include "phononnamespace.h" |
| 29 |
#include <QtGui/QWidget> |
| 30 |
|
| 31 |
QT_BEGIN_HEADER |
| 32 |
QT_BEGIN_NAMESPACE |
| 33 |
|
| 34 |
#ifndef QT_NO_PHONON_SEEKSLIDER |
| 35 |
|
| 36 |
namespace Phonon |
| 37 |
{ |
| 38 |
class MediaObject; |
| 39 |
|
| 40 |
class SeekSliderPrivate; |
| 41 |
|
| 42 |
/** \class SeekSlider seekslider.h Phonon/SeekSlider |
| 43 |
* \short Widget providing a slider for seeking in MediaObject objects. |
| 44 |
* |
| 45 |
* \ingroup PhononWidgets |
| 46 |
* \author Matthias Kretz <kretz@kde.org> |
| 47 |
*/ |
| 48 |
class PHONON_EXPORT SeekSlider : public QWidget |
| 49 |
{ |
| 50 |
Q_OBJECT |
| 51 |
K_DECLARE_PRIVATE(SeekSlider) |
| 52 |
/** |
| 53 |
* This property holds whether the icon next to the slider is visible. |
| 54 |
* |
| 55 |
* By default the icon is visible if the platform provides an icon; else |
| 56 |
* it's hidden. |
| 57 |
*/ |
| 58 |
Q_PROPERTY(bool iconVisible READ isIconVisible WRITE setIconVisible) |
| 59 |
|
| 60 |
/** |
| 61 |
* This property holds whether slider tracking is enabled. |
| 62 |
* |
| 63 |
* If tracking is enabled (the default), the media seeks |
| 64 |
* while the slider is being dragged. If tracking is |
| 65 |
* disabled, the media seeks only when the user |
| 66 |
* releases the slider. |
| 67 |
*/ |
| 68 |
Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking) |
| 69 |
|
| 70 |
/** |
| 71 |
* This property holds the page step. |
| 72 |
* |
| 73 |
* The larger of two natural steps that a slider provides and |
| 74 |
* typically corresponds to the user pressing PageUp or PageDown. |
| 75 |
* |
| 76 |
* Defaults to 5 seconds. |
| 77 |
*/ |
| 78 |
Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep) |
| 79 |
|
| 80 |
/** |
| 81 |
* This property holds the single step. |
| 82 |
* |
| 83 |
* The smaller of two natural steps that a slider provides and |
| 84 |
* typically corresponds to the user pressing an arrow key. |
| 85 |
* |
| 86 |
* Defaults to 0.5 seconds. |
| 87 |
*/ |
| 88 |
Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep) |
| 89 |
|
| 90 |
/** |
| 91 |
* This property holds the orientation of the slider. |
| 92 |
* |
| 93 |
* The orientation must be Qt::Vertical or Qt::Horizontal (the default). |
| 94 |
*/ |
| 95 |
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) |
| 96 |
|
| 97 |
/** |
| 98 |
* \brief the icon size used for the mute button/icon. |
| 99 |
* |
| 100 |
* The default size is defined by the GUI style. |
| 101 |
*/ |
| 102 |
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) |
| 103 |
|
| 104 |
public: |
| 105 |
/** |
| 106 |
* Constructs a seek slider widget with the given \p parent. |
| 107 |
*/ |
| 108 |
explicit SeekSlider(QWidget *parent = 0); |
| 109 |
explicit SeekSlider(MediaObject *media, QWidget *parent = 0); |
| 110 |
|
| 111 |
/** |
| 112 |
* Destroys the seek slider. |
| 113 |
*/ |
| 114 |
~SeekSlider(); |
| 115 |
|
| 116 |
bool hasTracking() const; |
| 117 |
void setTracking(bool tracking); |
| 118 |
int pageStep() const; |
| 119 |
void setPageStep(int milliseconds); |
| 120 |
int singleStep() const; |
| 121 |
void setSingleStep(int milliseconds); |
| 122 |
Qt::Orientation orientation() const; |
| 123 |
bool isIconVisible() const; |
| 124 |
QSize iconSize() const; |
| 125 |
MediaObject *mediaObject() const; |
| 126 |
|
| 127 |
public Q_SLOTS: |
| 128 |
void setOrientation(Qt::Orientation); |
| 129 |
void setIconVisible(bool); |
| 130 |
void setIconSize(const QSize &size); |
| 131 |
|
| 132 |
/** |
| 133 |
* Sets the media object to be controlled by this slider. |
| 134 |
*/ |
| 135 |
void setMediaObject(MediaObject *); |
| 136 |
|
| 137 |
protected: |
| 138 |
SeekSliderPrivate *const k_ptr; |
| 139 |
|
| 140 |
private: |
| 141 |
Q_PRIVATE_SLOT(k_func(), void _k_stateChanged(Phonon::State)) |
| 142 |
Q_PRIVATE_SLOT(k_func(), void _k_seek(int)) |
| 143 |
Q_PRIVATE_SLOT(k_func(), void _k_tick(qint64)) |
| 144 |
Q_PRIVATE_SLOT(k_func(), void _k_length(qint64)) |
| 145 |
Q_PRIVATE_SLOT(k_func(), void _k_seekableChanged(bool)) |
| 146 |
Q_PRIVATE_SLOT(k_func(), void _k_currentSourceChanged()) |
| 147 |
}; |
| 148 |
|
| 149 |
} // namespace Phonon |
| 150 |
|
| 151 |
#endif //QT_NO_PHONON_SEEKSLIDER |
| 152 |
|
| 153 |
QT_END_NAMESPACE |
| 154 |
QT_END_HEADER |
| 155 |
|
| 156 |
// vim: sw=4 ts=4 tw=80 |
| 157 |
#endif // PHONON_UI_SEEKSLIDER_H |