Plasma
videowidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLASMA_VIDEOWIDGET_H
00021 #define PLASMA_VIDEOWIDGET_H
00022
00023 #include <QtGui/QGraphicsProxyWidget>
00024
00025 #include <plasma/plasma_export.h>
00026
00027 namespace Phonon {
00028 class VideoWidget;
00029 class MediaObject;
00030 class AudioOutput;
00031 }
00032
00033 class KUrl;
00034
00035 namespace Plasma
00036 {
00037
00038 class VideoWidgetPrivate;
00039
00048 class PLASMA_EXPORT VideoWidget : public QGraphicsProxyWidget
00049 {
00050 Q_OBJECT
00051
00052 Q_PROPERTY(QString url READ url WRITE setUrl)
00053 Q_PROPERTY(qint64 currentTime READ currentTime)
00054 Q_PROPERTY(qint64 totalTime READ totalTime)
00055 Q_PROPERTY(qint64 remainingTime READ remainingTime)
00056 Q_PROPERTY(Controls usedControls READ usedControls WRITE setUsedControls)
00057 Q_PROPERTY(bool controlsVisible READ controlsVisible WRITE setControlsVisible)
00058 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
00059 Q_ENUMS(Control)
00060
00061 public:
00062 enum Control {
00063 NoControls = 0,
00064 Play = 1,
00065 Pause = 2,
00066 Stop = 4,
00067 PlayPause = 8,
00068 Previous = 16,
00069 Next = 32,
00070 Progress = 64,
00071 Volume = 128,
00072 OpenFile = 128,
00073 DefaultControls = PlayPause|Progress|Volume|OpenFile
00074 };
00075 Q_DECLARE_FLAGS(Controls, Control)
00076
00077 explicit VideoWidget(QGraphicsWidget *parent = 0);
00078 ~VideoWidget();
00079
00084 void setUrl(const QString &url);
00085
00089 QString url() const;
00090
00095 Q_INVOKABLE Phonon::MediaObject *mediaObject() const;
00096
00101 Q_INVOKABLE Phonon::AudioOutput *audioOutput() const;
00102
00106 qint64 currentTime() const;
00107
00111 qint64 totalTime() const;
00112
00116 qint64 remainingTime() const;
00117
00124 void setUsedControls(const Controls controls);
00125
00130 Controls usedControls() const;
00131
00138 void setControlsVisible(bool visible);
00139
00143 bool controlsVisible() const;
00144
00150 void setStyleSheet(const QString &stylesheet);
00151
00155 QString styleSheet();
00156
00160 Phonon::VideoWidget *nativeWidget() const;
00161
00162 public Q_SLOTS:
00163
00167 void play();
00168
00172 void pause();
00173
00177 void stop();
00178
00183 void seek(qint64 time);
00184
00185 Q_SIGNALS:
00190 void tick(qint64 time);
00191
00195 void aboutToFinish();
00196
00201 void nextRequested();
00202
00207 void previousRequested();
00208
00209 protected:
00210 void resizeEvent(QGraphicsSceneResizeEvent *event);
00211 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
00212 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
00213 void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
00214
00215 private:
00216 VideoWidgetPrivate * const d;
00217
00218 Q_PRIVATE_SLOT(d, void playPause())
00219 Q_PRIVATE_SLOT(d, void ticked(qint64 progress))
00220 Q_PRIVATE_SLOT(d, void totalTimeChanged(qint64 time))
00221 Q_PRIVATE_SLOT(d, void setPosition(int progress))
00222 Q_PRIVATE_SLOT(d, void setVolume(int value))
00223 Q_PRIVATE_SLOT(d, void volumeChanged(qreal value))
00224 Q_PRIVATE_SLOT(d, void showOpenFileDialog())
00225 Q_PRIVATE_SLOT(d, void stateChanged(Phonon::State newState, Phonon::State oldState))
00226 Q_PRIVATE_SLOT(d, void hideControlWidget())
00227 Q_PRIVATE_SLOT(d, void slidingCompleted(QGraphicsItem *item))
00228 };
00229
00230 }
00231
00232 #endif // multiple inclusion guard