-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathlibrary.h
More file actions
212 lines (176 loc) · 6.56 KB
/
Copy pathlibrary.h
File metadata and controls
212 lines (176 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#pragma once
#include <QFont>
#include <QList>
#include <QObject>
#include <QPointer>
#include "analyzer/trackanalysisscheduler.h"
#include "library/library_decl.h"
#ifdef __ENGINEPRIME__
#include "library/trackset/crate/crateid.h"
#endif
#include "preferences/usersettings.h"
#include "track/track_decl.h"
#include "util/db/dbconnectionpool.h"
#include "util/parented_ptr.h"
class AnalysisFeature;
class AutoDJFeature;
class BrowseFeature;
class ControlObject;
class CrateFeature;
class LibraryControl;
class LibraryFeature;
class LibraryTableModel;
class KeyboardEventFilter;
class MixxxLibraryFeature;
class PlayerManager;
class PlaylistFeature;
class RecordingManager;
class SidebarModel;
class TrackCollectionManager;
class WSearchLineEdit;
class WLibrarySidebar;
class WLibrary;
class QAbstractItemModel;
#ifdef __ENGINEPRIME__
namespace mixxx {
class LibraryExporter;
} // namespace mixxx
#endif
// A Library class is a container for all the model-side aspects of the library.
// A library widget can be attached to the Library object by calling bindLibraryWidget.
class Library: public QObject {
Q_OBJECT
public:
Library(QObject* parent,
UserSettingsPointer pConfig,
mixxx::DbConnectionPoolPtr pDbConnectionPool,
TrackCollectionManager* pTrackCollectionManager,
PlayerManager* pPlayerManager,
RecordingManager* pRecordingManager);
~Library() override;
void stopPendingTasks();
const mixxx::DbConnectionPoolPtr& dbConnectionPool() const {
return m_pDbConnectionPool;
}
TrackCollectionManager* trackCollectionManager() const;
TrackAnalysisScheduler::Pointer createTrackAnalysisScheduler(
int numWorkerThreads,
AnalyzerModeFlags modeFlags) const;
void bindSearchboxWidget(WSearchLineEdit* pSearchboxWidget);
void bindSidebarWidget(WLibrarySidebar* sidebarWidget);
void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* pKeyboard);
void addFeature(LibraryFeature* feature);
/// Needed for exposing models to QML
LibraryTableModel* trackTableModel() const;
bool isTrackIdInCurrentLibraryView(const TrackId& trackId);
int getTrackTableRowHeight() const {
return m_iTrackTableRowHeight;
}
const QFont& getTrackTableFont() const {
return m_trackTableFont;
}
bool selectedClickEnabled() const {
return m_editMetadataSelectedClick;
}
//static Library* buildDefaultLibrary();
static const int kDefaultRowHeightPx;
void setFont(const QFont& font);
void setRowHeight(int rowHeight);
void setEditMetadataSelectedClick(bool enable);
/// Switches to the internal track collection view
/// and focuses the search box.
void searchTracksInCollection();
/// Triggers a new search in the internal track collection
/// and shows the results by switching the view.
void searchTracksInCollection(const QString& query);
void showAutoDJ();
static const QString kAutoDJViewName;
bool requestAddDir(const QString& directory);
bool requestRemoveDir(const QString& directory, LibraryRemovalType removalType);
bool requestRelocateDir(const QString& previousDirectory, const QString& newDirectory);
#ifdef __ENGINEPRIME__
std::unique_ptr<mixxx::LibraryExporter> makeLibraryExporter(QWidget* parent);
#endif
public slots:
void slotShowTrackModel(QAbstractItemModel* model);
void slotSwitchToView(const QString& view);
void slotLoadTrack(TrackPointer pTrack);
#ifdef __STEM__
void slotLoadTrackToPlayer(TrackPointer pTrack,
const QString& group,
mixxx::StemChannelSelection stemMask,
bool play);
#else
void slotLoadTrackToPlayer(TrackPointer pTrack, const QString& group, bool play);
#endif
void slotLoadLocationToPlayer(const QString& location, const QString& group, bool play);
void slotRefreshLibraryModels();
void slotCreatePlaylist();
void slotCreateCrate();
void slotSearchInCurrentView();
void slotSearchInAllTracks();
void onSkinLoadFinished();
void slotSaveCurrentViewState() const;
void slotRestoreCurrentViewState() const;
void slotSaveSelectedTrackId();
void slotRestoreSelectedTrackId();
signals:
void showTrackModel(QAbstractItemModel* model, bool restoreState = true);
void switchToView(const QString& view);
void loadTrack(TrackPointer pTrack);
#ifdef __STEM__
void loadTrackToPlayer(TrackPointer pTrack,
const QString& group,
mixxx::StemChannelSelection stemMask,
bool play = false);
#else
void loadTrackToPlayer(TrackPointer pTrack,
const QString& group,
bool play = false);
#endif
void restoreSearch(const QString&);
void search(const QString& text);
void disableSearch();
void pasteFromSidebar();
// emit this signal to enable/disable the cover art widget
void enableCoverArtDisplay(bool);
void selectTrack(const TrackId&);
void trackSelected(TrackPointer pTrack);
void analyzeTracks(const QList<AnalyzerScheduledTrack>& tracks);
#ifdef __ENGINEPRIME__
void exportLibrary();
void exportCrate(CrateId crateId);
void exportPlaylist(int playlistId);
#endif
void saveModelState();
void restoreModelState();
void setTrackTableFont(const QFont& font);
void setTrackTableRowHeight(int rowHeight);
void setSelectedClick(bool enable);
void setSidebarHoverExpandDelay(int delay);
void onTrackAnalyzerProgress(TrackId trackId, AnalyzerProgress analyzerProgress);
private slots:
void onPlayerManagerTrackAnalyzerProgress(TrackId trackId, AnalyzerProgress analyzerProgress);
void onPlayerManagerTrackAnalyzerIdle();
private:
const UserSettingsPointer m_pConfig;
// The Mixxx database connection pool
const mixxx::DbConnectionPoolPtr m_pDbConnectionPool;
const QPointer<TrackCollectionManager> m_pTrackCollectionManager;
parented_ptr<SidebarModel> m_pSidebarModel;
parented_ptr<LibraryControl> m_pLibraryControl;
QList<LibraryFeature*> m_features;
const static QString m_sTrackViewName;
WLibrary* m_pLibraryWidget;
parented_ptr<MixxxLibraryFeature> m_pMixxxLibraryFeature;
parented_ptr<AutoDJFeature> m_pAutoDJFeature;
parented_ptr<PlaylistFeature> m_pPlaylistFeature;
parented_ptr<CrateFeature> m_pCrateFeature;
parented_ptr<BrowseFeature> m_pBrowseFeature;
parented_ptr<AnalysisFeature> m_pAnalysisFeature;
QFont m_trackTableFont;
int m_iTrackTableRowHeight;
bool m_editMetadataSelectedClick;
std::unique_ptr<ControlObject> m_pKeyNotation;
};