![]() |
Mixxx
|
00001 // rhythmboxfeature.h 00002 // Created 8/23/2009 by RJ Ryan (rryan@mit.edu) 00003 00004 #ifndef RHYTHMBOXFEATURE_H 00005 #define RHYTHMBOXFEATURE_H 00006 00007 #include <QStringListModel> 00008 #include <QtSql> 00009 #include <QXmlStreamReader> 00010 #include <QFuture> 00011 #include <QtConcurrentRun> 00012 #include <QFutureWatcher> 00013 00014 #include "library/libraryfeature.h" 00015 #include "library/treeitemmodel.h" 00016 #include "library/rhythmbox/rhythmboxtrackmodel.h" 00017 #include "library/rhythmbox/rhythmboxplaylistmodel.h" 00018 #include "library/trackcollection.h" 00019 00020 class RhythmboxFeature : public LibraryFeature { 00021 Q_OBJECT 00022 public: 00023 RhythmboxFeature(QObject* parent, TrackCollection*); 00024 virtual ~RhythmboxFeature(); 00025 static bool isSupported(); 00026 00027 QVariant title(); 00028 QIcon getIcon(); 00029 00030 bool dropAccept(QUrl url); 00031 bool dropAcceptChild(const QModelIndex& index, QUrl url); 00032 bool dragMoveAccept(QUrl url); 00033 bool dragMoveAcceptChild(const QModelIndex& index, QUrl url); 00034 00035 TreeItemModel* getChildModel(); 00037 TreeItem* importMusicCollection(); 00039 TreeItem* importPlaylists(); 00040 00041 public slots: 00042 void activate(); 00043 void activateChild(const QModelIndex& index); 00044 void onRightClick(const QPoint& globalPos); 00045 void onRightClickChild(const QPoint& globalPos, QModelIndex index); 00046 void onLazyChildExpandation(const QModelIndex& index); 00047 void onTrackCollectionLoaded(); 00048 00049 private: 00050 RhythmboxTrackModel* m_pRhythmboxTrackModel; 00051 RhythmboxPlaylistModel* m_pRhythmboxPlaylistModel; 00052 TrackCollection* m_pTrackCollection; 00053 //new DB object because of threads 00054 QSqlDatabase m_database; 00055 bool m_isActivated; 00056 QString m_title; 00057 00058 QFutureWatcher<TreeItem*> m_track_watcher; 00059 QFuture<TreeItem*> m_track_future; 00060 TreeItemModel m_childModel; 00061 bool m_cancelImport; 00062 00064 void clearTable(QString table_name); 00066 void importTrack(QXmlStreamReader &xml, QSqlQuery &query); 00068 void importPlaylist(QXmlStreamReader &xml, QSqlQuery &query, int playlist_id); 00069 }; 00070 00071 #endif /* RHYTHMBOXFEATURE_H */