#include <addPhotosDialog.h>
Inheritance diagram for FilePreview:


Public Member Functions | |
| FilePreview (QWidget *parent=0) | |
| ~FilePreview () | |
| QSize | minimumSizeHint () const |
| void | previewUrl (const QUrl &) |
| declared to make base class happy. we'll use an updatePreview function instead | |
| void | updatePreview (const QString &path) |
| call this function to update the file preview | |
Protected Member Functions | |
| void | customEvent (QCustomEvent *e) |
| handle update events that come from the GeneratePreviewThread | |
Private Attributes | |
| QLabel * | filePreview |
| preview of last selected file | |
| QLabel * | fileDetails |
| details about last selected file | |
| GeneratePreviewThread * | generatorThread |
| a worker thread that actually generates the file preview image and details information that is displayed. | |
|
|
Definition at line 173 of file addPhotosDialog.cpp. References fileDetails, filePreview, and generatorThread. 00173 : QWidget(parent) 00174 { 00175 //create widgets for display preview image and details 00176 filePreview = new QLabel( this ); 00177 fileDetails = new QLabel( this ); 00178 00179 QGridLayout* grid = new QGridLayout( this, 4, 3 ); 00180 grid->setRowStretch( 0, 1 ); 00181 grid->addWidget( filePreview, 1, 1, Qt::AlignHCenter ); 00182 grid->addWidget( fileDetails, 2, 1, Qt::AlignHCenter ); 00183 grid->setRowStretch( 3, 1 ); 00184 00185 grid->setColStretch( 0, 1 ); 00186 grid->setColStretch( 2, 1 ); 00187 00188 //create a generator thread that will be used for actually generating 00189 //preview images and constructing details strings 00190 generatorThread = new GeneratePreviewThread(this); 00191 }
|
|
|
Definition at line 193 of file addPhotosDialog.cpp. References generatorThread. 00194 {
00195 //make sure generator thread is done!
00196 generatorThread->wait();
00197 delete generatorThread;
00198 generatorThread = NULL;
00199 }
|
|
|
handle update events that come from the GeneratePreviewThread
Definition at line 207 of file addPhotosDialog.cpp. References fileDetails, filePreview, UpdatePreviewEvent::getDetails(), and UpdatePreviewEvent::getImage(). 00208 {
00209 //handle UpdatePrevewEvents that are sent from the worker thread
00210 //by update the preview image and details that are shown
00211 if ( e->type() == UPDATE_PREVIEW_DETAILS )
00212 {
00213 UpdatePreviewEvent* upe = (UpdatePreviewEvent*)e;
00214
00215 if( !upe->getImage().isNull() )
00216 {
00217 QPixmap scaledPixmap;
00218 scaledPixmap.convertFromImage( upe->getImage() );
00219 filePreview->setPixmap( scaledPixmap );
00220 }
00221
00222 fileDetails->setText( upe->getDetails() );
00223 }
00224 }
|
|
|
Definition at line 201 of file addPhotosDialog.cpp. References MIN_HEIGHT, and MIN_WIDTH. 00202 {
00203 QFontMetrics fm( font() );
00204 return QSize(MIN_WIDTH, MIN_HEIGHT + 2*fm.height() );
00205 }
|
|
|
declared to make base class happy. we'll use an updatePreview function instead
Definition at line 63 of file addPhotosDialog.h. 00063 {}
|
|
|
call this function to update the file preview
Definition at line 226 of file addPhotosDialog.cpp. References generatorThread, and GeneratePreviewThread::start(). Referenced by AddPhotosDialog::updatePreview(). 00227 {
00228 //handle requests to update the preview information by asking
00229 //the generator thread to handle them. by using
00230 //an auxiallary thread we can process requests very quickly while
00231 //any current work being done to generate an image preview continues
00232 if( generatorThread != NULL)
00233 {
00234 generatorThread->start( filename );
00235 }
00236 }
|
|
|
details about last selected file
Definition at line 77 of file addPhotosDialog.h. Referenced by customEvent(), and FilePreview(). |
|
|
preview of last selected file
Definition at line 74 of file addPhotosDialog.h. Referenced by customEvent(), and FilePreview(). |
|
|
a worker thread that actually generates the file preview image and details information that is displayed.
Definition at line 82 of file addPhotosDialog.h. Referenced by FilePreview(), updatePreview(), and ~FilePreview(). |
1.3.9.1