Commit 1aefb7b2 authored by Laurent Montel's avatar Laurent Montel 😁

Add support for mute/umute

parent 1041c55c
......@@ -558,6 +558,13 @@ void ActionManagerImpl::initTabWidget(TabWidget *tabWidget)
action = KStandardAction::printPreview(d->tabWidget, SLOT(slotPrintPreview()), coll);
coll->addAction(QStringLiteral("viewer_printpreview"), action);
action = KStandardAction::printPreview(d->tabWidget, SLOT(slotMute()), coll);
coll->addAction(QStringLiteral("tab_mute"), action);
action = KStandardAction::printPreview(d->tabWidget, SLOT(slotUnMute()), coll);
coll->addAction(QStringLiteral("tab_unmute"), action);
action = new QAction(i18n("Speak Text"), this);
action->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-text-to-speech")));
coll->addAction(QStringLiteral("speak_text"), action);
......
......@@ -186,6 +186,15 @@ void ArticleViewerWebEngine::slotCopyImageLocationInFrame()
slotCopyLinkAddress();
}
void ArticleViewerWebEngine::slotMute(bool mute)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
page()->setAudioMuted(mute);
#else
Q_UNUSED(mute);
#endif
}
void ArticleViewerWebEngine::slotCopyLinkAddress()
{
if (mCurrentUrl.isEmpty()) {
......
......@@ -96,6 +96,7 @@ public Q_SLOTS:
void slotCopyLinkAddress();
void slotSaveImageOnDiskInFrame();
void slotCopyImageLocationInFrame();
void slotMute(bool mute);
Q_SIGNALS:
void signalOpenUrlRequest(Akregator::OpenUrlRequest &);
void showStatusBarMessage(const QString &link);
......
......@@ -127,6 +127,14 @@ void MainFrame::slotSaveImageOnDiskInFrame(int frameId)
mArticleViewer->articleViewerWidgetNg()->articleViewerNg()->slotSaveImageOnDiskInFrame();
}
void MainFrame::slotMute(int frameId, bool mute)
{
if (frameId != 0) {
return;
}
mArticleViewer->articleViewerWidgetNg()->articleViewerNg()->slotMute(mute);
}
void MainFrame::slotCopyImageLocationInFrame(int frameId)
{
if (frameId != 0) {
......
......@@ -57,6 +57,7 @@ public Q_SLOTS:
void slotFindTextInFrame(int frameId);
void slotCopyImageLocationInFrame(int frameId);
void slotSaveImageOnDiskInFrame(int frameId);
void slotMute(int frameId, bool mute);
private:
KParts::ReadOnlyPart *m_part;
Akregator::ArticleViewerWidget *mArticleViewer;
......
......@@ -205,3 +205,11 @@ void WebEngineFrame::slotCopyImageLocationInFrame(int frameId)
mArticleViewerWidgetNg->articleViewerNg()->slotCopyImageLocationInFrame();
}
void WebEngineFrame::slotMute(int frameId, bool mute)
{
if (frameId != id()) {
return;
}
mArticleViewerWidgetNg->articleViewerNg()->slotMute(mute);
}
......@@ -54,6 +54,7 @@ public Q_SLOTS:
void slotCopyLinkAsInFrame(int frameId);
void slotSaveImageOnDiskInFrame(int frameId);
void slotCopyImageLocationInFrame(int frameId);
void slotMute(int frameId, bool mute);
Q_SIGNALS:
void signalIconChanged(Akregator::Frame *, const QIcon &icon);
......
......@@ -256,6 +256,7 @@ MainWidget::MainWidget(Part *part, QWidget *parent, ActionManagerImpl *actionMan
connect(m_tabWidget, &TabWidget::signalCopyLinkAsInFrame, m_mainFrame, &MainFrame::slotCopyLinkAsInFrame);
connect(m_tabWidget, &TabWidget::signalCopyImageLocation, m_mainFrame, &MainFrame::slotCopyImageLocationInFrame);
connect(m_tabWidget, &TabWidget::signalSaveImageOnDisk, m_mainFrame, &MainFrame::slotSaveImageOnDiskInFrame);
connect(m_tabWidget, &TabWidget::signalMute, m_mainFrame, &MainFrame::slotMute);
Kernel::self()->frameManager()->slotAddFrame(m_mainFrame);
......@@ -369,6 +370,7 @@ void MainWidget::connectFrame(Akregator::WebEngineFrame *frame)
connect(m_tabWidget, &TabWidget::signalCopyLinkAsInFrame, frame, &WebEngineFrame::slotCopyLinkAsInFrame);
connect(m_tabWidget, &TabWidget::signalCopyImageLocation, frame, &WebEngineFrame::slotCopyImageLocationInFrame);
connect(m_tabWidget, &TabWidget::signalSaveImageOnDisk, frame, &WebEngineFrame::slotSaveImageOnDiskInFrame);
connect(m_tabWidget, &TabWidget::signalMute, frame, &WebEngineFrame::slotMute);
connect(frame, &WebEngineFrame::showStatusBarMessage, this, &MainWidget::slotShowStatusBarMessage);
connect(frame, &WebEngineFrame::signalIconChanged, m_tabWidget, &TabWidget::slotSetIcon);
......
......@@ -478,6 +478,16 @@ void TabWidget::slotSaveImageOnDisk()
Q_EMIT signalSaveImageOnDisk(d->currentFrame()->id());
}
void TabWidget::slotUnMute()
{
Q_EMIT signalMute(d->currentFrame()->id(), false);
}
void TabWidget::slotMute()
{
Q_EMIT signalMute(d->currentFrame()->id(), true);
}
void TabWidget::slotCopyImageLocation()
{
Q_EMIT signalCopyImageLocation(d->currentFrame()->id());
......
......@@ -69,6 +69,8 @@ public Q_SLOTS:
void slotSaveLinkAs();
void slotCopyImageLocation();
void slotSaveImageOnDisk();
void slotUnMute();
void slotMute();
Q_SIGNALS:
void signalCurrentFrameChanged(int);
void signalRemoveFrameRequest(int);
......@@ -83,6 +85,7 @@ Q_SIGNALS:
void signalCopyLinkAsInFrame(int currentFrame);
void signalCopyImageLocation(int currentFrame);
void signalSaveImageOnDisk(int currentFrame);
void signalMute(int currentFrame, bool);
private:
void tabInserted(int) Q_DECL_OVERRIDE;
void tabRemoved(int) Q_DECL_OVERRIDE;
......
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