ScaledPreviewInterface Class Reference

#include <scaledPreviewInterface.h>

Inheritance diagram for ScaledPreviewInterface:

Inheritance graph
[legend]
Collaboration diagram for ScaledPreviewInterface:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 19 of file scaledPreviewInterface.h.


Signals

void resized ()

Public Member Functions

 ScaledPreviewInterface (QString imageFilename, QWidget *parent=0, const char *name=0)
 Creates layout.
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const

Protected Member Functions

void resizeEvent (QResizeEvent *)

Private Attributes

QImage fullScreenImage
 Full screen version of image.
QSize origImageSize
 original image dimensions

Constructor & Destructor Documentation

ScaledPreviewInterface::ScaledPreviewInterface ( QString  imageFilename,
QWidget parent = 0,
const char *  name = 0 
)

Creates layout.

Definition at line 19 of file scaledPreviewInterface.cpp.

References fullScreenImage, getImageSize(), origImageSize, and scaleImage().

00020                                                                                     : 
00021                                                 SplitViewInterface (parent, name )
00022 {                  
00023   //store original image dimensions
00024   getImageSize( imageFilename, origImageSize );
00025   
00026   //resize image to current screen size for faster
00027   //scaling during resize events
00028   QRect screenSize = qApp->desktop()->availableGeometry();
00029   scaleImage( imageFilename, fullScreenImage, screenSize.width()/2, screenSize.height()/2 );
00030   //-----
00031 }


Member Function Documentation

QSize ScaledPreviewInterface::sizeHint (  )  const [virtual]

Implements SplitViewInterface.

Definition at line 47 of file scaledPreviewInterface.cpp.

References origImageSize.

00048 {
00049   //a 500x375 is 4:3 aspect ratio which is fairly typical
00050   //we'll clamp the hight to 375 in the situation where an image is mucher taller than wide
00051   //(and hence computed height would be so big window won't fit on screen)  
00052   int w = 500;
00053   int h = QMIN( 375, (w*origImageSize.height())/origImageSize.width() );
00054 
00055   return QSize( w,h );
00056 }

QSize ScaledPreviewInterface::minimumSizeHint (  )  const [virtual]

Reimplemented from SplitViewInterface.

Definition at line 58 of file scaledPreviewInterface.cpp.

References SplitViewInterface::minimumSizeHint(), and origImageSize.

00059 {
00060   QSize baseMinSize = SplitViewInterface::minimumSizeHint();
00061   int w = baseMinSize.width();
00062   int h = QMAX( baseMinSize.height(), (w*origImageSize.height())/origImageSize.width() );
00063   return QSize( w, h );
00064 }

void ScaledPreviewInterface::resizeEvent ( QResizeEvent *   )  [protected, virtual]

Implements SplitViewInterface.

Definition at line 33 of file scaledPreviewInterface.cpp.

References fullScreenImage, height, resized(), SplitViewInterface::setImages(), and width.

00034 {
00035   //if image has yet to be set return
00036   if( fullScreenImage.isNull() ) return;
00037 
00038   //generate orig image
00039   //set adjusted image to null so repain won't occur until it is reset
00040   setImages( fullScreenImage.scale( width(), height(), QImage::ScaleMin ),
00041              QImage() );
00042   
00043   //emit resized signal
00044   emit resized();
00045 }

void ScaledPreviewInterface::resized (  )  [signal]

Referenced by resizeEvent().


Member Data Documentation

Full screen version of image.

Definition at line 35 of file scaledPreviewInterface.h.

Referenced by resizeEvent(), and ScaledPreviewInterface().

original image dimensions

Definition at line 38 of file scaledPreviewInterface.h.

Referenced by minimumSizeHint(), ScaledPreviewInterface(), and sizeHint().


The documentation for this class was generated from the following files:

Generated on Thu Jun 19 15:43:50 2008 for AlbumShaper by  doxygen 1.5.6