Qmmp
/usr/src/RPM/BUILD/qmmp-0.8-svn/src/qmmpui/fileloader_p.h
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2012 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 <QDir>
00025 #include <QQueue>
00026 #include <QFileInfo>
00027 #include <QThread>
00028 
00029 class PlayListTrack;
00030 class PlayListItem;
00031 class QmmpUiSettings;
00032 
00042 class FileLoader : public QThread
00043 {
00044     Q_OBJECT
00045 public:
00050     FileLoader(QObject *parent = 0);
00054     ~FileLoader();
00058     void finish();
00062     void add(const QString &path);
00066     void add(const QStringList &paths);
00067 
00068     void insert(PlayListItem *before, const QString &path);
00069     void insert(PlayListItem *before, const QStringList &paths);
00070 
00071 signals:
00076     void newTrackToAdd(PlayListTrack *track);
00077     void newTrackToInsert(PlayListItem *before, PlayListTrack *track);
00078 
00079 private:
00080     virtual void run();
00081     void addFile(const QString &path, PlayListItem *before = 0);
00082     void addDirectory(const QString &s, PlayListItem *before = 0);
00083     bool checkRestrictFilters(const QFileInfo &info);
00084     bool checkExcludeFilters(const QFileInfo &info);
00085     struct InsertItem
00086     {
00087         PlayListItem *before;
00088         QString path;
00089 
00090     };
00091     QQueue <QString> m_paths;
00092     QQueue <InsertItem> m_insertItems;
00093     QStringList m_filters;
00094     QmmpUiSettings *m_settings;
00095     bool m_finished;
00096 };
00097 
00098 #endif
 All Classes Functions Variables Enumerations Enumerator