add a way to play currently loaded URL in media player - #1324
This commit is contained in:
parent
143f24c1b6
commit
408d5e19e5
@ -4,7 +4,7 @@
|
||||
Added:
|
||||
* Existing read/unread state is respected when some article gets "updated" (infamously happens for YouTube feeds). (#1279)
|
||||
* NSIS installer was bit tweaked to warn about MSVC runtime. (#1306)
|
||||
* iCalendar files (*.ics, *.ical) are now supported.
|
||||
* iCalendar files (*.ics, *.ical) are now supported. Note that the support is rather basic.
|
||||
* Added more ways of limitting amount of articles in each feed. (#1270, #1267)
|
||||
* Added way to use old legacy article formatting in "lite" version. (#1286)
|
||||
* New way of fetching articles - new "Source" -> "Built-in web browser with JavaScript support" which allows user to use built-in Chromium-based network stack to fetch feeds and other data. It allows even fetching of majority of JavaScript-powered websites. (#1313)
|
||||
|
@ -31,7 +31,10 @@ WebBrowser::WebBrowser(WebViewer* viewer, QWidget* parent)
|
||||
this)),
|
||||
m_actionReadabilePage(new QAction(qApp->icons()->fromTheme(QSL("text-html")),
|
||||
tr("View website in reader mode"),
|
||||
this)) {
|
||||
this)),
|
||||
m_actionPlayPageInMediaPlayer(new QAction(qApp->icons()->fromTheme(QSL("player_play"), QSL("media-playback-start")),
|
||||
tr("Play in media player"),
|
||||
this)) {
|
||||
if (m_webView == nullptr) {
|
||||
m_webView = qApp->createWebView();
|
||||
dynamic_cast<QWidget*>(m_webView)->setParent(this);
|
||||
@ -82,6 +85,10 @@ void WebBrowser::createConnections() {
|
||||
connect(m_actionOpenInSystemBrowser, &QAction::triggered, this, &WebBrowser::openCurrentSiteInSystemBrowser);
|
||||
connect(m_actionReadabilePage, &QAction::triggered, this, &WebBrowser::readabilePage);
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
connect(m_actionPlayPageInMediaPlayer, &QAction::triggered, this, &WebBrowser::playCurrentSiteInMediaPlayer);
|
||||
#endif
|
||||
|
||||
connect(m_txtLocation,
|
||||
&LocationLineEdit::submitted,
|
||||
this,
|
||||
@ -132,6 +139,12 @@ void WebBrowser::onZoomFactorChanged() {
|
||||
qApp->settings()->setValue(GROUP(Messages), Messages::Zoom, fact);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
void WebBrowser::playCurrentSiteInMediaPlayer() {
|
||||
qApp->mainForm()->tabWidget()->addMediaPlayer(m_webView->url().toString(), true);
|
||||
}
|
||||
#endif
|
||||
|
||||
void WebBrowser::clear(bool also_hide) {
|
||||
m_webView->clear();
|
||||
m_messages.clear();
|
||||
@ -313,6 +326,11 @@ void WebBrowser::initializeLayout() {
|
||||
m_toolBar->addAction(m_actionOpenInSystemBrowser);
|
||||
m_toolBar->addAction(m_actionReadabilePage);
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
m_actionPlayPageInMediaPlayer->setEnabled(false);
|
||||
m_toolBar->addAction(m_actionPlayPageInMediaPlayer);
|
||||
#endif
|
||||
|
||||
m_txtLocationAction = m_toolBar->addWidget(m_txtLocation);
|
||||
|
||||
m_loadingProgress = new QProgressBar(this);
|
||||
@ -337,6 +355,10 @@ void WebBrowser::onLoadingStarted() {
|
||||
m_loadingProgress->show();
|
||||
m_actionOpenInSystemBrowser->setEnabled(false);
|
||||
m_actionReadabilePage->setEnabled(false);
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
m_actionPlayPageInMediaPlayer->setEnabled(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebBrowser::onLoadingProgress(int progress) {
|
||||
@ -351,10 +373,18 @@ void WebBrowser::onLoadingFinished(bool success) {
|
||||
if (url.isValid() && !url.host().isEmpty()) {
|
||||
m_actionOpenInSystemBrowser->setEnabled(true);
|
||||
m_actionReadabilePage->setEnabled(true);
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
m_actionPlayPageInMediaPlayer->setEnabled(true);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
m_actionOpenInSystemBrowser->setEnabled(false);
|
||||
m_actionReadabilePage->setEnabled(false);
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
m_actionPlayPageInMediaPlayer->setEnabled(false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,11 @@ class WebBrowser : public TabContent {
|
||||
|
||||
private slots:
|
||||
void onZoomFactorChanged();
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
void playCurrentSiteInMediaPlayer();
|
||||
#endif
|
||||
|
||||
void openCurrentSiteInSystemBrowser();
|
||||
void updateUrl(const QUrl& url);
|
||||
void onLoadingStarted();
|
||||
@ -70,8 +75,8 @@ class WebBrowser : public TabContent {
|
||||
void newWindowRequested(WebViewer* viewer);
|
||||
|
||||
void readabilePage();
|
||||
void setReadabledHtml(QObject *sndr, const QString& better_html);
|
||||
void readabilityFailed(QObject *sndr, const QString& error);
|
||||
void setReadabledHtml(QObject* sndr, const QString& better_html);
|
||||
void readabilityFailed(QObject* sndr, const QString& error);
|
||||
|
||||
signals:
|
||||
void windowCloseRequested();
|
||||
@ -97,6 +102,11 @@ class WebBrowser : public TabContent {
|
||||
QAction* m_actionStop;
|
||||
QAction* m_actionOpenInSystemBrowser;
|
||||
QAction* m_actionReadabilePage;
|
||||
|
||||
#if defined(ENABLE_MEDIAPLAYER)
|
||||
QAction* m_actionPlayPageInMediaPlayer;
|
||||
#endif
|
||||
|
||||
QList<Message> m_messages;
|
||||
QPointer<RootItem> m_root;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user