Logo Search packages:      
Sourcecode: albumshaper version File versions  Download package

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, albumAnnotationGrid, albumStatistics(), albumStats, busy, exportLargeImages(), exportSmallWebGallery(), file, Window::getConfig(), RecentAlbums::getMaxItems(), Configuration::getString(), Album::getTmpDir(), help(), helpMenu, helpWindow, RecentAlbums::insertEntry(), loadAlbum(), mainGrid, menu, newAlbum(), openRecent, photoMenu, populateOpenRecentMenu(), quitApplication(), refreshOpenRecentMenu(), REMOVE_DESCRIPTIONS, removeSelectedPhotoDesc(), revertPhotos(), revertToSaved(), saveAlbum(), saveAsAlbum(), settings(), settingsWindow, storeAnnotations(), subalbumAnnotationGrid, tmpDirErrorMessage, tools, unsetAlbumImage(), unsetSubalbumImage(), and window.

                                                    : QFrame(parent,name)
{
  tmpDirErrorMessage = tr("Error! Unable to create temp directory!");
  tmpDirErrorDesc = tr("Album Shaper was unable to create the necessary temp directory required: ");
  //--------------------------------------------------------------
  QColor white(255, 255, 255);
  QColor lightBlue(193, 210, 238);
  QColor darkBlue(35, 75, 139);
  QColor black(0, 0, 0);
  //--------------------------------------------------------------
  ///Store parent pointer
  window = (Window*)parent;

  ///program not busy at first
  busy = false;

  //detect changes to text fields
  detectModifications = true;

  ///no windows open by default
  albumStats = NULL;
  settingsWindow = NULL;
  about = NULL;
  helpWindow = NULL;

  //create backend album object
  albm = new Album( createTmpDir() );
  if(albm->getTmpDir().isNull() )
  {
      AlertDialog alert( tmpDirErrorMessage, tmpDirErrorDesc + window->getConfig()->getString( "loadSave", "tempImageDirectory" ),
      "alertIcons/warning.png", this );
      alert.exec();
      quitApplication();
  }
  //-------------------------------------
  //initialize recent albums object
  int i;
  QString recentName, recentLocation, recentPhotoCount;
  for(i = 0; i<recentAlbums.getMaxItems(); i++)
  {
    //get album name and location
    recentName = window->getConfig()->getString(    "recentAlbums", QString("%1_name").arg(i)     );
    recentLocation = window->getConfig()->getString("recentAlbums", QString("%1_location").arg(i) );
    recentPhotoCount = window->getConfig()->getString("recentAlbums", QString("%1_photoCount").arg(i) );

    //no such listing? since listings are continious all listings must be loaded
    if(recentLocation.compare("-1") == 0)
      break;

    //insert item into list
    recentAlbums.insertEntry( recentName, recentLocation, recentPhotoCount ); 
  }      
  //--------------------------------------------------------------
  //create menus
  menu = new QMenuBar( this, "menuBar" );
  //---
  //File menu
  file = new QPopupMenu( this, "fileMenu" );
  NEW_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/new.png") ),
                                tr("&New"), this, SLOT(newAlbum()), CTRL+Key_N );

  OPEN_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/open.png") ),
                                 tr("&Open..."), this, SLOT(loadAlbum()), CTRL+Key_O );

  openRecent = new QPopupMenu( this, "openRecentMenu" );
  populateOpenRecentMenu();
  refreshOpenRecentMenu();
  file->insertItem( tr("Open Recent"), openRecent );
  //----------------------
  file->insertSeparator();
  //----------------------  
  SAVE_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/save.png") ),
                                 tr("&Save"), this, SLOT(saveAlbum()), CTRL+Key_S );

  SAVEAS_ALBUM = file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/saveas.png") ),
                                   tr("&Save As..."), this, SLOT(saveAsAlbum()), CTRL+SHIFT+Key_S );

  REVERT_TO_SAVED_ALBUM = file->insertItem( tr("Revert to Saved"), this, SLOT(revertToSaved()) );
  file->setItemEnabled( REVERT_TO_SAVED_ALBUM, false );  
  //----------------------
  file->insertSeparator();
  //----------------------
  QPopupMenu* exportAs = new QPopupMenu( this, "exportAs" );
  EXPORT_SMALL_WEB_GALLERY = exportAs->insertItem( tr("Small Web Gallery..."), 
                                                   this, SLOT(exportSmallWebGallery()) );
  EXPORT_LARGE_IMAGES = exportAs->insertItem( tr("Images for Printing..."), 
                                              this, SLOT(exportLargeImages()) );
  
  file->insertItem( tr("Export"), exportAs );
  //----------------------  
  file->insertSeparator();
  //----------------------
  file->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/quit.png") ),
                    tr("&Quit"), this, SLOT(quitApplication()), CTRL+Key_Q);

  
  menu->insertItem( tr("&File"), file );
  //---
  //Photo menu
  photoMenu = new QPopupMenu( this, "phooMenu" );
    
  REMOVE_DESCRIPTIONS = photoMenu->insertItem( tr("Remove Description"), this, SLOT(removeSelectedPhotoDesc()) );
  REVERT_PHOTOS = photoMenu->insertItem( tr("Revert to Original"), this, SLOT(revertPhotos()) );
  
  menu->insertItem( tr("&Photos"), photoMenu );
  //---
  //Tools menu
  tools = new QPopupMenu( this, "toolsMenu" );
/*
  BEGIN_PRESENTATION_AT = tools->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/startPresentation.png") ),
                                          tr("Begin Presentation"), 
                                          window, SLOT(startSlideshowWithSelectedPhoto()), CTRL+Key_P );   
  BEGIN_PRESENTATION = tools->insertItem( tr("Begin Presentation at Beginning"), 
                                             window, SLOT(startSlideshowAtBeginning()), CTRL+SHIFT+Key_P ); 
  updateMenus();
 */

  tools->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/albumStatistics.png") ),
                     tr("Album Statistics"), this, SLOT(albumStatistics()), CTRL+Key_I );

  tools->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/settings.png") ),
                     tr("Settings"), this, SLOT(settings()) );

  menu->insertItem( tr("&Tools"), tools );
  //---
  //PLATFORM_SPECIFIC_CODE
  //Window menu
  #if defined(Q_OS_MACX)
  windowMenu = new QPopupMenu( this, "windoMenu" );
  WINDOW_MINIMIZE = windowMenu->insertItem( tr("&Minimize"), (QWidget*)window, SLOT(showMinimized()), CTRL+Key_M );
  menu->insertItem( tr("&Window"), windowMenu );
  #endif
  //---    
  //Help menu
  helpMenu = new QPopupMenu( this, "helpMenu" );
  helpMenu->insertItem( tr("Album Shaper Help"), this, SLOT(help()), CTRL+Key_Question );

  helpMenu->insertItem( QIconSet( QPixmap(QString(IMAGE_PATH)+"menuIcons/about.png") ),
                    tr("About"), this, SLOT(aboutProgram()) );
  menu->insertSeparator();
  menu->insertItem( tr("&Help"), helpMenu );
  //--------------------------------------------------------------
  //create all widgets
  mainFrame = new QFrame( this, "mainFrame" );
  mainFrame->setPaletteBackgroundColor( darkBlue );
  //------
  //album annotations
  albumAnnotationFrame = new QFrame( mainFrame, "albumAnnotationFrame" );
  albumAnnotationFrame->setLineWidth(2);
  albumAnnotationFrame->setMidLineWidth(0);
  albumAnnotationFrame->setFrameStyle( QFrame::Panel | QFrame::Plain );
  albumAnnotationFrame->setPaletteForegroundColor( white );
  albumAnnotationFrame->setPaletteBackgroundColor( darkBlue );

  QFrame* albumImageFrame = new QFrame( albumAnnotationFrame, "albumImageFrame" );
  albumImage = new ALabel( albumImageFrame, "albumImage",
                                               new QPixmap( QString(IMAGE_PATH)+"buttonIcons/removeImage.png") );
  connect( albumImage, SIGNAL(mouseRelease()),
                this, SLOT(unsetAlbumImage()) );

  //allow drop events
  this->setAcceptDrops(true);

  albumName = new QLabel( tr("Album Name:"), albumAnnotationFrame, "albumName" );
  albumNameVal = new QLineEdit( albumAnnotationFrame, "albumNameVal" );
  connect( albumNameVal, SIGNAL(textChanged( const QString&)),
           SLOT( storeAnnotations()) );

  albumDescription = new QLabel( tr("Description:"), albumAnnotationFrame, "albumDescription" );
  albumDescriptionVal = new QLineEdit( albumAnnotationFrame, "albumDescriptionVal" );
  connect( albumDescriptionVal, SIGNAL(textChanged( const QString&)),
           SLOT( storeAnnotations()) );

  albumAuthor = new QLabel( tr("Author:"), albumAnnotationFrame, "albumAuthor" );
  albumAuthorVal = new QLineEdit( albumAnnotationFrame, "albumAuthorVal" );
  connect( albumAuthorVal, SIGNAL(textChanged( const QString&)),
           SLOT( storeAnnotations()) );
  //------
  //subalbum annotations
  subalbumAnnotationFrame = new QFrame( mainFrame, "subalbumAnnotationFrame" );
  subalbumAnnotationFrame->setLineWidth(2);
  subalbumAnnotationFrame->setMidLineWidth(0);
  subalbumAnnotationFrame->setFrameStyle( QFrame::Panel | QFrame::Plain );
  subalbumAnnotationFrame->setPaletteForegroundColor( white );
  subalbumAnnotationFrame->setPaletteBackgroundColor( darkBlue );

  QFrame* subalbumImageFrame = new QFrame( subalbumAnnotationFrame, "subalbumImageFrame" );
  subalbumImage = new ALabel( subalbumImageFrame, "subalbumImage",
                                                    new QPixmap( QString(IMAGE_PATH)+"buttonIcons/removeImage.png") );

  connect( subalbumImage, SIGNAL(mouseRelease()),
                 this, SLOT(unsetSubalbumImage()) );

  subalbumName = new QLabel( tr("Collection Name:"), subalbumAnnotationFrame );
  subalbumNameVal = new QLineEdit( subalbumAnnotationFrame );
  connect( subalbumNameVal, SIGNAL(textChanged( const QString&)),
           SLOT( storeAnnotations()) );

  subalbumDescription = new QLabel( tr("Description:"), subalbumAnnotationFrame );
  subalbumDescriptionVal = new QLineEdit( subalbumAnnotationFrame );
  connect( subalbumDescriptionVal, SIGNAL(textChanged( const QString&)),
           SLOT( storeAnnotations()) );
  //--------------------------------------------------------------
  //Set fonts + colors
  QFont labelFont = albumName->font();
  labelFont.setWeight(QFont::Bold);

  albumName->setFont( labelFont );
  albumName->setPaletteForegroundColor( white );
  albumName->setPaletteBackgroundColor( darkBlue );

  albumNameVal->setFont( labelFont );
  albumNameVal->setPaletteForegroundColor( black );
  albumNameVal->setPaletteBackgroundColor( lightBlue );
  albumNameVal->setFrameShape ( QFrame::NoFrame );

  albumDescription->setFont( labelFont );
  albumDescription->setPaletteForegroundColor( white );
  albumDescription->setPaletteBackgroundColor( darkBlue );

  albumDescriptionVal->setFont( labelFont );
  albumDescriptionVal->setPaletteForegroundColor( black );
  albumDescriptionVal->setPaletteBackgroundColor( lightBlue );
  albumDescriptionVal->setFrameShape ( QFrame::NoFrame );

  albumAuthor->setFont( labelFont );
  albumAuthor->setPaletteForegroundColor( white );
  albumAuthor->setPaletteBackgroundColor( darkBlue );

  albumAuthorVal->setFont( labelFont );
  albumAuthorVal->setPaletteForegroundColor( black );
  albumAuthorVal->setPaletteBackgroundColor( lightBlue );
  albumAuthorVal->setFrameShape ( QFrame::NoFrame );

  subalbumName->setFont( labelFont );
  subalbumName->setPaletteForegroundColor( white );
  subalbumName->setPaletteBackgroundColor( darkBlue );

  subalbumNameVal->setFont( labelFont );
  subalbumNameVal->setPaletteForegroundColor( black );
  subalbumNameVal->setPaletteBackgroundColor( lightBlue );
  subalbumNameVal->setFrameShape ( QFrame::NoFrame );

  subalbumDescription->setFont( labelFont );
  subalbumDescription->setPaletteForegroundColor( white );
  subalbumDescription->setPaletteBackgroundColor( darkBlue );

  subalbumDescriptionVal->setFont( labelFont );
  subalbumDescriptionVal->setPaletteForegroundColor( black );
  subalbumDescriptionVal->setPaletteBackgroundColor( lightBlue );
  subalbumDescriptionVal->setFrameShape ( QFrame::NoFrame );
  //--------------------------------------------------------------
  //place widgets in grids
  //------------------------
  //album annotations
  QGridLayout* albumImageGrid = new QGridLayout( albumImageFrame, 1, 1 );
  albumImageGrid->addWidget( albumImage, 0, 0 );
  albumImageGrid->setRowSpacing( 0, REP_IMAGE_HEIGHT );

  albumAnnotationGrid =      new QGridLayout( albumAnnotationFrame, 3, 3);
  albumAnnotationGrid->setMargin(WIDGET_SPACING);
  albumAnnotationGrid->setSpacing(WIDGET_SPACING);

  albumAnnotationGrid->addMultiCellWidget( albumImageFrame, 0, 2, 0, 0 );

  albumAnnotationGrid->addWidget          ( albumName, 0, 1, Qt::AlignLeft);
  albumAnnotationGrid->addWidget          ( albumDescription, 1, 1, Qt::AlignLeft);
  albumAnnotationGrid->addWidget          ( albumAuthor, 2, 1, Qt::AlignLeft);

  albumAnnotationGrid->setColStretch(2, 1);
  albumAnnotationGrid->addWidget( albumNameVal, 0, 2);
  albumAnnotationGrid->addWidget( albumDescriptionVal, 1, 2);
  albumAnnotationGrid->addWidget( albumAuthorVal, 2, 2);
  //------------------------
  //subalbum annotations
  QGridLayout* subalbumImageGrid = new QGridLayout( subalbumImageFrame, 1, 1 );
  subalbumImageGrid->addWidget( subalbumImage, 0, 0 );
  subalbumImageGrid->setRowSpacing( 0, REP_IMAGE_HEIGHT );

  subalbumAnnotationGrid = new QGridLayout( subalbumAnnotationFrame, 5, 5);
  subalbumAnnotationGrid->setMargin(WIDGET_SPACING);
  subalbumAnnotationGrid->setSpacing(WIDGET_SPACING);

  subalbumAnnotationGrid->addMultiCellWidget( subalbumImageFrame, 0, 2, 0, 0);

  subalbumAnnotationGrid->setRowStretch(2, 1);
  subalbumAnnotationGrid->addWidget          ( subalbumName, 0, 1, Qt::AlignLeft);
  subalbumAnnotationGrid->addWidget          ( subalbumDescription, 1, 1, Qt::AlignLeft);

  subalbumAnnotationGrid->setColStretch(2, 1);
  subalbumAnnotationGrid->addWidget( subalbumNameVal, 0, 2);
  subalbumAnnotationGrid->addWidget( subalbumDescriptionVal, 1, 2);
  //------------------------
  //place menu and album and subalbum annotations into main grid
  mainGrid =                       new QGridLayout( mainFrame, 1, 2);
  mainGrid->setMargin(WIDGET_SPACING);
  mainGrid->setSpacing(WIDGET_SPACING);

  mainGrid->addWidget          ( albumAnnotationFrame, 0, 0);
  mainGrid->setColStretch(0, 1);

  mainGrid->addWidget          ( subalbumAnnotationFrame, 0, 1);
  mainGrid->setColStretch(1, 1);

  QVBoxLayout* vb = new QVBoxLayout(this);
  this->layout()->setMenuBar( menu );
  vb->addWidget(mainFrame);
  //-----------------------------------------------
}


Generated by  Doxygen 1.6.0   Back to index