diff options
author | Be <be@mixxx.org> | 2019-05-07 11:12:46 -0500 |
---|---|---|
committer | Be <be@mixxx.org> | 2019-05-07 11:31:22 -0500 |
commit | c45b27f6118d142ad590c25d5a73b46c672a6ab7 (patch) | |
tree | 134ac2cf4f2bc50a67d5271b7efc29c77c469673 /src/track | |
parent | 450d409bd9b3cd621857950ed1492e737e33f2f6 (diff) |
convert Cue::CueType to enum class
Diffstat (limited to 'src/track')
-rw-r--r-- | src/track/cue.cpp | 8 | ||||
-rw-r--r-- | src/track/cue.h | 26 | ||||
-rw-r--r-- | src/track/track.cpp | 16 | ||||
-rw-r--r-- | src/track/track.h | 4 |
4 files changed, 27 insertions, 27 deletions
diff --git a/src/track/cue.cpp b/src/track/cue.cpp index 1d27df21c6..3110634c85 100644 --- a/src/track/cue.cpp +++ b/src/track/cue.cpp @@ -24,7 +24,7 @@ Cue::Cue(TrackId trackId) m_iId(-1), m_trackId(trackId), m_source(UNKNOWN), - m_type(INVALID), + m_type(Cue::Type::Invalid), m_samplePosition(-1.0), m_length(0.0), m_iHotCue(-1), @@ -33,7 +33,7 @@ Cue::Cue(TrackId trackId) DEBUG_ASSERT(!m_label.isNull()); } -Cue::Cue(int id, TrackId trackId, Cue::CueSource source, Cue::CueType type, double position, double length, +Cue::Cue(int id, TrackId trackId, Cue::CueSource source, Cue::Type type, double position, double length, int hotCue, QString label, PredefinedColorPointer color) : m_bDirty(false), m_iId(id), @@ -87,12 +87,12 @@ void Cue::setSource(CueSource source) { emit(updated()); } -Cue::CueType Cue::getType() const { +Cue::Type Cue::getType() const { QMutexLocker lock(&m_mutex); return m_type; } -void Cue::setType(Cue::CueType type) { +void Cue::setType(Cue::Type type) { QMutexLocker lock(&m_mutex); m_type = type; m_bDirty = true; diff --git a/src/track/cue.h b/src/track/cue.h index 6843dab197..df7603f091 100644 --- a/src/track/cue.h +++ b/src/track/cue.h @@ -23,15 +23,15 @@ class Cue : public QObject { MANUAL = 2, }; - enum CueType { - INVALID = 0, - CUE = 1, // hot cue - LOAD = 2, // the cue - BEAT = 3, - LOOP = 4, - JUMP = 5, - INTRO = 6, - OUTRO = 7, + enum class Type { + Invalid = 0, + Hotcue = 1, + MainCue = 2, + Beat = 3, // unused (what is this for?) + Loop = 4, + Jump = 5, + Intro = 6, + Outro = 7, }; ~Cue() override = default; @@ -43,8 +43,8 @@ class Cue : public QObject { CueSource getSource() const; void setSource(CueSource source); - CueType getType() const; - void setType(CueType type); + Cue::Type getType() const; + void setType(Cue::Type type); double getPosition() const; void setPosition(double samplePosition); @@ -68,7 +68,7 @@ class Cue : public QObject { private: explicit Cue(TrackId trackId); - Cue(int id, TrackId trackId, CueSource source, CueType type, double position, double length, + Cue(int id, TrackId trackId, CueSource source, Cue::Type type, double position, double length, int hotCue, QString label, PredefinedColorPointer color); void setDirty(bool dirty); void setId(int id); @@ -80,7 +80,7 @@ class Cue : public QObject { int m_iId; TrackId m_trackId; CueSource m_source; - CueType m_type; + Cue::Type m_type; double m_samplePosition; double m_length; int m_iHotCue; diff --git a/src/track/track.cpp b/src/track/track.cpp index 5e8559e033..d5e21e7137 100644 --- a/src/track/track.cpp +++ b/src/track/track.cpp @@ -732,13 +732,13 @@ void Track::setCuePoint(CuePosition cue) { } // Store the cue point in a load cue - CuePointer pLoadCue = findCueByType(Cue::LOAD); + CuePointer pLoadCue = findCueByType(Cue::Type::MainCue); Cue::CueSource source = cue.getSource(); double position = cue.getPosition(); if (position != 0.0 && position != -1.0) { if (!pLoadCue) { pLoadCue = CuePointer(new Cue(m_record.getId())); - pLoadCue->setType(Cue::LOAD); + pLoadCue->setType(Cue::Type::MainCue); connect(pLoadCue.get(), SIGNAL(updated()), this, SLOT(slotCueUpdated())); m_cuePoints.push_back(pLoadCue); @@ -775,10 +775,10 @@ CuePointer Track::createAndAddCue() { return pCue; } -CuePointer Track::findCueByType(Cue::CueType type) const { +CuePointer Track::findCueByType(Cue::Type type) const { // This method cannot be used for hotcues because there can be // multiple hotcues and this function returns only a single CuePointer. - DEBUG_ASSERT(type != Cue::CUE); + DEBUG_ASSERT(type != Cue::Type::Hotcue); QMutexLocker lock(&m_qMutex); for (const CuePointer& pCue: m_cuePoints) { if (pCue->getType() == type) { @@ -796,20 +796,20 @@ void Track::removeCue(const CuePointer& pCue) { QMutexLocker lock(&m_qMutex); disconnect(pCue.get(), 0, this, 0); m_cuePoints.removeOne(pCue); - if (pCue->getType() == Cue::LOAD) { + if (pCue->getType() == Cue::Type::MainCue) { m_record.setCuePoint(CuePosition()); } markDirtyAndUnlock(&lock); emit(cuesUpdated()); } -void Track::removeCuesOfType(Cue::CueType type) { +void Track::removeCuesOfType(Cue::Type type) { QMutexLocker lock(&m_qMutex); bool dirty = false; QMutableListIterator<CuePointer> it(m_cuePoints); while (it.hasNext()) { CuePointer pCue = it.next(); - // FIXME: Why does this only work for the CUE CueType? + // FIXME: Why does this only work for the Hotcue Type? if (pCue->getType() == type) { disconnect(pCue.get(), 0, this, 0); it.remove(); @@ -843,7 +843,7 @@ void Track::setCuePoints(const QList<CuePointer>& cuePoints) { connect(pCue.get(), SIGNAL(updated()), this, SLOT(slotCueUpdated())); // update main cue point - if (pCue->getType() == Cue::LOAD) { + if (pCue->getType() == Cue::Type::MainCue) { m_record.setCuePoint(CuePosition(pCue->getPosition(), pCue->getSource())); } } diff --git a/src/track/track.h b/src/track/track.h index cfdc2d3a4e..21e1149acd 100644 --- a/src/track/track.h +++ b/src/track/track.h @@ -250,9 +250,9 @@ class Track : public QObject { // Calls for managing the track's cue points CuePointer createAndAddCue(); - CuePointer findCueByType(Cue::CueType type) const; // NOTE: Cannot be used for hotcues. + CuePointer findCueByType(Cue::Type type) const; // NOTE: Cannot be used for hotcues. void removeCue(const CuePointer& pCue); - void removeCuesOfType(Cue::CueType); + void removeCuesOfType(Cue::Type); QList<CuePointer> getCuePoints() const; void setCuePoints(const QList<CuePointer>& cuePoints); |