Global Spacebar Play (#7762)
This PR refactors how the spacebar is handled by the editors and the MainWindow to allow it to play/stop (Shift+Space for play/pause) the last played editor, no matter if it is in focus or not. --------- Co-authored-by: Fawn <rubiefawn@gmail.com> Co-authored-by: Sotonye Atemie <satemiej@gmail.com>
This commit is contained in:
@@ -57,6 +57,13 @@ protected:
|
||||
DropToolBar * addDropToolBar(QWidget * parent, Qt::ToolBarArea whereToAdd, QString const & windowTitle);
|
||||
|
||||
void closeEvent(QCloseEvent * event) override;
|
||||
void keyPressEvent(QKeyEvent *ke) override;
|
||||
public slots:
|
||||
//! Called by pressing the space key. Plays or stops.
|
||||
void togglePlayStop();
|
||||
//! Called by pressing shift+space. Toggles pause state.
|
||||
void togglePause();
|
||||
|
||||
protected slots:
|
||||
virtual void play() {}
|
||||
virtual void record() {}
|
||||
@@ -65,12 +72,6 @@ protected slots:
|
||||
virtual void stop() {}
|
||||
|
||||
private slots:
|
||||
/// Called by pressing the space key. Plays or stops.
|
||||
void togglePlayStop();
|
||||
|
||||
/// Called by pressing shift+space. Toggles pause state.
|
||||
void togglePause();
|
||||
|
||||
void toggleMaximize();
|
||||
|
||||
signals:
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
void contextMenuEvent(QContextMenuEvent*) override;
|
||||
void mousePressEvent(QMouseEvent*) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent*) override;
|
||||
bool eventFilter(QObject* dist, QEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* ke) override;
|
||||
|
||||
void reset();
|
||||
int channelIndex() const { return m_channelIndex; }
|
||||
|
||||
@@ -257,6 +257,7 @@ public:
|
||||
return m_playMode;
|
||||
}
|
||||
|
||||
PlayMode lastPlayMode() const { return m_lastPlayMode; }
|
||||
inline PlayPos & getPlayPos( PlayMode pm )
|
||||
{
|
||||
return m_playPos[static_cast<std::size_t>(pm)];
|
||||
@@ -492,6 +493,7 @@ private:
|
||||
std::array<Timeline, PlayModeCount> m_timelines;
|
||||
|
||||
PlayMode m_playMode;
|
||||
PlayMode m_lastPlayMode;
|
||||
PlayPos m_playPos[PlayModeCount];
|
||||
bar_t m_length;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user