summaryrefslogtreecommitdiffstats
path: root/src/library/browse
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2019-11-01 20:51:43 +0100
committerUwe Klotz <uklotz@mixxx.org>2019-11-21 11:27:43 +0100
commit8e04492dcb85205a3ec8d9a33e238eac8651391f (patch)
tree696c11ea9f059ea4ccbc86f0f3ce078fdb69cf89 /src/library/browse
parent0cdced650845d66c8fc5b71acb9ed7f9b1e914aa (diff)
Move export of track metadata from TrackCollection into Library
Diffstat (limited to 'src/library/browse')
-rw-r--r--src/library/browse/browsefeature.cpp16
-rw-r--r--src/library/browse/browsefeature.h7
-rw-r--r--src/library/browse/browsetablemodel.cpp11
-rw-r--r--src/library/browse/browsetablemodel.h7
4 files changed, 21 insertions, 20 deletions
diff --git a/src/library/browse/browsefeature.cpp b/src/library/browse/browsefeature.cpp
index 89c1a7ca09..b89a26b1aa 100644
--- a/src/library/browse/browsefeature.cpp
+++ b/src/library/browse/browsefeature.cpp
@@ -14,6 +14,7 @@
#include "library/browse/browsefeature.h"
#include "library/library.h"
#include "library/trackcollection.h"
+#include "library/trackcollectionmanager.h"
#include "library/treeitem.h"
#include "track/track.h"
#include "util/memory.h"
@@ -24,20 +25,19 @@
const QString kQuickLinksSeparator = "-+-";
-BrowseFeature::BrowseFeature(Library* parent,
+BrowseFeature::BrowseFeature(
+ Library* pLibrary,
UserSettingsPointer pConfig,
- TrackCollection* pTrackCollection,
RecordingManager* pRecordingManager)
- : LibraryFeature(parent),
- m_pConfig(pConfig),
- m_browseModel(this, pTrackCollection, pRecordingManager),
+ : LibraryFeature(pLibrary, std::move(pConfig)),
+ m_pTrackCollection(pLibrary->trackCollections()->internalCollection()),
+ m_browseModel(this, pLibrary->trackCollections(), pRecordingManager),
m_proxyModel(&m_browseModel),
- m_pTrackCollection(pTrackCollection),
- m_pLastRightClickedItem(NULL),
+ m_pLastRightClickedItem(nullptr),
m_icon(":/images/library/ic_library_computer.svg") {
connect(this,
&BrowseFeature::requestAddDir,
- parent,
+ pLibrary,
&Library::slotRequestAddDir);
m_pAddQuickLinkAction = new QAction(tr("Add to Quick Links"),this);
diff --git a/src/library/browse/browsefeature.h b/src/library/browse/browsefeature.h
index 1bf005c662..0665a96b3c 100644
--- a/src/library/browse/browsefeature.h
+++ b/src/library/browse/browsefeature.h
@@ -29,9 +29,8 @@ class WLibrarySidebar;
class BrowseFeature : public LibraryFeature {
Q_OBJECT
public:
- BrowseFeature(Library* parent,
+ BrowseFeature(Library* pLibrary,
UserSettingsPointer pConfig,
- TrackCollection* pTrackCollection,
RecordingManager* pRecordingManager);
virtual ~BrowseFeature();
@@ -67,10 +66,10 @@ class BrowseFeature : public LibraryFeature {
void saveQuickLinks();
void loadQuickLinks();
- UserSettingsPointer m_pConfig;
+ TrackCollection* const m_pTrackCollection;
+
BrowseTableModel m_browseModel;
ProxyTrackModel m_proxyModel;
- TrackCollection* m_pTrackCollection;
FolderTreeModel m_childModel;
QAction* m_pAddQuickLinkAction;
QAction* m_pRemoveQuickLinkAction;
diff --git a/src/library/browse/browsetablemodel.cpp b/src/library/browse/browsetablemodel.cpp
index 49c3296714..12856dd390 100644
--- a/src/library/browse/browsetablemodel.cpp
+++ b/src/library/browse/browsetablemodel.cpp
@@ -9,19 +9,20 @@
#include "control/controlobject.h"
#include "library/browse/browsetablemodel.h"
#include "library/browse/browsethread.h"
-#include "library/dao/trackdao.h"
#include "library/previewbuttondelegate.h"
+#include "library/trackcollection.h"
+#include "library/trackcollectionmanager.h"
#include "mixer/playerinfo.h"
#include "mixer/playermanager.h"
#include "widget/wlibrarytableview.h"
BrowseTableModel::BrowseTableModel(QObject* parent,
- TrackCollection* pTrackCollection,
+ TrackCollectionManager* pTrackCollectionManager,
RecordingManager* pRecordingManager)
- : TrackModel(pTrackCollection->database(),
+ : TrackModel(pTrackCollectionManager->internalCollection()->database(),
"mixxx.db.model.browse"),
QStandardItemModel(parent),
- m_pTrackCollection(pTrackCollection),
+ m_pTrackCollectionManager(pTrackCollectionManager),
m_pRecordingManager(pRecordingManager),
m_previewDeckGroup(PlayerManager::groupForPreviewDeck(0)) {
QStringList header_data;
@@ -170,7 +171,7 @@ TrackPointer BrowseTableModel::getTrack(const QModelIndex& index) const {
// them edit the tracks in a way that persists across sessions
// and we didn't want to edit the files on disk by default
// unless the user opts in to that.
- return m_pTrackCollection->getOrAddTrack(
+ return m_pTrackCollectionManager->getOrAddTrack(
TrackRef::fromFileInfo(trackLocation));
}
diff --git a/src/library/browse/browsetablemodel.h b/src/library/browse/browsetablemodel.h
index 35a479071b..9a2256e746 100644
--- a/src/library/browse/browsetablemodel.h
+++ b/src/library/browse/browsetablemodel.h
@@ -5,7 +5,6 @@
#include <QMimeData>
#include "library/trackmodel.h"
-#include "library/trackcollection.h"
#include "recording/recordingmanager.h"
#include "util/file.h"
#include "library/browse/browsethread.h"
@@ -33,6 +32,7 @@ const int COLUMN_FILE_MODIFIED_TIME = 18;
const int COLUMN_FILE_CREATION_TIME = 19;
const int COLUMN_REPLAYGAIN = 20;
+class TrackCollectionManager;
// The BrowseTable models displays tracks
// of given directory on the HDD.
@@ -45,7 +45,7 @@ class BrowseTableModel final : public QStandardItemModel, public virtual TrackMo
Q_OBJECT
public:
- BrowseTableModel(QObject* parent, TrackCollection* pTrackCollection, RecordingManager* pRec);
+ BrowseTableModel(QObject* parent, TrackCollectionManager* pTrackCollectionManager, RecordingManager* pRec);
virtual ~BrowseTableModel();
void setPath(const MDir& path);
@@ -80,9 +80,10 @@ class BrowseTableModel final : public QStandardItemModel, public virtual TrackMo
private:
void addSearchColumn(int index);
+ TrackCollectionManager* const m_pTrackCollectionManager;
+
QList<int> m_searchColumns;
MDir m_current_directory;
- TrackCollection* m_pTrackCollection;
RecordingManager* m_pRecordingManager;
BrowseThreadPointer m_pBrowseThread;
QString m_previewDeckGroup;