Qmmp
/usr/src/RPM/BUILD/qmmp-0.11-svn/src/qmmpui/fileloader_p.h
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2017 by Ilya Kotov                                 *
00003  *   forkotov02@hotmail.ru                                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
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     void addPlayList(const QString &fmt, const QByteArray &data);
00065 
00066     void insert(PlayListItem *before, const QString &path);
00067     void insert(PlayListItem *before, const QStringList &paths);
00068 
00069 
00070 public slots:
00074     void finish();
00075 
00076 signals:
00081     void newTracksToInsert(PlayListItem *before, QList<PlayListTrack *> tracks);
00082 
00083 private:
00084     void run();
00085     QList<PlayListTrack*> processFile(const QString &path, QStringList *ignoredPaths = 0);
00086     void insertPlayList(const QString &fmt, const QByteArray &contents, PlayListItem *before);
00087     void insertPlayList(const QString &path, PlayListItem *before);
00088     void addDirectory(const QString &s, PlayListItem *before = 0);
00089     bool checkRestrictFilters(const QFileInfo &info);
00090     bool checkExcludeFilters(const QFileInfo &info);
00091     void removeIgnoredTracks(QList<PlayListTrack *> *tracks, const QStringList &ignoredPaths);
00092     struct LoaderTask
00093     {
00094         QString path;
00095         PlayListItem *before;
00096         QString playListFormat;
00097         QByteArray playListContent;
00098     };
00099     QQueue <LoaderTask> m_tasks;
00100     QStringList m_filters;
00101     QmmpUiSettings *m_settings;
00102     bool m_finished;
00103     bool m_use_meta;
00104     QMutex m_mutex;
00105 
00106 };
00107 
00108 #endif
 All Classes Functions Variables Enumerations Enumerator