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

Window Class Reference

#include <window.h>

Inheritance diagram for Window:

[legend]
Collaboration diagram for Window:
[legend]
List of all members.

Detailed Description

Top level widget, encapsulates the title widget, the layout widget, and the toolbar widget.

Definition at line 32 of file window.h.

Public Member Functions

 Window (QWidget *parent=0, const char *name=0)
 Creates title area, layout, and tool bar and places them in grid.

 ~Window ()
 Save user settings on destruct.

TitleWidgetgetTitle ()
 returns a pointer to the title widget

LayoutWidgetgetLayout ()
 returns a pointer to the layout object

StatusWidgetgetStatus ()
 returns a pointer to the status widget

void refresh ()
 refreshes the layout

ConfigurationgetConfig ()
 get setting object


Public Attributes

QPixmap * shadowBL
QPixmap * shadowB
QPixmap * shadowBR
QPixmap * shadowR
QPixmap * shadowTR
QPixmap * photoInfo

Protected Member Functions

bool event (QEvent *)
void hideEvent (QHideEvent *)
void showEvent (QShowEvent *)
void closeEvent (QCloseEvent *e)

Private Member Functions

void startSlideshow (bool startAtBeginning)
 utility function used by above, actually started slideshow


Private Attributes

Configurationconfig
 Configuration settings.

QGridLayout * grid
 Grid objects placed in.

TitleWidgettitle
 Title widget cont ains menu's, album information and Album Shaper icon.

LayoutWidgetlayout
 Layout includes subalbums listing and particular subalbum layout.

StatusWidgetstatus
 Status widget either displays a status message or progress bar.


Constructor & Destructor Documentation

Window::Window QWidget parent = 0,
const char *  name = 0
 

Creates title area, layout, and tool bar and places them in grid.

refresh title annotations when collections are selected

refresh collection icons when collection names are edited

Definition at line 48 of file window.cpp.

References config, Configuration::getBool(), Configuration::getString(), grid, IMAGE_PATH, layout, Configuration::loadSettings(), photoInfo, LayoutWidget::refresh(), Configuration::resetSetting(), shadowB, shadowBL, shadowBR, shadowR, shadowTR, status, title, TitleWidget::useAnimation(), and Window().

Referenced by Window().

00048 : QWidget(parent,name) 00049 { 00050 //don't clear pixmap area before painting, prevents flicker 00051 setWFlags(WRepaintNoErase); 00052 00053 //load shadow pixmaps 00054 shadowBL = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottomLeft.png" ); 00055 shadowB = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottom.png" ); 00056 shadowBR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottomRight.png" ); 00057 shadowR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientRight.png" ); 00058 shadowTR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientTopRight.png" ); 00059 00060 //load photo info pixmap 00061 photoInfo = new QPixmap( QString(IMAGE_PATH)+"buttonIcons/photoInfo.png"); 00062 00063 //------------------------------------------------ 00064 //create configuration object with default settings 00065 config = new Configuration(); 00066 LoadingSavingWidget::setDefaults(config); 00067 LayoutSettingsWidget::setDefaults(config); 00068 AlertsWidget::setDefaults(config); 00069 MiscSettings::setDefaults(config); 00070 //------------------------------------------------ 00071 //load user settings 00072 config->loadSettings(); 00073 00074 //if temorary image directory does not exist create it 00075 QDir homeDir; 00076 bool configDirMade = true; 00077 if(!homeDir.exists( config->getString( "loadSave", "tempImageDirectory")) ) 00078 { configDirMade = homeDir.mkdir( config->getString( "loadSave", "tempImageDirectory")); } 00079 //if directory could not be made attempt to revert to default directory 00080 if(!configDirMade) 00081 { 00082 AlertDialog alert( "unable to create temp dir", QString("unable to make temporary directory! (" + config->getString( "loadSave", "tempImageDirectory") ), 00083 "alertIcons/warning.png", this ); 00084 alert.exec(); 00085 00086 00087 config->resetSetting( "loadSave", "tempImageDirectory" ); 00088 configDirMade = true; 00089 if(!homeDir.exists( config->getString( "loadSave", "tempImageDirectory")) ) 00090 { configDirMade = homeDir.mkdir( config->getString( "loadSave", "tempImageDirectory")); } 00091 } 00092 00093 //if we are still unable to create the temporary image directory then immediately abort 00094 if(!configDirMade) 00095 { 00096 AlertDialog alert( "unable to create temp dir", QString("unable to make temporary directory! (" + config->getString( "loadSave", "tempImageDirectory") ), 00097 "alertIcons/warning.png", this ); 00098 alert.exec(); 00099 00100 close(); 00101 } 00102 00103 //------------------------------------------------ 00104 //create top level widgets 00105 title = new TitleWidget (this, "title"); 00106 layout = new LayoutWidget(this, "layout"); 00107 status = new StatusWidget(this, "status"); 00108 00110 connect( layout, SIGNAL(collectionSelected(Subalbum*)), 00111 title, SLOT(refreshCollectionAnnotations(Subalbum*)) ); 00112 00114 connect( title, SIGNAL(subalbumNameChanged()), 00115 layout, SLOT(refreshSelectedCollectionIconName()) ); 00116 00117 // slideshow = new SlideshowWidget(this, "slideshow", WResizeNoErase); 00118 // slideshow->hide(); 00119 // connect( slideshow, SIGNAL(endSlideshow()), this, SLOT(endSlideshow()) ); 00120 00121 //refresh subalbums listing 00122 layout->refresh(); 00123 00124 //place widgets in main frame 00125 grid = new QGridLayout( this, 3, 2, 0); 00126 grid->addWidget( title, 0, 0 ); 00127 grid->addWidget( layout, 1, 0 ); 00128 grid->setRowStretch( 1, 1 ); 00129 grid->addWidget( status, 2, 0 ); 00130 grid->setRowSpacing( 2, 24 ); 00131 // grid->addMultiCellWidget( slideshow, 0, 2, 1, 1 ); 00132 grid->setColStretch(0, 1 ); 00133 00134 //PLATFORM_SPECIFIC_CODE 00135 //create and set application icon 00136 #if( !defined(Q_OS_MACX) && !defined(Q_OS_WIN) ) 00137 setIcon( QPixmap(QString(IMAGE_PATH)+"miscImages/as32.png") ); 00138 #endif 00139 00140 setCaption( 00141 #ifdef CVS_CODE 00142 "(CVS BUILD) " + 00143 #endif 00144 tr("Album Shaper")); 00145 //------------------------------------------------ 00146 //apply settings 00147 QToolTip::setGloballyEnabled( config->getBool( "layout", "showTooltips" ) ); 00148 title->useAnimation( config->getBool( "layout", "animation" ) ); 00149 //------------------------------------------------ 00150 }

Window::~Window  ) 
 

Save user settings on destruct.

Definition at line 152 of file window.cpp.

References config, RecentAlbums::getEntry(), TitleWidget::getRecentAlbums(), height, RecentAlbums::numEntries(), Configuration::removeGroup(), Configuration::saveSettings(), Configuration::setInt(), Configuration::setString(), title, and width.

00153 { 00154 //flush and reinsert recent albums listing 00155 config->removeGroup( "recentAlbums" ); 00156 RecentAlbums* recentAlbums = title->getRecentAlbums(); 00157 int num = recentAlbums->numEntries(); 00158 int i; 00159 QString albumName, albumLocation, albumPhotoCount; 00160 for(i=0; i<num; i++) 00161 { 00162 recentAlbums->getEntry( i, albumName, albumLocation, albumPhotoCount ); 00163 config->setString( "recentAlbums", QString("%1_name").arg(i), albumName ); 00164 config->setString( "recentAlbums", QString("%1_location").arg(i), albumLocation ); 00165 config->setString( "recentAlbums", QString("%1_photoCount").arg(i), albumPhotoCount ); 00166 } 00167 00168 //store window size and placement in config object 00169 config->setInt( "layout", "windowPosX", pos().x() ); 00170 config->setInt( "layout", "windowPosY", pos().y() ); 00171 config->setInt( "layout", "windowWidth", size().width() ); 00172 config->setInt( "layout", "windowHeight", size().height() ); 00173 00174 //save user settings 00175 config->saveSettings(); 00176 00177 //delete non-qt objects 00178 delete config; 00179 config = NULL; 00180 }


Member Function Documentation

void Window::closeEvent QCloseEvent *  e  )  [protected]
 

Definition at line 202 of file window.cpp.

References Album::albumModified(), closeEvent(), config, TitleWidget::getAlbum(), Configuration::getBool(), and title.

Referenced by closeEvent().

00203 { 00204 //check if unsaved modifications exist, warn user they 00205 //will lose these if they quit now 00206 if(title->getAlbum()->albumModified() ) 00207 { 00208 //if user has chosen to not receive destructive action warnings, or agrees to the action then quit 00209 bool proceed = (!config->getBool( "alerts", "showDestructiveAlerts" )); 00210 if(!proceed) 00211 { 00212 QuestionDialog sure( tr("Quit without saving?"), 00213 tr("You have unsaved work. Are you sure you want to quit without saving?"), 00214 "alertIcons/warning.png", 00215 this ); 00216 proceed = sure.exec(); 00217 } 00218 if(proceed) 00219 e->accept(); 00220 else 00221 e->ignore(); 00222 } 00223 else 00224 { 00225 e->accept(); 00226 } 00227 }

bool Window::event QEvent *   )  [protected]
 

Definition at line 322 of file window.cpp.

References event(), title, and TitleWidget::windowStateChanged().

Referenced by event().

00323 { 00324 //if base class handles event return immediately 00325 if (QWidget::event( e ) ) 00326 return true; 00327 00328 //handle showMinimized events 00329 if ( e->type() == QEvent::ShowMinimized ) 00330 { 00331 //update menu entries as per window state change 00332 title->windowStateChanged( false ); 00333 return true; 00334 } 00335 00336 return false; 00337 }

Configuration * Window::getConfig  ) 
 

get setting object

Definition at line 229 of file window.cpp.

References config.

Referenced by TitleWidget::createTmpDir(), TitleWidget::exportLargeImages(), TitleWidget::exportSmallWebGallery(), TitleWidget::loadAlbum(), main(), TitleWidget::newAlbum(), TitleWidget::proceedWithLoad(), TitleWidget::removeSelectedPhotoDesc(), TitleWidget::revertToSaved(), TitleWidget::saveAlbum(), TitleWidget::saveAsAlbum(), TitleWidget::settings(), and TitleWidget::TitleWidget().

00230 { 00231 return config; 00232 }

LayoutWidget * Window::getLayout  ) 
 

returns a pointer to the layout object

Definition at line 187 of file window.cpp.

References layout.

Referenced by TitleWidget::dropEvent(), TitleWidget::exportLargeImages(), TitleWidget::exportSmallWebGallery(), TitleWidget::loadAlbum(), TitleWidget::newAlbum(), TitleWidget::removeSelectedPhotoDesc(), TitleWidget::revertPhotos(), TitleWidget::saveAlbum(), TitleWidget::saveAsAlbum(), TitleWidget::setAlbumImage(), TitleWidget::setSubalbumImage(), TitleWidget::storeAnnotations(), and TitleWidget::unsetSubalbumImage().

00188 { 00189 return layout; 00190 }

StatusWidget * Window::getStatus  ) 
 

returns a pointer to the status widget

Definition at line 192 of file window.cpp.

References status.

Referenced by SubalbumWidget::addImageAction(), EditingInterface::adjustGrain(), EditingInterface::applyEffect(), EditingInterface::colorBalance(), EditingInterface::crop(), EditingInterface::enhanceContrast(), TitleWidget::exportLargeImages(), TitleWidget::exportSmallWebGallery(), EditingInterface::finishCorrectTilt(), TitleWidget::loadAlbum(), EditingInterface::removeRedeye(), EditingInterface::revertCurrentPhoto(), SubalbumWidget::rotate270ImageAction(), SubalbumWidget::rotate90ImageAction(), EditingInterface::rotateFlip(), TitleWidget::saveAlbum(), TitleWidget::saveAsAlbum(), and EditingInterface::tuneLevels().

00193 { 00194 return status; 00195 }

TitleWidget * Window::getTitle  ) 
 

returns a pointer to the title widget

Definition at line 182 of file window.cpp.

References title.

Referenced by SubalbumWidget::addImageAction(), SubalbumsWidget::createAction(), SubalbumsWidget::deleteAction(), SubalbumsWidget::handleSelectionAttempt(), LayoutWidget::photoStateChangedEvent(), SubalbumsWidget::refreshCollectionsList(), SubalbumWidget::removeImageAction(), SubalbumsWidget::reorder(), SubalbumWidget::rotate270ImageAction(), and SubalbumWidget::rotate90ImageAction().

00183 { 00184 return title; 00185 }

void Window::hideEvent QHideEvent *   )  [protected]
 

Definition at line 339 of file window.cpp.

References hideEvent(), title, and TitleWidget::windowStateChanged().

Referenced by hideEvent().

00340 { 00341 //update menu entries as per window state change 00342 title->windowStateChanged( false ); 00343 }

void Window::refresh  ) 
 

refreshes the layout

Definition at line 197 of file window.cpp.

References layout, and LayoutWidget::refresh().

Referenced by TitleWidget::refresh().

00198 { 00199 layout->refresh(); 00200 }

void Window::showEvent QShowEvent *   )  [protected]
 

Definition at line 345 of file window.cpp.

References showEvent(), title, and TitleWidget::windowStateChanged().

Referenced by showEvent().

00346 { 00347 //update menu entries as per window state change 00348 title->windowStateChanged( true ); 00349 }

void Window::startSlideshow bool  startAtBeginning  )  [private]
 

utility function used by above, actually started slideshow


Member Data Documentation

Configuration* Window::config [private]
 

Configuration settings.

Definition at line 100 of file window.h.

Referenced by closeEvent(), getConfig(), Window(), and ~Window().

QGridLayout* Window::grid [private]
 

Grid objects placed in.

Definition at line 103 of file window.h.

Referenced by Window().

LayoutWidget* Window::layout [private]
 

Layout includes subalbums listing and particular subalbum layout.

Definition at line 109 of file window.h.

Referenced by getLayout(), refresh(), and Window().

QPixmap* Window::photoInfo
 

Definition at line 66 of file window.h.

Referenced by Window().

QPixmap * Window::shadowB
 

Definition at line 63 of file window.h.

Referenced by PhotoPreviewWidget::paintItem(), and Window().

QPixmap* Window::shadowBL
 

Definition at line 63 of file window.h.

Referenced by PhotoPreviewWidget::paintItem(), and Window().

QPixmap * Window::shadowBR
 

Definition at line 63 of file window.h.

Referenced by PhotoPreviewWidget::paintItem(), and Window().

QPixmap * Window::shadowR
 

Definition at line 63 of file window.h.

Referenced by PhotoPreviewWidget::paintItem(), and Window().

QPixmap * Window::shadowTR
 

Definition at line 63 of file window.h.

Referenced by PhotoPreviewWidget::paintItem(), and Window().

StatusWidget* Window::status [private]
 

Status widget either displays a status message or progress bar.

Definition at line 112 of file window.h.

Referenced by getStatus(), and Window().

TitleWidget* Window::title [private]
 

Title widget cont ains menu's, album information and Album Shaper icon.

Definition at line 106 of file window.h.

Referenced by closeEvent(), event(), getTitle(), hideEvent(), showEvent(), Window(), and ~Window().


The documentation for this class was generated from the following files:
Generated on Sun Mar 4 19:43:10 2007 for AlbumShaper by doxygen 1.3.7