QMap<QString, QAction*> *actions = The::globalActions();
- backAct = new QAction(tr("&Back"), this);
- backAct->setEnabled(false);
- backAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Left));
- backAct->setStatusTip(tr("Go to the previous view"));
- actions->insert("back", backAct);
- connect(backAct, SIGNAL(triggered()), this, SLOT(goBack()));
-
stopAct = new QAction(QtIconLoader::icon("media-playback-stop", QIcon(":/images/media-playback-stop.png")), tr("&Stop"), this);
stopAct->setStatusTip(tr("Stop playback and go back to the search view"));
stopAct->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::Key_Escape) << QKeySequence(Qt::Key_MediaStop));
actions->insert("compactView", compactViewAct);
connect(compactViewAct, SIGNAL(toggled(bool)), this, SLOT(compactView(bool)));
- webPageAct = new QAction(tr("Open &YouTube page"), this);
- webPageAct->setStatusTip(tr("Open the YouTube video page and pause playback"));
+ webPageAct = new QAction(tr("Open the &YouTube page"), this);
+ webPageAct->setStatusTip(tr("Go to the YouTube video page and pause playback"));
webPageAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y));
webPageAct->setEnabled(false);
actions->insert("webpage", webPageAct);
connect(webPageAct, SIGNAL(triggered()), mediaView, SLOT(openWebPage()));
- copyLinkAct = new QAction(tr("Copy video &link"), this);
- copyLinkAct->setStatusTip(tr("Copy the current stream URL to the clipboard"));
- copyLinkAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
+ copyPageAct = new QAction(tr("Copy the YouTube &link"), this);
+ copyPageAct->setStatusTip(tr("Copy the current video YouTube link to the clipboard"));
+ copyPageAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
+ copyPageAct->setEnabled(false);
+ actions->insert("pagelink", copyPageAct);
+ connect(copyPageAct, SIGNAL(triggered()), mediaView, SLOT(copyWebPage()));
+
+ copyLinkAct = new QAction(tr("Copy the video stream &URL"), this);
+ copyLinkAct->setStatusTip(tr("Copy the current video stream URL to the clipboard"));
+ copyLinkAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U));
copyLinkAct->setEnabled(false);
actions->insert("videolink", copyLinkAct);
connect(copyLinkAct, SIGNAL(triggered()), mediaView, SLOT(copyVideoLink()));
actions->insert("site", siteAct);
connect(siteAct, SIGNAL(triggered()), this, SLOT(visitSite()));
- donateAct = new QAction(tr("&Donate via PayPal"), this);
+ donateAct = new QAction(tr("&Donate"), this);
donateAct->setStatusTip(tr("Please support the continued development of %1").arg(Constants::APP_NAME));
actions->insert("donate", donateAct);
connect(donateAct, SIGNAL(triggered()), this, SLOT(donate()));
viewMenu->addAction(skipAct);
viewMenu->addSeparator();
viewMenu->addAction(webPageAct);
+ viewMenu->addAction(copyPageAct);
viewMenu->addAction(copyLinkAct);
viewMenu->addSeparator();
viewMenu->addAction(compactViewAct);
}
mainToolBar->setFont(smallerFont);
+#ifdef Q_WS_MAC
mainToolBar->setIconSize(QSize(32, 32));
+#endif
+
mainToolBar->addAction(stopAct);
mainToolBar->addAction(pauseAct);
mainToolBar->addAction(skipAct);
statusBar()->showMessage((metadata.value("description").toString()));
}
- // backAct->setEnabled(history->size() > 1);
stopAct->setEnabled(widget == mediaView);
fullscreenAct->setEnabled(widget == mediaView);
compactViewAct->setEnabled(widget == mediaView);
webPageAct->setEnabled(widget == mediaView);
+ copyPageAct->setEnabled(widget == mediaView);
copyLinkAct->setEnabled(widget == mediaView);
aboutAct->setEnabled(widget != aboutView);
// Also no Youtube action since it opens a new window
webPageAct->setVisible(m_fullscreen);
+ copyPageAct->setVisible(m_fullscreen);
copyLinkAct->setVisible(m_fullscreen);
+
stopAct->setVisible(m_fullscreen);
// workaround: prevent focus on the search bar
QDesktopServices::openUrl(video->webpage());
}
+void MediaView::copyWebPage() {
+ Video* video = listModel->activeVideo();
+ if (!video) return;
+ QApplication::clipboard()->setText(video->webpage().toString());
+ QMainWindow* mainWindow = dynamic_cast<QMainWindow*>(window());
+ QString message = tr("You can now paste the YouTube link into another application");
+ if (mainWindow) mainWindow->statusBar()->showMessage(message);
+}
+
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.");
- }
+ if (!video) return;
+ QApplication::clipboard()->setText(video->getStreamUrl().toString());
+ QString message = tr("You can now paste the video stream URL into another application")
+ + ". " + tr("The link will be valid only for a limited time.");
QMainWindow* mainWindow = dynamic_cast<QMainWindow*>(window());
if (mainWindow) mainWindow->statusBar()->showMessage(message);
}