Qmmp
|
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 PlayListItem; 00030 class QmmpUiSettings; 00031 00041 class FileLoader : public QThread 00042 { 00043 Q_OBJECT 00044 public: 00049 FileLoader(QObject *parent = 0); 00053 ~FileLoader(); 00057 void finish(); 00061 void loadFile(const QString &path); 00065 void loadFiles(const QStringList &paths); 00069 void loadDirectory(const QString &path); 00070 00071 signals: 00076 void newPlayListItem(PlayListItem *item); 00077 00078 protected: 00079 virtual void run(); 00080 void addFile(const QString &path); 00081 void addDirectory(const QString &s); 00082 00083 private: 00084 bool checkRestrictFilters(const QFileInfo &info); 00085 bool checkExcludeFilters(const QFileInfo &info); 00086 QQueue <QString> m_files; 00087 QQueue <QString> m_directories; 00088 QStringList m_filters; 00089 QmmpUiSettings *m_settings; 00090 bool m_finished; 00091 }; 00092 00093 #endif