Commit beef8f3b authored by Henrik Fehlauer's avatar Henrik Fehlauer

Align slideshow terminology to MPRIS behaviour

Summary:
9631043c 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
parent 3a02df6e
......@@ -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"));
}
}
......
......@@ -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>
......
......@@ -136,7 +136,7 @@ bool MprisMediaPlayer2Player::canPause() const
void MprisMediaPlayer2Player::Pause()
{
mSlideShow->stop();
mSlideShow->pause();
}
void MprisMediaPlayer2Player::PlayPause()
......
......@@ -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();
}
}
......
......@@ -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);
/**
......
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