return i;
}
-MediaView::MediaView(QWidget *parent) : QWidget(parent)
+MediaView::MediaView(QWidget *parent) : View(parent)
, stopped(false)
, downloadItem(0)
#ifdef APP_SNAPSHOT
SearchParams* MediaView::getSearchParams() {
VideoSource *videoSource = playlistModel->getVideoSource();
if (videoSource && videoSource->metaObject()->className() == QLatin1String("YTSearch")) {
- YTSearch *search = dynamic_cast<YTSearch *>(videoSource);
+ YTSearch *search = qobject_cast<YTSearch *>(videoSource);
return search->getSearchParams();
}
return 0;
QSlider *slider = MainWindow::instance()->getSlider();
slider->setEnabled(false);
slider->setValue(0);
+#else
+ Phonon::SeekSlider *slider = MainWindow::instance()->getSeekSlider();
#endif
+#ifdef APP_SNAPSHOT
if (snapshotSettings) {
delete snapshotSettings;
snapshotSettings = 0;
}
+#endif
}
const QString & MediaView::getCurrentVideoId() {
slider->setValue(0);
#endif
+#ifdef APP_SNAPSHOT
if (snapshotSettings) {
delete snapshotSettings;
snapshotSettings = 0;
MainWindow::instance()->adjustStatusBarVisibility();
}
+#endif
// see you in gotStreamUrl...
}
#ifdef APP_PHONON
qint64 currentTime = mediaObject->currentTime();
qint64 totalTime = mediaObject->totalTime();
- qDebug() << __PRETTY_FUNCTION__ << currentTime << totalTime;
+ // qDebug() << __PRETTY_FUNCTION__ << currentTime << totalTime;
if (totalTime < 1 || currentTime + 10000 < totalTime) {
// QTimer::singleShot(500, this, SLOT(playbackResume()));
mediaObject->seek(currentTime);
#ifdef APP_PHONON
const qint64 totalTime = mediaObject->totalTime();
const qint64 currentTime = mediaObject->currentTime();
- qDebug() << __PRETTY_FUNCTION__ << mediaObject->currentTime() << totalTime;
+ // qDebug() << __PRETTY_FUNCTION__ << mediaObject->currentTime() << totalTime;
// add 10 secs for imprecise Phonon backends (VLC, Xine)
if (currentTime > 0 && currentTime + 10000 < totalTime) {
// mediaObject->seek(currentTime);
if (stopped) return;
#ifdef APP_PHONON
const qint64 currentTime = mediaObject->currentTime();
- qDebug() << __PRETTY_FUNCTION__ << currentTime;
+ // qDebug() << __PRETTY_FUNCTION__ << currentTime;
if (currentTime > 0)
mediaObject->seek(currentTime);
mediaObject->play();
#ifdef APP_PHONON
mediaObject->pause();
#endif
- QDesktopServices::openUrl(video->webpage());
+ QString url = video->webpage() + QLatin1String("&t=") + QString::number(mediaObject->currentTime() / 1000);
+ QDesktopServices::openUrl(url);
}
void MediaView::copyWebPage() {
#endif
QMessageBox msgBox(this);
- msgBox.setIconPixmap(QPixmap(":/images/app.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ msgBox.setIconPixmap(IconUtils::pixmap(":/images/app.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
msgBox.setText(tr("This is just the demo version of %1.").arg(Constants::NAME));
msgBox.setInformativeText(tr("It allows you to test the application and see if it works for you."));
msgBox.setModal(true);
Video* video = playlistModel->activeVideo();
if (!video) return;
DownloadManager::instance()->addItem(video);
- The::globalActions()->value("downloads")->setVisible(true);
+ MainWindow::instance()->showActionInStatusBar(The::globalActions()->value("downloads"), true);
QString message = tr("Downloading %1").arg(video->title());
MainWindow::instance()->showMessage(message);
}
QString userId = video->channelId();
if (userId.isEmpty()) return;
bool subscribed = YTChannel::isSubscribed(userId);
- if (subscribed) YTChannel::unsubscribe(userId);
- else YTChannel::subscribe(userId);
+ if (subscribed) {
+ YTChannel::unsubscribe(userId);
+ MainWindow::instance()->showMessage(tr("Unsubscribed from %1").arg(video->channelTitle()));
+ } else {
+ YTChannel::subscribe(userId);
+ MainWindow::instance()->showMessage(tr("Subscribed to %1").arg(video->channelTitle()));
+ }
updateSubscriptionAction(video, !subscribed);
}