![]() |
Mixxx
|
00001 // libraryfeature.h 00002 // Created 8/17/2009 by RJ Ryan (rryan@mit.edu) 00003 00004 #ifndef LIBRARYFEATURE_H 00005 #define LIBRARYFEATURE_H 00006 00007 #include <QtDebug> 00008 #include <QIcon> 00009 #include <QModelIndex> 00010 #include <QObject> 00011 #include <QString> 00012 #include <QVariant> 00013 #include <QAbstractItemModel> 00014 #include <QUrl> 00015 00016 #include "trackinfoobject.h" 00017 #include "treeitemmodel.h" 00018 00019 class TrackModel; 00020 class WLibrarySidebar; 00021 class WLibrary; 00022 class MixxxKeyboard; 00023 00024 class LibraryFeature : public QObject { 00025 Q_OBJECT 00026 public: 00027 LibraryFeature(QObject* parent = NULL); 00028 00029 virtual QVariant title() = 0; 00030 virtual QIcon getIcon() = 0; 00031 00032 virtual bool dropAccept(QUrl url) = 0; 00033 virtual bool dropAcceptChild(const QModelIndex& index, QUrl url) = 0; 00034 virtual bool dragMoveAccept(QUrl url) = 0; 00035 virtual bool dragMoveAcceptChild(const QModelIndex& index, QUrl url) = 0; 00036 00037 // Reimplement this to register custom views with the library widget. 00038 virtual void bindWidget(WLibrarySidebar* /* sidebarWidget */, 00039 WLibrary* /* libraryWidget */, 00040 MixxxKeyboard* /* keyboard */) { 00041 } 00042 virtual TreeItemModel* getChildModel() = 0; 00043 00044 public slots: 00046 virtual void activate() = 0; 00048 virtual void activateChild(const QModelIndex& index) = 0; 00050 virtual void onRightClick(const QPoint& globalPos) = 0; 00052 virtual void onRightClickChild(const QPoint& globalPos, QModelIndex index) = 0; 00053 /* 00054 * Only implement this, if using incremental or lazy childmodels, see BrowseFeature. 00055 * This method is executed whenever you **double** click child items 00056 */ 00057 virtual void onLazyChildExpandation(const QModelIndex& index) = 0; 00058 signals: 00059 void featureUpdated(); 00060 void showTrackModel(QAbstractItemModel* model); 00061 void switchToView(const QString& view); 00062 void loadTrack(TrackPointer pTrack); 00063 void loadTrackToPlayer(TrackPointer pTrack, QString group); 00064 void restoreSearch(const QString&); 00066 void featureIsLoading(LibraryFeature*); 00068 void featureLoadingFinished(LibraryFeature*s); 00069 00070 00071 }; 00072 00073 #endif /* LIBRARYFEATURE_H */