1 #pragma once
2 
3 #include <QStringListModel>
4 #include <QtSql>
5 #include <QFuture>
6 #include <QtConcurrentRun>
7 #include <QFutureWatcher>
8 
9 #include "library/baseexternallibraryfeature.h"
10 #include "library/trackcollection.h"
11 #include "library/treeitemmodel.h"
12 #include "library/treeitem.h"
13 #include "library/banshee/bansheedbconnection.h"
14 
15 
16 class BansheePlaylistModel;
17 
18 class BansheeFeature : public BaseExternalLibraryFeature {
19     Q_OBJECT
20   public:
21     BansheeFeature(Library* pLibrary, UserSettingsPointer pConfig);
22     virtual ~BansheeFeature();
23     static bool isSupported();
24     static void prepareDbPath(UserSettingsPointer pConfig);
25 
26     virtual QVariant title();
27     virtual QIcon getIcon();
28 
29     virtual TreeItemModel* getChildModel();
30 
31   public slots:
32     virtual void activate();
33     virtual void activateChild(const QModelIndex& index);
34 
35   private:
36     virtual void appendTrackIdsFromRightClickIndex(QList<TrackId>* trackIds, QString* pPlaylist);
37 
38     BansheePlaylistModel* m_pBansheePlaylistModel;
39     TreeItemModel m_childModel;
40     QStringList m_playlists;
41 
42     //a new DB connection for the worker thread
43     BansheeDbConnection m_connection;
44 
45     QSqlDatabase m_database;
46     bool m_isActivated;
47     QString m_dbfile;
48 
49     QFutureWatcher<TreeItem*> m_future_watcher;
50     QFuture<TreeItem*> m_future;
51     QString m_title;
52     bool m_cancelImport;
53     QIcon m_icon;
54 
55     static QString m_databaseFile;
56 
57     static const QString BANSHEE_MOUNT_KEY;
58 };
59