Scribus
Open source desktop publishing at your fingertips
loadimage.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 IMAGELOADER_H
20 #define IMAGELOADER_H
21 
22 
23 #include <QImage>
24 #include <QObject>
25 #include <QString>
26 #include <QThread>
27 #include <QMutex>
28 
29 class ImageInformation;
30 class PictureBrowser;
31 class PreviewImagesModel;
32 
33 //a thread to load previewimages
34 class loadImagesThread : public QThread
35 {
36  Q_OBJECT
37 
38  public:
39  //sets pointer to calling PictureBrowser object and to the related previewImagesModel
40  loadImagesThread ( PictureBrowser *parent, PreviewImagesModel *parentModel );
41 
42  //called after the thread has been started
43  void run();
44 
45  private:
46  QMutex mutex;
47  //contains a pointer to the calling PictureBrowser object
48  PictureBrowser *pictureBrowser;
49  //contains a pointer to the related PreviewImagesModel
50  PreviewImagesModel *pModel;
51 /*};
52 
53 
54 //a helper class to get the signals/slots executed in the right thread
55 class loadImagesThreadInstance : public QObject
56 {
57  Q_OBJECT
58 
59  public:
60  loadImagesThreadInstance();
61 
62  //contains a pointer to the calling PictureBrowser object
63  PictureBrowser *pictureBrowser;
64  //contains a pointer to the related PreviewImagesModel
65  PreviewImagesModel *pModel;
66 */
67  signals:
68  //emitted when image was loaded
69  //parameters:
70  //previewImage* loadedImage: pointer to the previewImage object which receives the image
71  //const QImage image: the actual image
72  //int tpId: unique id the thread has been called with
73  void imageLoaded ( int, const QImage, ImageInformation*, int );
74  void imageLoadError ( int, int, int );
75 
76  private slots:
77  //called when an image should be loaded
78  //parameters:
79  //previewImage* loadImage: pointer to the previewImage object which should receive the image
80  //QString path: path to the image
81  //int size: desired size of the icon
82  //int tpId: unique id
83  void processLoadImageJob ( int row, QString path, int size, int tpId );
84 };
85 
86 
87 
88 
89 #endif // IMAGELOADER_H
Definition: previewimage.h:42
Definition: previewimage.h:140
Definition: loadimage.h:34
Definition: picturebrowser.h:97