Skip to content

Commit

Permalink
Pass Timeline to TimeLineWIdget as a pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
regulus79 committed Dec 17, 2024
1 parent 1b3c761 commit 2a50a8c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/TimeLineWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class TimeLineWidget : public QWidget
Disabled
};

TimeLineWidget(int xoff, int yoff, float ppb, Timeline& timeline,
TimeLineWidget(int xoff, int yoff, float ppb, Timeline* timeline,
const TimePos& begin, Song::PlayMode mode, QWidget* parent);
~TimeLineWidget() override;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/AutomationEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ AutomationEditor::AutomationEditor() :

// add time-line
m_timeLine = new TimeLineWidget(VALUES_WIDTH, 0, m_ppb,
Engine::getSong()->getTimeline(Song::PlayMode::AutomationClip),
&Engine::getSong()->getTimeline(Song::PlayMode::AutomationClip),
m_currentPosition, Song::PlayMode::AutomationClip, this
);
connect(m_timeLine->model(), &Timeline::positionChanged, this, &AutomationEditor::updatePosition, Qt::QueuedConnection);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ PianoRoll::PianoRoll() :

// add time-line
m_timeLine = new TimeLineWidget(m_whiteKeyWidth, 0, m_ppb,
Engine::getSong()->getTimeline(Song::PlayMode::MidiClip),
&Engine::getSong()->getTimeline(Song::PlayMode::MidiClip),
m_currentPosition, Song::PlayMode::MidiClip, this
);
connect(m_timeLine->model(), &Timeline::positionChanged, this, &PianoRoll::updatePosition, Qt::QueuedConnection);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ SongEditor::SongEditor( Song * song ) :
m_snappingModel->setParent(this);

m_timeLine = new TimeLineWidget(m_trackHeadWidth, 32, pixelsPerBar(),
m_song->getTimeline(Song::PlayMode::Song),
&m_song->getTimeline(Song::PlayMode::Song),
m_currentPosition, Song::PlayMode::Song, this
);
connect(m_timeLine->model(), &Timeline::positionChanged, this, &SongEditor::updatePosition, Qt::QueuedConnection);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editors/TimeLineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ namespace
constexpr int MIN_BAR_LABEL_DISTANCE = 35;
}

TimeLineWidget::TimeLineWidget(const int xoff, const int yoff, const float ppb, Timeline& timeline,
TimeLineWidget::TimeLineWidget(const int xoff, const int yoff, const float ppb, Timeline* timeline,
const TimePos& begin, Song::PlayMode mode, QWidget* parent) :
QWidget{parent},
m_xOffset{xoff},
m_ppb{ppb},
m_timeline{&timeline},
m_timeline{timeline},
m_begin{begin},
m_mode{mode}
{
Expand Down

0 comments on commit 2a50a8c

Please sign in to comment.