diff --git a/widgets/videowidget.cpp b/widgets/videowidget.cpp index 9b58bff47..f2e0ee4da 100644 --- a/widgets/videowidget.cpp +++ b/widgets/videowidget.cpp @@ -50,10 +50,12 @@ public: hideTimer(0), shownControls(VideoWidget::NoControls), controlsWidget(0), + previousButton(0), playButton(0), pauseButton(0), stopButton(0), playPauseButton(0), + nextButton(0), progress(0), volume(0), openFileButton(0) @@ -93,10 +95,12 @@ public: QTimer *hideTimer; VideoWidget::Controls shownControls; Plasma::Frame *controlsWidget; + IconWidget *previousButton; IconWidget *playButton; IconWidget *pauseButton; IconWidget *stopButton; IconWidget *playPauseButton; + IconWidget *nextButton; Slider *progress; Slider *volume; IconWidget *openFileButton; @@ -307,6 +311,18 @@ void VideoWidget::setUsedControls(const Controls controls) controlsLayout->removeAt(0); } + if (controls&Previous) { + if (!d->previousButton) { + d->previousButton = new IconWidget(d->controlsWidget); + d->previousButton->setIcon("media-playback-start"); + connect(d->playButton, SIGNAL(clicked()), this, SLOT(PreviousRequested())); + } + controlsLayout->addItem(d->previousButton); + } else { + d->previousButton->deleteLater(); + d->previousButton = 0; + } + if (controls&Play) { if (!d->playButton) { d->playButton = new IconWidget(d->controlsWidget); @@ -355,6 +371,18 @@ void VideoWidget::setUsedControls(const Controls controls) d->playPauseButton = 0; } + if (controls&Next) { + if (!d->nextButton) { + d->nextButton = new IconWidget(d->nextButton); + d->nextButton->setIcon("media-playback-start"); + connect(d->nextButton, SIGNAL(clicked()), this, SIGNAL(nextRequested())); + } + controlsLayout->addItem(d->nextButton); + } else { + d->nextButton->deleteLater(); + d->nextButton = 0; + } + connect(d->media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State, Phonon::State))); @@ -435,7 +463,6 @@ void VideoWidget::stop() d->media->stop(); } - void VideoWidget::seek(qint64 time) { d->media->seek(time); diff --git a/widgets/videowidget.h b/widgets/videowidget.h index 3ddbe4e12..5db75a4fb 100644 --- a/widgets/videowidget.h +++ b/widgets/videowidget.h @@ -65,8 +65,10 @@ public: Pause = 2, Stop = 4, PlayPause = 8, - Progress = 32, - Volume = 64, + Previous = 16, + Next = 32, + Progress = 64, + Volume = 128, OpenFile = 128, DefaultControls = PlayPause|Progress|Volume|OpenFile }; @@ -158,6 +160,7 @@ public: Phonon::VideoWidget *nativeWidget() const; public Q_SLOTS: + /** * Play the current file */ @@ -191,6 +194,16 @@ Q_SIGNALS: */ void aboutToFinish(); + /** + * The user pressed the "next" button + */ + void nextRequested(); + + /** + * The user pressed the "previous" button + */ + void previousRequested(); + protected: void resizeEvent(QGraphicsSceneResizeEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);