]> git.sur5r.net Git - minitube/commitdiff
Share via Buffer app
authorFlavio <flavio@odisseo.local>
Mon, 13 Aug 2012 15:02:50 +0000 (17:02 +0200)
committerFlavio <flavio@odisseo.local>
Mon, 13 Aug 2012 15:02:50 +0000 (17:02 +0200)
src/MainWindow.cpp
src/MediaView.cpp
src/MediaView.h
src/playlistview.cpp

index e9b6a0bf05042062e5a9f6043cb82c5023c40950..600d794ea4fe3514aafba66a9e7a08fcc5ba5263 100644 (file)
@@ -407,6 +407,11 @@ void MainWindow::createActions() {
     actions->insert("facebook", action);
     connect(action, SIGNAL(triggered()), mediaView, SLOT(shareViaFacebook()));
 
+    action = new QAction("&Buffer", this);
+    action->setStatusTip(shareTip.arg("Buffer"));
+    actions->insert("buffer", action);
+    connect(action, SIGNAL(triggered()), mediaView, SLOT(shareViaBuffer()));
+
     action = new QAction(tr("&Email"), this);
     action->setStatusTip(shareTip.arg(tr("Email")));
     actions->insert("email", action);
@@ -534,6 +539,8 @@ void MainWindow::createMenus() {
     shareMenu->addSeparator();
     shareMenu->addAction(The::globalActions()->value("twitter"));
     shareMenu->addAction(The::globalActions()->value("facebook"));
+    shareMenu->addAction(The::globalActions()->value("buffer"));
+    shareMenu->addSeparator();
     shareMenu->addAction(The::globalActions()->value("email"));
 
 #ifdef APP_MAC
@@ -1276,7 +1283,6 @@ void MainWindow::toggleDownloads(bool show) {
 }
 
 void MainWindow::startToolbarSearch(QString query) {
-
     query = query.trimmed();
 
     // check for empty query
index 8ad65ba547cea808a1ad2d915195d2f1cd3b5da9..50736ae3972f6a2ce83cfc1c46a7fd4877acdf30 100644 (file)
@@ -845,6 +845,18 @@ void MediaView::shareViaFacebook() {
     QDesktopServices::openUrl(url);
 }
 
+void MediaView::shareViaBuffer() {
+    Video* video = listModel->activeVideo();
+    if (!video) return;
+    QUrl url("http://bufferapp.com/add");
+    url.addQueryItem("via", "minitubeapp");
+    url.addQueryItem("text", video->title());
+    url.addQueryItem("url", video->webpage().toString());
+    if (!video->thumbnailUrls().isEmpty())
+        url.addQueryItem("picture", video->thumbnailUrls().first().toString());
+    QDesktopServices::openUrl(url);
+}
+
 void MediaView::shareViaEmail() {
     Video* video = listModel->activeVideo();
     if (!video) return;
index a69bef3467954867a1ef377ac54b37c2b257bd29..e4dec2aea48008b1c0168071cae0f1fd91219dbe 100644 (file)
@@ -55,6 +55,7 @@ public slots:
     void copyVideoLink();
     void shareViaTwitter();
     void shareViaFacebook();
+    void shareViaBuffer();
     void shareViaEmail();
     void removeSelected();
     void moveUpSelected();
index 2705c4dd8590181950cbeec0c2e52cb2ebaebf49..d976b094728452853d3a5913a3b1aea7a88a339a 100644 (file)
@@ -18,6 +18,7 @@ void PlaylistView::leaveEvent(QEvent * /* event */) {
 }
 
 void PlaylistView::mouseMoveEvent(QMouseEvent *event) {
+    QListView::mouseMoveEvent(event);
     QWidget::mouseMoveEvent(event);
 
     if (isHoveringAuthor(event)) {