Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Subalbum Class Reference

#include <subalbum.h>

Collaboration diagram for Subalbum:

Collaboration graph
[legend]
List of all members.

Detailed Description

A subalbum contains photos.

Specific contents:

Definition at line 51 of file subalbum.h.

Public Member Functions

 Subalbum (Album *albm, int number)
 Sets default information is the Subalbum number.

 ~Subalbum ()
 Frees photos.

void setName (QString val)
 Sets the Subalbum Name.

QString getName ()
 Gets the Subalbum Name.

void setDescription (QString val)
 Sets the Subalbum description.

QString getDescription ()
 Gets the Subalbum description.

QPixmap * getRepresentativeImage (int size)
 gets a sized representative image

void setRepresentativeImages (QImage *val)
 sets a sized representative iamge

bool addPhoto (QString fileName, bool replaceDescription=false, Photo *newPhoto=NULL)
 Adds a new photo to the Subalbum and appends it to the end, returns TRUE if successful.

bool lazyAddPhoto (QString imageName, QString slideshowName, QString thumbnailName, Photo *newPhoto)
 Lazily adds a new photo to the subalbum without rescaling from scrath, returns TRUE if successful.

void addPhoto (Photo *newPhoto)
 Adds a preexisting photo object to the Subalbum, appending it to the end.

void photoMoved (Photo *val)
 Removes a specified photo without deleting the object.

void removePhoto (Photo *val)
 Removes a specified photo.

SubalbumgetNext ()
 Returns pointer to next subalbum.

void setNext (Subalbum *val)
 Sets pointer of next subalbum.

PhotogetFirst ()
 Returns first photo in subalbum.

PhotogetLast ()
 Returns last photo in subalbum.

void exportToXML (QTextStream &stream)
 Exports subalbum to xml.

void importFromDisk (QDomNode *root, int subalbumNum, StatusWidget *status, QString dirName)
 Builds subalbum from XML DOM node.

void syncPhotoList (PhotoWidget *item)
 Syncs photo ordering with front end gui ordering.

int getSubalbumNumber ()
 Returns subalbum number.

int getNumPhotos ()
 Returns the number of photos in the subalbum.

int getNumLoadedPhotos ()
 Returns the number of loaded photos in subalbum.

void resetNumLoadedPhotos ()
void setModified ()

Private Attributes

int number
 Subalbum Number.

int numPhotos
 Number of photos in subalbum.

int loadedPhotos
 Number of photos in subalbum when last loaded.

QString name
 Short Name for subalbum.

QString description
 Longer description of subalbum.

QPixmap * smallRepresentativeImage
QPixmap * mediumRepresentativeImage
QPixmap * largeRepresentativeImage
PhotofirstPhoto
 Pointer to first photo.

PhotolastPhoto
 Pointer to last photo.

SubalbumnextSubalbum
 Pointer to next subalbum.

Albumalbm
 Pointer to album subalbum is in.


Constructor & Destructor Documentation

Subalbum::Subalbum Album albm,
int  number
 

Sets default information is the Subalbum number.

Definition at line 41 of file subalbum.cpp.

References description, firstPhoto, IMAGE_PATH, largeRepresentativeImage, lastPhoto, loadedPhotos, mediumRepresentativeImage, name, nextSubalbum, numPhotos, and smallRepresentativeImage.

00042 {
00043   //set subalbum number
00044   this->number = number;
00045 
00046   //by default no photos in subalbum
00047   numPhotos = 0;
00048   loadedPhotos = 0;
00049   
00050   //set strings to default values
00051   name = "";
00052   description ="";
00053 
00054   //set default rep images
00055   smallRepresentativeImage = new QPixmap( QString(IMAGE_PATH)+"notSpecified.png" );
00056   mediumRepresentativeImage = new QPixmap( QString(IMAGE_PATH)+"subalbum.png" );
00057   largeRepresentativeImage = NULL;
00058 
00059   //no photos by default
00060   firstPhoto = NULL;
00061   lastPhoto = NULL;
00062   
00063   //next pointer null by default
00064   nextSubalbum = NULL;
00065   
00066   //set album pointer
00067   this->albm = albm;
00068 }

Subalbum::~Subalbum  ) 
 

Frees photos.

Definition at line 71 of file subalbum.cpp.

References firstPhoto, Photo::getNext(), largeRepresentativeImage, mediumRepresentativeImage, and smallRepresentativeImage.

00072 {
00073   //delete representative images
00074   delete smallRepresentativeImage;
00075   delete mediumRepresentativeImage;
00076   delete largeRepresentativeImage;
00077   
00078   //delete all photos
00079   Photo* current = firstPhoto;
00080   Photo* temp;
00081   while(current != NULL)
00082   {
00083     temp = current->getNext();
00084     delete current;
00085     current = temp;
00086   }
00087 } 


Member Function Documentation

void Subalbum::addPhoto Photo newPhoto  ) 
 

Adds a preexisting photo object to the Subalbum, appending it to the end.

Definition at line 203 of file subalbum.cpp.

References albm, firstPhoto, lastPhoto, numPhotos, Album::setModified(), and Photo::setNext().

00204 {
00205   //increase counter
00206   numPhotos++;
00207   
00208   //set it's next pointer to null
00209   newPhoto->setNext(NULL);
00210 
00211   //if this is the only photo, set first and last 
00212   //pointers to this photo.
00213   if(firstPhoto == NULL)
00214   {
00215     firstPhoto = newPhoto;
00216     lastPhoto = newPhoto;
00217   }
00218   //else append to end of list
00219   else
00220   {
00221     lastPhoto->setNext(newPhoto);
00222     lastPhoto = newPhoto;
00223   }
00224     
00225   //set modified
00226   albm->setModified();
00227 }

bool Subalbum::addPhoto QString  fileName,
bool  replaceDescription = false,
Photo newPhoto = NULL
 

Adds a new photo to the Subalbum and appends it to the end, returns TRUE if successful.

Definition at line 230 of file subalbum.cpp.

References albm, Photo::deallocateLargeImages(), firstPhoto, Photo::getImage(), IMAGE, lastPhoto, number, numPhotos, Photo::setDescription(), Photo::setImage(), Photo::setImageFilename(), Album::setModified(), Photo::setNext(), Photo::setSlideshowFilename(), and SLIDESHOW.

Referenced by SubalbumWidget::addImageAction(), SubalbumPreviewWidget::dropped(), and importFromDisk().

00231 {
00232   numPhotos++;
00233   
00234   //create new photo if necessary
00235   if(newPhoto == NULL)
00236     newPhoto = new Photo(this, numPhotos);
00237     
00238   //replace description with filename if instructed
00239   //(aka /home/bob/happy.jpg -> happy)
00240   if(replaceDescription) 
00241   {
00242     QString desc(fileName);  
00243     desc = desc.section( QRegExp("/"), -1);
00244     desc.truncate(desc.length() - 4);
00245     newPhoto->setDescription( desc );
00246   }
00247     
00248   //attempt to set image
00249   if(!newPhoto->setImage(fileName))
00250   {
00251     delete newPhoto;
00252     return false;
00253   }
00254   
00255   //if this is the only photo, set first and last 
00256   //pointers to this photo.
00257   if(firstPhoto == NULL)
00258   {
00259     firstPhoto = newPhoto;
00260     lastPhoto = newPhoto;
00261   }
00262   //else append to end of list
00263   else
00264   {
00265     lastPhoto->setNext(newPhoto);
00266     lastPhoto = newPhoto;
00267   }
00268   
00269   //copy image file over
00270   QString saveName = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2")
00271                                 .arg(number)
00272                                 .arg(numPhotos);
00273   
00274   newPhoto->getImage(IMAGE)->save( saveName + ".jpg", "JPEG", 100);
00275   newPhoto->getImage(SLIDESHOW)->save( saveName + "_slideshow.jpg", "JPEG", 100);
00276   
00277   newPhoto->setImageFilename(saveName + ".jpg");
00278   newPhoto->setSlideshowFilename(saveName + "_slideshow.jpg");
00279   
00280   //deallocate full image and slideshow versions to conserve memory
00281   newPhoto->deallocateLargeImages();
00282     
00283   //set modified
00284   albm->setModified();
00285   
00286   return true;
00287 }

void Subalbum::exportToXML QTextStream &  stream  ) 
 

Exports subalbum to xml.

Definition at line 370 of file subalbum.cpp.

References description, Photo::exportToXML(), firstPhoto, fixXMLString(), Photo::getNext(), getRepresentativeImage(), LARGE, name, and number.

Referenced by Album::exportToXML().

00371 {
00372   //write subalbum information
00373   stream << "  <subalbum>\n";
00374   stream << "    <name>" << fixXMLString(name) << "</name>\n";
00375   stream << "    <description>" << fixXMLString(description) << "</description>\n";
00376   
00377   //if subalbum has a represenatative image save it's path
00378    if(getRepresentativeImage(LARGE) != NULL )
00379    {
00380      stream << "    <thumb path=\"img/" << number << "_thumb.jpg\"/>\n"; 
00381    }  
00382   
00383   //write photos
00384   Photo* current = firstPhoto;
00385   while(current != NULL)
00386   {
00387     current->exportToXML(stream);
00388     current = current->getNext();
00389   }  
00390   
00391   //close subalbum
00392   stream << "  </subalbum>\n";
00393 
00394 }

QString Subalbum::getDescription  ) 
 

Gets the Subalbum description.

Definition at line 116 of file subalbum.cpp.

References description.

Referenced by SubalbumWidget::setSubalbum(), and SubalbumWidget::SubalbumWidget().

00117 {
00118   return QString(description);
00119 }

Photo * Subalbum::getFirst  ) 
 

Returns first photo in subalbum.

Definition at line 396 of file subalbum.cpp.

References firstPhoto.

Referenced by AlbumStatistics::AlbumStatistics(), Album::exportSubalbumImages(), SubalbumWidget::refreshPhotos(), and Album::reorderSubalbumImages().

00397 {
00398   return firstPhoto;
00399 }

Photo * Subalbum::getLast  ) 
 

Returns last photo in subalbum.

Definition at line 401 of file subalbum.cpp.

References lastPhoto.

Referenced by SubalbumWidget::addImageAction().

00402 {
00403   return lastPhoto;
00404 }

QString Subalbum::getName  ) 
 

Gets the Subalbum Name.

Definition at line 100 of file subalbum.cpp.

References name.

Referenced by SubalbumWidget::setSubalbum(), and SubalbumWidget::SubalbumWidget().

00101 {
00102   return QString(name);
00103 }

Subalbum * Subalbum::getNext  ) 
 

Returns pointer to next subalbum.

Definition at line 357 of file subalbum.cpp.

References nextSubalbum.

Referenced by AlbumStatistics::AlbumStatistics(), Album::exportSubalbumImages(), Album::exportToDisk(), Album::exportTopLevelImages(), Album::exportToXML(), SubalbumsWidget::refresh(), Album::removeStagnantImages(), Album::removeSubalbum(), Album::reorderSubalbumImages(), and Album::~Album().

00358 {
00359   return nextSubalbum;
00360 }

int Subalbum::getNumLoadedPhotos  ) 
 

Returns the number of loaded photos in subalbum.

Definition at line 595 of file subalbum.cpp.

References loadedPhotos.

Referenced by Album::removeStagnantImages().

00596 {
00597   return loadedPhotos;;
00598 }

int Subalbum::getNumPhotos  ) 
 

Returns the number of photos in the subalbum.

Definition at line 590 of file subalbum.cpp.

References numPhotos.

Referenced by AlbumStatistics::AlbumStatistics(), Album::exportToDisk(), and Album::removeStagnantImages().

00591 {
00592   return numPhotos;;
00593 }

QPixmap * Subalbum::getRepresentativeImage int  size  ) 
 

gets a sized representative image

Definition at line 122 of file subalbum.cpp.

References LARGE, largeRepresentativeImage, MEDIUM, mediumRepresentativeImage, SMALL, and smallRepresentativeImage.

Referenced by Album::exportTopLevelImages(), exportToXML(), SubalbumWidget::setImageAction(), SubalbumWidget::setSubalbum(), and SubalbumWidget::SubalbumWidget().

00123 {
00124   if(size == SMALL)
00125     return smallRepresentativeImage;
00126   if(size == MEDIUM)
00127     return mediumRepresentativeImage;
00128   if(size == LARGE)
00129     return largeRepresentativeImage;
00130   else
00131     return NULL;
00132 }

int Subalbum::getSubalbumNumber  ) 
 

Returns subalbum number.

Definition at line 585 of file subalbum.cpp.

References number.

00586 {
00587   return number;
00588 }

void Subalbum::importFromDisk QDomNode *  root,
int  subalbumNum,
StatusWidget status,
QString  dirName
 

Builds subalbum from XML DOM node.

Definition at line 406 of file subalbum.cpp.

References addPhoto(), description, Photo::getImageChecksum(), getMD5(), Photo::getSlideshowChecksum(), Photo::getThumbnailChecksum(), Photo::importFromDisk(), StatusWidget::incrementProgress(), lazyAddPhoto(), name, resetNumLoadedPhotos(), and setRepresentativeImages().

Referenced by Album::importFromDisk().

00410 {
00411   //if representative image exists load
00412   QString repName = QString(dirName + "/img/%1_thumb.jpg").arg(subalbumNum);
00413   QImage repImage(repName);
00414   if(!repImage.isNull())
00415   {
00416     setRepresentativeImages(&repImage);  
00417   }  
00418   
00419   QDomNode node = root->firstChild();
00420   QDomText val;  
00421   int photoNum = 0;
00422   while( !node.isNull() )
00423   {
00424     //------------------------------------------------------------
00425     //subalbum name
00426     if( node.isElement() && node.nodeName() == "name" )
00427     { 
00428       val = node.firstChild().toText();
00429       if(!val.isNull())
00430         name = val.nodeValue();
00431     }
00432     //------------------------------------------------------------
00433     //subalbum description
00434     else if( node.isElement() && node.nodeName() == "description" )
00435     { 
00436       val = node.firstChild().toText();
00437       if(!val.isNull())
00438         description = val.nodeValue();
00439     }
00440     //------------------------------------------------------------
00441     //photo
00442     else if( node.isElement() && node.nodeName() == "photo" )
00443     { 
00444       //increase counter
00445       photoNum++;
00446       
00447       //create new photo object
00448       QString imageName = QString(dirName + "img/%1/%2.jpg").arg(subalbumNum).arg(photoNum);
00449       QString slideshowName = QString(dirName + "img/%1/%2_slideshow.jpg").arg(subalbumNum).arg(photoNum);
00450       QString thumbName = QString(dirName + "img/%1/%2_thumb.jpg").arg(subalbumNum).arg(photoNum);
00451       Photo* newPhoto = new Photo(this, photoNum);
00452 
00453       //load photo information from disk
00454       QDateTime* modificationTimes = newPhoto->importFromDisk( &node );      
00455 
00456       //first check to see if modifications times have changed
00457       bool lazyLoad = true; //assume no modifications     
00458       QFileInfo info[3];
00459       info[0].setFile( imageName );
00460       info[1].setFile( slideshowName );
00461       info[2].setFile( thumbName );
00462       if(modificationTimes[0] != info[0].lastModified() ||
00463          modificationTimes[1] != info[1].lastModified() ||
00464          modificationTimes[2] != info[2].lastModified())
00465          lazyLoad = false;
00466 
00467       //if no changes have occured do lazy load - don't 
00468       //bother scaling down thumbnail and slideshow images
00469       //from original image
00470       std::ifstream imageFile( imageName );      
00471       std::ifstream slideshowFile( slideshowName );      
00472       std::ifstream thumbnailFile( thumbName );
00473       
00474       if( lazyLoad ||
00475           (
00476             imageFile.is_open() &&
00477             thumbnailFile.is_open() &&
00478             slideshowFile.is_open() &&
00479             getMD5(imageFile) == newPhoto->getImageChecksum() &&
00480             getMD5(slideshowFile) == newPhoto->getSlideshowChecksum() &&
00481             getMD5(thumbnailFile) == newPhoto->getThumbnailChecksum()
00482           )
00483         )
00484       {
00485         //close ifstreams
00486         imageFile.close();
00487         slideshowFile.close();
00488         thumbnailFile.close();
00489         
00490         //populate image
00491         lazyAddPhoto(imageName, slideshowName, thumbName, newPhoto);
00492       }
00493       //else reload image and scale it since changes have occured.
00494       else
00495       {
00496         //close ifstreams if open
00497         if(imageFile.is_open())
00498           imageFile.close();
00499         if(thumbnailFile.is_open())
00500           thumbnailFile.close();
00501           
00502         //populate image
00503         addPhoto(imageName, false, newPhoto);
00504       }
00505 
00506       if(imageFile.is_open())
00507         imageFile.close();
00508       if(slideshowFile.is_open())
00509         slideshowFile.close();
00510       if(thumbnailFile.is_open())
00511         thumbnailFile.close();
00512       
00513       //update progress bar
00514       status->incrementProgress();
00515       qApp->processEvents();
00516     }
00517     //------------------------------------------------------------
00518     //advance to next node   
00519     node = node.nextSibling();
00520     //------------------------------------------------------------
00521   }
00522   //------------------------------------------------------------
00523   //set loaded number
00524   resetNumLoadedPhotos();
00525   //------------------------------------------------------------  
00526 }

bool Subalbum::lazyAddPhoto QString  imageName,
QString  slideshowName,
QString  thumbnailName,
Photo newPhoto
 

Lazily adds a new photo to the subalbum without rescaling from scrath, returns TRUE if successful.

Definition at line 289 of file subalbum.cpp.

References albm, firstPhoto, lastPhoto, numPhotos, Photo::setImage(), Album::setModified(), and Photo::setNext().

Referenced by importFromDisk().

00293 {
00294   numPhotos++;
00295   
00296   //attempt to set image
00297   if(!newPhoto->setImage(imageName, slideshowName, thumbnailName))
00298   {
00299     delete newPhoto;
00300     return false;
00301   }
00302   
00303   //if this is the only photo, set first and last 
00304   //pointers to this photo.
00305   if(firstPhoto == NULL)
00306   {
00307     firstPhoto = newPhoto;
00308     lastPhoto = newPhoto;
00309   }
00310   //else append to end of list
00311   else
00312   {
00313     lastPhoto->setNext(newPhoto);
00314     lastPhoto = newPhoto;
00315   }
00316     
00317   //set modified
00318   albm->setModified();
00319   
00320   return true;
00321 }

void Subalbum::photoMoved Photo val  ) 
 

Removes a specified photo without deleting the object.

Definition at line 528 of file subalbum.cpp.

References albm, firstPhoto, Photo::getNext(), lastPhoto, numPhotos, Album::setModified(), and Photo::setNext().

Referenced by SubalbumPreviewWidget::dropped().

00529 {
00530   //decrease counter
00531   numPhotos--;
00532  
00533  //walk through list of photos and find specified photo
00534   Photo* current = firstPhoto;
00535   Photo* prev = NULL;
00536   while(current != NULL &&
00537         current != val)
00538   {
00539     prev = current;
00540     current = current->getNext();
00541   }
00542 
00543   if(current == val)
00544   {
00545     //update prev next pointer
00546     if(prev != NULL)
00547       prev->setNext(current->getNext());
00548     
00549     //update first and last pointers if necessary
00550     if(current == firstPhoto)
00551       firstPhoto = current->getNext();
00552     if(current == lastPhoto)
00553       lastPhoto = prev;
00554   }
00555     
00556   //set modified
00557   albm->setModified();
00558 }

void Subalbum::removePhoto Photo val  ) 
 

Removes a specified photo.

Definition at line 324 of file subalbum.cpp.

References albm, firstPhoto, Photo::getNext(), lastPhoto, numPhotos, Album::setModified(), and Photo::setNext().

Referenced by SubalbumWidget::removeImageAction().

00325 { 
00326   //walk through list of photos and find specified photo
00327   Photo* current = firstPhoto;
00328   Photo* prev = NULL;
00329   while(current != val && current->getNext() != NULL)
00330   {
00331     prev = current;
00332     current = current->getNext();
00333   }
00334 
00335   if(current == val)
00336   {
00337     //update prev next pointer
00338     if(prev != NULL)
00339       prev->setNext(current->getNext());
00340     
00341     //update first and last pointers if necessary
00342     if(current == firstPhoto)
00343       firstPhoto = current->getNext();
00344     if(current == lastPhoto)
00345       lastPhoto = prev;
00346 
00347     //free Photo
00348     delete current;
00349     current = NULL;
00350     numPhotos--;
00351   }
00352     
00353   //set modified
00354   albm->setModified();
00355 }

void Subalbum::resetNumLoadedPhotos  ) 
 

Definition at line 600 of file subalbum.cpp.

References loadedPhotos, and numPhotos.

Referenced by importFromDisk(), and Album::removeStagnantImages().

00601 {
00602   loadedPhotos = numPhotos;
00603 }

void Subalbum::setDescription QString  val  ) 
 

Sets the Subalbum description.

Definition at line 106 of file subalbum.cpp.

References albm, description, and Album::setModified().

Referenced by SubalbumWidget::updateDescription().

00107 {
00108   if(description != val)
00109   {
00110     description = val;
00111     albm->setModified();
00112   }
00113 }

void Subalbum::setModified  ) 
 

Definition at line 605 of file subalbum.cpp.

References albm, and Album::setModified().

Referenced by Photo::flipHorizontally(), Photo::flipVertically(), Photo::rotate270(), Photo::rotate90(), Photo::setDescription(), Photo::setImage(), and Photo::setNext().

00606 {
00607   albm->setModified();
00608 }

void Subalbum::setName QString  val  ) 
 

Sets the Subalbum Name.

Definition at line 90 of file subalbum.cpp.

References albm, name, and Album::setModified().

Referenced by SubalbumWidget::updateName().

00091 {
00092   if(name != val)
00093   {
00094     name = val;
00095     albm->setModified();
00096   }
00097 }

void Subalbum::setNext Subalbum val  ) 
 

Sets pointer of next subalbum.

Definition at line 362 of file subalbum.cpp.

References albm, nextSubalbum, and Album::setModified().

Referenced by Album::appendSubalbum(), Album::removeSubalbum(), and Album::syncSubalbumList().

00363 {
00364   nextSubalbum = val;
00365     
00366   //set modified
00367   albm->setModified();
00368 }

void Subalbum::setRepresentativeImages QImage *  val  ) 
 

sets a sized representative iamge

Definition at line 135 of file subalbum.cpp.

References albm, largeRepresentativeImage, mediumRepresentativeImage, resizeImage(), Album::setModified(), and smallRepresentativeImage.

Referenced by importFromDisk(), and SubalbumWidget::setImageAction().

00136 {
00137   //---------------------------------------------------------    
00138   //delete old representative images
00139   delete smallRepresentativeImage;
00140   delete mediumRepresentativeImage;
00141   delete largeRepresentativeImage;
00142   //---------------------------------------------------------    
00143   //compute various representative image sizes
00144   int smallRepWidth = 0;
00145   int smallRepHeight = 0;
00146   int mediumRepWidth = 0;
00147   int mediumRepHeight = 0;  
00148   resizeImage( rawThumbnail->width(), rawThumbnail->height(),
00149                131, 98,
00150                mediumRepWidth, mediumRepHeight);
00151   resizeImage( rawThumbnail->width(), rawThumbnail->height(),
00152                107, 80,
00153                smallRepWidth, smallRepHeight);
00154   //---------------------------------------------------------    
00155   //create various representative images
00156   //---------------------------------------------------------    
00157   //copy and scale small version
00158   QImage thumbnailSmall = rawThumbnail->smoothScale( smallRepWidth, smallRepHeight );
00159   smallRepresentativeImage = new QPixmap( smallRepWidth, smallRepHeight );
00160   smallRepresentativeImage->convertFromImage( thumbnailSmall );  
00161   
00162   //copy and scale medium version
00163   QImage thumbnailMedium = rawThumbnail->smoothScale( mediumRepWidth, mediumRepHeight );
00164   QImage* centeredThumbnailMedium = new QImage(131, 98, thumbnailMedium.depth());
00165   centeredThumbnailMedium->setAlphaBuffer(true);
00166  
00167   int xDiff = 131 - mediumRepWidth;
00168   int yDiff = 98  - mediumRepHeight;
00169   
00170   //set all pixels to white
00171   int x, y;
00172   for(x=0; x< 131; x++)
00173   {
00174     for(y=0; y<98; y++)
00175     {
00176       centeredThumbnailMedium->setPixel(x, y, QColor(255, 255, 255).rgb()); 
00177     }
00178   }
00179   
00180   int x2 = 0;
00181   for(x= xDiff/2; x < (xDiff/2) + mediumRepWidth; x++)
00182   {
00183     int y2 = 0;
00184     for(y= yDiff/2; y < (yDiff/2) + mediumRepHeight; y++)
00185     {
00186       centeredThumbnailMedium->setPixel(x, y, thumbnailMedium.pixel(x2, y2));
00187       y2++;
00188     }
00189     x2++;
00190   }
00191   
00192   mediumRepresentativeImage = new QPixmap( centeredThumbnailMedium->width(), centeredThumbnailMedium->height() );
00193   mediumRepresentativeImage->convertFromImage( *centeredThumbnailMedium );
00194   delete centeredThumbnailMedium;
00195   //copy large version 
00196   largeRepresentativeImage = new QPixmap(*rawThumbnail);
00197   //---------------------------------------------------------    
00198     
00199   //set modified
00200   albm->setModified();
00201 }

void Subalbum::syncPhotoList PhotoWidget item  ) 
 

Syncs photo ordering with front end gui ordering.

Definition at line 560 of file subalbum.cpp.

References firstPhoto, PhotoWidget::getPhoto(), lastPhoto, and Photo::setNext().

Referenced by SubalbumWidget::reorder().

00561 {
00562   //base case, no items
00563   if(item == NULL)
00564   {
00565     firstPhoto = NULL;
00566     lastPhoto = NULL;
00567     return;
00568   }
00569   
00570   //set first and last pointers
00571   firstPhoto = item->getPhoto();
00572   firstPhoto->setNext(NULL);
00573   lastPhoto = firstPhoto;
00574     
00575   //set all next pointers
00576   while(item->nextItem() != NULL)
00577   {
00578     item->getPhoto()->setNext( ((PhotoWidget*)item->nextItem())->getPhoto() );
00579     item = (PhotoWidget*)item->nextItem();
00580     lastPhoto = item->getPhoto();
00581     lastPhoto->setNext(NULL);
00582   }
00583 }


Member Data Documentation

Album* Subalbum::albm [private]
 

Pointer to album subalbum is in.

Definition at line 167 of file subalbum.h.

Referenced by addPhoto(), lazyAddPhoto(), photoMoved(), removePhoto(), setDescription(), setModified(), setName(), setNext(), and setRepresentativeImages().

QString Subalbum::description [private]
 

Longer description of subalbum.

Definition at line 150 of file subalbum.h.

Referenced by exportToXML(), getDescription(), importFromDisk(), setDescription(), and Subalbum().

Photo* Subalbum::firstPhoto [private]
 

Pointer to first photo.

Definition at line 158 of file subalbum.h.

Referenced by addPhoto(), exportToXML(), getFirst(), lazyAddPhoto(), photoMoved(), removePhoto(), Subalbum(), syncPhotoList(), and ~Subalbum().

QPixmap* Subalbum::largeRepresentativeImage [private]
 

Definition at line 155 of file subalbum.h.

Referenced by getRepresentativeImage(), setRepresentativeImages(), Subalbum(), and ~Subalbum().

Photo* Subalbum::lastPhoto [private]
 

Pointer to last photo.

Definition at line 161 of file subalbum.h.

Referenced by addPhoto(), getLast(), lazyAddPhoto(), photoMoved(), removePhoto(), Subalbum(), and syncPhotoList().

int Subalbum::loadedPhotos [private]
 

Number of photos in subalbum when last loaded.

Definition at line 144 of file subalbum.h.

Referenced by getNumLoadedPhotos(), resetNumLoadedPhotos(), and Subalbum().

QPixmap* Subalbum::mediumRepresentativeImage [private]
 

Definition at line 154 of file subalbum.h.

Referenced by getRepresentativeImage(), setRepresentativeImages(), Subalbum(), and ~Subalbum().

QString Subalbum::name [private]
 

Short Name for subalbum.

Definition at line 147 of file subalbum.h.

Referenced by exportToXML(), getName(), importFromDisk(), setName(), and Subalbum().

Subalbum* Subalbum::nextSubalbum [private]
 

Pointer to next subalbum.

Definition at line 164 of file subalbum.h.

Referenced by getNext(), setNext(), and Subalbum().

int Subalbum::number [private]
 

Subalbum Number.

Definition at line 138 of file subalbum.h.

Referenced by addPhoto(), exportToXML(), and getSubalbumNumber().

int Subalbum::numPhotos [private]
 

Number of photos in subalbum.

Definition at line 141 of file subalbum.h.

Referenced by addPhoto(), getNumPhotos(), lazyAddPhoto(), photoMoved(), removePhoto(), resetNumLoadedPhotos(), and Subalbum().

QPixmap* Subalbum::smallRepresentativeImage [private]
 

Definition at line 153 of file subalbum.h.

Referenced by getRepresentativeImage(), setRepresentativeImages(), Subalbum(), and ~Subalbum().


The documentation for this class was generated from the following files:
Generated on Thu Nov 13 00:11:16 2003 for AlbumShaper by doxygen 1.3.4