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

bool Photo::setImage ( QString  editedImageFilename  ) 

Reset photo data after photo editing has taken place. Slideshow and thumbnail images need to be regenerated.

Definition at line 155 of file photo.cpp.

References constructSmallerImages(), Subalbum::getAlbum(), getEverSaved(), Album::getTmpDir(), imageLocation, recentlyReverted, and subalbum.

{
  //if the image has been saved then simply change the image,slideshow/thubnail 
  //filename handles to point to the temporary directory. We don't need to worry about backing up the
  //image because the new version will be written to the temporary directory and the save location
  if( getEverSaved() )
  {
    imageLocation = subalbum->getAlbum()->getTmpDir() + 
                    QString("/%1_%2.jpg").arg(initialSubalbumNumber).arg(initialPhotoNumber);
    slideshowLocation = subalbum->getAlbum()->getTmpDir() + 
                        QString("/%1_%2_slideshow.jpg").arg(initialSubalbumNumber).arg(initialPhotoNumber);
    thumbnailLocation = subalbum->getAlbum()->getTmpDir() + 
                        QString("/%1_%2_thumb.jpg").arg(initialSubalbumNumber).arg(initialPhotoNumber);
  }
  //otherwise image has never been saved, make sure original form has been backed up!
  else
  {
    QString tempOrigLocation = imageLocation;
    tempOrigLocation.truncate( imageLocation.length() - 4 );
    tempOrigLocation = tempOrigLocation + "_orig.jpg";
       
    QDir tmpDir;
    if(!tmpDir.exists( tempOrigLocation ) )
    { copyFile( imageLocation, tempOrigLocation ); }    
  }
  
  //copy over full size image
  copyFile( editedImageFilename, imageLocation );
  
  //reset revert flag since image has not been modified
  recentlyReverted = false;
  
  //construct smaller iamges
  return constructSmallerImages();
}


Generated by  Doxygen 1.6.0   Back to index