|
AlbumShaper
1.0a3
|
#include <addPhotosDialog.h>


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 55 of file addPhotosDialog.h.
| FilePreview::FilePreview | ( | QWidget * | parent = 0 | ) |
Definition at line 173 of file addPhotosDialog.cpp.
References fileDetails, filePreview, and generatorThread.
: QWidget(parent) { //create widgets for display preview image and details filePreview = new QLabel( this ); fileDetails = new QLabel( this ); QGridLayout* grid = new QGridLayout( this, 4, 3 ); grid->setRowStretch( 0, 1 ); grid->addWidget( filePreview, 1, 1, Qt::AlignHCenter ); grid->addWidget( fileDetails, 2, 1, Qt::AlignHCenter ); grid->setRowStretch( 3, 1 ); grid->setColStretch( 0, 1 ); grid->setColStretch( 2, 1 ); //create a generator thread that will be used for actually generating //preview images and constructing details strings generatorThread = new GeneratePreviewThread(this); }
| FilePreview::~FilePreview | ( | ) |
Definition at line 193 of file addPhotosDialog.cpp.
References generatorThread.
{
//make sure generator thread is done!
generatorThread->wait();
delete generatorThread;
generatorThread = NULL;
}
| void FilePreview::customEvent | ( | QCustomEvent * | e | ) | [protected] |
handle update events that come from the GeneratePreviewThread
Definition at line 207 of file addPhotosDialog.cpp.
References fileDetails, filePreview, UpdatePreviewEvent::getDetails(), UpdatePreviewEvent::getImage(), and UPDATE_PREVIEW_DETAILS.
{
//handle UpdatePrevewEvents that are sent from the worker thread
//by update the preview image and details that are shown
if ( e->type() == UPDATE_PREVIEW_DETAILS )
{
UpdatePreviewEvent* upe = (UpdatePreviewEvent*)e;
if( !upe->getImage().isNull() )
{
QPixmap scaledPixmap;
scaledPixmap.convertFromImage( upe->getImage() );
filePreview->setPixmap( scaledPixmap );
}
fileDetails->setText( upe->getDetails() );
}
}
| QSize FilePreview::minimumSizeHint | ( | ) | const |
Definition at line 201 of file addPhotosDialog.cpp.
References MIN_HEIGHT, and MIN_WIDTH.
{
QFontMetrics fm( font() );
return QSize(MIN_WIDTH, MIN_HEIGHT + 2*fm.height() );
}
| void FilePreview::previewUrl | ( | const QUrl & | ) | [inline] |
declared to make base class happy. we'll use an updatePreview function instead
Definition at line 63 of file addPhotosDialog.h.
{}
| void FilePreview::updatePreview | ( | const QString & | path | ) |
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().
{
//handle requests to update the preview information by asking
//the generator thread to handle them. by using
//an auxiallary thread we can process requests very quickly while
//any current work being done to generate an image preview continues
if( generatorThread != NULL)
{
generatorThread->start( filename );
}
}
QLabel* FilePreview::fileDetails [private] |
details about last selected file
Definition at line 77 of file addPhotosDialog.h.
Referenced by customEvent(), and FilePreview().
QLabel* FilePreview::filePreview [private] |
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.7.5.1