blob: 94f1a986b5608002c0df18d247458e0c598fc799 (
plain)
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
|
// AutoDJfeature.h
// FORK FORK FORK on 11/1/2009 by Albert Santoni (alberts@mixxx.org)
// Created 8/23/2009 by RJ Ryan (rryan@mit.edu)
#ifndef AUTODJFEATURE_H
#define AUTODJFEATURE_H
#include <QObject>
#include <QStringListModel>
#include <QVariant>
#include <QIcon>
#include <QUrl>
#include <QList>
#include <QModelIndex>
#include <QPoint>
#include <QAction>
#include <QPointer>
#include "library/libraryfeature.h"
#include "preferences/usersettings.h"
#include "library/treeitemmodel.h"
#include "library/crate/crate.h"
#include "library/dao/autodjcratesdao.h"
class DlgAutoDJ;
class Library;
class PlayerManagerInterface;
class TrackCollection;
class TrackCollectionManager;
class AutoDJProcessor;
class WLibrarySidebar;
class AutoDJFeature : public LibraryFeature {
Q_OBJECT
public:
AutoDJFeature(Library* pLibrary,
UserSettingsPointer pConfig,
PlayerManagerInterface* pPlayerManager);
virtual ~AutoDJFeature();
QVariant title() override;
QIcon getIcon() override;
bool dropAccept(QList<QUrl> urls, QObject* pSource) override;
bool dragMoveAccept(QUrl url) override;
void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* keyboard) override;
void bindSidebarWidget(WLibrarySidebar* pSidebarWidget) override;
TreeItemModel* getChildModel() override;
bool hasTrackTable() override {
return true;
}
public slots:
void activate() override;
// Temporary, until WCrateTableView can be written.
void onRightClickChild(const QPoint& globalPos, QModelIndex index) override;
private:
TrackCollection* const m_pTrackCollection;
PlaylistDAO& m_playlistDao;
// The id of the AutoDJ playlist.
int m_iAutoDJPlaylistId;
AutoDJProcessor* m_pAutoDJProcessor;
TreeItemModel m_childModel;
DlgAutoDJ* m_pAutoDJView;
// Initialize the list of crates loaded into the auto-DJ queue.
void constructCrateChildModel();
// 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;
// A context-menu item that allows crates to be removed from the
// auto-DJ list.
QAction *m_pRemoveCrateFromAutoDj;
QIcon m_icon;
QPointer<WLibrarySidebar> m_pSidebarWidget;
private slots:
// Add a crate to the auto-DJ queue.
void slotAddCrateToAutoDj(int iCrateId);
// 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);
};
#endif /* AUTODJFEATURE_H */
|