Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/library/trackcollection.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                            trackcollection.h
00003                               -------------------
00004      begin                : 10/27/2008
00005      copyright            : (C) 2008 Albert Santoni
00006      email                : gamegod \a\t users.sf.net
00007 ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef TRACKCOLLECTION_H
00019 #define TRACKCOLLECTION_H
00020 
00021 #include <QtSql>
00022 #include <QList>
00023 #include <QRegExp>
00024 #include <QSharedPointer>
00025 #include <QSqlDatabase>
00026 
00027 #include "configobject.h"
00028 #include "library/basetrackcache.h"
00029 #include "library/dao/trackdao.h"
00030 #include "library/dao/cratedao.h"
00031 #include "library/dao/cuedao.h"
00032 #include "library/dao/playlistdao.h"
00033 
00034 class TrackInfoObject;
00035 
00036 #define AUTODJ_TABLE "Auto DJ"
00037 
00038 const QString MIXXX_DB_PATH = QDir::homePath().append("/").append(SETTINGS_PATH).append("mixxxdb.sqlite");
00039 
00040 class BpmDetector;
00041 
00045 class TrackCollection : public QObject
00046 {
00047     Q_OBJECT
00048   public:
00049     TrackCollection(ConfigObject<ConfigValue>* pConfig);
00050     ~TrackCollection();
00051     bool checkForTables();
00052 
00054     bool importDirectory(QString directory, TrackDAO &trackDao,
00055                          QList<TrackInfoObject*>& tracksToAdd);
00056 
00057     void resetLibaryCancellation();
00058     QSqlDatabase& getDatabase();
00059 
00060     CrateDAO& getCrateDAO();
00061     TrackDAO& getTrackDAO();
00062     PlaylistDAO& getPlaylistDAO();
00063     QSharedPointer<BaseTrackCache> getTrackSource(const QString name);
00064     void addTrackSource(const QString name, QSharedPointer<BaseTrackCache> trackSource);
00065 
00066   public slots:
00067     void slotCancelLibraryScan();
00068 
00069   signals:
00070     void startedLoading();
00071     void progressLoading(QString path);
00072     void finishedLoading();
00073 
00074   private:
00075     ConfigObject<ConfigValue>* m_pConfig;
00076     QSqlDatabase m_db;
00077     QHash<QString, QSharedPointer<BaseTrackCache> > m_trackSources;
00078     PlaylistDAO m_playlistDao;
00079     CrateDAO m_crateDao;
00080     CueDAO m_cueDao;
00081     TrackDAO m_trackDao;
00082     const QRegExp m_supportedFileExtensionsRegex;
00084     int bCancelLibraryScan;
00085     QMutex m_libraryScanMutex;
00086 };
00087 
00088 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines