summaryrefslogtreecommitdiffstats
path: root/src/library
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2019-11-25 00:15:58 +0100
committerUwe Klotz <uklotz@mixxx.org>2019-11-25 00:34:28 +0100
commitfa4920a072774278f92226d5ae29c05f3814a34a (patch)
tree89104cc51a34c60a221aa81ec9f795a0a222a80f /src/library
parent624be0ea395beab93b9c753fc16ddb3a2b1a7119 (diff)
Use parented_ptr
Diffstat (limited to 'src/library')
-rw-r--r--src/library/library.cpp8
-rw-r--r--src/library/library.h5
-rw-r--r--src/library/sidebarmodel.h4
-rw-r--r--src/library/trackcollectionmanager.cpp2
-rw-r--r--src/library/trackcollectionmanager.h3
5 files changed, 14 insertions, 8 deletions
diff --git a/src/library/library.cpp b/src/library/library.cpp
index 1c3205d304..07f9ca93dd 100644
--- a/src/library/library.cpp
+++ b/src/library/library.cpp
@@ -77,8 +77,8 @@ Library::Library(
m_pConfig(std::move(pConfig)),
m_pDbConnectionPool(std::move(pDbConnectionPool)),
m_pTrackCollectionManager(pTrackCollectionManager),
- m_pSidebarModel(new SidebarModel(this)),
- m_pLibraryControl(new LibraryControl(this)),
+ m_pSidebarModel(make_parented<SidebarModel>(this)),
+ m_pLibraryControl(make_parented<LibraryControl>(this)),
m_pMixxxLibraryFeature(nullptr),
m_pPlaylistFeature(nullptr),
m_pCrateFeature(nullptr),
@@ -101,7 +101,7 @@ Library::Library(
addFeature(m_pMixxxLibraryFeature);
addFeature(new AutoDJFeature(this, m_pConfig, pPlayerManager));
- m_pPlaylistFeature = new PlaylistFeature(this, m_pConfig);
+ m_pPlaylistFeature = new PlaylistFeature(this, UserSettingsPointer(m_pConfig));
addFeature(m_pPlaylistFeature);
m_pCrateFeature = new CrateFeature(this, m_pConfig);
addFeature(m_pCrateFeature);
@@ -123,7 +123,7 @@ Library::Library(
addFeature(browseFeature);
addFeature(new RecordingFeature(this, m_pConfig, pRecordingManager));
- addFeature(new SetlogFeature(this, m_pConfig));
+ addFeature(new SetlogFeature(this, UserSettingsPointer(m_pConfig)));
m_pAnalysisFeature = new AnalysisFeature(this, m_pConfig);
connect(m_pPlaylistFeature, &PlaylistFeature::analyzeTracks,
diff --git a/src/library/library.h b/src/library/library.h
index 1554b6ca04..55d8f279df 100644
--- a/src/library/library.h
+++ b/src/library/library.h
@@ -10,6 +10,7 @@
#include "preferences/usersettings.h"
#include "track/track.h"
#include "util/db/dbconnectionpool.h"
+#include "util/parented_ptr.h"
class AnalysisFeature;
class ControlObject;
@@ -130,9 +131,9 @@ class Library: public QObject {
const QPointer<TrackCollectionManager> m_pTrackCollectionManager;
- SidebarModel* m_pSidebarModel;
+ parented_ptr<SidebarModel> m_pSidebarModel;
+ parented_ptr<LibraryControl> m_pLibraryControl;
- LibraryControl* m_pLibraryControl;
QList<LibraryFeature*> m_features;
const static QString m_sTrackViewName;
const static QString m_sAutoDJViewName;
diff --git a/src/library/sidebarmodel.h b/src/library/sidebarmodel.h
index a9eb333284..84e89d5cd4 100644
--- a/src/library/sidebarmodel.h
+++ b/src/library/sidebarmodel.h
@@ -15,6 +15,10 @@ class LibraryFeature;
class SidebarModel : public QAbstractItemModel {
Q_OBJECT
public:
+ // Keep object tree functions from QObject accessible
+ // for parented_ptr
+ using QObject::parent;
+
explicit SidebarModel(
QObject* parent = nullptr);
~SidebarModel() override = default;
diff --git a/src/library/trackcollectionmanager.cpp b/src/library/trackcollectionmanager.cpp
index 061e1f926a..80fb0c71a7 100644
--- a/src/library/trackcollectionmanager.cpp
+++ b/src/library/trackcollectionmanager.cpp
@@ -27,7 +27,7 @@ TrackCollectionManager::TrackCollectionManager(
deleteTrackFn_t /*only-needed-for-testing*/ deleteTrackFn)
: QObject(parent),
m_pConfig(pConfig),
- m_pInternalCollection(new TrackCollection(this, pConfig)),
+ m_pInternalCollection(make_parented<TrackCollection>(this, pConfig)),
m_scanner(pDbConnectionPool, m_pInternalCollection, pConfig) {
const QSqlDatabase dbConnection = mixxx::DbConnectionPooled(std::move(pDbConnectionPool));
diff --git a/src/library/trackcollectionmanager.h b/src/library/trackcollectionmanager.h
index 91d9097f8f..d3ca466681 100644
--- a/src/library/trackcollectionmanager.h
+++ b/src/library/trackcollectionmanager.h
@@ -9,6 +9,7 @@
#include "preferences/usersettings.h"
#include "track/globaltrackcache.h"
#include "util/db/dbconnectionpool.h"
+#include "util/parented_ptr.h"
class TrackCollection;
class ExternalTrackCollection;
@@ -93,7 +94,7 @@ class TrackCollectionManager: public QObject,
const UserSettingsPointer m_pConfig;
- TrackCollection* const m_pInternalCollection;
+ const parented_ptr<TrackCollection> m_pInternalCollection;
QList<ExternalTrackCollection*> m_externalCollections;