Commit 875111b1 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

use std::unique_ptr for all private implementation pointers

parent 10a78ec9
......@@ -46,7 +46,6 @@ AbstractFileListener::AbstractFileListener(QObject *parent)
AbstractFileListener::~AbstractFileListener()
{
delete d;
}
DatabaseInterface *AbstractFileListener::databaseInterface() const
......
......@@ -24,6 +24,8 @@
#include <QVector>
#include <QString>
#include <memory>
class AbstractFileListenerPrivate;
class DatabaseInterface;
class MusicAudioTrack;
......@@ -90,7 +92,7 @@ protected:
private:
AbstractFileListenerPrivate *d = nullptr;
std::unique_ptr<AbstractFileListenerPrivate> d;
};
......
......@@ -48,7 +48,6 @@ AlbumModel::AlbumModel(QObject *parent) : QAbstractItemModel(parent), d(new Albu
AlbumModel::~AlbumModel()
{
delete d;
}
int AlbumModel::rowCount(const QModelIndex &parent) const
......
......@@ -28,6 +28,8 @@
#include "musicalbum.h"
#include "musicaudiotrack.h"
#include <memory>
class DatabaseInterface;
class AlbumModelPrivate;
class MusicStatistics;
......@@ -136,7 +138,7 @@ private:
QVariant internalDataTrack(const MusicAudioTrack &track, int role, int rowIndex) const;
AlbumModelPrivate *d;
std::unique_ptr<AlbumModelPrivate> d;
};
......
......@@ -48,7 +48,6 @@ AllAlbumsModel::AllAlbumsModel(QObject *parent) : QAbstractItemModel(parent), d(
AllAlbumsModel::~AllAlbumsModel()
{
delete d;
}
int AllAlbumsModel::albumCount() const
......
......@@ -28,6 +28,8 @@
#include "musicalbum.h"
#include "musicaudiotrack.h"
#include <memory>
class AllAlbumsModelPrivate;
class MusicStatistics;
class QMutex;
......@@ -94,7 +96,7 @@ private:
QVariant internalDataAlbum(int albumIndex, int role) const;
AllAlbumsModelPrivate *d;
std::unique_ptr<AllAlbumsModelPrivate> d;
};
......
......@@ -48,7 +48,6 @@ AllArtistsModel::AllArtistsModel(QObject *parent) : QAbstractItemModel(parent),
AllArtistsModel::~AllArtistsModel()
{
delete d;
}
int AllArtistsModel::rowCount(const QModelIndex &parent) const
......
......@@ -27,6 +27,8 @@
#include "musicartist.h"
#include <memory>
class DatabaseInterface;
class AllArtistsModelPrivate;
......@@ -73,7 +75,7 @@ public Q_SLOTS:
private:
AllArtistsModelPrivate *d;
std::unique_ptr<AllArtistsModelPrivate> d;
};
......
......@@ -39,7 +39,6 @@ AllTracksModel::AllTracksModel(QObject *parent) : QAbstractItemModel(parent), d(
AllTracksModel::~AllTracksModel()
{
delete d;
}
int AllTracksModel::rowCount(const QModelIndex &parent) const
......
......@@ -24,6 +24,8 @@
#include "musicaudiotrack.h"
#include <memory>
class AllTracksModelPrivate;
class AllTracksModel : public QAbstractItemModel
......@@ -79,7 +81,7 @@ public Q_SLOTS:
private:
AllTracksModelPrivate *d;
std::unique_ptr<AllTracksModelPrivate> d;
};
......
......@@ -49,7 +49,6 @@ AudioWrapper::AudioWrapper(QObject *parent) : QObject(parent), d(new AudioWrappe
AudioWrapper::~AudioWrapper()
{
delete d;
}
bool AudioWrapper::muted() const
......
......@@ -25,6 +25,8 @@
#include <QMediaPlayer>
#include <QString>
#include <memory>
class AudioWrapperPrivate;
class AudioWrapper : public QObject
......@@ -160,7 +162,7 @@ private Q_SLOTS:
private:
AudioWrapperPrivate *d = nullptr;
std::unique_ptr<AudioWrapperPrivate> d;
};
......
......@@ -39,7 +39,6 @@ BalooListener::BalooListener(QObject *parent) : AbstractFileListener(parent), d(
BalooListener::~BalooListener()
{
delete d;
}
......
......@@ -26,6 +26,8 @@
#include <QVector>
#include <QString>
#include <memory>
class BalooListenerPrivate;
class DatabaseInterface;
class MusicAudioTrack;
......@@ -45,7 +47,7 @@ public Q_SLOTS:
private:
BalooListenerPrivate *d = nullptr;
std::unique_ptr<BalooListenerPrivate> d;
};
......
......@@ -165,8 +165,6 @@ DatabaseInterface::~DatabaseInterface()
if (d) {
d->mTracksDatabase.close();
}
delete d;
}
void DatabaseInterface::init(const QString &dbName, const QString &databaseFileName)
......@@ -188,7 +186,7 @@ void DatabaseInterface::init(const QString &dbName, const QString &databaseFileN
}
qDebug() << "DatabaseInterface::init" << (tracksDatabase.driver()->hasFeature(QSqlDriver::Transactions) ? "yes" : "no");
d = new DatabaseInterfacePrivate(tracksDatabase);
d = std::make_unique<DatabaseInterfacePrivate>(tracksDatabase);
initDatabase();
initRequest();
......
......@@ -31,6 +31,8 @@
#include <QVariant>
#include <QUrl>
#include <memory>
class DatabaseInterfacePrivate;
class QMutex;
class QSqlRecord;
......@@ -175,7 +177,7 @@ private:
void internalRemoveTracksList(const QList<QUrl> &removedTracks);
DatabaseInterfacePrivate *d;
std::unique_ptr<DatabaseInterfacePrivate> d;
};
......
......@@ -41,7 +41,6 @@ FileListener::FileListener(QObject *parent) : AbstractFileListener(parent), d(ne
FileListener::~FileListener()
{
delete d;
}
const LocalFileListing& FileListener::localFileIndexer() const
......
......@@ -57,7 +57,7 @@ public Q_SLOTS:
private:
FileListenerPrivate *d = nullptr;
std::unique_ptr<FileListenerPrivate> d;
};
......
......@@ -47,7 +47,6 @@ MediaPlayList::MediaPlayList(QObject *parent) : QAbstractListModel(parent), d(ne
MediaPlayList::~MediaPlayList()
{
delete d;
}
int MediaPlayList::rowCount(const QModelIndex &parent) const
......
......@@ -153,7 +153,7 @@ private Q_SLOTS:
private:
MediaPlayListPrivate *d;
std::unique_ptr<MediaPlayListPrivate> d;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment