From c6523a0c04cf61d807de32df7f54ea26a58f2dbc Mon Sep 17 00:00:00 2001 From: <> Date: Sun, 11 Apr 2010 14:35:52 +0200 Subject: [PATCH] Ability to copy stream url Fixed video title in status bar --- src/MediaView.cpp | 21 +++++++++++++++++---- src/MediaView.h | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/MediaView.cpp b/src/MediaView.cpp index c1b1e3c..1a14660 100644 --- a/src/MediaView.cpp +++ b/src/MediaView.cpp @@ -179,17 +179,17 @@ void MediaView::stateChanged(Phonon::State newState, Phonon::State /*oldState*/) switch (newState) { - case Phonon::ErrorState: + case Phonon::ErrorState: qDebug() << "Phonon error:" << mediaObject->errorString() << mediaObject->errorType(); handleError(mediaObject->errorString()); break; - case Phonon::PlayingState: + case Phonon::PlayingState: //qDebug("playing"); videoAreaWidget->showVideo(); break; - case Phonon::StoppedState: + case Phonon::StoppedState: //qDebug("stopped"); // play() has already been called when setting the source // but Phonon on Linux needs a little more help to start playback @@ -273,7 +273,7 @@ void MediaView::activeRowChanged(int row) { timerPlayFlag = false; // video title in the statusbar - QMainWindow* mainWindow = dynamic_cast(qApp->topLevelWidgets().first()); + QMainWindow* mainWindow = dynamic_cast(window()); if (mainWindow) mainWindow->statusBar()->showMessage(video->title()); // see you in gotStreamUrl... @@ -361,6 +361,19 @@ void MediaView::openWebPage() { QDesktopServices::openUrl(video->webpage()); } +void MediaView::copyVideoLink() { + Video* video = listModel->activeVideo(); + QString message; + if (video) { + QApplication::clipboard()->setText(video->getStreamUrl().toString()); + message = tr("You can now paste the video link into another application. The link will be valid only for a limited time."); + } else { + message = tr("No video is playing. The link has not been copied."); + } + QMainWindow* mainWindow = dynamic_cast(window()); + if (mainWindow) mainWindow->statusBar()->showMessage(message); +} + void MediaView::removeSelected() { if (!listView->selectionModel()->hasSelection()) return; QModelIndexList indexes = listView->selectionModel()->selectedIndexes(); diff --git a/src/MediaView.h b/src/MediaView.h index 954540d..c4ddd4c 100644 --- a/src/MediaView.h +++ b/src/MediaView.h @@ -42,6 +42,7 @@ public slots: void skip(); void skipVideo(); void openWebPage(); + void copyVideoLink(); void removeSelected(); void moveUpSelected(); void moveDownSelected(); -- 2.39.5