Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/library/dao/cue.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#include <QObject>
#include <QMutex>
#include <QSharedPointer>
#include <QColor>

#include "track/trackid.h"
#include "util/memory.h"

class CueDAO;
class Track;
Expand Down Expand Up @@ -74,20 +74,11 @@ class Cue : public QObject {
friend class CueDAO;
};

class CuePointer: public QSharedPointer<Cue> {
class CuePointer: public std::shared_ptr<Cue> {
public:
CuePointer() {}
explicit CuePointer(Cue* pCue)
: QSharedPointer<Cue>(pCue, deleteLater) {
}

// TODO(uklotzde): Remove these functions after migration
// from QSharedPointer to std::shared_ptr
Cue* get() const {
return data();
}
void reset() {
clear();
: std::shared_ptr<Cue>(pCue, deleteLater) {
}

private:
Expand Down
5 changes: 2 additions & 3 deletions src/sources/audiosource.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef MIXXX_AUDIOSOURCE_H
#define MIXXX_AUDIOSOURCE_H

#include <QSharedPointer>

#include "sources/urlresource.h"
#include "util/audiosignal.h"
#include "util/memory.h"
#include "util/result.h"
#include "util/samplebuffer.h"

Expand Down Expand Up @@ -231,7 +230,7 @@ class AudioSourceConfig : public AudioSignal {
using AudioSignal::resetSamplingRate;
};

typedef QSharedPointer<AudioSource> AudioSourcePointer;
typedef std::shared_ptr<AudioSource> AudioSourcePointer;

} // namespace mixxx

Expand Down
4 changes: 2 additions & 2 deletions src/sources/soundsource.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ class SoundSource: public MetadataSource, public AudioSource {
const QString m_type;
};

typedef QSharedPointer<SoundSource> SoundSourcePointer;
typedef std::shared_ptr<SoundSource> SoundSourcePointer;

template<typename T>
SoundSourcePointer newSoundSourceFromUrl(const QUrl& url) {
return SoundSourcePointer(new T(url));
return std::make_shared<T>(url);
}

} //namespace mixxx
Expand Down
2 changes: 1 addition & 1 deletion src/sources/soundsourcepluginlibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace mixxx {
return s_loadedPluginLibraries.value(libFilePath);
} else {
SoundSourcePluginLibraryPointer pPluginLibrary(
new SoundSourcePluginLibrary(libFilePath));
std::make_shared<SoundSourcePluginLibrary>(libFilePath));
if (pPluginLibrary->init()) {
s_loadedPluginLibraries.insert(libFilePath, pPluginLibrary);
return pPluginLibrary;
Expand Down
8 changes: 5 additions & 3 deletions src/sources/soundsourcepluginlibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ namespace mixxx {

class SoundSourcePluginLibrary;

typedef QSharedPointer<SoundSourcePluginLibrary> SoundSourcePluginLibraryPointer;
typedef std::shared_ptr<SoundSourcePluginLibrary> SoundSourcePluginLibraryPointer;


// Wrapper class for a dynamic library that implements the SoundSource plugin API
class SoundSourcePluginLibrary {
public:
static SoundSourcePluginLibraryPointer load(const QString& libFilePath);

// Use load() instead of this constructor!
// The constructor has been declared 'public' only for technical reasons.
explicit SoundSourcePluginLibrary(const QString& libFilePath);

virtual ~SoundSourcePluginLibrary();

QString getFilePath() const {
Expand All @@ -33,8 +37,6 @@ class SoundSourcePluginLibrary {
SoundSourceProviderPointer getSoundSourceProvider() const;

protected:
explicit SoundSourcePluginLibrary(const QString& libFilePath);

virtual bool init();

private:
Expand Down
4 changes: 2 additions & 2 deletions src/sources/soundsourceprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class SoundSourceProvider {
virtual SoundSourcePointer newSoundSource(const QUrl& url) = 0;
};

typedef QSharedPointer<SoundSourceProvider> SoundSourceProviderPointer;
typedef std::shared_ptr<SoundSourceProvider> SoundSourceProviderPointer;

template<typename T>
static SoundSourceProviderPointer newSoundSourceProvider() {
return SoundSourceProviderPointer(new T);
return std::make_shared<T>();
}

} // namespace mixxx
Expand Down
2 changes: 1 addition & 1 deletion src/sources/soundsourceproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ class AudioSourceProxy: public mixxx::AudioSource {
DEBUG_ASSERT(pTrack);
DEBUG_ASSERT(pAudioSource);
return mixxx::AudioSourcePointer(
new AudioSourceProxy(pTrack, pAudioSource));
std::make_shared<AudioSourceProxy>(pTrack, pAudioSource));
}

SINT seekSampleFrame(SINT frameIndex) override {
Expand Down
2 changes: 1 addition & 1 deletion src/test/soundproxy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ TEST_F(SoundSourceProxyTest, seekBoundaries) {

// ...and verify read results
mixxx::AudioSourcePointer pContReadSource(openAudioSource(filePath));
ASSERT_TRUE(pContReadSource);
ASSERT_FALSE(!pContReadSource);
ASSERT_EQ(frameOffset, pContReadSource->skipSampleFrames(frameOffset));
SampleBuffer contReadData(
pContReadSource->frames2samples(kReadFrameCount));
Expand Down
21 changes: 6 additions & 15 deletions src/track/track.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <QList>
#include <QMutex>
#include <QObject>
#include <QSharedPointer>

#include "library/dao/cue.h"
#include "library/coverart.h"
Expand All @@ -16,13 +15,14 @@
#include "track/trackid.h"
#include "track/playcounter.h"
#include "track/trackmetadata.h"
#include "util/memory.h"
#include "util/sandbox.h"
#include "util/duration.h"
#include "waveform/waveform.h"

class Track;
class TrackPointer;
typedef QWeakPointer<Track> TrackWeakPointer;
typedef std::weak_ptr<Track> TrackWeakPointer;

class Track : public QObject {
Q_OBJECT
Expand Down Expand Up @@ -415,26 +415,17 @@ class Track : public QObject {
friend class TrackDAO;
};

class TrackPointer: public QSharedPointer<Track> {
class TrackPointer: public std::shared_ptr<Track> {
public:
TrackPointer() {}
explicit TrackPointer(const TrackWeakPointer& pTrack)
: QSharedPointer<Track>(pTrack) {
: std::shared_ptr<Track>(pTrack.lock()) {
}
explicit TrackPointer(Track* pTrack)
: QSharedPointer<Track>(pTrack, deleteLater) {
: std::shared_ptr<Track>(pTrack, deleteLater) {
}
TrackPointer(Track* pTrack, void (*deleter)(Track*))
: QSharedPointer<Track>(pTrack, deleter) {
}

// TODO(uklotzde): Remove these functions after migration
// from QSharedPointer to std::shared_ptr
Track* get() const {
return data();
}
void reset() {
clear();
: std::shared_ptr<Track>(pTrack, deleter) {
}

private:
Expand Down