From: Flavio Tordini Date: Mon, 12 Apr 2010 22:13:42 +0000 (+0200) Subject: Added ability to copy the YouTube link to the clipboard X-Git-Tag: 1.0~17 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6724d5dd8a92e48cf070002dec3118fe3bcdc537;p=minitube Added ability to copy the YouTube link to the clipboard Removed unused code for the "back" action Removed PayPal from donation strings Removed the "Technology Preview" paragraph --- diff --git a/src/AboutView.cpp b/src/AboutView.cpp index 020b4e1..5ae3512 100644 --- a/src/AboutView.cpp +++ b/src/AboutView.cpp @@ -21,14 +21,13 @@ AboutView::AboutView(QWidget *parent) : QWidget(parent) { "

" + tr("Version %1").arg(Constants::VERSION) + "

" + QString("

%1

").arg(Constants::WEBSITE) + - "

" + tr("This is a \"Technology Preview\" release, do not expect it to be perfect.") + "
" - + tr("Report bugs and send in your ideas to %1") - .arg(QString("%1").arg(Constants::EMAIL)) + "

" - "

" + tr("%1 is Free Software but its development takes precious time.").arg(Constants::APP_NAME) + "
" - + tr("Please donate via PayPal to support the continued development of %2.") + + tr("Please donate to support the continued development of %2.") .arg(QString(Constants::WEBSITE).append("#donate"), Constants::APP_NAME) + "

" + "

" + tr("Report bugs and send in your ideas to %1") + .arg(QString("%1").arg(Constants::EMAIL)) + "

" + "

" + tr("Icon designed by %1.").arg("Sebastian Kraft") + "
" + tr("Compact mode contributed by %1.").arg("Stefan Brück") diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 42bf542..897f1da 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -77,13 +77,6 @@ void MainWindow::createActions() { QMap *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(Qt::Key_Escape) << QKeySequence(Qt::Key_MediaStop)); @@ -120,16 +113,23 @@ void MainWindow::createActions() { 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())); @@ -178,7 +178,7 @@ void MainWindow::createActions() { 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())); @@ -278,6 +278,7 @@ void MainWindow::createMenus() { viewMenu->addAction(skipAct); viewMenu->addSeparator(); viewMenu->addAction(webPageAct); + viewMenu->addAction(copyPageAct); viewMenu->addAction(copyLinkAct); viewMenu->addSeparator(); viewMenu->addAction(compactViewAct); @@ -308,7 +309,10 @@ void MainWindow::createToolBars() { } mainToolBar->setFont(smallerFont); +#ifdef Q_WS_MAC mainToolBar->setIconSize(QSize(32, 32)); +#endif + mainToolBar->addAction(stopAct); mainToolBar->addAction(pauseAct); mainToolBar->addAction(skipAct); @@ -415,11 +419,11 @@ void MainWindow::showWidget ( QWidget* widget ) { 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); @@ -565,7 +569,9 @@ void MainWindow::fullscreen() { // 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 diff --git a/src/MainWindow.h b/src/MainWindow.h index 9c297d2..bdb1396 100755 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -97,6 +97,7 @@ private: QAction *fullscreenAct; QAction *compactViewAct; QAction *webPageAct; + QAction *copyPageAct; QAction *copyLinkAct; QAction *downloadAct; QAction *volumeUpAct; diff --git a/src/MediaView.cpp b/src/MediaView.cpp index 1a14660..2e2d8bc 100644 --- a/src/MediaView.cpp +++ b/src/MediaView.cpp @@ -361,15 +361,21 @@ void MediaView::openWebPage() { QDesktopServices::openUrl(video->webpage()); } +void MediaView::copyWebPage() { + Video* video = listModel->activeVideo(); + if (!video) return; + QApplication::clipboard()->setText(video->webpage().toString()); + QMainWindow* mainWindow = dynamic_cast(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(window()); if (mainWindow) mainWindow->statusBar()->showMessage(message); } diff --git a/src/MediaView.h b/src/MediaView.h index c4ddd4c..f26f22a 100644 --- a/src/MediaView.h +++ b/src/MediaView.h @@ -42,6 +42,7 @@ public slots: void skip(); void skipVideo(); void openWebPage(); + void copyWebPage(); void copyVideoLink(); void removeSelected(); void moveUpSelected();