diff --git a/src/track/beatgrid.cpp b/src/track/beatgrid.cpp index 57ee8c97f0c0..b796a811a383 100644 --- a/src/track/beatgrid.cpp +++ b/src/track/beatgrid.cpp @@ -55,8 +55,7 @@ BeatGrid::BeatGrid( } BeatGrid::BeatGrid(const BeatGrid& other) - : QObject(), - m_mutex(QMutex::Recursive), + : m_mutex(QMutex::Recursive), m_subVersion(other.m_subVersion), m_iSampleRate(other.m_iSampleRate), m_grid(other.m_grid), diff --git a/src/track/beatgrid.h b/src/track/beatgrid.h index ea5aa32d2946..90ad5ca0c851 100644 --- a/src/track/beatgrid.h +++ b/src/track/beatgrid.h @@ -2,7 +2,6 @@ #define BEATGRID_H #include -#include #include "track/track.h" #include "track/beats.h" @@ -14,8 +13,7 @@ // BeatGrid is an implementation of the Beats interface that implements an // infinite grid of beats, aligned to a song simply by a starting offset of the // first beat and the song's average beats-per-minute. -class BeatGrid : public QObject, public virtual Beats { - Q_OBJECT +class BeatGrid final : public Beats { public: // Construct a BeatGrid. If a more accurate sample rate is known, provide it // in the iSampleRate parameter -- otherwise pass 0. @@ -73,9 +71,6 @@ class BeatGrid : public QObject, public virtual Beats { virtual void scale(enum BPMScale scale); virtual void setBpm(double dBpm); - signals: - void updated(); - private: BeatGrid(const BeatGrid& other); double firstBeatSample() const; diff --git a/src/track/beatmap.cpp b/src/track/beatmap.cpp index bb022a968414..b6460a527c9b 100644 --- a/src/track/beatmap.cpp +++ b/src/track/beatmap.cpp @@ -83,8 +83,7 @@ BeatMap::BeatMap(const Track& track, SINT iSampleRate, } BeatMap::BeatMap (const BeatMap& other) - : QObject(), - m_mutex(QMutex::Recursive), + : m_mutex(QMutex::Recursive), m_subVersion(other.m_subVersion), m_iSampleRate(other.m_iSampleRate), m_dCachedBpm(other.m_dCachedBpm), diff --git a/src/track/beatmap.h b/src/track/beatmap.h index 42da0d477ae3..184e28d35ca4 100644 --- a/src/track/beatmap.h +++ b/src/track/beatmap.h @@ -8,7 +8,6 @@ #ifndef BEATMAP_H_ #define BEATMAP_H_ -#include #include #include "track/track.h" @@ -19,8 +18,7 @@ typedef QList BeatList; -class BeatMap : public QObject, public Beats { - Q_OBJECT +class BeatMap final : public Beats { public: // Construct a BeatMap. iSampleRate may be provided if a more accurate // sample rate is known than the one associated with the Track. @@ -82,9 +80,6 @@ class BeatMap : public QObject, public Beats { virtual void scale(enum BPMScale scale); virtual void setBpm(double dBpm); - signals: - void updated(); - private: BeatMap(const BeatMap& other); bool readByteArray(const QByteArray& byteArray); diff --git a/src/track/beats.h b/src/track/beats.h index 11baf45bbf07..c0f1a5a8a4d1 100644 --- a/src/track/beats.h +++ b/src/track/beats.h @@ -1,6 +1,7 @@ #ifndef BEATS_H #define BEATS_H +#include #include #include #include @@ -25,7 +26,8 @@ class BeatIterator { // Beats is a pure abstract base class for BPM and beat management classes. It // provides a specification of all methods a beat-manager class must provide, as // well as a capability model for representing optional features. -class Beats { +class Beats : public QObject { + Q_OBJECT public: Beats() { } virtual ~Beats() { } @@ -161,6 +163,9 @@ class Beats { // Adjust the beats so the global average BPM matches dBpm. Beats class must // have the capability BEATSCAP_SET. virtual void setBpm(double dBpm) = 0; + + signals: + void updated(); }; #endif /* BEATS_H */ diff --git a/src/track/track.cpp b/src/track/track.cpp index 4581718469b9..184b81add878 100644 --- a/src/track/track.cpp +++ b/src/track/track.cpp @@ -353,23 +353,15 @@ void Track::setBeatsAndUnlock(QMutexLocker* pLock, BeatsPointer pBeats) { } if (m_pBeats) { - auto pObject = dynamic_cast(m_pBeats.data()); - if (pObject) { - disconnect(pObject, SIGNAL(updated()), - this, SLOT(slotBeatsUpdated())); - } + disconnect(m_pBeats.data(), &Beats::updated, this, &Track::slotBeatsUpdated); } - m_pBeats = pBeats; + m_pBeats = std::move(pBeats); auto bpmValue = mixxx::Bpm::kValueUndefined; if (m_pBeats) { bpmValue = m_pBeats->getBpm(); - auto pObject = dynamic_cast(m_pBeats.data()); - if (pObject) { - connect(pObject, SIGNAL(updated()), - this, SLOT(slotBeatsUpdated())); - } + connect(m_pBeats.data(), &Beats::updated, this, &Track::slotBeatsUpdated); } m_record.refMetadata().refTrackInfo().setBpm(mixxx::Bpm(bpmValue));