Commit 2d003895 authored by Laurent Montel's avatar Laurent Montel 😁

Add support for media mute/unmute

parent e1a9884a
......@@ -87,6 +87,12 @@ ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *p
mWebShortcutMenuManager = new KIO::KUriFilterSearchProviderActions(this);
mShareServiceManager = new PimCommon::ShareServiceUrlManager(this);
connect(mShareServiceManager, &PimCommon::ShareServiceUrlManager::serviceUrlSelected, this, &ArticleViewerWebEngine::slotServiceUrlSelected);
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
connect(page(), &QWebEnginePage::audioMutedChanged,
this, &ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged);
connect(page(), &QWebEnginePage::recentlyAudibleChanged,
this, &ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged);
#endif
}
ArticleViewerWebEngine::~ArticleViewerWebEngine()
......@@ -94,6 +100,12 @@ ArticleViewerWebEngine::~ArticleViewerWebEngine()
}
void ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged()
{
Q_EMIT webPageMutedOrAudibleChanged(page()->isAudioMuted(), page()->recentlyAudible());
}
QWebEngineView *ArticleViewerWebEngine::createWindow(QWebEnginePage::WebWindowType type)
{
qDebug() << " QWebEngineView *ArticleViewerWebEngine::createWindow(QWebEnginePage::WebWindowType type) not implemented yet" << type;
......
......@@ -103,6 +103,7 @@ Q_SIGNALS:
void articleAction(Akregator::ArticleViewerWebEngine::ArticleAction type, const QString &articleId, const QString &feed);
void findTextInHtml();
void textToSpeech();
void webPageMutedOrAudibleChanged(bool isAudioMuted, bool wasRecentlyAudible);
protected:
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
......@@ -125,6 +126,7 @@ private Q_SLOTS:
void slotShowContextMenu(const QPoint &pos);
void slotWebHitFinished(const WebEngineViewer::WebHitTestResult &result);
void slotActivatePlugin(MessageViewer::ViewerPluginInterface *interface);
void slotWebPageMutedOrAudibleChanged();
protected:
ArticleViewerWebEnginePage *mPageEngine;
......
......@@ -39,6 +39,7 @@ WebEngineFrame::WebEngineFrame(KActionCollection *ac, QWidget *parent)
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::loadStarted, this, &WebEngineFrame::slotLoadStarted);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::loadFinished, this, &WebEngineFrame::slotLoadFinished);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::showStatusBarMessage, this, &WebEngineFrame::showStatusBarMessage);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::webPageMutedOrAudibleChanged, this, &WebEngineFrame::slotWebPageMutedOrAudibleChanged);
layout->addWidget(mArticleViewerWidgetNg);
}
......@@ -46,6 +47,11 @@ WebEngineFrame::~WebEngineFrame()
{
}
void WebEngineFrame::slotWebPageMutedOrAudibleChanged(bool isAudioMuted, bool wasRecentlyAudible)
{
Q_EMIT webPageMutedOrAudibleChanged(this, isAudioMuted, wasRecentlyAudible);
}
void WebEngineFrame::slotLoadFinished()
{
Q_EMIT signalCompleted(this);
......
......@@ -57,12 +57,14 @@ public Q_SLOTS:
Q_SIGNALS:
void signalIconChanged(Akregator::Frame *, const QIcon &icon);
void webPageMutedOrAudibleChanged(Akregator::Frame *,bool isAudioMuted, bool wasRecentlyAudible);
private Q_SLOTS:
void slotTitleChanged(const QString &title);
void slotProgressChanged(int progress);
void slotLoadStarted();
void slotLoadFinished();
void slotWebPageMutedOrAudibleChanged(bool isAudioMuted, bool wasRecentlyAudible);
private:
Akregator::ArticleViewerWebEngineWidgetNg *mArticleViewerWidgetNg;
};
......
......@@ -372,7 +372,7 @@ void MainWidget::connectFrame(Akregator::WebEngineFrame *frame)
connect(frame, &WebEngineFrame::showStatusBarMessage, this, &MainWidget::slotShowStatusBarMessage);
connect(frame, &WebEngineFrame::signalIconChanged, m_tabWidget, &TabWidget::slotSetIcon);
connect(frame, &WebEngineFrame::webPageMutedOrAudibleChanged, m_tabWidget, &TabWidget::slotWebPageMutedOrAudibleChanged);
}
void MainWidget::slotRequestNewFrame(int &frameId)
......
......@@ -338,6 +338,16 @@ void TabWidget::slotSetTitle(Frame *frame, const QString &title)
d->setTitle(title, frame);
}
void TabWidget::slotWebPageMutedOrAudibleChanged(Akregator::Frame *frame, bool isAudioMuted, bool wasRecentlyAudible)
{
const int idx = indexOf(frame);
if (idx < 0) {
return;
}
//TODO
//setTabIcon(idx, icon);
}
void TabWidget::slotSetIcon(Akregator::Frame *frame, const QIcon &icon)
{
const int idx = indexOf(frame);
......
......@@ -44,6 +44,7 @@ public:
~TabWidget();
public Q_SLOTS:
void slotWebPageMutedOrAudibleChanged(Akregator::Frame *frame, bool isAudioMuted, bool wasRecentlyAudible);
void slotCopy();
void slotZoomChanged(qreal value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment