diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index 6b4cceb7..45285a4d 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.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); diff --git a/src/domain/UBGraphicsMediaItem.cpp b/src/domain/UBGraphicsMediaItem.cpp index 0ad9e810..7c48853a 100644 --- a/src/domain/UBGraphicsMediaItem.cpp +++ b/src/domain/UBGraphicsMediaItem.cpp @@ -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); } diff --git a/src/domain/UBGraphicsMediaItemDelegate.cpp b/src/domain/UBGraphicsMediaItemDelegate.cpp index dcd1ae2d..a268c460 100644 --- a/src/domain/UBGraphicsMediaItemDelegate.cpp +++ b/src/domain/UBGraphicsMediaItemDelegate.cpp @@ -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 diff --git a/src/domain/UBGraphicsMediaItemDelegate.h b/src/domain/UBGraphicsMediaItemDelegate.h index 31097cc0..a9e20041 100644 --- a/src/domain/UBGraphicsMediaItemDelegate.h +++ b/src/domain/UBGraphicsMediaItemDelegate.h @@ -50,7 +50,7 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate bool mousePressEvent(QGraphicsSceneMouseEvent* event); - void showToolBar(); + void showToolBar(bool autohide = true); public slots: