Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/library/traktor/traktorfeature.h

Go to the documentation of this file.
00001 // traktorfeature.h
00002 // Created 9/26/2010 by Tobias Rafreider
00003 
00004 #ifndef TRAKTOR_FEATURE_H
00005 #define TRAKTOR_FEATURE_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/traktor/traktortablemodel.h"
00016 #include "library/traktor/traktorplaylistmodel.h"
00017 #include "library/treeitemmodel.h"
00018 
00019 class LibraryTableModel;
00020 class MissingTableModel;
00021 class TrackCollection;
00022 
00023 class TraktorFeature : public LibraryFeature {
00024     Q_OBJECT
00025     public:
00026     TraktorFeature(QObject* parent, TrackCollection*);
00027     virtual ~TraktorFeature();
00028 
00029     QVariant title();
00030     QIcon getIcon();
00031     static bool isSupported();
00032     bool dropAccept(QUrl url);
00033     bool dropAcceptChild(const QModelIndex& index, QUrl url);
00034     bool dragMoveAccept(QUrl url);
00035     bool dragMoveAcceptChild(const QModelIndex& index, QUrl url);
00036 
00037 
00038     TreeItemModel* getChildModel();
00039 
00040 public slots:
00041     void activate();
00042     void activateChild(const QModelIndex& index);
00043     void onRightClick(const QPoint& globalPos);
00044     void onRightClickChild(const QPoint& globalPos, QModelIndex index);
00045     void onLazyChildExpandation(const QModelIndex& index);
00046     void refreshLibraryModels();
00047     void onTrackCollectionLoaded();
00048 private:
00049     TreeItem* importLibrary(QString file);
00051     void parseTrack(QXmlStreamReader &xml, QSqlQuery &query);
00053     TreeItem* parsePlaylists(QXmlStreamReader &xml);
00055     void parsePlaylistEntries(QXmlStreamReader &xml, QString playlist_path,
00056     QSqlQuery query_insert_into_playlist, QSqlQuery query_insert_into_playlisttracks);
00057     void clearTable(QString table_name);
00058     static QString getTraktorMusicDatabase();
00059     //private fields
00060     TreeItemModel m_childModel;
00061     TrackCollection* m_pTrackCollection;
00062     //A separate db connection for the worker parsing thread
00063     QSqlDatabase m_database;
00064     TraktorTableModel* m_pTraktorTableModel;
00065     TraktorPlaylistModel* m_pTraktorPlaylistModel;
00066 
00067     bool m_isActivated;
00068     bool m_cancelImport;
00069     QFutureWatcher<TreeItem*> m_future_watcher;
00070     QFuture<TreeItem*> m_future;
00071     QString m_title;
00072 };
00073 
00074 
00075 
00076 #endif /* TRAKTOR_FEATURE_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines