diff --git a/QuiteRSS.qrc b/QuiteRSS.qrc
index 856eac4d..39a286d5 100644
--- a/QuiteRSS.qrc
+++ b/QuiteRSS.qrc
@@ -120,6 +120,7 @@
html/newspaper_description.html
html/newspaper_head.html
html/newspaper_description_rtl.html
+ html/sequential_youtube_player.html
images/flags/flag_arab.png
diff --git a/html/sequential_youtube_player.html b/html/sequential_youtube_player.html
new file mode 100644
index 00000000..d1b33530
--- /dev/null
+++ b/html/sequential_youtube_player.html
@@ -0,0 +1,114 @@
+
+
+
+
+
+ YouTube Sequential Player
+
+
+
+
+
+
+
+
+
diff --git a/src/application/mainwindow.cpp b/src/application/mainwindow.cpp
index 3973e2b0..0e14da09 100755
--- a/src/application/mainwindow.cpp
+++ b/src/application/mainwindow.cpp
@@ -549,6 +549,8 @@ void MainWindow::createFeedsWidget()
this, SLOT(clearDeleted()));
connect(categoriesTree_, SIGNAL(signalMarkRead(QTreeWidgetItem*)),
this, SLOT(slotMarkReadCategory(QTreeWidgetItem*)));
+ connect(categoriesTree_, SIGNAL(signalViewAllYoutubeVideos()),
+ this, SLOT(viewAllYoutubeVideos()));
connect(showCategoriesButton_, SIGNAL(clicked()),
this, SLOT(showNewsCategoriesTree()));
connect(feedsSplitter_, SIGNAL(splitterMoved(int,int)),
@@ -7585,6 +7587,11 @@ void MainWindow::slotMarkReadCategory(QTreeWidgetItem *item)
}
}
+void MainWindow::viewAllYoutubeVideos()
+{
+ currentNewsTab->viewAllYoutubeVideos();
+}
+
/** @brief Show/Hide categories tree
*---------------------------------------------------------------------------*/
void MainWindow::showNewsCategoriesTree()
diff --git a/src/application/mainwindow.h b/src/application/mainwindow.h
index 7c882e6d..e6f25fb5 100755
--- a/src/application/mainwindow.h
+++ b/src/application/mainwindow.h
@@ -455,6 +455,7 @@ private slots:
void slotCategoriesClicked(QTreeWidgetItem *item, int, bool createTab = false);
void clearDeleted();
void slotMarkReadCategory(QTreeWidgetItem *item);
+ void viewAllYoutubeVideos();
void showNewsCategoriesTree();
void feedsSplitterMoved(int pos, int);
diff --git a/src/categoriestreewidget.cpp b/src/categoriestreewidget.cpp
index 6f62d2ac..ccce5283 100644
--- a/src/categoriestreewidget.cpp
+++ b/src/categoriestreewidget.cpp
@@ -142,6 +142,10 @@ void CategoriesTreeWidget::showContextMenuCategory(const QPoint &pos)
menu.addSeparator();
menu.addAction(tr("Mark Read"), this, SLOT(slotMarkRead()));
}
+ if (itemClicked_ == topLevelItem(UnreadItem)) {
+ menu.addSeparator();
+ menu.addAction(tr("View All Youtube Videos (Experimental)"), this, SIGNAL(signalViewAllYoutubeVideos()));
+ }
menu.exec(viewport()->mapToGlobal(pos));
}
}
diff --git a/src/categoriestreewidget.h b/src/categoriestreewidget.h
index 39413d70..4763cc53 100644
--- a/src/categoriestreewidget.h
+++ b/src/categoriestreewidget.h
@@ -57,6 +57,7 @@ class CategoriesTreeWidget : public QTreeWidget
void signalMiddleClicked();
void signalClearDeleted();
void signalMarkRead(QTreeWidgetItem *item);
+ void signalViewAllYoutubeVideos();
// void pressKeyUp();
// void pressKeyDown();
diff --git a/src/newstabwidget.cpp b/src/newstabwidget.cpp
index 835f33b8..95418d16 100644
--- a/src/newstabwidget.cpp
+++ b/src/newstabwidget.cpp
@@ -1036,6 +1036,55 @@ void NewsTabWidget::markAllNewsRead()
mainWindow_->recountCategoryCounts();
}
+void NewsTabWidget::viewAllYoutubeVideos()
+{
+ if (type_ != TabTypeUnread) return;
+ int cnt = newsModel_->rowCount();
+ if (cnt == 0) return;
+ QList allYoutubeVideoIDs;
+ for (int i = cnt-1; i > -1; --i) {
+ bool read = (newsModel_->dataField(i, "read").toInt() > 0);
+ if (read) continue; //they might still be in the Unread category but just recently read moments ago
+ QUrl htmlUrl = QUrl::fromEncoded(getLinkNews(i).toUtf8());
+ QString host = htmlUrl.host();
+ if (host == "youtube.com" || host == "www.youtube.com") {
+ QUrlQuery query(htmlUrl);
+ QString videoId = query.queryItemValue("v");
+ if (!videoId.isEmpty()) {
+ allYoutubeVideoIDs.append(videoId);
+ }
+ }
+ }
+ if (allYoutubeVideoIDs.isEmpty()) return;
+ QFile sequentialYoutubePlayerHtmlFile;
+ sequentialYoutubePlayerHtmlFile.setFileName(":/html/sequential_youtube_player");
+ sequentialYoutubePlayerHtmlFile.open(QFile::ReadOnly);
+ QString sequentialYoutubePlayerHtml = QString::fromUtf8(sequentialYoutubePlayerHtmlFile.readAll());
+ sequentialYoutubePlayerHtmlFile.close();
+
+ QString youtubeIdsAsJavascriptArray;
+ bool first = true;
+ foreach (const QString &ytId, allYoutubeVideoIDs) {
+ if (!first) {
+ youtubeIdsAsJavascriptArray += ",\n";
+ }
+ first = false;
+ youtubeIdsAsJavascriptArray += "'" + ytId + "'";
+ }
+
+ sequentialYoutubePlayerHtml = sequentialYoutubePlayerHtml.arg(youtubeIdsAsJavascriptArray);
+
+ QTemporaryFile tempFile(QDir::tempPath() + "/sequential-youtube-player-XXXXXX.html");
+ if (tempFile.open()) {
+ tempFile.setAutoRemove(false);
+ QTextStream tempFileStream(&tempFile);
+ tempFileStream << sequentialYoutubePlayerHtml;
+ tempFile.close();
+ QUrl tempFileUrl = "file://" + tempFile.fileName();
+ openUrl(tempFileUrl);
+ }
+}
+
/** @brief Mark selected news Starred
*----------------------------------------------------------------------------*/
void NewsTabWidget::markNewsStar()
diff --git a/src/newstabwidget.h b/src/newstabwidget.h
index f6d86345..b8dae8b9 100644
--- a/src/newstabwidget.h
+++ b/src/newstabwidget.h
@@ -77,6 +77,7 @@ class NewsTabWidget : public QWidget
void setBrowserPosition();
void markNewsRead();
void markAllNewsRead();
+ void viewAllYoutubeVideos();
void markNewsStar();
void setLabelNews(int labelId);
void deleteNews();