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