Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

FilePreview Class Reference

#include <addPhotosDialog.h>

Inheritance diagram for FilePreview:

Inheritance graph
[legend]
Collaboration diagram for FilePreview:

Collaboration graph
[legend]
List of all members.

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

QLabelfilePreview
 preview of last selected file
QLabelfileDetails
 details about last selected file
GeneratePreviewThreadgeneratorThread
 a worker thread that actually generates the file preview image and details information that is displayed.

Constructor & Destructor Documentation

FilePreview::FilePreview QWidget parent = 0  ) 
 

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 }

FilePreview::~FilePreview  ) 
 

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 }


Member Function Documentation

void FilePreview::customEvent QCustomEvent e  )  [protected]
 

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 }

QSize FilePreview::minimumSizeHint  )  const
 

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 }

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.

00063 {}

void FilePreview::updatePreview const QString &  path  ) 
 

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 }


Member Data Documentation

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().

GeneratePreviewThread* FilePreview::generatorThread [private]
 

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().


The documentation for this class was generated from the following files:
Generated on Sat Apr 2 05:44:56 2005 for AlbumShaper by  doxygen 1.3.9.1