[gwenview/Applications/18.04] /: Align slideshow terminology to MPRIS behaviour

Henrik Fehlauer null at kde.org
Wed Mar 21 09:27:29 UTC 2018


Git commit beef8f3b0f6f23f1b8f48f954063b5ac232de221 by Henrik Fehlauer.
Committed on 21/03/2018 at 09:27.
Pushed by rkflx into branch 'Applications/18.04'.

Align slideshow terminology to MPRIS behaviour

Summary:
9631043c110d introduced MPRIS support to Gwenview. Common MPRIS
controllers often only provide "Pause" in the main interface, with
"Stop" being non-existent or hidden. Therefore "holding" the slideshow
was mapped to "Pause". "Play" either "Resumes" automatically advancing
to the next image, or in non-fullscreen mode switches to fullscreen and
starts playback. Conversely, "Stop" ends playback and exits from
fullscreen.

To keep consistency, we change the tooltip text of the fullscreen button
controlling the playback to "Pause". In addition, the internal `enum` is
adapted accordingly to avoid confusing developers.

Note that the icon on the button still shows a "Pause" symbol as before
the patch.

Ref T8222

Test Plan:
Start Gwenview normally, with `-f` and with `-s`, and observe the
tooltip of the playback button in the top fullscreen toolbar as well as
the button text in non-fullscreen mode (use {nav Configure Toolbars} to
add it) make sense in every situation.

Reviewers: #gwenview, kossebau, muhlenpfordt

Reviewed By: #gwenview, muhlenpfordt

Subscribers: ltoscano, muhlenpfordt, huoni, kde-doc-english

Maniphest Tasks: T8222

Differential Revision: https://phabricator.kde.org/D11495

M  +5    -4    app/mainwindow.cpp
M  +1    -1    doc/index.docbook
M  +1    -1    lib/mpris2/mprismediaplayer2player.cpp
M  +8    -8    lib/slideshow.cpp
M  +2    -2    lib/slideshow.h

https://commits.kde.org/gwenview/beef8f3b0f6f23f1b8f48f954063b5ac232de221

diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp
index 61660ea0..c8646465 100644
--- a/app/mainwindow.cpp
+++ b/app/mainwindow.cpp
@@ -1324,7 +1324,7 @@ void MainWindow::toggleFullScreen(bool checked)
         qApp->setProperty("KDE_COLOR_SCHEME_PATH", QVariant());
         QApplication::setPalette(d->mGvCore->palette(GvCore::NormalPalette));
 
-        d->mSlideShow->stop();
+        d->mSlideShow->pause();
         KToggleFullScreenAction::setFullScreen(this, false);
         menuBar()->setVisible(d->mShowMenuBarAction->isChecked());
         toolBar()->setVisible(d->mStateBeforeFullScreen.mToolBarVisible);
@@ -1402,7 +1402,7 @@ void MainWindow::showDocumentInFullScreen(const QUrl &url)
 void MainWindow::toggleSlideShow()
 {
     if (d->mSlideShow->isRunning()) {
-        d->mSlideShow->stop();
+        d->mSlideShow->pause();
     } else {
         if (!d->mViewAction->isChecked()) {
             d->mViewAction->trigger();
@@ -1433,10 +1433,11 @@ void MainWindow::toggleSlideShow()
 void MainWindow::updateSlideShowAction()
 {
     if (d->mSlideShow->isRunning()) {
-        d->mToggleSlideShowAction->setText(i18n("Stop Slideshow"));
+        d->mToggleSlideShowAction->setText(i18n("Pause Slideshow"));
         d->mToggleSlideShowAction->setIcon(QIcon::fromTheme("media-playback-pause"));
     } else {
-        d->mToggleSlideShowAction->setText(i18n("Start Slideshow"));
+        d->mToggleSlideShowAction->setText(d->mFullScreenAction->isChecked() ? i18n("Resume Slideshow")
+                                                                             : i18n("Start Slideshow"));
         d->mToggleSlideShowAction->setIcon(QIcon::fromTheme("media-playback-start"));
     }
 }
diff --git a/doc/index.docbook b/doc/index.docbook
index 7b54f939..95730450 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -376,7 +376,7 @@ mouse to the top of the screen. If the mouse cursor is over the top bar, it
 will not autohide. Most of the buttons on the bar are the same as the ones on
 the toolbar in Browse or View Modes, except for the <guiicon>Exit Full
 Screen Mode</guiicon> button which returns you to the &gwenview; window, the
-<guiicon>Start/Stop Slideshow</guiicon> button, and the
+<guiicon>Pause/Resume Slideshow</guiicon> button, and the
 <guiicon>Configure Full Screen Mode</guiicon> button which shows a
 small settings dialog that allows you to easily and quickly configure the
 slideshow. The slideshow controls there are: </para>
diff --git a/lib/mpris2/mprismediaplayer2player.cpp b/lib/mpris2/mprismediaplayer2player.cpp
index 19abe4a7..530c6e73 100644
--- a/lib/mpris2/mprismediaplayer2player.cpp
+++ b/lib/mpris2/mprismediaplayer2player.cpp
@@ -136,7 +136,7 @@ bool MprisMediaPlayer2Player::canPause() const
 
 void MprisMediaPlayer2Player::Pause()
 {
-    mSlideShow->stop();
+    mSlideShow->pause();
 }
 
 void MprisMediaPlayer2Player::PlayPause()
diff --git a/lib/slideshow.cpp b/lib/slideshow.cpp
index f14a27e9..019b7a6a 100644
--- a/lib/slideshow.cpp
+++ b/lib/slideshow.cpp
@@ -50,7 +50,7 @@ namespace Gwenview
 #endif
 
 enum State {
-    Stopped,
+    Paused,
     Started,
     WaitForEndOfUrl
 };
@@ -177,7 +177,7 @@ SlideShow::SlideShow(QObject* parent)
 : QObject(parent)
 , d(new SlideShowPrivate)
 {
-    d->mState = Stopped;
+    d->mState = Paused;
 
     d->mTimer = new QTimer(this);
     connect(d->mTimer, &QTimer::timeout, this, &SlideShow::goToNextUrl);
@@ -264,11 +264,11 @@ int SlideShow::position() const
     return 0;
 }
 
-void SlideShow::stop()
+void SlideShow::pause()
 {
     LOG("Stopping timer");
     d->mTimer->stop();
-    d->mState = Stopped;
+    d->mState = Paused;
     stateChanged(false);
 }
 
@@ -286,7 +286,7 @@ void SlideShow::goToNextUrl()
     QUrl url = d->findNextUrl();
     LOG("url:" << url);
     if (!url.isValid()) {
-        stop();
+        pause();
         return;
     }
     goToUrl(url);
@@ -301,14 +301,14 @@ void SlideShow::setCurrentUrl(const QUrl &url)
     d->mCurrentUrl = url;
     // Restart timer to avoid showing new url for the remaining time of the old
     // url
-    if (d->mState != Stopped) {
+    if (d->mState != Paused) {
         d->doStart();
     }
 }
 
 bool SlideShow::isRunning() const
 {
-    return d->mState != Stopped;
+    return d->mState != Paused;
 }
 
 void SlideShow::updateConfig()
@@ -319,7 +319,7 @@ void SlideShow::updateConfig()
 
 void SlideShow::slotRandomActionToggled(bool on)
 {
-    if (on && d->mState != Stopped) {
+    if (on && d->mState != Paused) {
         d->initShuffledUrls();
     }
 }
diff --git a/lib/slideshow.h b/lib/slideshow.h
index f7058064..fa7e1bdb 100644
--- a/lib/slideshow.h
+++ b/lib/slideshow.h
@@ -43,7 +43,7 @@ public:
     virtual ~SlideShow();
 
     void start(const QList<QUrl>& urls);
-    void stop();
+    void pause();
 
     QAction* loopAction() const;
     QAction* randomAction() const;
@@ -72,7 +72,7 @@ public Q_SLOTS:
 Q_SIGNALS:
     void goToUrl(const QUrl&);
     /**
-     * Slideshow has been started or stopped
+     * Slideshow has been started or paused
      */
     void stateChanged(bool running);
     /**


More information about the kde-doc-english mailing list