Skip to content

Commit

Permalink
Add a shortcut to hide the VUI (#1636)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatherly and ddennedy authored Feb 27, 2025
1 parent 5437715 commit 4f9ab6f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ void MainWindow::setupAndConnectPlayerWidget()
ui->menuPlayer->addAction(Actions["playerSetInAction"]);
ui->menuPlayer->addAction(Actions["playerSetOutAction"]);
ui->menuPlayer->addAction(Actions["playerSetPositionAction"]);
ui->menuPlayer->addAction(Actions["playerToggleVui"]);
ui->menuPlayer->addAction(Actions["playerSwitchSourceProgramAction"]);
}

Expand Down Expand Up @@ -962,6 +963,7 @@ void MainWindow::connectVideoWidgetSignals()
&FilterController::currentFilterChanged,
videoWidget,
&Mlt::VideoWidget::setCurrentFilter);
connect(m_player, &Player::toggleVuiRequested, videoWidget, &Mlt::VideoWidget::toggleVuiDisplay);
}

void MainWindow::onFocusWindowChanged(QWindow *) const
Expand Down
5 changes: 5 additions & 0 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,11 @@ void Player::setupActions()
action->setProperty(Actions.hardKeyProperty, "Shift+Esc");
connect(action, &QAction::triggered, this, [&]() { setFocus(); });
Actions.add("playerFocus", action, tr("Player"));

action = new QAction(tr("Toggle Filter Overlay"), this);
action->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Q));
connect(action, &QAction::triggered, this, [&]() { emit toggleVuiRequested(); });
Actions.add("playerToggleVui", action, tr("Player"));
}

void Player::setIn(int pos)
Expand Down
1 change: 1 addition & 0 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class Player : public QWidget
void trimIn();
void trimOut();
void loopChanged(int start, int end);
void toggleVuiRequested();

public slots:
void play(double speed = 1.0);
Expand Down
10 changes: 9 additions & 1 deletion src/videowidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ VideoWidget::VideoWidget(QObject *parent)
, m_snapToGrid(true)
, m_scrubAudio(false)
, m_maxTextureSize(4096)
, m_hideVui(false)
{
LOG_DEBUG() << "begin";
setAttribute(Qt::WA_AcceptTouchEvents);
Expand Down Expand Up @@ -486,12 +487,18 @@ void VideoWidget::requestImage() const
m_frameRenderer->requestImage();
}

void VideoWidget::toggleVuiDisplay()
{
m_hideVui = !m_hideVui;
refreshConsumer();
}

void VideoWidget::onFrameDisplayed(const SharedFrame &frame)
{
m_mutex.lock();
m_sharedFrame = frame;
m_mutex.unlock();
bool isVui = frame.get_int(kShotcutVuiMetaProperty);
bool isVui = frame.get_int(kShotcutVuiMetaProperty) && !m_hideVui;
if (!isVui && source() != QmlUtilities::blankVui()) {
m_savedQmlSource = source();
setSource(QmlUtilities::blankVui());
Expand Down Expand Up @@ -533,6 +540,7 @@ void VideoWidget::setOffsetY(int y)

void VideoWidget::setCurrentFilter(QmlFilter *filter, QmlMetadata *meta)
{
m_hideVui = false;
if (meta && meta->type() == QmlMetadata::Filter
&& QFile::exists(meta->vuiFilePath().toLocalFile())) {
filter->producer().set(kShotcutVuiMetaProperty, 1);
Expand Down
2 changes: 2 additions & 0 deletions src/videowidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class VideoWidget : public QQuickWidget, public Controller
void requestImage() const;
bool snapToGrid() const { return m_snapToGrid; }
int maxTextureSize() const { return m_maxTextureSize; }
void toggleVuiDisplay();

public slots:
void setGrid(int grid);
Expand Down Expand Up @@ -137,6 +138,7 @@ public slots:
float m_zoom;
QPoint m_offset;
QUrl m_savedQmlSource;
bool m_hideVui;
bool m_snapToGrid;
QTimer m_refreshTimer;
bool m_scrubAudio;
Expand Down

0 comments on commit 4f9ab6f

Please sign in to comment.