Refactor Global Spacebar Play (#7926)

This PR simplifies #7762 by removing the editor-specific code from MainWindow and m_lastPlayMode from Song, and instead uses a static variable in Editor which keeps track of the last played editor.

This PR also removes the spacebar shortcut from MixerChannelView for changing the volume, as multiple users have noticed that it clashes with their intuition after getting used to the spacebar working everywhere else.
This commit is contained in:
regulus79
2025-08-14 10:08:04 -04:00
committed by GitHub
parent 0d6cbbdf5e
commit 981e266613
6 changed files with 16 additions and 30 deletions

View File

@@ -51,6 +51,7 @@ class Editor : public QMainWindow
public:
void setPauseIcon(bool displayPauseIcon=true);
QAction *playAction() const;
static Editor* lastPlayedEditor() { return s_lastPlayedEditor; }
protected:
DropToolBar * addDropToolBarToTop(QString const & windowTitle);
DropToolBar * addDropToolBar(Qt::ToolBarArea whereToAdd, QString const & windowTitle);
@@ -73,6 +74,8 @@ protected slots:
private slots:
void toggleMaximize();
private:
inline static Editor* s_lastPlayedEditor = nullptr;
signals:

View File

@@ -254,7 +254,6 @@ public:
return m_playMode;
}
PlayMode lastPlayMode() const { return m_lastPlayMode; }
inline PlayPos & getPlayPos( PlayMode pm )
{
return m_playPos[static_cast<std::size_t>(pm)];
@@ -490,7 +489,6 @@ private:
std::array<Timeline, PlayModeCount> m_timelines;
PlayMode m_playMode;
PlayMode m_lastPlayMode;
PlayPos m_playPos[PlayModeCount];
bar_t m_length;