Skip to content

Commit

Permalink
app: add spacebar playback control
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramen2X committed Dec 12, 2024
1 parent 0b484ea commit 8e25f45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/viewer/mediapanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ MediaPanel::MediaPanel(QWidget *parent) :

m_PlayBtn = new QPushButton(tr("Play"));
m_PlayBtn->setCheckable(true);
m_PlayShortcut = new QShortcut(QKeySequence(Qt::Key_Space), this);
connect(m_PlayBtn, &QPushButton::clicked, this, &MediaPanel::Play);
connect(m_PlayShortcut, &QShortcut::activated, this, [this]() { Play(!IsPlaying()); });
ctrl_layout->addWidget(m_PlayBtn);

//FinishLayout();
Expand Down
2 changes: 2 additions & 0 deletions app/viewer/mediapanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extern "C" {
#include <QCheckBox>
#include <QLabel>
#include <QPushButton>
#include <QShortcut>
#include <QSlider>
#include <QTimer>
#include "panel.h"
Expand Down Expand Up @@ -188,6 +189,7 @@ class MediaPanel : public Panel

QSlider *m_PlayheadSlider;
QPushButton *m_PlayBtn;
QShortcut *m_PlayShortcut;
QTimer *m_PlaybackTimer;
qint64 m_PlaybackStart;
float m_PlaybackOffset;
Expand Down

0 comments on commit 8e25f45

Please sign in to comment.