Skip to content

Commit

Permalink
woverview waveformsmarks will now reflect their hotcue color
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftb0y committed Oct 6, 2018
1 parent e0d73a0 commit 29df355
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/widget/woverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ void WOverview::slotLoadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack)
this, SLOT(slotWaveformSummaryUpdated()));
connect(pNewTrack.get(), SIGNAL(analyzerProgress(int)),
this, SLOT(slotAnalyzerProgress(int)));
connect(pNewTrack.get(), SIGNAL(cuesUpdated(void)),
this, SLOT(onTrackCueChange(void)));

slotAnalyzerProgress(pNewTrack->getAnalyzerProgress());
} else {
Expand All @@ -247,14 +249,38 @@ void WOverview::onEndOfTrackChange(double v) {

void WOverview::onMarkChanged(double /*v*/) {
//qDebug() << "WOverview::onMarkChanged()" << v;
update();
onTrackCueChange();
//update();
}

void WOverview::onMarkRangeChange(double /*v*/) {
//qDebug() << "WOverview::onMarkRangeChange()" << v;
update();
}

// currently only updates the mark color but it could be easily extended.
void WOverview::onTrackCueChange(void) {

const QList<CuePointer> loadedCues = m_pCurrentTrack->getCuePoints();

for (CuePointer currentCue: loadedCues) {

const WaveformMarkPointer currentMark = m_marks.getHotCueMark(currentCue->getHotCue());

if (currentMark && currentMark->isValid()) {

WaveformMarkProperties markProperties = currentMark->getProperties();
const QColor newColor = currentCue->getColor();

if (newColor != markProperties.m_color) {
markProperties.m_color = newColor;
currentMark->setProperties(markProperties);
}
}
}
update();
}

void WOverview::mouseMoveEvent(QMouseEvent* e) {
if (m_orientation == Qt::Horizontal) {
m_iPos = math_clamp(e->x(), 0, width() - 1);
Expand Down
1 change: 1 addition & 0 deletions src/widget/woverview.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class WOverview : public WWidget {

void onMarkChanged(double v);
void onMarkRangeChange(double v);
void onTrackCueChange(void);

void slotWaveformSummaryUpdated();
void slotAnalyzerProgress(int progress);
Expand Down

0 comments on commit 29df355

Please sign in to comment.