00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FILELOADER_H
00021 #define FILELOADER_H
00022
00023 #include <QObject>
00024 #include <QQueue>
00025 #include <QStringList>
00026 #include <QFileInfo>
00027 #include <QMutex>
00028 #include <QThread>
00029
00030 class PlayListTrack;
00031 class PlayListItem;
00032 class QmmpUiSettings;
00033
00043 class FileLoader : public QThread
00044 {
00045 Q_OBJECT
00046 public:
00051 FileLoader(QObject *parent = 0);
00055 ~FileLoader();
00059 void add(const QString &path);
00063 void add(const QStringList &paths);
00064
00065 void insert(PlayListItem *before, const QString &path);
00066 void insert(PlayListItem *before, const QStringList &paths);
00067
00068 public slots:
00072 void finish();
00073
00074 signals:
00079 void newTracksToInsert(PlayListItem *before, QList<PlayListTrack *> tracks);
00080
00081 private:
00082 void run();
00083 QList<PlayListTrack*> processFile(const QString &path, QStringList *ignoredPaths = 0);
00084 void addDirectory(const QString &s, PlayListItem *before = 0);
00085 bool checkRestrictFilters(const QFileInfo &info);
00086 bool checkExcludeFilters(const QFileInfo &info);
00087 void removeIgnoredTracks(QList<PlayListTrack *> *tracks, const QStringList &ignoredPaths);
00088 struct LoaderTask
00089 {
00090 QString path;
00091 PlayListItem *before;
00092 };
00093 QQueue <LoaderTask> m_tasks;
00094 QStringList m_filters;
00095 QmmpUiSettings *m_settings;
00096 bool m_finished;
00097 bool m_use_meta;
00098 QMutex m_mutex;
00099
00100 };
00101
00102 #endif