Commit 6f5b2329 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

presentation: Show better the status of the "playing" button

This fixes the issue that it's not obvious how to stop the next page
timer if a pdf has defined a given duration.

BUGS: 432416
parent f8fa27e2
Pipeline #53049 skipped
...@@ -199,7 +199,6 @@ PresentationWidget::PresentationWidget(QWidget *parent, Okular::Document *doc, D ...@@ -199,7 +199,6 @@ PresentationWidget::PresentationWidget(QWidget *parent, Okular::Document *doc, D
playPauseAct->setEnabled(true); playPauseAct->setEnabled(true);
connect(playPauseAct, &QAction::triggered, this, &PresentationWidget::slotTogglePlayPause); connect(playPauseAct, &QAction::triggered, this, &PresentationWidget::slotTogglePlayPause);
m_topBar->addAction(playPauseAct); m_topBar->addAction(playPauseAct);
setPlayPauseIcon();
addAction(playPauseAct); addAction(playPauseAct);
m_topBar->addSeparator(); m_topBar->addSeparator();
...@@ -257,6 +256,7 @@ PresentationWidget::PresentationWidget(QWidget *parent, Okular::Document *doc, D ...@@ -257,6 +256,7 @@ PresentationWidget::PresentationWidget(QWidget *parent, Okular::Document *doc, D
m_nextPageTimer = new QTimer(this); m_nextPageTimer = new QTimer(this);
m_nextPageTimer->setSingleShot(true); m_nextPageTimer->setSingleShot(true);
connect(m_nextPageTimer, &QTimer::timeout, this, &PresentationWidget::slotNextPage); connect(m_nextPageTimer, &QTimer::timeout, this, &PresentationWidget::slotNextPage);
setPlayPauseIcon();
connect(m_document, &Okular::Document::processMovieAction, this, &PresentationWidget::slotProcessMovieAction); connect(m_document, &Okular::Document::processMovieAction, this, &PresentationWidget::slotProcessMovieAction);
connect(m_document, &Okular::Document::processRenditionAction, this, &PresentationWidget::slotProcessRenditionAction); connect(m_document, &Okular::Document::processRenditionAction, this, &PresentationWidget::slotProcessRenditionAction);
...@@ -500,7 +500,7 @@ void PresentationWidget::setupActions() ...@@ -500,7 +500,7 @@ void PresentationWidget::setupActions()
void PresentationWidget::setPlayPauseIcon() void PresentationWidget::setPlayPauseIcon()
{ {
QAction *playPauseAction = m_ac->action(QStringLiteral("presentation_play_pause")); QAction *playPauseAction = m_ac->action(QStringLiteral("presentation_play_pause"));
if (m_advanceSlides) { if (m_nextPageTimer->isActive()) {
playPauseAction->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause"))); playPauseAction->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause")));
playPauseAction->setToolTip(i18nc("For Presentation", "Pause")); playPauseAction->setToolTip(i18nc("For Presentation", "Pause"));
} else { } else {
...@@ -1339,6 +1339,7 @@ void PresentationWidget::startAutoChangeTimer() ...@@ -1339,6 +1339,7 @@ void PresentationWidget::startAutoChangeTimer()
m_nextPageTimer->start((int)(secs * 1000)); m_nextPageTimer->start((int)(secs * 1000));
} }
setPlayPauseIcon();
} }
QScreen *PresentationWidget::defaultScreen() const QScreen *PresentationWidget::defaultScreen() const
...@@ -2229,12 +2230,13 @@ void PresentationWidget::slotProcessRenditionAction(const Okular::RenditionActio ...@@ -2229,12 +2230,13 @@ void PresentationWidget::slotProcessRenditionAction(const Okular::RenditionActio
void PresentationWidget::slotTogglePlayPause() void PresentationWidget::slotTogglePlayPause()
{ {
m_advanceSlides = !m_advanceSlides; if (!m_nextPageTimer->isActive()) {
setPlayPauseIcon(); m_advanceSlides = true;
if (m_advanceSlides) {
startAutoChangeTimer(); startAutoChangeTimer();
} else { } else {
m_nextPageTimer->stop(); m_nextPageTimer->stop();
m_advanceSlides = false;
setPlayPauseIcon();
} }
} }
......
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