void MediaView::copyWebPage() { Video *video = playlistModel->activeVideo(); if (!video) return; QString address = video->getWebpage(); QApplication::clipboard()->setText(address); QString message = tr("You can now paste the YouTube link into another application"); MainWindow::instance()->showMessage(message); }
void MediaView::openWebPage() { Video *video = playlistModel->activeVideo(); if (!video) return; media->pause(); QString url = video->getWebpage() + QLatin1String("&t=") + QString::number(media->position() / 1000); QDesktopServices::openUrl(url); }
void MediaView::shareViaFacebook() { Video *video = playlistModel->activeVideo(); if (!video) return; QUrl url("https://www.facebook.com/sharer.php"); QUrlQuery q; q.addQueryItem("t", video->getTitle()); q.addQueryItem("u", video->getWebpage()); url.setQuery(q); QDesktopServices::openUrl(url); }
void MediaView::shareViaTwitter() { Video *video = playlistModel->activeVideo(); if (!video) return; QUrl url("https://twitter.com/intent/tweet"); QUrlQuery q; q.addQueryItem("via", "minitubeapp"); q.addQueryItem("text", video->getTitle()); q.addQueryItem("url", video->getWebpage()); url.setQuery(q); QDesktopServices::openUrl(url); }
void MediaView::shareViaEmail() { Video *video = playlistModel->activeVideo(); if (!video) return; QUrl url("mailto:"); QUrlQuery q; q.addQueryItem("subject", video->getTitle()); const QString body = video->getTitle() + "\n" + video->getWebpage() + "\n\n" + tr("Sent from %1").arg(Constants::NAME) + "\n" + Constants::WEBSITE; q.addQueryItem("body", body); url.setQuery(q); QDesktopServices::openUrl(url); }