TitleWidget Class Reference

#include <titleWidget.h>

Inheritance diagram for TitleWidget:

Inheritance graph
[legend]
Collaboration diagram for TitleWidget:

Collaboration graph
[legend]

List of all members.


Detailed Description

Widget which displays album name, description, representative image, and album shaper logo.

Definition at line 49 of file titleWidget.h.


Public Slots

void albumStatisticsClosed ()
 Frees album statistics dialog once closed.
void aboutClosed ()
 Frees about dialog once closed.
void helpClosed ()
 Frees HelpWindow once closed.
void quitApplication ()
 Quit slot.
void settingsWindowClosed ()
void updateAlbumAnnotations ()
 Updates subalbum annotations.
void refreshCollectionAnnotations (Subalbum *collection)
 Update displayed collection name and cover image.
void setAlbumImage (Photo *photo)
 Sets the album image to the passed in photo.
void setSubalbumImage (Photo *photo)
 Sets the subalbum image to the passed in photo.
void aboutProgram (int mode=ABOUT)
 Pops up about dialog.
void help ()
 Pops up HelpWindow.
void windowStateChanged (bool state)
 Enables/disables "minimize" window menu entry depending on window state.
void updateMenus (bool anySelected=false, bool anyRevertable=false)
 update begin presentation menu entry - disabled when no photos in album

Signals

void subalbumNameChanged ()
 Emitted when user changes subalbum name.

Public Member Functions

 TitleWidget (QWidget *parent=0, const char *name=0)
 Creates layout.
 ~TitleWidget ()
 Deletes stuff!
void useAnimation (bool val)
 Use animation for rep images?
void setAlbum (Album *val)
 Sets new pointer to the album object.
AlbumgetAlbum ()
 Returns a pointer to the album object.
void refresh ()
 Refreshs data from backend objects.
bool getBusy ()
 is program busy?
void setBusy (bool val)
 set program busy state
RecentAlbumsgetRecentAlbums ()
 returns handle to recent albums object

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *e)
void dropEvent (QDropEvent *e)
QString createTmpDir (QString albumPath=QString::null)

Private Slots

void storeAnnotations ()
 Store annotations.
void setAlbumImage ()
 Sets the Album Image.
void unsetAlbumImage ()
 Unsets the Album Image.
void setSubalbumImage ()
 Sets the Subalbum Image.
void unsetSubalbumImage ()
 Unsets the Subalbum Image.
void newAlbum ()
 Resets to empty album.
void loadAlbum ()
 Loads an album specified with file chooser.
void loadRecentAlbum (int index)
 Loads a recent album.
bool proceedWithLoad ()
 Helper function for load methods, checks if there are any unsaved changes and if so warns user any such changes will be lost if they proceed.
void loadAlbum (QString location)
 Loads a specified album.
void saveAlbum ()
 Saves album.
void saveAsAlbum ()
 Saves album as.
void revertToSaved ()
 Revert to last saved album.
void exportSmallWebGallery ()
 Export small web gallery (excludes full size images and Album.xml file).
void exportLargeImages ()
 Export large images only to a new directory for printing purposes.
void settings ()
 Pops up settings window.
void removeSelectedPhotoDesc ()
 Strip descriptions from selected photos.
void revertPhotos ()
 Revert selected photos to original form.
void albumStatistics ()
 Pops up album statistics window.
void clearOpenRecentMenu ()
 Clears albums from open recent menu.

Private Member Functions

void populateOpenRecentMenu ()
 Populates the open recent menu with a default set of 9 items + clear.
void refreshOpenRecentMenu ()
 Refreshes open recent menu.

Private Attributes

QMenuBar * menu
 Menubar file menu and help menu inserted in.
QPopupMenu * file
 File menu.
QPopupMenu * openRecent
 Open recent submenu.
int * recentMenuItems
int numRecentMenuItems
RecentAlbumMenuItem ** customRecentMenuItems
QPopupMenu * photoMenu
 Photos menu.
QPopupMenu * tools
 Tools menu.
QPopupMenu * helpMenu
 Window menu, only used in OSX.
QGridLayout * mainGrid
 Main grid.
QFramemainFrame
QGridLayout * albumAnnotationGrid
 Album annotation grid.
QFramealbumAnnotationFrame
ALabelalbumImage
QLabelalbumName
QLineEdit * albumNameVal
QLabelalbumDescription
QLineEdit * albumDescriptionVal
QLabelalbumAuthor
QLineEdit * albumAuthorVal
QGridLayout * subalbumAnnotationGrid
 Subalbum annotation grid.
QFramesubalbumAnnotationFrame
ALabelsubalbumImage
QLabelsubalbumName
QLineEdit * subalbumNameVal
QLabelsubalbumDescription
QLineEdit * subalbumDescriptionVal
Albumalbm
 Backend album object.
Windowwindow
 Window pointer.
AlbumStatisticsalbumStats
 Album Statistics dialog pointer.
ConfigurationWidgetsettingsWindow
 Settings dialog pointer.
Aboutabout
 About dialog pointer.
HelpWindowhelpWindow
 HelpWindow pointer.
bool busy
 Is the program currently busy? helps block other operations.
bool detectModifications
int NEW_ALBUM
int OPEN_ALBUM
int SAVE_ALBUM
int SAVEAS_ALBUM
int REVERT_TO_SAVED_ALBUM
int EXPORT_SMALL_WEB_GALLERY
int EXPORT_LARGE_IMAGES
int REMOVE_DESCRIPTIONS
 photos menu item id's
int REVERT_PHOTOS
int BEGIN_PRESENTATION
 tools menu item id's
int BEGIN_PRESENTATION_AT
bool cacheSetButtonState
 cached set button state
QString tmpDirErrorMessage
 error message and description when temp directory cannot be created
QString tmpDirErrorDesc
RecentAlbums recentAlbums

Constructor & Destructor Documentation

TitleWidget::TitleWidget ( QWidget parent = 0,
const char *  name = 0 
)

Creates layout.

Store parent pointer

program not busy at first

no windows open by default

Definition at line 62 of file titleWidget.cpp.

References about, aboutProgram(), albm, albumAnnotationFrame, albumAnnotationGrid, albumAuthor, albumAuthorVal, albumDescription, albumDescriptionVal, albumImage, albumName, albumNameVal, albumStatistics(), albumStats, busy, createTmpDir(), detectModifications, EXPORT_LARGE_IMAGES, EXPORT_SMALL_WEB_GALLERY, exportLargeImages(), exportSmallWebGallery(), file, Window::getConfig(), RecentAlbums::getMaxItems(), Configuration::getString(), Album::getTmpDir(), help(), helpMenu, helpWindow, IMAGE_PATH, RecentAlbums::insertEntry(), loadAlbum(), mainFrame, mainGrid, menu, NEW_ALBUM, newAlbum(), OPEN_ALBUM, openRecent, photoMenu, populateOpenRecentMenu(), quitApplication(), recentAlbums, refreshOpenRecentMenu(), REMOVE_DESCRIPTIONS, removeSelectedPhotoDesc(), REP_IMAGE_HEIGHT, REVERT_PHOTOS, REVERT_TO_SAVED_ALBUM, revertPhotos(), revertToSaved(), SAVE_ALBUM, saveAlbum(), SAVEAS_ALBUM, saveAsAlbum(), settings(), settingsWindow, storeAnnotations(), subalbumAnnotationFrame, subalbumAnnotationGrid, subalbumDescription, subalbumDescriptionVal, subalbumImage, subalbumName, subalbumNameVal, tmpDirErrorDesc, tmpDirErrorMessage, tools, unsetAlbumImage(), unsetSubalbumImage(), WIDGET_SPACING, and window.

00063                                                     : QFrame(parent,name)
00064 {
00065   tmpDirErrorMessage = tr("Error! Unable to create temp directory!");
00066   tmpDirErrorDesc = tr("Album Shaper was unable to create the necessary temp directory required: ");
00067   //--------------------------------------------------------------
00068   QColor white(255, 255, 255);
00069   QColor lightBlue(193, 210, 238);
00070   QColor darkBlue(35, 75, 139);
00071   QColor black(0, 0, 0);
00072   //--------------------------------------------------------------
00074   window = (Window*)parent;
00075 
00077   busy = false;
00078 
00079   //detect changes to text fields
00080   detectModifications = true;
00081 
00083   albumStats = NULL;
00084   settingsWindow = NULL;
00085   about = NULL;
00086   helpWindow = NULL;
00087 
00088   //create backend album object
00089   albm = new Album( createTmpDir() );
00090   if(albm->getTmpDir().isNull() )
00091   {
00092       AlertDialog alert( tmpDirErrorMessage, tmpDirErrorDesc + window->getConfig()->getString( "loadSave", "tempImageDirectory" ),
00093       "alertIcons/warning.png", this );
00094       alert.exec();
00095       quitApplication();
00096   }
00097   //-------------------------------------
00098   //initialize recent albums object
00099   int i;
00100   QString recentName, recentLocation, recentPhotoCount;
00101   for(i = 0; i<recentAlbums.getMaxItems(); i++)
00102   {
00103     //get album name and location
00104     recentName = window->getConfig()->getString(    "recentAlbums", QString("%1_name").arg(i)     );
00105     recentLocation = window->getConfig()->getString("recentAlbums", QString("%1_location").arg(i) );
00106     recentPhotoCount = window->getConfig()->getString("recentAlbums", QString("%1_photoCount").arg(i) );
00107 
00108     //no such listing? since listings are continious all listings must be loaded
00109     if(recentLocation.compare("-1") == 0)
00110       break;
00111 
00112     //insert item into list
00113     recentAlbums.insertEntry( recentName, recentLocation, recentPhotoCount ); 
00114   }      
00115   //--------------------------------------------------------------
00116   //create menus
00117   menu = new QMenuBar( this, "menuBar" );
00118   //---
00119   //File menu
00120   file = new QPopupMenu( this, "fileMenu" );
00121   NEW_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/new.png") ),
00122                                 tr("&New"), this, SLOT(newAlbum()), CTRL+Key_N );
00123 
00124   OPEN_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/open.png") ),
00125                                  tr("&Open..."), this, SLOT(loadAlbum()), CTRL+Key_O );
00126 
00127   openRecent = new QPopupMenu( this, "openRecentMenu" );
00128   populateOpenRecentMenu();
00129   refreshOpenRecentMenu();
00130   file->insertItem( tr("Open Recent"), openRecent );
00131   //----------------------
00132   file->insertSeparator();
00133   //----------------------  
00134   SAVE_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/save.png") ),
00135                                  tr("&Save"), this, SLOT(saveAlbum()), CTRL+Key_S );
00136 
00137   SAVEAS_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/saveas.png") ),
00138                                    tr("&Save As..."), this, SLOT(saveAsAlbum()), CTRL+SHIFT+Key_S );
00139 
00140   REVERT_TO_SAVED_ALBUM = file->insertItem( tr("Revert to Saved"), this, SLOT(revertToSaved()) );
00141   file->setItemEnabled( REVERT_TO_SAVED_ALBUM, false );  
00142   //----------------------
00143   file->insertSeparator();
00144   //----------------------
00145   QPopupMenu* exportAs = new QPopupMenu( this, "exportAs" );
00146   EXPORT_SMALL_WEB_GALLERY = exportAs->insertItem( tr("Small Web Gallery..."), 
00147                                                    this, SLOT(exportSmallWebGallery()) );
00148   EXPORT_LARGE_IMAGES = exportAs->insertItem( tr("Images for Printing..."), 
00149                                               this, SLOT(exportLargeImages()) );
00150   
00151   file->insertItem( tr("Export"), exportAs );
00152   //----------------------  
00153   file->insertSeparator();
00154   //----------------------
00155   file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/quit.png") ),
00156                     tr("&Quit"), this, SLOT(quitApplication()), CTRL+Key_Q);
00157 
00158   
00159   menu->insertItem( tr("&File"), file );
00160   //---
00161   //Photo menu
00162   photoMenu = new QPopupMenu( this, "phooMenu" );
00163     
00164   REMOVE_DESCRIPTIONS = photoMenu->insertItem( tr("Remove Description"), this, SLOT(removeSelectedPhotoDesc()) );
00165   REVERT_PHOTOS = photoMenu->insertItem( tr("Revert to Original"), this, SLOT(revertPhotos()) );
00166   
00167   menu->insertItem( tr("&Photos"), photoMenu );
00168   //---
00169   //Tools menu
00170   tools = new QPopupMenu( this, "toolsMenu" );
00171 /*
00172   BEGIN_PRESENTATION_AT = tools->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/startPresentation.png") ),
00173                                           tr("Begin Presentation"), 
00174                                           window, SLOT(startSlideshowWithSelectedPhoto()), CTRL+Key_P );   
00175   BEGIN_PRESENTATION = tools->insertItem( tr("Begin Presentation at Beginning"), 
00176                                              window, SLOT(startSlideshowAtBeginning()), CTRL+SHIFT+Key_P ); 
00177   updateMenus();
00178  */
00179 
00180   tools->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/albumStatistics.png") ),
00181                      tr("Album Statistics"), this, SLOT(albumStatistics()), CTRL+Key_I );
00182 
00183   tools->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/settings.png") ),
00184                      tr("Settings"), this, SLOT(settings()) );
00185 
00186   menu->insertItem( tr("&Tools"), tools );
00187   //---
00188   //PLATFORM_SPECIFIC_CODE
00189   //Window menu
00190   #if defined(Q_OS_MACX)
00191   windowMenu = new QPopupMenu( this, "windoMenu" );
00192   WINDOW_MINIMIZE = windowMenu->insertItem( tr("&Minimize"), (QWidget*)window, SLOT(showMinimized()), CTRL+Key_M );
00193   menu->insertItem( tr("&Window"), windowMenu );
00194   #endif
00195   //---    
00196   //Help menu
00197   helpMenu = new QPopupMenu( this, "helpMenu" );
00198   helpMenu->insertItem( tr("Album Shaper Help"), this, SLOT(help()), CTRL+Key_Question );
00199 
00200   helpMenu->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/about.png") ),
00201                     tr("About"), this, SLOT(aboutProgram()) );
00202   menu->insertSeparator();
00203   menu->insertItem( tr("&Help"), helpMenu );
00204   //--------------------------------------------------------------
00205   //create all widgets
00206   mainFrame = new QFrame( this, "mainFrame" );
00207   mainFrame->setPaletteBackgroundColor( darkBlue );
00208   //------
00209   //album annotations
00210   albumAnnotationFrame = new QFrame( mainFrame, "albumAnnotationFrame" );
00211   albumAnnotationFrame->setLineWidth(2);
00212   albumAnnotationFrame->setMidLineWidth(0);
00213   albumAnnotationFrame->setFrameStyle( QFrame::Panel | QFrame::Plain );
00214   albumAnnotationFrame->setPaletteForegroundColor( white );
00215   albumAnnotationFrame->setPaletteBackgroundColor( darkBlue );
00216 
00217   QFrame* albumImageFrame = new QFrame( albumAnnotationFrame, "albumImageFrame" );
00218   albumImage = new ALabel( albumImageFrame, "albumImage",
00219                                                new QPixmap( QString(IMAGE_PATH)+"buttonIcons/removeImage.png") );
00220   connect( albumImage, SIGNAL(mouseRelease()),
00221                 this, SLOT(unsetAlbumImage()) );
00222 
00223   //allow drop events
00224   this->setAcceptDrops(true);
00225 
00226   albumName = new QLabel( tr("Album Name:"), albumAnnotationFrame, "albumName" );
00227   albumNameVal = new QLineEdit( albumAnnotationFrame, "albumNameVal" );
00228   connect( albumNameVal, SIGNAL(textChanged( const QString&)),
00229            SLOT( storeAnnotations()) );
00230 
00231   albumDescription = new QLabel( tr("Description:"), albumAnnotationFrame, "albumDescription" );
00232   albumDescriptionVal = new QLineEdit( albumAnnotationFrame, "albumDescriptionVal" );
00233   connect( albumDescriptionVal, SIGNAL(textChanged( const QString&)),
00234            SLOT( storeAnnotations()) );
00235 
00236   albumAuthor = new QLabel( tr("Author:"), albumAnnotationFrame, "albumAuthor" );
00237   albumAuthorVal = new QLineEdit( albumAnnotationFrame, "albumAuthorVal" );
00238   connect( albumAuthorVal, SIGNAL(textChanged( const QString&)),
00239            SLOT( storeAnnotations()) );
00240   //------
00241   //subalbum annotations
00242   subalbumAnnotationFrame = new QFrame( mainFrame, "subalbumAnnotationFrame" );
00243   subalbumAnnotationFrame->setLineWidth(2);
00244   subalbumAnnotationFrame->setMidLineWidth(0);
00245   subalbumAnnotationFrame->setFrameStyle( QFrame::Panel | QFrame::Plain );
00246   subalbumAnnotationFrame->setPaletteForegroundColor( white );
00247   subalbumAnnotationFrame->setPaletteBackgroundColor( darkBlue );
00248 
00249   QFrame* subalbumImageFrame = new QFrame( subalbumAnnotationFrame, "subalbumImageFrame" );
00250   subalbumImage = new ALabel( subalbumImageFrame, "subalbumImage",
00251                                                     new QPixmap( QString(IMAGE_PATH)+"buttonIcons/removeImage.png") );
00252 
00253   connect( subalbumImage, SIGNAL(mouseRelease()),
00254                  this, SLOT(unsetSubalbumImage()) );
00255 
00256   subalbumName = new QLabel( tr("Collection Name:"), subalbumAnnotationFrame );
00257   subalbumNameVal = new QLineEdit( subalbumAnnotationFrame );
00258   connect( subalbumNameVal, SIGNAL(textChanged( const QString&)),
00259            SLOT( storeAnnotations()) );
00260 
00261   subalbumDescription = new QLabel( tr("Description:"), subalbumAnnotationFrame );
00262   subalbumDescriptionVal = new QLineEdit( subalbumAnnotationFrame );
00263   connect( subalbumDescriptionVal, SIGNAL(textChanged( const QString&)),
00264            SLOT( storeAnnotations()) );
00265   //--------------------------------------------------------------
00266   //Set fonts + colors
00267   QFont labelFont = albumName->font();
00268   labelFont.setWeight(QFont::Bold);
00269 
00270   albumName->setFont( labelFont );
00271   albumName->setPaletteForegroundColor( white );
00272   albumName->setPaletteBackgroundColor( darkBlue );
00273 
00274   albumNameVal->setFont( labelFont );
00275   albumNameVal->setPaletteForegroundColor( black );
00276   albumNameVal->setPaletteBackgroundColor( lightBlue );
00277   albumNameVal->setFrameShape ( QFrame::NoFrame );
00278 
00279   albumDescription->setFont( labelFont );
00280   albumDescription->setPaletteForegroundColor( white );
00281   albumDescription->setPaletteBackgroundColor( darkBlue );
00282 
00283   albumDescriptionVal->setFont( labelFont );
00284   albumDescriptionVal->setPaletteForegroundColor( black );
00285   albumDescriptionVal->setPaletteBackgroundColor( lightBlue );
00286   albumDescriptionVal->setFrameShape ( QFrame::NoFrame );
00287 
00288   albumAuthor->setFont( labelFont );
00289   albumAuthor->setPaletteForegroundColor( white );
00290   albumAuthor->setPaletteBackgroundColor( darkBlue );
00291 
00292   albumAuthorVal->setFont( labelFont );
00293   albumAuthorVal->setPaletteForegroundColor( black );
00294   albumAuthorVal->setPaletteBackgroundColor( lightBlue );
00295   albumAuthorVal->setFrameShape ( QFrame::NoFrame );
00296 
00297   subalbumName->setFont( labelFont );
00298   subalbumName->setPaletteForegroundColor( white );
00299   subalbumName->setPaletteBackgroundColor( darkBlue );
00300 
00301   subalbumNameVal->setFont( labelFont );
00302   subalbumNameVal->setPaletteForegroundColor( black );
00303   subalbumNameVal->setPaletteBackgroundColor( lightBlue );
00304   subalbumNameVal->setFrameShape ( QFrame::NoFrame );
00305 
00306   subalbumDescription->setFont( labelFont );
00307   subalbumDescription->setPaletteForegroundColor( white );
00308   subalbumDescription->setPaletteBackgroundColor( darkBlue );
00309 
00310   subalbumDescriptionVal->setFont( labelFont );
00311   subalbumDescriptionVal->setPaletteForegroundColor( black );
00312   subalbumDescriptionVal->setPaletteBackgroundColor( lightBlue );
00313   subalbumDescriptionVal->setFrameShape ( QFrame::NoFrame );
00314   //--------------------------------------------------------------
00315   //place widgets in grids
00316   //------------------------
00317   //album annotations
00318   QGridLayout* albumImageGrid = new QGridLayout( albumImageFrame, 1, 1 );
00319   albumImageGrid->addWidget( albumImage, 0, 0 );
00320   albumImageGrid->setRowSpacing( 0, REP_IMAGE_HEIGHT );
00321 
00322   albumAnnotationGrid =      new QGridLayout( albumAnnotationFrame, 3, 3);
00323   albumAnnotationGrid->setMargin(WIDGET_SPACING);
00324   albumAnnotationGrid->setSpacing(WIDGET_SPACING);
00325 
00326   albumAnnotationGrid->addMultiCellWidget( albumImageFrame, 0, 2, 0, 0 );
00327 
00328   albumAnnotationGrid->addWidget          ( albumName, 0, 1, Qt::AlignLeft);
00329   albumAnnotationGrid->addWidget          ( albumDescription, 1, 1, Qt::AlignLeft);
00330   albumAnnotationGrid->addWidget          ( albumAuthor, 2, 1, Qt::AlignLeft);
00331 
00332   albumAnnotationGrid->setColStretch(2, 1);
00333   albumAnnotationGrid->addWidget( albumNameVal, 0, 2);
00334   albumAnnotationGrid->addWidget( albumDescriptionVal, 1, 2);
00335   albumAnnotationGrid->addWidget( albumAuthorVal, 2, 2);
00336   //------------------------
00337   //subalbum annotations
00338   QGridLayout* subalbumImageGrid = new QGridLayout( subalbumImageFrame, 1, 1 );
00339   subalbumImageGrid->addWidget( subalbumImage, 0, 0 );
00340   subalbumImageGrid->setRowSpacing( 0, REP_IMAGE_HEIGHT );
00341 
00342   subalbumAnnotationGrid = new QGridLayout( subalbumAnnotationFrame, 5, 5);
00343   subalbumAnnotationGrid->setMargin(WIDGET_SPACING);
00344   subalbumAnnotationGrid->setSpacing(WIDGET_SPACING);
00345 
00346   subalbumAnnotationGrid->addMultiCellWidget( subalbumImageFrame, 0, 2, 0, 0);
00347 
00348   subalbumAnnotationGrid->setRowStretch(2, 1);
00349   subalbumAnnotationGrid->addWidget          ( subalbumName, 0, 1, Qt::AlignLeft);
00350   subalbumAnnotationGrid->addWidget          ( subalbumDescription, 1, 1, Qt::AlignLeft);
00351 
00352   subalbumAnnotationGrid->setColStretch(2, 1);
00353   subalbumAnnotationGrid->addWidget( subalbumNameVal, 0, 2);
00354   subalbumAnnotationGrid->addWidget( subalbumDescriptionVal, 1, 2);
00355   //------------------------
00356   //place menu and album and subalbum annotations into main grid
00357   mainGrid =                       new QGridLayout( mainFrame, 1, 2);
00358   mainGrid->setMargin(WIDGET_SPACING);
00359   mainGrid->setSpacing(WIDGET_SPACING);
00360 
00361   mainGrid->addWidget          ( albumAnnotationFrame, 0, 0);
00362   mainGrid->setColStretch(0, 1);
00363 
00364   mainGrid->addWidget          ( subalbumAnnotationFrame, 0, 1);
00365   mainGrid->setColStretch(1, 1);
00366 
00367   QVBoxLayout* vb = new QVBoxLayout(this);
00368   this->layout()->setMenuBar( menu );
00369   vb->addWidget(mainFrame);
00370   //-----------------------------------------------
00371 }

TitleWidget::~TitleWidget (  ) 

Deletes stuff!

Definition at line 391 of file titleWidget.cpp.

References albm.

00392 {
00393   //delete old album
00394   delete albm;
00395   albm = NULL;
00396 }


Member Function Documentation

void TitleWidget::useAnimation ( bool  val  ) 

Use animation for rep images?

Definition at line 373 of file titleWidget.cpp.

References albumImage, FADE_TRANSITION, ALabel::setAnimationMethods(), SLIDE_IN_LEFT, SLIDE_OUT_LEFT, and subalbumImage.

Referenced by Window::Window().

00374 {
00375   //enable animation
00376   if(val)
00377   {
00378     albumImage->setAnimationMethods( SLIDE_IN_LEFT, SLIDE_OUT_LEFT,
00379                                                                 FADE_TRANSITION, FADE_TRANSITION);
00380     subalbumImage->setAnimationMethods( SLIDE_IN_LEFT, SLIDE_OUT_LEFT,
00381                                                                 FADE_TRANSITION, FADE_TRANSITION);
00382   }
00383   //disable animation
00384   else
00385   {
00386     albumImage->setAnimationMethods();
00387     subalbumImage->setAnimationMethods();
00388   }
00389 }

void TitleWidget::setAlbum ( Album val  ) 

Sets new pointer to the album object.

Definition at line 480 of file titleWidget.cpp.

References albm.

00481 {
00482   //delete old album
00483   delete albm;
00484   albm = val;
00485 }

Album * TitleWidget::getAlbum (  ) 

void TitleWidget::refresh (  ) 

Refreshs data from backend objects.

Definition at line 566 of file titleWidget.cpp.

References Window::refresh(), updateAlbumAnnotations(), and window.

Referenced by loadAlbum(), and newAlbum().

00567 {
00568   //first refresh the subalbums listing. this is 
00569   //IMPERATIVE! Right now current subalbum selection contains a pointer
00570   //to dead memory where previous subalbum was deleted. 
00571   //AKA not refreshing the subalbums iconview first will cause a crash!
00572   window->refresh();
00573 
00574   //update the album annotations (name, desc, author, images)
00575   //subalbum auto updated since window refresh auto selected first item
00576   updateAlbumAnnotations();
00577 }

bool TitleWidget::getBusy (  ) 

is program busy?

Definition at line 1246 of file titleWidget.cpp.

References busy.

Referenced by SubalbumsWidget::handleSelectionAttempt().

01247 {
01248   return busy;
01249 }

void TitleWidget::setBusy ( bool  val  ) 

set program busy state

Definition at line 1251 of file titleWidget.cpp.

References busy, file, NEW_ALBUM, OPEN_ALBUM, SAVE_ALBUM, and SAVEAS_ALBUM.

Referenced by SubalbumWidget::addImageAction(), exportLargeImages(), exportSmallWebGallery(), loadAlbum(), SubalbumWidget::removeImageAction(), SubalbumWidget::rotate270ImageAction(), SubalbumWidget::rotate90ImageAction(), saveAlbum(), and saveAsAlbum().

01252 {
01253   busy = val;
01254 
01255   //disable/enable file operations
01256   if(busy)
01257   {
01258     file->setItemEnabled(NEW_ALBUM, false);
01259     file->setItemEnabled(OPEN_ALBUM, false);
01260     file->setItemEnabled(SAVE_ALBUM, false);
01261     file->setItemEnabled(SAVEAS_ALBUM, false);
01262   }
01263   else
01264   {
01265     file->setItemEnabled(NEW_ALBUM, true);
01266     file->setItemEnabled(OPEN_ALBUM, true);
01267     file->setItemEnabled(SAVE_ALBUM, true);
01268     file->setItemEnabled(SAVEAS_ALBUM, true);
01269   }
01270 }

RecentAlbums * TitleWidget::getRecentAlbums (  ) 

returns handle to recent albums object

Definition at line 1540 of file titleWidget.cpp.

References recentAlbums.

Referenced by Window::~Window().

01541 {
01542   return &recentAlbums; 
01543 }

void TitleWidget::dragEnterEvent ( QDragEnterEvent *  e  )  [protected]

Definition at line 1277 of file titleWidget.cpp.

01278 {
01279   e->accept(true);
01280 }

void TitleWidget::dropEvent ( QDropEvent *  e  )  [protected]

Definition at line 1282 of file titleWidget.cpp.

References Window::getLayout(), SubalbumWidget::getPhotos(), LayoutWidget::getSubalbum(), setAlbumImage(), setSubalbumImage(), width, and window.

01283 {
01284   //force redraw so we don't see missing unpainted
01285   //region while we resize an image which takes a while.
01286   repaint(false);
01287   qApp->processEvents();
01288 
01289   //if the source is not the origanize icon view then ignore the event
01290   if(e->source() == NULL ||
01291      e->source()->parentWidget() != window->getLayout()->getSubalbum()->getPhotos())
01292     return;
01293   
01294   if( e->pos().x() < (width() / 2) )
01295     setAlbumImage();
01296   else
01297     setSubalbumImage();
01298 }

QString TitleWidget::createTmpDir ( QString  albumPath = QString::null  )  [protected]

Definition at line 1300 of file titleWidget.cpp.

References Window::getConfig(), Configuration::getString(), Configuration::resetSetting(), and window.

Referenced by loadAlbum(), newAlbum(), and TitleWidget().

01301 {
01302   //if album path provided attempt to create tmp directory in there to
01303   //minimize cost of doing moves when saving album changes.
01304   //the other reasoning is that user will have hopefully provided enough
01305   //space for saving large files on directory where they previously saved,
01306   //so this minmizes the chance of running out of disk hopefully
01307   if(!albumPath.isNull())
01308   {
01309     QDir rootDir( albumPath );
01310     if(rootDir.exists( "tmp" ) || rootDir.mkdir( "tmp" ))
01311     return QDir::convertSeparators( albumPath + "/tmp" );
01312   }
01313 
01314   //otherwise create unique tmp dir under scratch dir user specified in preferences
01315   QDate date = QDate::currentDate();
01316   QTime time = QTime::currentTime();
01317   QString baseDir = window->getConfig()->getString( "loadSave", "tempImageDirectory" );
01318 
01319   QDir testPath(baseDir);
01320   if(!testPath.exists())
01321   {
01322     window->getConfig()->resetSetting( "loadSave", "tempImageDirectory" );
01323     baseDir = window->getConfig()->getString( "loadSave", "tempImageDirectory" );
01324   }
01325 
01326   QString tmpDir = QString("albumshaper_tmp%1%2%3%4%5%6%7").arg( date.year() ).arg( date.month() ).arg
01327                                   ( date.day() ).arg( time.hour() ).arg( time.minute() ).arg( time.second() ).arg( time.msec() );
01328 
01329   QDir rootDir( baseDir );
01330   if(rootDir.exists() && (rootDir.exists( tmpDir ) || rootDir.mkdir( tmpDir) ) )
01331   {
01332 /*    AlertDialog alert( "tmpDir:", QDir::convertSeparators( QString("(" + baseDir + "/" + tmpDir ) ),
01333     "alertIcons/warning.png", this );
01334     alert.exec();
01335 */
01336     return QDir::convertSeparators( baseDir + "/" + tmpDir );
01337   }
01338   else
01339   {
01340 //    cout << "ERROR!\n";
01341     return QString::null;
01342   }
01343 }

void TitleWidget::subalbumNameChanged (  )  [signal]

Emitted when user changes subalbum name.

Referenced by storeAnnotations().

void TitleWidget::albumStatisticsClosed (  )  [slot]

Frees album statistics dialog once closed.

Definition at line 1222 of file titleWidget.cpp.

References albumStats.

Referenced by albumStatistics().

01223 {
01224   delete albumStats;
01225   albumStats = NULL;
01226 }

void TitleWidget::aboutClosed (  )  [slot]

Frees about dialog once closed.

Definition at line 1228 of file titleWidget.cpp.

References about.

Referenced by aboutProgram().

01229 {
01230   delete about;
01231   about = NULL;
01232 }

void TitleWidget::helpClosed (  )  [slot]

Frees HelpWindow once closed.

Definition at line 1234 of file titleWidget.cpp.

References helpWindow.

Referenced by help().

01235 {
01236   delete helpWindow;
01237   helpWindow = NULL;
01238 }

void TitleWidget::quitApplication (  )  [slot]

Quit slot.

Definition at line 1272 of file titleWidget.cpp.

References window.

Referenced by loadAlbum(), newAlbum(), and TitleWidget().

01273 {
01274   window->close();
01275 }

void TitleWidget::settingsWindowClosed (  )  [slot]

Definition at line 1240 of file titleWidget.cpp.

References settingsWindow.

Referenced by settings().

01241 {
01242   delete settingsWindow;
01243   settingsWindow = NULL;
01244 }

void TitleWidget::updateAlbumAnnotations (  )  [slot]

Updates subalbum annotations.

Definition at line 425 of file titleWidget.cpp.

References albm, albumAuthorVal, albumDescriptionVal, albumImage, albumNameVal, detectModifications, Album::getAuthor(), Album::getDescription(), Album::getName(), Album::getRepresentativeImage(), LARGE, ALabel::removePixmap(), ALabel::setPixmap(), and SMALL.

Referenced by refresh().

00426 {
00427   //disable modification detection while updating fields
00428   detectModifications = false;
00429 
00430   //set album annotations
00431 
00432   //if no image then remove pixmap
00433   if( albm->getRepresentativeImage(LARGE) != NULL)
00434     albumImage->setPixmap( *albm->getRepresentativeImage(SMALL) );
00435   else
00436     albumImage->removePixmap();
00437 
00438   albumNameVal->setText( albm->getName() );
00439   albumNameVal->setCursorPosition(0);
00440   albumDescriptionVal->setText( albm->getDescription() );
00441   albumDescriptionVal->setCursorPosition(0);
00442   albumAuthorVal->setText( albm->getAuthor() );
00443   albumAuthorVal->setCursorPosition(0);
00444 
00445   //enable modification detection
00446   detectModifications = true;
00447 }

void TitleWidget::refreshCollectionAnnotations ( Subalbum collection  )  [slot]

Update displayed collection name and cover image.

Definition at line 449 of file titleWidget.cpp.

References detectModifications, Subalbum::getDescription(), Subalbum::getName(), Subalbum::getRepresentativeImage(), LARGE, ALabel::removePixmap(), ALabel::setPixmap(), SMALL, subalbumAnnotationFrame, subalbumDescriptionVal, subalbumImage, and subalbumNameVal.

00450 {
00451   //disable modification detection while updating fields
00452   detectModifications = false;
00453 
00454   //get subalbum pointer
00455   if( collection == NULL )
00456   {
00457     subalbumAnnotationFrame->hide();
00458     subalbumImage->removePixmap(true);
00459   }
00460   else
00461   {
00462     subalbumAnnotationFrame->show();
00463 
00464     //if no image then remove pixmap
00465     if( collection->getRepresentativeImage(LARGE) != NULL)
00466       subalbumImage->setPixmap( *collection->getRepresentativeImage(SMALL) );
00467     else
00468       subalbumImage->removePixmap();
00469 
00470     subalbumNameVal->setText( collection->getName() );
00471     subalbumNameVal->setCursorPosition(0);
00472     subalbumDescriptionVal->setText( collection->getDescription() );
00473     subalbumDescriptionVal->setCursorPosition(0);
00474   }
00475 
00476   //enable modification detection
00477   detectModifications = true;
00478 }

void TitleWidget::setAlbumImage ( Photo photo  )  [slot]

Sets the album image to the passed in photo.

Definition at line 504 of file titleWidget.cpp.

References albm, albumImage, Photo::getImageFilename(), Album::getRepresentativeImage(), ALabel::setPixmap(), Album::setRepresentativeImages(), and SMALL.

00505 {
00506   if(selectedPhoto == NULL)
00507     return;
00508   //---------------------------------------------------------
00509   //set album image
00510   qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
00511   albm->setRepresentativeImages( selectedPhoto->getImageFilename() );
00512   //---------------------------------------------------------
00513   //update onscreen image
00514   albumImage->setPixmap( *albm->getRepresentativeImage(SMALL) );
00515   qApp->restoreOverrideCursor();
00516   //---------------------------------------------------------
00517 }

void TitleWidget::setSubalbumImage ( Photo photo  )  [slot]

Sets the subalbum image to the passed in photo.

Definition at line 536 of file titleWidget.cpp.

References SubalbumsWidget::getCurrentSelection(), Window::getLayout(), Subalbum::getRepresentativeImage(), SubalbumWidget::getSubalbum(), LayoutWidget::getSubalbum(), LayoutWidget::getSubalbums(), Photo::getThumbnailFilename(), MEDIUM, ALabel::setPixmap(), Subalbum::setRepresentativeImage(), SMALL, subalbumImage, and window.

00537 {
00538   if(selectedPhoto == NULL)
00539     return;
00540 
00541   //---------------------------------------------------------
00542   //set subalbum image
00543   qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
00544   SubalbumWidget* sw = window->getLayout()->getSubalbum();
00545   sw->getSubalbum()->setRepresentativeImage( selectedPhoto->getThumbnailFilename() );  
00546   //---------------------------------------------------------
00547   //update onscreen image
00548   subalbumImage->setPixmap( *sw->getSubalbum()->getRepresentativeImage(SMALL) );
00549   SubalbumPreviewWidget* item = (SubalbumPreviewWidget*)window->getLayout()->getSubalbums()->getCurrentSelection();
00550   item->setPixmap( *sw->getSubalbum()->getRepresentativeImage(MEDIUM), false );
00551   qApp->restoreOverrideCursor();
00552   //---------------------------------------------------------
00553 }

void TitleWidget::aboutProgram ( int  mode = ABOUT  )  [slot]

Pops up about dialog.

Definition at line 1190 of file titleWidget.cpp.

References about, aboutClosed(), and centerWindow().

Referenced by WelcomeWindow::itemClicked(), and TitleWidget().

01191 {
01192   //create window and center if not already present
01193   if(about == NULL)
01194   {
01195     about = new About(mode);
01196     connect( about, SIGNAL(closed()),
01197              this, SLOT(aboutClosed()));
01198     about->show();
01199     centerWindow(about);
01200   }
01201 
01202   about->raise();
01203   about->setActiveWindow();
01204 }

void TitleWidget::help (  )  [slot]

Pops up HelpWindow.

Definition at line 1206 of file titleWidget.cpp.

References centerWindow(), helpClosed(), and helpWindow.

Referenced by WelcomeWindow::itemClicked(), and TitleWidget().

01207 {
01208   //create window and center if not already present
01209   if(helpWindow == NULL)
01210   {
01211     helpWindow = new HelpWindow(0);
01212     connect( helpWindow, SIGNAL(closed()),
01213              this, SLOT(helpClosed()));
01214     helpWindow->show();
01215     centerWindow(helpWindow);
01216   }
01217 
01218   helpWindow->raise();
01219   helpWindow->setActiveWindow();
01220 }

void TitleWidget::windowStateChanged ( bool  state  )  [slot]

Enables/disables "minimize" window menu entry depending on window state.

Definition at line 1353 of file titleWidget.cpp.

Referenced by Window::event(), Window::hideEvent(), and Window::showEvent().

01354 { 
01355 //Do nothing 
01356 }

void TitleWidget::updateMenus ( bool  anySelected = false,
bool  anyRevertable = false 
) [slot]

update begin presentation menu entry - disabled when no photos in album

Definition at line 1545 of file titleWidget.cpp.

References photoMenu, REMOVE_DESCRIPTIONS, and REVERT_PHOTOS.

Referenced by SubalbumWidget::addImageAction(), SubalbumsWidget::deleteAction(), loadAlbum(), and LayoutWidget::photoStateChangedEvent().

01546 {
01547   //no photos? disable begin presentation command
01548 //  tools->setItemEnabled( BEGIN_PRESENTATION, albm->getNumPhotos() != 0 );
01549 //  tools->setItemEnabled( BEGIN_PRESENTATION_AT, albm->getNumPhotos() != 0 );  
01550 
01551   //none selected? disable removing photo descriptions
01552   photoMenu->setItemEnabled( REMOVE_DESCRIPTIONS, anySelected );
01553 
01554   //none revertable? disable revert photos
01555   photoMenu->setItemEnabled( REVERT_PHOTOS, anyRevertable );
01556 }

void TitleWidget::storeAnnotations (  )  [private, slot]

Store annotations.

Definition at line 398 of file titleWidget.cpp.

References albm, albumAuthorVal, albumDescriptionVal, albumNameVal, detectModifications, Window::getLayout(), Subalbum::getName(), SubalbumsWidget::getSelectedSubalbum(), LayoutWidget::getSubalbums(), Album::setAuthor(), Subalbum::setDescription(), Album::setDescription(), Subalbum::setName(), Album::setName(), subalbumDescriptionVal, subalbumNameChanged(), subalbumNameVal, and window.

Referenced by TitleWidget().

00399 {
00400   //only sync backend album/collection data when detectModifications is enabled
00401   if( !detectModifications ) return;
00402 
00403   //set album annotations
00404   albm->setName        ( albumNameVal->text()        );
00405   albm->setDescription ( albumDescriptionVal->text() );
00406   albm->setAuthor      ( albumAuthorVal->text()      );
00407 
00408   //get subalbum pointer
00409   Subalbum* collection = window->getLayout()->getSubalbums()->getSelectedSubalbum();
00410   if(collection != NULL )
00411   {
00412     //store old subalbum name
00413     QString oldName =  collection->getName();
00414 
00415     //set name and description
00416     collection->setName(  subalbumNameVal->text()   );
00417     collection->setDescription(  subalbumDescriptionVal->text()   );
00418 
00419     //if subalbum name has changed emit signal
00420     if(oldName.compare( collection->getName() ) != 0)
00421       emit subalbumNameChanged();
00422   }
00423 }

void TitleWidget::setAlbumImage (  )  [private, slot]

Sets the Album Image.

Definition at line 492 of file titleWidget.cpp.

References Window::getLayout(), SubalbumWidget::getSelectedPhoto(), LayoutWidget::getSubalbum(), and window.

Referenced by dropEvent().

00493 {
00494   //---------------------------------------------------------
00495   //determine if a subalbum is even selected
00496   SubalbumWidget* sw = window->getLayout()->getSubalbum();
00497   if(sw == NULL)
00498     return;
00499   //---------------------------------------------------------
00500   //set image to photo
00501   setAlbumImage( sw->getSelectedPhoto() );
00502 }

void TitleWidget::unsetAlbumImage (  )  [private, slot]

Unsets the Album Image.

Definition at line 519 of file titleWidget.cpp.

References albm, and Album::setRepresentativeImages().

Referenced by TitleWidget().

00520 {
00521   albm->setRepresentativeImages( QString::null );
00522 }

void TitleWidget::setSubalbumImage (  )  [private, slot]

Sets the Subalbum Image.

Definition at line 524 of file titleWidget.cpp.

References Window::getLayout(), SubalbumWidget::getSelectedPhoto(), LayoutWidget::getSubalbum(), and window.

Referenced by dropEvent().

00525 {
00526   //---------------------------------------------------------
00527   //determine if a subalbum is even selected
00528   SubalbumWidget* sw = window->getLayout()->getSubalbum();
00529   if(sw == NULL)
00530     return;
00531   //---------------------------------------------------------
00532   //set collection image to selected photo
00533   setSubalbumImage( sw->getSelectedPhoto() );
00534 }

void TitleWidget::unsetSubalbumImage (  )  [private, slot]

Unsets the Subalbum Image.

Definition at line 555 of file titleWidget.cpp.

References SubalbumsWidget::getCurrentSelection(), Window::getLayout(), Subalbum::getRepresentativeImage(), LayoutWidget::getSubalbums(), MEDIUM, Subalbum::setRepresentativeImage(), and window.

Referenced by TitleWidget().

00556 {
00557   SubalbumPreviewWidget* item = (SubalbumPreviewWidget*)window->getLayout()->getSubalbums()->getCurrentSelection();
00558   if(item != NULL && ((SubalbumPreviewWidget*)item)->getSubalbum() != NULL)
00559   {
00560     Subalbum* subalbm =  ((SubalbumPreviewWidget*)item)->getSubalbum();
00561     subalbm->setRepresentativeImage( QString::null );
00562     item->setPixmap( *subalbm->getRepresentativeImage(MEDIUM), false );
00563   }
00564 }

void TitleWidget::newAlbum (  )  [private, slot]

Resets to empty album.

Definition at line 579 of file titleWidget.cpp.

References albm, albumImage, Album::albumModified(), createTmpDir(), file, Configuration::getBool(), Window::getConfig(), Window::getLayout(), Configuration::getString(), LayoutWidget::getSubalbum(), Album::getTmpDir(), quitApplication(), refresh(), ALabel::removePixmap(), REVERT_TO_SAVED_ALBUM, Album::setModified(), SubalbumWidget::setSubalbum(), subalbumImage, tmpDirErrorDesc, tmpDirErrorMessage, and window.

Referenced by TitleWidget().

00580 {
00581   //if modifications exist and user wants to receive destructive action warnings,
00582   //ask if they are sure before creating a new album
00583   if( albm->albumModified() && window->getConfig()->getBool( "alerts", "showDestructiveAlerts" ) )
00584   {
00585     QuestionDialog sure( tr("New album?"),
00586                                    tr("Warning, unsaved modifications to the current album exist. Creating a new album will result in lost work. Are you sure you want to do this?"),
00587                                    "alertIcons/warning.png",
00588                                    this );
00589     if(!sure.exec())
00590       return;
00591   }
00592 
00593   //delete old album
00594   delete albm;
00595 
00596   //create new one
00597   albm = new Album( createTmpDir() );
00598   
00599   if(albm->getTmpDir().isNull() )
00600   {
00601       AlertDialog alert( tmpDirErrorMessage, tmpDirErrorDesc + window->getConfig()->getString( "loadSave", "tempImageDirectory" ),
00602       "alertIcons/warning.png", this );
00603       alert.exec();
00604       quitApplication();
00605   }
00606 
00607   //refresh screen
00608   albumImage->removePixmap();
00609   subalbumImage->removePixmap(true);
00610 
00611   //disable revert menu option since there is no loaded album
00612   file->setItemEnabled( REVERT_TO_SAVED_ALBUM, false );  
00613   
00614   //reset editing interface since old pointers are invalid
00615   window->getLayout()->getSubalbum()->setSubalbum( NULL );
00616   refresh();
00617 
00618   albm->setModified(false);
00619 }

void TitleWidget::loadAlbum (  )  [private, slot]

Loads an album specified with file chooser.

make sure we want to proceed

Definition at line 621 of file titleWidget.cpp.

References Window::getConfig(), Configuration::getString(), proceedWithLoad(), Configuration::resetSetting(), and window.

Referenced by loadRecentAlbum(), revertToSaved(), and TitleWidget().

00622 {
00624   if(!proceedWithLoad())
00625     return;
00626 
00627   QString path = window->getConfig()->getString( "loadSave", "loadSaveDir" );
00628   QDir testPath(path);
00629   if(!testPath.exists())
00630   {
00631     window->getConfig()->resetSetting( "loadSave", "loadSaveDir" );
00632     path = window->getConfig()->getString( "loadSave", "loadSaveDir" );
00633   }
00634   
00635   QString albumXML = QFileDialog::getOpenFileName( path,
00636                                                    tr("XML Files (*.xml)"),
00637                                                    this,
00638                                                    "open file dialog",
00639                                                    tr("Choose an album to load") );
00640   
00641   //if null bail
00642   if(albumXML.isNull()) return;
00643   
00644   //attempt to load album
00645   loadAlbum( albumXML );    
00646 }  

void TitleWidget::loadRecentAlbum ( int  index  )  [private, slot]

Loads a recent album.

make sure we want to proceed

Definition at line 648 of file titleWidget.cpp.

References RecentAlbums::getEntry(), loadAlbum(), proceedWithLoad(), and recentAlbums.

Referenced by populateOpenRecentMenu().

00649 {
00651   if(!proceedWithLoad())
00652     return;
00653   //load album
00654   QString recentName, recentLocation, recentPhotoCount;
00655   recentAlbums.getEntry( index, recentName, recentLocation, recentPhotoCount );
00656   loadAlbum( QDir::convertSeparators( recentLocation + "/Album.xml") );             
00657 }

bool TitleWidget::proceedWithLoad (  )  [private, slot]

Helper function for load methods, checks if there are any unsaved changes and if so warns user any such changes will be lost if they proceed.

Definition at line 659 of file titleWidget.cpp.

References albm, Album::albumModified(), Configuration::getBool(), Window::getConfig(), and window.

Referenced by loadAlbum(), and loadRecentAlbum().

00660 {
00661   //if modifications exist and user wants to receive destructive action warnings,
00662   //ask if they are sure before creating a new album
00663   if( albm->albumModified() && window->getConfig()->getBool( "alerts", "showDestructiveAlerts" ) )
00664   {
00665     QuestionDialog sure( tr("Load album?"),
00666                          tr("Warning, unsaved modifications to the current album exist. Loading a new album will result in lost work. Are you sure you want to do this?"),
00667                          "alertIcons/warning.png",
00668                          this );
00669     if(!sure.exec())
00670       return false;
00671   }  
00672   
00673   return true;
00674 }

void TitleWidget::loadAlbum ( QString  location  )  [private, slot]

Loads a specified album.

Definition at line 889 of file titleWidget.cpp.

References albm, ALBUM_LOADED, ALBUM_READ_ERROR, ALBUM_XML_ERROR, createTmpDir(), file, Configuration::getBool(), Window::getConfig(), Album::getFirstSubalbum(), Window::getLayout(), Album::getName(), Album::getNumPhotos(), Album::getSaveLocation(), Window::getStatus(), Configuration::getString(), LayoutWidget::getSubalbum(), LayoutWidget::getSubalbums(), Album::getTmpDir(), StatusWidget::grabInput(), Album::importFromDisk(), RecentAlbums::insertEntry(), quitApplication(), recentAlbums, refresh(), refreshOpenRecentMenu(), StatusWidget::releaseInput(), ALabel::removePixmap(), REVERT_TO_SAVED_ALBUM, setBusy(), Album::setModified(), Configuration::setString(), SubalbumWidget::setSubalbum(), subalbumAnnotationFrame, subalbumImage, tmpDirErrorDesc, tmpDirErrorMessage, SubalbumWidget::updateButtons(), SubalbumsWidget::updateButtons(), updateMenus(), and window.

00890 {
00891   //disable user input
00892   window->getStatus()->grabInput();
00893   
00894   //enable busy cursor, set busy flag, and deactivate buttons
00895   qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
00896   setBusy(true);
00897   window->getLayout()->getSubalbums()->updateButtons(false);
00898   if(window->getLayout()->getSubalbum() != NULL)
00899     window->getLayout()->getSubalbum()->updateButtons(false);
00900 
00901   //store load/save location
00902   QDir lastDir = QDir( QFileInfo(albumXML).dirPath() );
00903   lastDir.cdUp();
00904   window->getConfig()->setString( "loadSave", "loadSaveDir", lastDir.path() );
00905  
00906   //create a new album (with no subalbums, hense false)
00907   delete albm;
00908 
00909   albm = new Album( createTmpDir( QFileInfo(albumXML).dirPath() ), false );
00910   if(albm->getTmpDir().isNull() )
00911   {
00912       AlertDialog alert( tmpDirErrorMessage, tmpDirErrorDesc + window->getConfig()->getString( "loadSave", "tempImageDirectory" ),
00913       "alertIcons/warning.png", this );
00914       alert.exec();
00915       quitApplication();
00916   }
00917 
00918   //attempt to load xml file
00919   int errorCode = albm->importFromDisk(window->getStatus(), albumXML,
00920                                        window->getConfig()->getBool( "loadSave", "disableCheckPhotoMods" ) );
00921 
00922   //if no subalbums in album then hide subalbum annotations
00923   if(albm->getFirstSubalbum() == NULL)
00924   {
00925     subalbumAnnotationFrame->hide();
00926     subalbumImage->removePixmap(true);
00927   }
00928   
00929   //reset editing interface since old pointers are invalid
00930   window->getLayout()->getSubalbum()->setSubalbum( NULL );
00931   refresh();
00932 
00933   //set album as not modified
00934   albm->setModified(false);
00935     
00936   //update recent albums listing
00937   recentAlbums.insertEntry( albm->getName(), albm->getSaveLocation(), 
00938                            QString("%1").arg(albm->getNumPhotos()), false );
00939   refreshOpenRecentMenu();  
00940   
00941   //nolonger busy
00942   qApp->restoreOverrideCursor();
00943   setBusy(false);
00944   window->getLayout()->getSubalbums()->updateButtons(true);
00945   if(window->getLayout()->getSubalbum() != NULL)
00946     window->getLayout()->getSubalbum()->updateButtons(true);
00947 
00948   //enable user input
00949   window->getStatus()->releaseInput(); 
00950   
00951   //load successful
00952   if(errorCode == ALBUM_LOADED)
00953   {
00954     //enable "revert" menu option
00955     file->setItemEnabled( REVERT_TO_SAVED_ALBUM, true );    
00956 
00957     //update presentation command based on if there are photos in this album
00958     updateMenus();
00959   }
00960   //else display appropriate error message
00961   else
00962   {  
00963     QString errorMessage, errorDescription;
00964     if(errorCode == ALBUM_READ_ERROR)
00965     {
00966       errorMessage = tr("Unable to open file!");
00967       errorDescription = tr("An error was encountered attempting to load the XML file. Perhaps you do not have read access?");
00968     }
00969     else if(errorCode == ALBUM_XML_ERROR)
00970     {
00971       errorMessage = tr("Unable to construct DOM!");
00972       errorDescription = tr("The XML file you selected is not valid XML.");
00973     }
00974     else
00975     {
00976       errorMessage = tr("Unknown loading error!");
00977       errorDescription = tr("An unknown error was encountered loading the specified file.");
00978     }
00979 
00980     AlertDialog alert( errorMessage, errorDescription, "alertIcons/warning.png", this );
00981     alert.exec();
00982   }
00983 }

void TitleWidget::saveAlbum (  )  [private, slot]

Saves album.

Definition at line 985 of file titleWidget.cpp.

References albm, Album::exportToDisk(), file, getAlbum(), Window::getConfig(), Window::getLayout(), Album::getName(), Album::getNumPhotos(), Album::getSaveLocation(), Window::getStatus(), LayoutWidget::getSubalbum(), LayoutWidget::getSubalbums(), RecentAlbums::insertEntry(), recentAlbums, refreshOpenRecentMenu(), REVERT_TO_SAVED_ALBUM, saveAsAlbum(), setBusy(), Configuration::setString(), SaveDialog::themeAvailable(), SubalbumWidget::updateButtons(), SubalbumsWidget::updateButtons(), and window.

Referenced by TitleWidget().

00986 {
00987   //if album not previously saved then
00988   //run saveas dialog
00989   if(!getAlbum()->prevSave())
00990   {
00991     saveAsAlbum();
00992     return;
00993   }
00994 
00995   //if previously used theme not available for use again alert user,
00996   //then run saveas dialog
00997   if(!SaveDialog::themeAvailable( getAlbum()->getTheme() ))
00998   {
00999     AlertDialog alert( tr("Previous theme not available!"),
01000                             tr("Theme previously used to save this album not available on this machine. Click ok to open the save-as dialog to save an alternative theme."),
01001                             "alertIcons/warning.png", this );
01002     alert.exec();
01003     saveAsAlbum();
01004     return;
01005   }
01006 
01007   //set busy flag and disable buttons
01008   setBusy(true);
01009   window->getLayout()->getSubalbums()->updateButtons(false);
01010   if(window->getLayout()->getSubalbum() != NULL)
01011     window->getLayout()->getSubalbum()->updateButtons(false);
01012   qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
01013 
01014   getAlbum()->exportToDisk(window->getStatus());
01015 
01016   window->getConfig()->setString( "loadSave", "lastUsedTheme",  getAlbum()->getTheme() );
01017 
01018   //update recent albums listing
01019   recentAlbums.insertEntry( albm->getName(), albm->getSaveLocation(), 
01020                             QString("%1").arg(albm->getNumPhotos()), false );
01021   refreshOpenRecentMenu();  
01022 
01023   //enable revert command since saved album now exists
01024   file->setItemEnabled( REVERT_TO_SAVED_ALBUM, true );    
01025   
01026   //nolonger busy
01027   setBusy(false);
01028   window->getLayout()->getSubalbums()->updateButtons(true);
01029   if(window->getLayout()->getSubalbum() != NULL)
01030     window->getLayout()->getSubalbum()->updateButtons(true);
01031   qApp->restoreOverrideCursor();
01032 }

void TitleWidget::saveAsAlbum (  )  [private, slot]

Saves album as.

Definition at line 1034 of file titleWidget.cpp.

References albm, albumAuthorVal, Album::exportToDisk(), file, getAlbum(), Window::getConfig(), Window::getLayout(), Album::getName(), Album::getNumPhotos(), Album::getSaveLocation(), Window::getStatus(), Configuration::getString(), LayoutWidget::getSubalbum(), LayoutWidget::getSubalbums(), Album::getTheme(), RecentAlbums::insertEntry(), recentAlbums, refreshOpenRecentMenu(), REVERT_TO_SAVED_ALBUM, SaveDialog::selectThemeAndPath(), setBusy(), Configuration::setString(), SubalbumWidget::updateButtons(), SubalbumsWidget::updateButtons(), and window.

Referenced by saveAlbum(), and TitleWidget().

01035 {
01036   //setup dialog title and default path
01037   QString dialogTitle = tr( "Save As" );
01038   QString defaultPath;
01039 
01040   if(getAlbum()->prevSave())
01041     defaultPath = getAlbum()->getSaveLocation();
01042   else
01043   {
01044     defaultPath = getAlbum()->getName();
01045     defaultPath.replace( QChar(' '), "_" );
01046     defaultPath.replace( "<", "" );
01047     defaultPath.replace( ">", "" );
01048     defaultPath.replace( "&", "and" );
01049     defaultPath.replace( "\"", "" );
01050     defaultPath.replace( "\'", "" );
01051     defaultPath.replace( "?", "" );
01052     defaultPath = QDir::convertSeparators
01053        ( window->getConfig()->getString( "loadSave", "loadSaveDir" ) + "/" + defaultPath );
01054   }
01055 
01056   //get directory name in which album directory will be placed in
01057   QString theme, savePath;
01058 
01059   //if abum saved before then auto select last used theme
01060   if(getAlbum()->getTheme().compare("-1") != 0)
01061     theme = getAlbum()->getTheme();
01062   else
01063   {
01064     if(window->getConfig()->getString( "loadSave", "defaultTheme" ).compare( "Last Used" ) == 0)
01065       theme = window->getConfig()->getString( "loadSave", "lastUsedTheme" );
01066     else
01067       theme = window->getConfig()->getString( "loadSave", "defaultTheme" );
01068   }
01069 
01070   if( !SaveDialog::selectThemeAndPath( dialogTitle, defaultPath, theme, savePath ) )
01071     return;
01072 
01073   //check if directory already exists, if not attempt to create it
01074   QDir d(savePath);
01075   if(!d.exists())
01076   {
01077     if(!d.mkdir(savePath))
01078     {
01079       AlertDialog alert( tr("Error creating directory!"),
01080                               tr("Unable to create directory to save album in. Perhaps you are running out of disk space or you don't have sufficient privileges?"),
01081                               "alertIcons/warning.png", this );
01082       alert.exec();
01083       return;
01084     }
01085   }
01086   else
01087   {
01088     if(!d.isReadable())
01089     {
01090       AlertDialog alert( tr("Destination directory not readable!"),
01091                               tr("The destination directory is not readable. Perhaps you don't have sufficient privileges?"),
01092                               "alertIcons/warning.png", this );
01093       alert.exec();
01094       return;
01095     }
01096   }
01097 
01098   //store this load/Save location
01099   QDir lastDir = QDir( savePath );
01100   lastDir.cdUp();
01101   window->getConfig()->setString( "loadSave", "loadSaveDir", lastDir.path() );
01102   window->getConfig()->setString( "loadSave", "lastUsedTheme",  theme );
01103 
01104   //set busy flag and disable buttons
01105   setBusy(true);
01106   window->getLayout()->getSubalbums()->updateButtons(false);
01107   if(window->getLayout()->getSubalbum() != NULL)
01108     window->getLayout()->getSubalbum()->updateButtons(false);
01109   qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
01110 
01111   //save
01112   getAlbum()->exportToDisk(window->getStatus(), savePath, theme);
01113   window->getConfig()->setString( "misc", "defaultAuthor", albumAuthorVal->text() );
01114 
01115   //update recent albums listing
01116   recentAlbums.insertEntry( albm->getName(), albm->getSaveLocation(), 
01117                             QString("%1").arg(albm->getNumPhotos()), false );
01118   refreshOpenRecentMenu();  
01119   
01120   //enable revert command since saved album now exists
01121   file->setItemEnabled( REVERT_TO_SAVED_ALBUM, true );    
01122   
01123   //nolonger busy
01124   setBusy(false);
01125   window->getLayout()->getSubalbums()->updateButtons(true);
01126   if(window->getLayout()->getSubalbum() != NULL)
01127     window->getLayout()->getSubalbum()->updateButtons(true);
01128   qApp->restoreOverrideCursor();
01129 }

void TitleWidget::revertToSaved (  )  [private, slot]

Revert to last saved album.

make sure we want to proceed

Definition at line 676 of file titleWidget.cpp.

References albm, Album::albumModified(), Configuration::getBool(), Window::getConfig(), Album::getSaveLocation(), loadAlbum(), and window.

Referenced by TitleWidget().

00677 {
00678   //if there are no changed then immediately return since reverting will have no effect
00679   //TODO: disable "revert" menu entry when no modifications exist
00680   if( !albm->albumModified() )
00681     return;
00682   
00684   //if modifications exist and user wants to receive destructive action warnings,
00685   //ask if they are sure before creating a new album
00686   if( window->getConfig()->getBool( "alerts", "showDestructiveAlerts" ) )
00687   {
00688     QuestionDialog sure( tr("Revert to Saved?"),
00689                          tr("Warning, unsaved modifications to the current album exist. These changes will be lost if you revert to the album's last saved form. Are you sure you want to do this?"),
00690                          "alertIcons/warning.png",
00691                          this );
00692     if(!sure.exec())
00693       return;
00694   }    
00695   
00696   //reload album
00697   loadAlbum( QDir::convertSeparators( albm->getSaveLocation() + "/Album.xml") );  
00698 }

void TitleWidget::exportSmallWebGallery (  )  [private, slot]

Export small web gallery (excludes full size images and Album.xml file).

Definition at line 700 of file titleWidget.cpp.

References Album::exportCompressedWebAlbum(), fixFilename(), getAlbum(), Window::getConfig(), Window::getLayout(), Album::getName(), Album::getNumPhotos(), Album::getSaveLocation(), Window::getStatus(), Configuration::getString(), LayoutWidget::getSubalbum(), LayoutWidget::getSubalbums(), Album::prevSave(), setBusy(), StatusWidget::setStatus(), StatusWidget::showProgressBar(), SaveDialog::themeAvailable(), SubalbumWidget::updateButtons(), SubalbumsWidget::updateButtons(), and window.

Referenced by TitleWidget().

00701 {
00702   //if the Album's theme is not currently available alert user and bail
00703   if(!SaveDialog::themeAvailable( getAlbum()->getTheme() ))
00704   {
00705     AlertDialog alert( tr("Previous theme not available!"),
00706                        QString(tr("Theme previously used to save this album not available on this machine. Before exporting the %1 theme must be installed, or the album must be resaved using a different theme.")).arg( getAlbum()->getTheme() ),
00707                         "alertIcons/warning.png", this );
00708     alert.exec();
00709     return;
00710   }
00711   
00712   
00713   //setup dialog title and default path
00714   QString dialogTitle = tr( "Export Small Web Gallery" );
00715   
00716   //new directory name in which all images will be contained
00717   QString newDir;
00718   if(getAlbum()->prevSave())
00719   { newDir = QDir( getAlbum()->getSaveLocation() ).dirName() + "_WEB"; }
00720   else
00721   { newDir = getAlbum()->getName() + "_WEB"; }
00722   newDir = fixFilename( newDir );
00723   
00724   //get filename from user
00725   QFileDialog* fd = new QFileDialog( this, "file dialog", TRUE );
00726   fd->setCaption( tr("Export Location") );
00727   fd->setMode( QFileDialog::DirectoryOnly );
00728   fd->setDir( window->getConfig()->getString( "loadSave", "loadSaveDir" ) );
00729   
00730   //user canceled operation
00731   if ( !fd->exec() == QDialog::Accepted ) { return; }
00732   
00733   //get export path
00734   QString exportPath = QDir::convertSeparators( fd->selectedFile() + "/" + newDir );
00735   
00736   //check to make sure the album is not in this location, if so raise red flag and abort!!
00737   if( getAlbum()->prevSave() && getAlbum()->getSaveLocation().compare( exportPath ) == 0 )
00738   {
00739     QString errorMessage = tr("Error! Cannot export to album location on disk!");
00740     QString errorDesc = tr("Exporting small web galleries to the same location the album is stored will corrupt it and is not allowed. Try using the default location when exporting images, or chose a different directory.");
00741     AlertDialog alert( errorMessage, errorDesc,
00742                        "alertIcons/warning.png", this );
00743     alert.exec();
00744     return;
00745   }
00746   
00747   //otherwise check if directory already exists, if so warn user and ask before proceeding
00748   QDir tmpDir;
00749   if(tmpDir.exists( exportPath ) )
00750   {
00751     QString warningMessage = 
00752     QString(tr("Warning! A directory named %1 already exists in %2. Continue with export?")).arg
00753     ( newDir ).arg( fd->selectedFile() );
00754     
00755     QuestionDialog sure( tr("Directory Exists!"),
00756                          warningMessage, "alertIcons/warning.png",
00757                          this );
00758     if(!sure.exec()) { return; }
00759   }    
00760   //else create directory
00761   else
00762   {
00763     if( !tmpDir.mkdir( exportPath ) )
00764     {
00765       AlertDialog alert( tr("Error creating directory!"),
00766                          tr("Unable to create directory to export images to. Perhaps you are running out of disk space or you don't have sufficient privileges?"),
00767                          "alertIcons/warning.png", this );
00768       alert.exec();
00769       return;
00770     }
00771   }
00772   
00773   //set busy flag and disable buttons
00774   setBusy(true);
00775   window->getLayout()->getSubalbums()->updateButtons(false);
00776   if(window->getLayout()->getSubalbum() != NULL)
00777     window->getLayout()->getSubalbum()->updateButtons(false);
00778   qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
00779   
00780   //setup progress bar
00781   int numPhotos = getAlbum()->getNumPhotos();  
00782   QString exportMessage = tr( "Exporting %1 photos to web gallery" );
00783   window->getStatus()->showProgressBar( exportMessage.arg(numPhotos), numPhotos );
00784   qApp->processEvents();
00785   
00786   //export large images
00787   getAlbum()->exportCompressedWebAlbum(window->getStatus(), exportPath, exportMessage);  
00788   
00789   //remove progress bar
00790   window->getStatus()->setStatus( tr("Exporting photos complete.") );
00791   
00792   //nolonger busy
00793   setBusy(false);
00794   window->getLayout()->getSubalbums()->updateButtons(true);
00795   if(window->getLayout()->getSubalbum() != NULL)
00796     window->getLayout()->getSubalbum()->updateButtons(true);
00797   qApp->restoreOverrideCursor();
00798 }

void TitleWidget::exportLargeImages (  )  [private, slot]

Export large images only to a new directory for printing purposes.

Definition at line 800 of file titleWidget.cpp.

References Album::exportLargeImages(), fixFilename(), getAlbum(), Window::getConfig(), Window::getLayout(), Album::getName(), Album::getNumPhotos(), Album::getSaveLocation(), Window::getStatus(), Configuration::getString(), LayoutWidget::getSubalbum(), LayoutWidget::getSubalbums(), Album::prevSave(), setBusy(), StatusWidget::setStatus(), StatusWidget::showProgressBar(), SubalbumWidget::updateButtons(), SubalbumsWidget::updateButtons(), and window.

Referenced by TitleWidget().

00801 {
00802   //setup dialog title and default path
00803   QString dialogTitle = tr( "Export Large Images" );
00804 
00805   //new directory name in which all images will be contained
00806   QString newDir;
00807   if(getAlbum()->prevSave())
00808   { newDir = QDir( getAlbum()->getSaveLocation() ).dirName() + "_IMAGES"; }
00809   else
00810   { newDir = getAlbum()->getName() + "_IMAGES"; }
00811   newDir = fixFilename( newDir );
00812   
00813   //get filename from user
00814   QFileDialog* fd = new QFileDialog( this, "file dialog", TRUE );
00815   fd->setCaption( tr("Export Location") );
00816   fd->setMode( QFileDialog::DirectoryOnly );
00817   fd->setDir( window->getConfig()->getString( "loadSave", "loadSaveDir" ) );
00818   
00819   //user canceled operation
00820   if ( !fd->exec() == QDialog::Accepted ) { return; }
00821 
00822   //get export path
00823   QString exportPath = QDir::convertSeparators( fd->selectedFile() + "/" + newDir );
00824 
00825   //check to make sure the album is not in this location, if so raise red flag and abort!!
00826   if( getAlbum()->prevSave() && getAlbum()->getSaveLocation().compare( exportPath ) == 0 )
00827   {
00828     QString errorMessage = tr("Error! Cannot export to album location on disk!");
00829     QString errorDesc = tr("Exporting large images to the same location the album is stored will corrupt it and is not allowed. Try using the default location when exporting images, or chose a different directory.");
00830     AlertDialog alert( errorMessage, errorDesc,
00831                        "alertIcons/warning.png", this );
00832     alert.exec();
00833     return;
00834   }
00835 
00836   //otherwise check if directory already exists, if so warn user and ask before proceeding
00837   QDir tmpDir;
00838   if(tmpDir.exists( exportPath ) )
00839   {
00840     QString warningMessage = 
00841     QString(tr("Warning! A directory named %1 already exists in %2. Continue with export?")).arg
00842     ( newDir ).arg( fd->selectedFile() );
00843     
00844     QuestionDialog sure( tr("Directory Exists!"),
00845                          warningMessage, "alertIcons/warning.png",
00846                          this );
00847     if(!sure.exec()) { return; }
00848   }    
00849   //else create directory
00850   else
00851   {
00852     if( !tmpDir.mkdir( exportPath ) )
00853     {
00854       AlertDialog alert( tr("Error creating directory!"),
00855                          tr("Unable to create directory to export images to.Perhaps you are running out of disk space or you don't have sufficient privileges?"),
00856                            "alertIcons/warning.png", this );
00857       alert.exec();
00858       return;
00859     }
00860   }
00861 
00862   //set busy flag and disable buttons
00863   setBusy(true);
00864   window->getLayout()->getSubalbums()->updateButtons(false);
00865   if(window->getLayout()->getSubalbum() != NULL)
00866     window->getLayout()->getSubalbum()->updateButtons(false);
00867   qApp->setOverrideCursor( QCursor(Qt::WaitCursor));
00868 
00869   //setup progress bar
00870   int numPhotos = getAlbum()->getNumPhotos();  
00871   QString exportMessage = tr( "Exporting %1 photos" );
00872   window->getStatus()->showProgressBar( exportMessage.arg(numPhotos), numPhotos );
00873   qApp->processEvents();
00874   
00875   //export large images
00876   getAlbum()->exportLargeImages(window->getStatus(), exportPath, exportMessage);  
00877 
00878   //remove progress bar
00879   window->getStatus()->setStatus( tr("Exporting photos complete.") );
00880 
00881   //nolonger busy
00882   setBusy(false);
00883   window->getLayout()->getSubalbums()->updateButtons(true);
00884   if(window->getLayout()->getSubalbum() != NULL)
00885     window->getLayout()->getSubalbum()->updateButtons(true);
00886   qApp->restoreOverrideCursor();
00887 }

void TitleWidget::settings (  )  [private, slot]

Pops up settings window.

Definition at line 1174 of file titleWidget.cpp.

References centerWindow(), Window::getConfig(), settingsWindow, settingsWindowClosed(), and window.

Referenced by TitleWidget().

01175 {
01176   //create window and center if not already present
01177   if(settingsWindow == NULL)
01178   {
01179     settingsWindow = new ConfigurationWidget( window->getConfig() );
01180     connect( settingsWindow, SIGNAL(closed()),
01181                   this, SLOT(settingsWindowClosed()));
01182     settingsWindow->show();
01183     centerWindow(settingsWindow);
01184   }
01185 
01186   settingsWindow->raise();
01187   settingsWindow->setActiveWindow();
01188 }

void TitleWidget::removeSelectedPhotoDesc (  )  [private, slot]

Strip descriptions from selected photos.

Definition at line 1147 of file titleWidget.cpp.

References SubalbumWidget::anyPhotosSelected(), Configuration::getBool(), Window::getConfig(), Window::getLayout(), LayoutWidget::getSubalbum(), SubalbumWidget::stripDescriptionsFromSelectedPhotos(), and window.

Referenced by TitleWidget().

01148 {
01149   //if no subalbum or photos selected ignore command
01150   if(window->getLayout()->getSubalbum() == NULL ||
01151      !window->getLayout()->getSubalbum()->anyPhotosSelected())
01152      return;
01153 
01154   //ask user if they are sure they want to remove selected photo descriptions
01155   if( window->getConfig()->getBool( "alerts", "showDestructiveAlerts" ) )
01156   {
01157     QuestionDialog sure( tr("Remove Selected Photo Descriptions?"),
01158                                    tr("This action cannot be undone. Are you sure you want to proceed?"),
01159                                    "alertIcons/warning.png",
01160                                    this );
01161     if(!sure.exec())
01162       return;
01163   }
01164 
01165   //proceed with stripping of photo descriptions
01166   window->getLayout()->getSubalbum()->stripDescriptionsFromSelectedPhotos();
01167 }

void TitleWidget::revertPhotos (  )  [private, slot]

Revert selected photos to original form.

Definition at line 1169 of file titleWidget.cpp.

References Window::getLayout(), LayoutWidget::revertPhotos(), and window.

Referenced by TitleWidget().

01170 {  
01171   window->getLayout()->revertPhotos();
01172 }

void TitleWidget::albumStatistics (  )  [private, slot]

Pops up album statistics window.

Definition at line 1131 of file titleWidget.cpp.

References albm, albumStatisticsClosed(), albumStats, and centerWindow().

Referenced by TitleWidget().

01132 {
01133   //create window and center if not already present
01134   if(albumStats == NULL)
01135   {
01136     albumStats = new AlbumStatistics(albm);
01137     connect( albumStats, SIGNAL(closed()),
01138            this, SLOT(albumStatisticsClosed()));
01139     albumStats->show();
01140     centerWindow(albumStats);
01141   }
01142 
01143   albumStats->raise();
01144   albumStats->setActiveWindow();
01145 }

void TitleWidget::clearOpenRecentMenu (  )  [private, slot]

Clears albums from open recent menu.

Definition at line 1359 of file titleWidget.cpp.

References RecentAlbums::clearList(), recentAlbums, and refreshOpenRecentMenu().

Referenced by populateOpenRecentMenu().

01360 {
01361   //clear recent list
01362   recentAlbums.clearList();
01363   
01364   //refresh menu
01365   refreshOpenRecentMenu();
01366 }

void TitleWidget::populateOpenRecentMenu (  )  [private]

Populates the open recent menu with a default set of 9 items + clear.

Definition at line 1368 of file titleWidget.cpp.

References clearOpenRecentMenu(), customRecentMenuItems, RecentAlbums::getMaxItems(), loadRecentAlbum(), numRecentMenuItems, openRecent, recentAlbums, and recentMenuItems.

Referenced by TitleWidget().

01369 {
01370   int maxItems = recentAlbums.getMaxItems();
01371   numRecentMenuItems = maxItems + 2; //+2 for seperator and clear entry
01372   recentMenuItems = new int[numRecentMenuItems];
01373   customRecentMenuItems = new RecentAlbumMenuItem*[maxItems];
01374   
01375   //insert recent albums into menu
01376   int i;
01377   for(i = 0; i<maxItems; i++)
01378   {
01379     Key key;
01380     if(i == 0) key = Key_1;
01381     else if(i == 1) key = Key_2;
01382     else if(i == 2) key = Key_3;
01383     else if(i == 3) key = Key_4;
01384     else if(i == 4) key = Key_5;
01385     else if(i == 5) key = Key_6;
01386     else if(i == 6) key = Key_7;
01387     else if(i == 7) key = Key_8;
01388     else if(i == 8) key = Key_9;
01389     else key = Key_unknown;
01390     
01391     //get album name + location
01392     QString recentName = "recentName";
01393     QString recentLocation = "recentLocation";
01394     QString recentPhotoCount = "recentPhotoCount";
01395     
01396     //----------------------------------------------    
01397     //PLATFORM_SPECIFIC_CODE
01398 #if defined(Q_OS_MACX)
01399     //Mac OS X does not support custom painted system menu entries. :(
01400     recentMenuItems[i] = openRecent->insertItem( "uninitialized recent album",
01401                                          this, SLOT(loadRecentAlbum(int)) );  
01402     //----------------------------------------------    
01403     //Under other operating systems (Windows, Linux, FreeBSD) use custom recent album menu item 
01404     //such that album image is larger and more detail is provided
01405 #else  
01406     customRecentMenuItems[i] = new RecentAlbumMenuItem(key);
01407     recentMenuItems[i] = openRecent->insertItem( customRecentMenuItems[i] );
01408     openRecent->connectItem( recentMenuItems[i], this, SLOT(loadRecentAlbum(int)) );
01409 #endif   
01410     //----------------------------------------------         
01411     //Set accelerator key sequence if valid    
01412     if( key != Key_unknown )
01413     {
01414       openRecent->setAccel( CTRL+key, recentMenuItems[i] ); 
01415       openRecent->setItemParameter( recentMenuItems[i], i );
01416     }
01417 
01418     //hide + disable entry
01419     openRecent->setItemVisible( recentMenuItems[i], false );    
01420     openRecent->setItemEnabled( recentMenuItems[i], false );      
01421     //----------------------------------------------         
01422   }
01423   
01424   //insert separator and "clear menu" entry.
01425   recentMenuItems[numRecentMenuItems-2] = openRecent->insertSeparator();
01426   recentMenuItems[numRecentMenuItems-1] = openRecent->insertItem( tr("Clear Menu"), 
01427                                                                   this, 
01428                                                                   SLOT(clearOpenRecentMenu()) );  
01429   
01430   //hide separtor, disable clear entry
01431   openRecent->setItemVisible( recentMenuItems[numRecentMenuItems-2], false );    
01432   openRecent->setItemEnabled( recentMenuItems[numRecentMenuItems-1], false );      
01433 }

void TitleWidget::refreshOpenRecentMenu (  )  [private]

Refreshes open recent menu.

Definition at line 1435 of file titleWidget.cpp.

References RecentAlbumMenuItem::changeItem(), customRecentMenuItems, RecentAlbums::getEntry(), RecentAlbums::numEntries(), numRecentMenuItems, openRecent, recentAlbums, recentMenuItems, scaleImage(), RecentAlbumMenuItem::setMaxWidth(), and width.

Referenced by clearOpenRecentMenu(), loadAlbum(), saveAlbum(), saveAsAlbum(), and TitleWidget().

01436 {
01437   //update text, visibility, and enabled bit for all items in list
01438   int i;
01439 
01440 #ifndef Q_OS_MACX
01441   int maxWidth=0;
01442 #endif
01443 
01444   for(i=0; i<numRecentMenuItems; i++)
01445   {
01446     //----------------------------------------------    
01447     //item - update fields, enable, and show
01448     QString recentName, recentLocation, recentPhotoCount;
01449     QDir tempDir;
01450     if( i < recentAlbums.numEntries())
01451     {
01452       //get album name + location
01453       recentAlbums.getEntry( i, recentName, recentLocation, recentPhotoCount );
01454       //----------------------------------------------    
01455       //PLATFORM_SPECIFIC_CODE
01456       //Mac OS X does not support custom painted system menu entries. :(
01457 #if defined(Q_OS_MACX)
01458       QString albumImageLocation = QDir::convertSeparators( recentLocation + "/img/album.jpg" );
01459       
01460       //don't display photo count if not available (-1)
01461       if(recentPhotoCount.compare("-1") == 0)
01462         recentPhotoCount = "";
01463       else
01464         recentPhotoCount = " (" + recentPhotoCount + ")";
01465       
01466       //if album image exits resize it and use for menu item icon
01467       if( tempDir.exists( albumImageLocation ) )
01468       {
01469         //scale image
01470         QImage scaledAlbumImage;
01471         scaleImage( albumImageLocation, scaledAlbumImage, 32, 32 );
01472         
01473         //use text and pixmap
01474         QPixmap scaledAlbumImagePixmap;
01475         scaledAlbumImagePixmap.convertFromImage( scaledAlbumImage );
01476         
01477         openRecent->changeItem( recentMenuItems[i],
01478                                 QIconSet( scaledAlbumImagePixmap ),
01479                                 QString("%1%2").arg(recentName).arg(recentPhotoCount) );
01480       }      
01481       //otherwise simply display the album name and number of phots (if available)
01482       else
01483       {
01484         //using just text
01485         openRecent->changeItem( recentMenuItems[i],
01486                                 QIconSet(NULL),
01487                                 QString("%1%2").arg(recentName).arg(recentPhotoCount) );
01488       }
01489       //----------------------------------------------    
01490       //Under other operating systems (Windows, Linux, FreeBSD) use custom recent album menu item 
01491       //such that album image is larger and more detail is provided
01492 #else  
01493       customRecentMenuItems[i]->changeItem( recentName, recentLocation, recentPhotoCount );                                           
01494       maxWidth = QMAX( maxWidth, customRecentMenuItems[i]->sizeHint().width() );
01495 #endif   
01496       //----------------------------------------------         
01497       openRecent->setItemEnabled( recentMenuItems[i], true );      
01498       openRecent->setItemVisible( recentMenuItems[i], true );    
01499       
01500       //if the Album.xml file is unavailable then disable menu entry
01501       if( !tempDir.exists( QDir::convertSeparators(recentLocation + "/Album.xml") ) )
01502         openRecent->setItemEnabled( recentMenuItems[i], false );    
01503     }
01504     //----------------------------------------------         
01505     //hidden item - disable and hide
01506     else if( i >= recentAlbums.numEntries() &&
01507              i < numRecentMenuItems-2 )
01508     {
01509       openRecent->setItemEnabled( recentMenuItems[i], false );      
01510       openRecent->setItemVisible( recentMenuItems[i], false );    
01511     }
01512     //----------------------------------------------         
01513     //separtor - show if one or more items in list
01514     else if (i == numRecentMenuItems-2)
01515     {
01516       openRecent->setItemVisible( recentMenuItems[numRecentMenuItems-2], 
01517                                   recentAlbums.numEntries() > 0 );    
01518     }
01519     //----------------------------------------------         
01520     //clear items - enable if items in list
01521     else if (i == numRecentMenuItems-1)
01522     {
01523       openRecent->setItemEnabled( recentMenuItems[numRecentMenuItems-1], 
01524                                   recentAlbums.numEntries() > 0 );    
01525     }
01526     //----------------------------------------------         
01527   }
01528 
01529 
01530   //pass over custom menu items a second time letting them know the maximum item width
01531 #ifndef Q_OS_MACX
01532   for(i=0; i<recentAlbums.numEntries(); i++)
01533   {
01534     customRecentMenuItems[i]->setMaxWidth( maxWidth );
01535   }
01536 #endif
01537 
01538 }


Member Data Documentation

QMenuBar* TitleWidget::menu [private]

Menubar file menu and help menu inserted in.

Definition at line 205 of file titleWidget.h.

Referenced by TitleWidget().

QPopupMenu* TitleWidget::file [private]

File menu.

Definition at line 208 of file titleWidget.h.

Referenced by loadAlbum(), newAlbum(), saveAlbum(), saveAsAlbum(), setBusy(), and TitleWidget().

QPopupMenu* TitleWidget::openRecent [private]

Open recent submenu.

Definition at line 211 of file titleWidget.h.

Referenced by populateOpenRecentMenu(), refreshOpenRecentMenu(), and TitleWidget().

Definition at line 212 of file titleWidget.h.

Referenced by populateOpenRecentMenu(), and refreshOpenRecentMenu().

Definition at line 213 of file titleWidget.h.

Referenced by populateOpenRecentMenu(), and refreshOpenRecentMenu().

Definition at line 214 of file titleWidget.h.

Referenced by populateOpenRecentMenu(), and refreshOpenRecentMenu().

QPopupMenu* TitleWidget::photoMenu [private]

Photos menu.

Definition at line 218 of file titleWidget.h.

Referenced by TitleWidget(), and updateMenus().

QPopupMenu* TitleWidget::tools [private]

Tools menu.

Definition at line 221 of file titleWidget.h.

Referenced by TitleWidget().

QPopupMenu* TitleWidget::helpMenu [private]

Window menu, only used in OSX.

Help menu

Definition at line 231 of file titleWidget.h.

Referenced by TitleWidget().

QGridLayout* TitleWidget::mainGrid [private]

Main grid.

Definition at line 234 of file titleWidget.h.

Referenced by TitleWidget().

Definition at line 235 of file titleWidget.h.

Referenced by TitleWidget().

QGridLayout* TitleWidget::albumAnnotationGrid [private]

Album annotation grid.

Definition at line 238 of file titleWidget.h.

Referenced by TitleWidget().

Definition at line 239 of file titleWidget.h.

Referenced by TitleWidget().

Definition at line 241 of file titleWidget.h.

Referenced by TitleWidget().

QLineEdit* TitleWidget::albumNameVal [private]

Definition at line 242 of file titleWidget.h.

Referenced by storeAnnotations(), TitleWidget(), and updateAlbumAnnotations().

Definition at line 243 of file titleWidget.h.

Referenced by TitleWidget().

QLineEdit* TitleWidget::albumDescriptionVal [private]

Definition at line 244 of file titleWidget.h.

Referenced by storeAnnotations(), TitleWidget(), and updateAlbumAnnotations().

Definition at line 245 of file titleWidget.h.

Referenced by TitleWidget().

QLineEdit* TitleWidget::albumAuthorVal [private]

Definition at line 246 of file titleWidget.h.

Referenced by saveAsAlbum(), storeAnnotations(), TitleWidget(), and updateAlbumAnnotations().

QGridLayout* TitleWidget::subalbumAnnotationGrid [private]

Subalbum annotation grid.

Definition at line 249 of file titleWidget.h.

Referenced by TitleWidget().

Definition at line 250 of file titleWidget.h.

Referenced by loadAlbum(), refreshCollectionAnnotations(), and TitleWidget().

Definition at line 252 of file titleWidget.h.

Referenced by TitleWidget().

QLineEdit* TitleWidget::subalbumNameVal [private]

Definition at line 253 of file titleWidget.h.

Referenced by refreshCollectionAnnotations(), storeAnnotations(), and TitleWidget().

Definition at line 254 of file titleWidget.h.

Referenced by TitleWidget().

Definition at line 255 of file titleWidget.h.

Referenced by refreshCollectionAnnotations(), storeAnnotations(), and TitleWidget().

Album Statistics dialog pointer.

Definition at line 264 of file titleWidget.h.

Referenced by albumStatistics(), albumStatisticsClosed(), and TitleWidget().

Settings dialog pointer.

Definition at line 267 of file titleWidget.h.

Referenced by settings(), settingsWindowClosed(), and TitleWidget().

About dialog pointer.

Definition at line 270 of file titleWidget.h.

Referenced by aboutClosed(), aboutProgram(), and TitleWidget().

HelpWindow pointer.

Definition at line 273 of file titleWidget.h.

Referenced by help(), helpClosed(), and TitleWidget().

bool TitleWidget::busy [private]

Is the program currently busy? helps block other operations.

Definition at line 276 of file titleWidget.h.

Referenced by getBusy(), setBusy(), and TitleWidget().

int TitleWidget::NEW_ALBUM [private]

Definition at line 282 of file titleWidget.h.

Referenced by setBusy(), and TitleWidget().

int TitleWidget::OPEN_ALBUM [private]

Definition at line 283 of file titleWidget.h.

Referenced by setBusy(), and TitleWidget().

int TitleWidget::SAVE_ALBUM [private]

Definition at line 284 of file titleWidget.h.

Referenced by setBusy(), and TitleWidget().

Definition at line 285 of file titleWidget.h.

Referenced by setBusy(), and TitleWidget().

Definition at line 286 of file titleWidget.h.

Referenced by loadAlbum(), newAlbum(), saveAlbum(), saveAsAlbum(), and TitleWidget().

Definition at line 287 of file titleWidget.h.

Referenced by TitleWidget().

Definition at line 288 of file titleWidget.h.

Referenced by TitleWidget().

photos menu item id's

Definition at line 291 of file titleWidget.h.

Referenced by TitleWidget(), and updateMenus().

Definition at line 292 of file titleWidget.h.

Referenced by TitleWidget(), and updateMenus().

tools menu item id's

Definition at line 295 of file titleWidget.h.

Definition at line 296 of file titleWidget.h.

cached set button state

Definition at line 299 of file titleWidget.h.

error message and description when temp directory cannot be created

Definition at line 302 of file titleWidget.h.

Referenced by loadAlbum(), newAlbum(), and TitleWidget().

QString TitleWidget::tmpDirErrorDesc [private]

Definition at line 302 of file titleWidget.h.

Referenced by loadAlbum(), newAlbum(), and TitleWidget().


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

Generated on Thu Jun 19 15:09:16 2008 for AlbumShaper by  doxygen 1.5.6