-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathautodjfeature.h
More file actions
110 lines (87 loc) · 3.23 KB
/
autodjfeature.h
File metadata and controls
110 lines (87 loc) · 3.23 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
#pragma once
#include <QList>
#include <QObject>
#include <QPointer>
#include <QUrl>
#include <QVariant>
#include "library/dao/autodjcratesdao.h"
#include "library/libraryfeature.h"
#include "library/trackset/crate/crate.h"
#include "preferences/usersettings.h"
#include "util/parented_ptr.h"
class DlgAutoDJ;
class Library;
class PlayerManagerInterface;
class TrackCollection;
class AutoDJProcessor;
class WLibrarySidebar;
class QAction;
class QModelIndex;
class QPoint;
class AutoDJFeature : public LibraryFeature {
Q_OBJECT
public:
AutoDJFeature(Library* pLibrary,
UserSettingsPointer pConfig,
PlayerManagerInterface* pPlayerManager);
virtual ~AutoDJFeature();
QVariant title() override;
void clear() override;
void paste() override;
void deleteItem(const QModelIndex& index) override;
bool dropAccept(const QList<QUrl>& urls, QObject* pSource) override;
bool dragMoveAccept(const QList<QUrl>& urls) override;
void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* keyboard) override;
void bindSidebarWidget(WLibrarySidebar* pSidebarWidget) override;
TreeItemModel* sidebarModel() const override;
bool hasTrackTable() override {
return true;
}
public slots:
void activate() override;
void onRightClick(const QPoint& globalPos) override;
// Temporary, until WCrateTableView can be written.
void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override;
private:
TrackCollection* const m_pTrackCollection;
PlaylistDAO& m_playlistDao;
// The id of the AutoDJ playlist.
int m_iAutoDJPlaylistId;
AutoDJProcessor* m_pAutoDJProcessor;
parented_ptr<TreeItemModel> m_pSidebarModel;
DlgAutoDJ* m_pAutoDJView;
const QString m_viewName;
// Initialize the list of crates loaded into the auto-DJ queue.
void constructCrateChildModel();
void removeCrateFromAutoDj(CrateId crateId = CrateId());
// The "Crates" tree-item under the "Auto DJ" tree-item.
TreeItem* m_pCratesTreeItem;
// The crate ID and name of all loaded crates.
// Its indices correspond one-to-one with tree-items contained by the
// "Crates" tree-item.
QList<Crate> m_crateList;
// How we access the auto-DJ-crates database.
AutoDJCratesDAO m_autoDjCratesDao;
parented_ptr<QAction> m_pEnableAutoDJAction;
parented_ptr<QAction> m_pDisableAutoDJAction;
parented_ptr<QAction> m_pClearQueueAction;
// A context-menu item that allows crates to be removed from the
// auto-DJ list.
parented_ptr<QAction> m_pRemoveCrateFromAutoDjAction;
QPointer<WLibrarySidebar> m_pSidebarWidget;
private slots:
void slotEnableAutoDJ();
void slotDisableAutoDJ();
void slotClearQueue();
// Add a crate to the auto-DJ queue.
void slotAddCrateToAutoDj(CrateId crateId);
// Implements the context-menu item.
void slotRemoveCrateFromAutoDj();
void slotCrateChanged(CrateId crateId);
// Adds a random track from all loaded crates to the auto-DJ queue.
void slotAddRandomTrack();
// Adds a random track from the queue upon hitting minimum number
// of tracks in the playlist
void slotRandomQueue(int numTracksToAdd);
};