![]() |
Mixxx
|
00001 // library.h 00002 // Created 8/23/2009 by RJ Ryan (rryan@mit.edu) 00003 00004 // A Library class is a container for all the model-side aspects of the library. 00005 // A library widget can be attached to the Library object by calling bindWidget. 00006 00007 #ifndef LIBRARY_H 00008 #define LIBRARY_H 00009 00010 #include <QList> 00011 #include <QObject> 00012 #include <QAbstractItemModel> 00013 00014 #include "configobject.h" 00015 #include "trackinfoobject.h" 00016 #include "recording/recordingmanager.h" 00017 00018 class TrackModel; 00019 class TrackCollection; 00020 class SidebarModel; 00021 class LibraryFeature; 00022 class LibraryTableModel; 00023 class WLibrarySidebar; 00024 class WLibrary; 00025 class WSearchLineEdit; 00026 class MixxxLibraryFeature; 00027 class PromoTracksFeature; 00028 class PlaylistFeature; 00029 class CrateFeature; 00030 class LibraryControl; 00031 class MixxxKeyboard; 00032 00033 class Library : public QObject { 00034 Q_OBJECT 00035 public: 00036 Library(QObject* parent, 00037 ConfigObject<ConfigValue>* pConfig, 00038 bool firstRun, RecordingManager* pRecordingManager); 00039 virtual ~Library(); 00040 00041 void bindWidget(WLibrarySidebar* sidebarWidget, 00042 WLibrary* libraryWidget, 00043 MixxxKeyboard* pKeyboard); 00044 void addFeature(LibraryFeature* feature); 00045 QList<TrackPointer> getTracksToAutoLoad(); 00046 00047 // TODO(rryan) Transitionary only -- the only reason this is here is so the 00048 // waveform widgets can signal to a player to load a track. This can be 00049 // fixed by moving the waveform renderers inside player and connecting the 00050 // signals directly. 00051 TrackCollection* getTrackCollection() { 00052 return m_pTrackCollection; 00053 } 00054 00055 //static Library* buildDefaultLibrary(); 00056 00057 public slots: 00058 void slotShowTrackModel(QAbstractItemModel* model); 00059 void slotSwitchToView(const QString& view); 00060 void slotLoadTrack(TrackPointer pTrack); 00061 void slotLoadTrackToPlayer(TrackPointer pTrack, QString group); 00062 void slotRestoreSearch(const QString& text); 00063 void slotRefreshLibraryModels(); 00064 void slotCreatePlaylist(); 00065 void slotCreateCrate(); 00066 signals: 00067 void showTrackModel(QAbstractItemModel* model); 00068 void switchToView(const QString& view); 00069 void loadTrack(TrackPointer tio); 00070 void loadTrackToPlayer(TrackPointer tio, QString group); 00071 void restoreSearch(const QString&); 00072 00073 private: 00074 ConfigObject<ConfigValue>* m_pConfig; 00075 SidebarModel* m_pSidebarModel; 00076 TrackCollection* m_pTrackCollection; 00077 QList<LibraryFeature*> m_features; 00078 const static QString m_sTrackViewName; 00079 const static QString m_sAutoDJViewName; 00080 MixxxLibraryFeature* m_pMixxxLibraryFeature; 00081 PlaylistFeature* m_pPlaylistFeature; 00082 CrateFeature* m_pCrateFeature; 00083 PromoTracksFeature* m_pPromoTracksFeature; 00084 LibraryControl* m_pLibraryControl; 00085 RecordingManager* m_pRecordingManager; 00086 }; 00087 00088 #endif /* LIBRARY_H */