Plasma
videowidget.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2009 Marco Martin <notmart@gmail.com> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 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(qint32 tickInterval READ tickInterval WRITE setTickInterval) 00059 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) 00060 Q_ENUMS(Control) 00061 00062 public: 00063 enum Control { 00064 NoControls = 0, 00065 Play = 1, 00066 Pause = 2, 00067 Stop = 4, 00068 PlayPause = 8, 00069 Previous = 16, 00070 Next = 32, 00071 Progress = 64, 00072 Volume = 128, 00073 OpenFile = 128, 00074 DefaultControls = PlayPause|Progress|Volume|OpenFile 00075 }; 00076 Q_DECLARE_FLAGS(Controls, Control) 00077 00078 explicit VideoWidget(QGraphicsWidget *parent = 0); 00079 ~VideoWidget(); 00080 00085 void setUrl(const QString &url); 00086 00090 QString url() const; 00091 00096 Q_INVOKABLE Phonon::MediaObject *mediaObject() const; 00097 00102 Q_INVOKABLE Phonon::AudioOutput *audioOutput() const; 00103 00107 qint64 currentTime() const; 00108 00112 qint64 totalTime() const; 00113 00117 qint64 remainingTime() const; 00118 00125 void setUsedControls(const Controls controls); 00126 00131 Controls usedControls() const; 00132 00139 void setControlsVisible(bool visible); 00140 00144 bool controlsVisible() const; 00145 00150 void setTickInterval(qint64 interval); 00151 00157 qint64 tickInterval() const; 00158 00164 void setStyleSheet(const QString &stylesheet); 00165 00169 QString styleSheet(); 00170 00174 Phonon::VideoWidget *nativeWidget() const; 00175 00176 public Q_SLOTS: 00177 00181 void play(); 00182 00186 void pause(); 00187 00191 void stop(); 00192 00197 void seek(qint64 time); 00198 00199 Q_SIGNALS: 00204 void tick(qint64 time); 00205 00209 void aboutToFinish(); 00210 00215 void nextRequested(); 00216 00221 void previousRequested(); 00222 00223 protected: 00224 void resizeEvent(QGraphicsSceneResizeEvent *event); 00225 void hoverEnterEvent(QGraphicsSceneHoverEvent *event); 00226 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); 00227 void hoverMoveEvent(QGraphicsSceneHoverEvent *event); 00228 00229 private: 00230 VideoWidgetPrivate * const d; 00231 00232 Q_PRIVATE_SLOT(d, void playPause()) 00233 Q_PRIVATE_SLOT(d, void ticked(qint64 progress)) 00234 Q_PRIVATE_SLOT(d, void totalTimeChanged(qint64 time)) 00235 Q_PRIVATE_SLOT(d, void setPosition(int progress)) 00236 Q_PRIVATE_SLOT(d, void setVolume(int value)) 00237 Q_PRIVATE_SLOT(d, void volumeChanged(qreal value)) 00238 Q_PRIVATE_SLOT(d, void showOpenFileDialog()) 00239 Q_PRIVATE_SLOT(d, void stateChanged(Phonon::State newState, Phonon::State oldState)) 00240 Q_PRIVATE_SLOT(d, void hideControlWidget()) 00241 Q_PRIVATE_SLOT(d, void slidingCompleted()) 00242 }; 00243 00244 } // namespace Plasma 00245 00246 #endif // multiple inclusion guard
KDE 4.7 API Reference