AlbumShaper  1.0a3
addPhotosDialog.h
Go to the documentation of this file.
1 //Added by qt3to4:
2 #include <QCustomEvent>
3 #include <Q3GridLayout>
4 #include <QLabel>
5 //==============================================
6 // copyright : (C) 2003-2005 by Will Stokes
7 //==============================================
8 // This program is free software; you can redistribute it
9 // and/or modify it under the terms of the GNU General
10 // Public License as published by the Free Software
11 // Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //==============================================
14 
15 #ifndef GUI_DIALOGS_ADDPHOTOSDIALOG_H
16 #define GUI_DIALOGS_ADDPHOTOSDIALOG_H
17 
18 //--------------------
19 //forward declarations
20 class Q3GridLayout;
21 class Q3FileDialog;
22 class QCheckBox;
23 class QLabel;
24 //--------------------
25 
26 #include <q3filedialog.h>
27 #include <qmutex.h>
28 #include <qthread.h>
29 class FilePreview;
31 
32 //================================
34 {
35 public:
37  void start( QString filename);
38  virtual void run();
39  //--------------
40 private:
42  QString filename;
43 
47 
49  bool updating;
50 
52  QString queue;
53 
56  QMutex lockingMutex;
57 };
58 //==============================================
59 class FilePreview : public QWidget, public Q3FilePreview
60 {
61 public:
62  FilePreview( QWidget* parent=0 );
63  ~FilePreview();
64  QSize minimumSizeHint () const;
65 
67  void previewUrl( const Q3Url& ) {}
68 
70  void updatePreview( const QString& path );
71 
72 protected:
74  void customEvent( QCustomEvent * e );
75 
76 private:
79 
82 
87 };
88 //=====================================
91 //=====================================
93 {
94 Q_OBJECT
95 
96 public:
97  AddPhotosDialog(QString path, QWidget *parent=0, const char* name=0);
98 
101  QStringList getFilenames(bool& setDescriptions);
102 //----------------------
103 private:
105  QCheckBox* setDescriptions;
106 
109 //----------------------
110 private slots:
112  void updatePreview(const QString& filename);
113 //----------------------
114 };
115 //======================
116 
117 #endif //GUI_DIALOGS_ADDPHOTOSDIALOG_H
Simple dialog for browsing and select photos to add to a subalbum.
FilePreview * filePreview
Used to preview selected files.
AddPhotosDialog(QString path, QWidget *parent=0, const char *name=0)
QCheckBox * setDescriptions
Checkbox asking if filenames should be used to set image descriptions.
void updatePreview(const QString &filename)
handle the user selecting items by updating the file preview fields
QStringList getFilenames(bool &setDescriptions)
returns the list of selected filenames, while setting setDescritions to the state the checkbox was le...
void previewUrl(const Q3Url &)
declared to make base class happy. we'll use an updatePreview function instead
void customEvent(QCustomEvent *e)
handle update events that come from the GeneratePreviewThread
QLabel * fileDetails
details about last selected file
QLabel * filePreview
preview of last selected file
QSize minimumSizeHint() const
GeneratePreviewThread * generatorThread
a worker thread that actually generates the file preview image and details information that is displa...
FilePreview(QWidget *parent=0)
void updatePreview(const QString &path)
call this function to update the file preview
GeneratePreviewThread(FilePreview *previewWidget)
void start(QString filename)
bool updating
is the worker thread currently generating a file preview?
QMutex lockingMutex
locking mutex - necessary to prevent multiple threads from accessing the updating bool or queue varia...
FilePreview * previewWidget
handle on preview widget necessary for posting an update event once the current file has been process...
QString filename
current file being processed
QString queue
next file to be processed by worker thread