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

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

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

refresh title annotations when collections are selected

refresh collection icons when collection names are edited

Definition at line 48 of file window.cpp.

References config, Configuration::getBool(), Configuration::getString(), grid, layout, Configuration::loadSettings(), LayoutWidget::refresh(), Configuration::resetSetting(), status, title, and TitleWidget::useAnimation().

                                                  : QWidget(parent,name)
{
  //don't clear pixmap area before painting, prevents flicker
  setWFlags(WRepaintNoErase);

  //load shadow pixmaps
  shadowBL = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottomLeft.png" );
  shadowB = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottom.png" );
  shadowBR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientBottomRight.png" );
  shadowR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientRight.png" );
  shadowTR = new QPixmap( QString(IMAGE_PATH)+"miscImages/photoGradientTopRight.png" );

  //load photo info pixmap
  photoInfo = new QPixmap( QString(IMAGE_PATH)+"buttonIcons/photoInfo.png");

  //------------------------------------------------
  //create configuration object with default settings
  config = new Configuration();
  LoadingSavingWidget::setDefaults(config);
  LayoutSettingsWidget::setDefaults(config);
  AlertsWidget::setDefaults(config);
  MiscSettings::setDefaults(config);
  //------------------------------------------------
  //load user settings
  config->loadSettings();

  //if temorary image directory does not exist create it
  QDir homeDir;
  bool configDirMade = true;
  if(!homeDir.exists( config->getString( "loadSave", "tempImageDirectory")) )
  { configDirMade = homeDir.mkdir( config->getString( "loadSave", "tempImageDirectory")); }
  //if directory could not be made attempt to revert to default directory
  if(!configDirMade)
  {
    AlertDialog alert( "unable to create temp dir", QString("unable to make temporary directory! (" + config->getString( "loadSave", "tempImageDirectory") ),
  "alertIcons/warning.png", this );
  alert.exec();


    config->resetSetting( "loadSave", "tempImageDirectory" );
    configDirMade = true;
    if(!homeDir.exists( config->getString( "loadSave", "tempImageDirectory")) )
    { configDirMade = homeDir.mkdir( config->getString( "loadSave", "tempImageDirectory")); }
  }

  //if we are still unable to create the temporary image directory then immediately abort
  if(!configDirMade)
  {
      AlertDialog alert( "unable to create temp dir", QString("unable to make temporary directory! (" + config->getString( "loadSave", "tempImageDirectory") ),
  "alertIcons/warning.png", this );
  alert.exec();

close();
  }

  //------------------------------------------------
  //create top level widgets
  title  = new TitleWidget (this, "title");
  layout = new LayoutWidget(this, "layout");
  status = new StatusWidget(this, "status");

  ///refresh title annotations when collections are selected
  connect( layout, SIGNAL(collectionSelected(Subalbum*)),
           title,  SLOT(refreshCollectionAnnotations(Subalbum*)) );

  ///refresh collection icons when collection names are edited
  connect( title,  SIGNAL(subalbumNameChanged()),
           layout, SLOT(refreshSelectedCollectionIconName()) );
  
//  slideshow = new SlideshowWidget(this, "slideshow", WResizeNoErase);
//  slideshow->hide();
//  connect( slideshow, SIGNAL(endSlideshow()), this, SLOT(endSlideshow()) );
    
  //refresh subalbums listing
  layout->refresh();

  //place widgets in main frame
  grid = new QGridLayout( this, 3, 2, 0);                
  grid->addWidget( title,     0, 0 );
  grid->addWidget( layout,    1, 0 );
  grid->setRowStretch( 1, 1 );
  grid->addWidget( status,    2, 0 );
  grid->setRowSpacing( 2, 24 );
//  grid->addMultiCellWidget( slideshow, 0, 2, 1, 1 );
  grid->setColStretch(0, 1 );  
  
  //PLATFORM_SPECIFIC_CODE
  //create and set application icon
  #if( !defined(Q_OS_MACX) && !defined(Q_OS_WIN) )
  setIcon( QPixmap(QString(IMAGE_PATH)+"miscImages/as32.png") );
  #endif

  setCaption( 
#ifdef CVS_CODE
      "(CVS BUILD) " +        
#endif              
              tr("Album Shaper"));
  //------------------------------------------------
  //apply settings
  QToolTip::setGloballyEnabled( config->getBool( "layout", "showTooltips" ) );
  title->useAnimation( config->getBool( "layout", "animation" ) );
  //------------------------------------------------
}


Generated by  Doxygen 1.6.0   Back to index