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

int Album::exportLargeImages ( StatusWidget *  status,
QString  exportPath,
QString  exportMessage 
)

Export fullsize images (excludes slideshow and thumbnail images, album and collection iamges, and html or xml files)

Definition at line 726 of file album.cpp.

References Subalbum::getFirst(), getFirstSubalbum(), Photo::getImageFilename(), Photo::getNext(), Subalbum::getNext(), getNumPhotos(), Subalbum::getNumPhotos(), and getNumSubalbums().

Referenced by TitleWidget::exportLargeImages().

{
  //determine number of digits collecion # requires
  uint collectionDigits = (uint) (1 + log( (double) getNumSubalbums() ) / log( 10.0 ) );
  
  //determine number of digits photo # requires, this
  //involves walking through the album and finding the collection with the most phots first
  int mostPhotos = 0;  
  Subalbum* curCollection = getFirstSubalbum();
  while(curCollection != NULL )
  {
    mostPhotos = QMAX( mostPhotos, curCollection->getNumPhotos() );
    curCollection = curCollection->getNext(); 
  }
  uint photoDigits = (uint) ( 1 + log( (double) mostPhotos ) / log( 10.0 ) );   
  //------------
  //copy files  
  int numPhotos = getNumPhotos();  
  int photosLeft = numPhotos;  
  
  int collectionNum = 1;
  curCollection = getFirstSubalbum();
  
  int updateInverval = numPhotos / 50;
  int updateCount = 0;
  
  while(curCollection != NULL )
  {
    //construct collection string
    QString collectionString = QString("%1").arg(collectionNum);
    while(collectionString.length() < collectionDigits)
    { collectionString = "0" + collectionString; }  
    
    //copy all photos in collection
    int photoNum = 1;
    Photo* curPhoto = curCollection->getFirst();
    while(curPhoto != NULL)
    {
      //update status message
      status->updateProgress( numPhotos - photosLeft, exportMessage.arg( photosLeft ) );
      
      //make sure events are processed every 2% of the photos that are processes
      updateCount++;
      if(updateCount > updateInverval)
      {
        updateCount = 0;
        qApp->processEvents();        
      }

      //construct photo string
      QString photoString = QString("%1").arg(photoNum);
      while(photoString.length() < photoDigits)
      { photoString = "0" + photoString; }  
      
      //construct new photo path
      QString newFilePath = QDir::convertSeparators( exportPath + "/" + collectionString + 
                                                     "_" + photoString + ".jpg" );
      //copy file
      copyFile( curPhoto->getImageFilename(), newFilePath );
      
      //move on to next file
      photosLeft--;
      curPhoto = curPhoto->getNext();
      photoNum++;
      
    } //while photo
    
    //move on to next collection
    curCollection = curCollection->getNext();
    collectionNum++;    
  }// while collection
   //------------
  return ALBUM_EXPORTED;
}


Generated by  Doxygen 1.6.0   Back to index