Scribus
Open source desktop publishing at your fingertips
findimage.h
1 /*****************************************************************
2 * Copyright (C) 2009 Pierre Marchand
3 
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 *
17 ******************************************************************/
18 
19 #ifndef FINDIMAGE_H
20 #define FINDIMAGE_H
21 
22 #include <QDir>
23 #include <QString>
24 #include <QStringList>
25 #include <QThread>
26 
27 //thread to search images in a folder and subfolders
28 class findImagesThread : public QThread
29 {
30  Q_OBJECT
31 
32  public:
33  //parameters:
34  //const QString& path2: path to be searched
35  //const QStringList& nameFilters2: namefilters for the images
36  //QDir::SortFlags sort2: sortflags
37  //bool searchSubfolders2: tells wether to search subfolders
38  findImagesThread ( const QString& path2, const QStringList& nameFilters2, QDir::SortFlags sort2, bool searchSubfolders2 );
39  //called after thread has been started
40  void run();
41  //called when the thread should be restarted
42  void restart();
43 
44  //finds the images in a given folder
45  void findFiles ( const QString& path );
46 
47  //contains the images which have been found
48  QStringList imageFiles;
49  //tells wether the thread should restart
50  volatile bool restartThread;
51 
52  private:
53  //path to start searching
54  QString startPath;
55  //namefilters for search
56  QStringList nameFilters;
57  //sortflags for search
58  QDir::SortFlags sort;
59  //tells wether to search subfolders
60  bool searchSubfolders;
61 };
62 
63 
64 #endif // FINDIMAGE_H
Definition: findimage.h:28