Don't hide video progress bar unless video is playing or paused

preferencesAboutTextFull
Craig Watson 9 years ago
parent d14b556050
commit 09c0649792
  1. 2
      src/domain/UBGraphicsMediaItem.h
  2. 16
      src/domain/UBGraphicsMediaItemDelegate.cpp

@ -83,6 +83,8 @@ public:
qint64 mediaPosition() const;
QMediaPlayer::State playerState() const;
bool isPlaying() const { return (mMediaObject->state() == QMediaPlayer::PlayingState); }
bool isPaused() const { return (mMediaObject->state() == QMediaPlayer::PausedState); }
QRectF boundingRect() const;

@ -74,13 +74,23 @@ bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *even
/**
* @brief Show the toolbar (play/pause, seek, mute).
*
* The toolbar then auto-hides after a set amount of time.
* The toolbar then auto-hides after a set amount of time, if the video is currently
* playing or is paused.
*/
void UBGraphicsMediaItemDelegate::showToolBar()
{
mToolBarItem->show();
if (mToolBarShowTimer)
mToolBarShowTimer->start();
if (mToolBarShowTimer) {
if (delegated()->isPlaying() || delegated()->isPaused())
mToolBarShowTimer->start();
else
mToolBarShowTimer->stop();
// Don't hide the toolbar if we're at the beginning of the video
if (delegated()->mediaPosition() == delegated()->initialPos())
mToolBarShowTimer->stop();
}
}
void UBGraphicsMediaItemDelegate::hideToolBar()

Loading…
Cancel
Save