#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 175 of file addPhotosDialog.cpp. References fileDetails, filePreview, and generatorThread. 00175 : QWidget(parent) 00176 { 00177 //create widgets for display preview image and details 00178 filePreview = new QLabel( this ); 00179 fileDetails = new QLabel( this ); 00180 00181 QGridLayout* grid = new QGridLayout( this, 4, 3 ); 00182 grid->setRowStretch( 0, 1 ); 00183 grid->addWidget( filePreview, 1, 1, Qt::AlignHCenter ); 00184 grid->addWidget( fileDetails, 2, 1, Qt::AlignHCenter ); 00185 grid->setRowStretch( 3, 1 ); 00186 00187 grid->setColStretch( 0, 1 ); 00188 grid->setColStretch( 2, 1 ); 00189 00190 //create a generator thread that will be used for actually generating 00191 //preview images and constructing details strings 00192 generatorThread = new GeneratePreviewThread(this); 00193 }
|
|
Definition at line 195 of file addPhotosDialog.cpp. References generatorThread. 00196 { 00197 //make sure generator thread is done! 00198 generatorThread->wait(); 00199 delete generatorThread; 00200 generatorThread = NULL; 00201 }
|
|
handle update events that come from the GeneratePreviewThread
Definition at line 209 of file addPhotosDialog.cpp. References fileDetails, filePreview, UpdatePreviewEvent::getDetails(), and UpdatePreviewEvent::getImage(). 00210 { 00211 //handle UpdatePrevewEvents that are sent from the worker thread 00212 //by update the preview image and details that are shown 00213 if ( e->type() == UPDATE_PREVIEW_DETAILS ) 00214 { 00215 UpdatePreviewEvent* upe = (UpdatePreviewEvent*)e; 00216 filePreview->setPixmap( upe->getImage() ); 00217 fileDetails->setText( upe->getDetails() ); 00218 } 00219 }
|
|
Definition at line 203 of file addPhotosDialog.cpp. References MIN_HEIGHT, and MIN_WIDTH. 00204 {
00205 QFontMetrics fm( font() );
00206 return QSize(MIN_WIDTH, MIN_HEIGHT + 2*fm.height() );
00207 }
|
|
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 221 of file addPhotosDialog.cpp. References generatorThread, and GeneratePreviewThread::start(). Referenced by AddPhotosDialog::updatePreview(). 00222 { 00223 //handle requests to update the preview information by asking 00224 //the generator thread to handle them. by using 00225 //an auxiallary thread we can process requests very quickly while 00226 //any current work being done to generate an image preview continues 00227 if( generatorThread != NULL) 00228 { 00229 generatorThread->start( filename ); 00230 } 00231 }
|
|
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(). |