Video item: make *sure* progress bar doesn't hide at end of playback

preferencesAboutTextFull
Craig Watson 9 years ago
parent dd5105b023
commit 4257ab6ffc
  1. 2
      src/domain/UBGraphicsItemDelegate.h
  2. 2
      src/domain/UBGraphicsMediaItem.cpp
  3. 8
      src/domain/UBGraphicsMediaItemDelegate.cpp
  4. 2
      src/domain/UBGraphicsMediaItemDelegate.h

@ -296,7 +296,7 @@ class UBGraphicsItemDelegate : public QObject
void setUBFlags(UBGraphicsFlags pf);
void setUBFlag(UBGraphicsFlags pf, bool set = true);
virtual void showToolBar() {}
virtual void showToolBar(bool autohide = true) {}
signals:
void showOnDisplayChanged(bool shown);

@ -514,7 +514,7 @@ void UBGraphicsVideoItem::videoSizeChanged(QSizeF newSize)
this->setSize(newSize.width(), newSize.height());
else // Make sure the toolbar doesn't disappear
Delegate()->showToolBar();
Delegate()->showToolBar(false);
}

@ -77,7 +77,7 @@ bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *even
* The toolbar then auto-hides after a set amount of time, if the video is currently
* playing or is paused.
*/
void UBGraphicsMediaItemDelegate::showToolBar()
void UBGraphicsMediaItemDelegate::showToolBar(bool autohide)
{
mToolBarItem->show();
if (mToolBarShowTimer) {
@ -90,6 +90,10 @@ void UBGraphicsMediaItemDelegate::showToolBar()
// Don't hide the toolbar if we're at the beginning of the video
if (delegated()->mediaPosition() == delegated()->initialPos())
mToolBarShowTimer->stop();
// Don't hide the toolbar if it was explicitly requested
if (!autohide)
mToolBarShowTimer->stop();
}
}
@ -245,7 +249,7 @@ void UBGraphicsMediaItemDelegate::mediaStatusChanged(QMediaPlayer::MediaStatus s
// At the end of the video, make sure the progress bar doesn't autohide
if (status == QMediaPlayer::EndOfMedia)
showToolBar();
showToolBar(false);
// in most cases, the only necessary action is to update the play/pause state

@ -50,7 +50,7 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
bool mousePressEvent(QGraphicsSceneMouseEvent* event);
void showToolBar();
void showToolBar(bool autohide = true);
public slots:

Loading…
Cancel
Save