#include <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 | setRepresentativeImage (QString imageFilename) |
sets a sized representative image | |
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. | |
Subalbum * | getPrev () |
Returns pointer to prev subalbum. | |
Subalbum * | getNext () |
Returns pointer to next subalbum. | |
void | setPrev (Subalbum *val) |
Sets pointer of prev subalbum. | |
void | setNext (Subalbum *val) |
Sets pointer of next subalbum. | |
Photo * | getFirst () |
Returns first photo in subalbum. | |
Photo * | getLast () |
Returns last photo in subalbum. | |
void | exportToXML (StatusWidget *status, QTextStream &stream) |
Exports subalbum to xml. | |
void | importFromDisk (QDomNode *root, int subalbumNum, StatusWidget *status, QString dirName, bool disableCheckPhotoMods) |
Builds subalbum from XML DOM node. | |
void | syncPhotoList (PhotoPreviewWidget *item) |
Syncs photo ordering with front end gui ordering. | |
int | getSubalbumNumber () |
Returns subalbum number. | |
void | setSubalbumNumber (int newVal) |
Sets the subalbum number to newVal. | |
int | getNumPhotos () |
Returns the number of photos in the subalbum. | |
int | getNumLoadedPhotos () |
Returns the number of loaded photos in subalbum. | |
void | resetNumLoadedPhotos () |
void | setModified () |
Album * | getAlbum () |
returns the album pointer | |
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 |
Photo * | firstPhoto |
Pointer to first photo. | |
Photo * | lastPhoto |
Pointer to last photo. | |
Subalbum * | prevSubalbum |
Pointer to prev subalbum. | |
Subalbum * | nextSubalbum |
Pointer to next subalbum. | |
Album * | albm |
Pointer to album subalbum is in. |
Specific contents:
Definition at line 45 of file subalbum.h.
Subalbum::Subalbum | ( | Album * | albm, | |
int | number | |||
) |
Sets default information is the Subalbum number.
Definition at line 35 of file subalbum.cpp.
References SubalbumPreviewWidget::createSubalbumPixmap(), description, firstPhoto, IMAGE_PATH, largeRepresentativeImage, lastPhoto, loadedPhotos, mediumRepresentativeImage, name, nextSubalbum, numPhotos, prevSubalbum, and smallRepresentativeImage.
00036 { 00037 //set subalbum number 00038 this->number = number; 00039 00040 //by default no photos in subalbum 00041 numPhotos = 0; 00042 loadedPhotos = 0; 00043 00044 //set strings to default values 00045 name = qApp->translate("Subalbum", "Collection %1").arg(number); 00046 description =""; 00047 00048 //set default rep images 00049 smallRepresentativeImage = NULL; 00050 mediumRepresentativeImage = SubalbumPreviewWidget::createSubalbumPixmap 00051 ( QString(IMAGE_PATH)+"miscImages/subalbum.png" ); 00052 largeRepresentativeImage = NULL; 00053 00054 //no photos by default 00055 firstPhoto = NULL; 00056 lastPhoto = NULL; 00057 00058 //next and prev pointers null by default 00059 prevSubalbum = NULL; 00060 nextSubalbum = NULL; 00061 00062 //set album pointer 00063 this->albm = albm; 00064 }
Subalbum::~Subalbum | ( | ) |
Frees photos.
Definition at line 66 of file subalbum.cpp.
References firstPhoto, Photo::getNext(), largeRepresentativeImage, mediumRepresentativeImage, and smallRepresentativeImage.
00067 { 00068 //delete representative images 00069 delete smallRepresentativeImage; 00070 delete mediumRepresentativeImage; 00071 delete largeRepresentativeImage; 00072 00073 //delete all photos 00074 Photo* current = firstPhoto; 00075 while(current != NULL) 00076 { 00077 Photo* temp = current->getNext(); 00078 delete current; 00079 current = temp; 00080 } 00081 }
void Subalbum::addPhoto | ( | Photo * | newPhoto | ) |
Adds a preexisting photo object to the Subalbum, appending it to the end.
Definition at line 173 of file subalbum.cpp.
References albm, firstPhoto, lastPhoto, numPhotos, Album::setModified(), Photo::setNext(), and Photo::setPrev().
00174 { 00175 //set the photos next and prev points to NULL by default 00176 newPhoto->setNext(NULL); 00177 newPhoto->setPrev(NULL); 00178 00179 //if list empty set to head 00180 if(firstPhoto == NULL) 00181 { 00182 firstPhoto = newPhoto; 00183 lastPhoto = newPhoto; 00184 } 00185 //else append to end of list 00186 else 00187 { 00188 lastPhoto->setNext(newPhoto); 00189 newPhoto->setPrev( lastPhoto ); 00190 lastPhoto = newPhoto; 00191 } 00192 00193 numPhotos++; 00194 albm->setModified(); 00195 }
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 197 of file subalbum.cpp.
References albm, firstPhoto, getLast(), Album::getNextUniquePhotoID(), lastPhoto, numPhotos, Photo::setDescription(), Photo::setImage(), Album::setModified(), Photo::setNext(), and Photo::setPrev().
Referenced by SubalbumWidget::addImageAction(), SubalbumPreviewWidget::dropped(), and importFromDisk().
00198 { 00199 //create new photo if necessary 00200 if(newPhoto == NULL) 00201 newPhoto = new Photo(this, getLast(), numPhotos); 00202 00203 //replace description with filename if instructed 00204 //(aka /home/bob/happy.jpg -> happy) 00205 if(replaceDescription) 00206 { 00207 //get filename 00208 QString desc(fileName); 00209 00210 //remove path 00211 desc = desc.section( QRegExp("/"), -1); 00212 00213 //remove extension if it exists 00214 int extensionIndex = desc.findRev( '.' ); 00215 if(extensionIndex > 0 ) 00216 desc.truncate(extensionIndex); 00217 00218 //convert _'s to spaces 00219 desc = desc.replace('_', ' '); 00220 00221 //set photos description 00222 newPhoto->setDescription( desc ); 00223 } 00224 00225 //attempt to set image 00226 if(!newPhoto->setImage(fileName, albm->getNextUniquePhotoID() )) 00227 { 00228 delete newPhoto; 00229 return false; 00230 } 00231 00232 //if this is the first photo set as the head 00233 if(firstPhoto == NULL) 00234 { 00235 firstPhoto = newPhoto; 00236 lastPhoto = newPhoto; 00237 } 00238 //else append to end of list 00239 else 00240 { 00241 lastPhoto->setNext(newPhoto); 00242 newPhoto->setPrev( lastPhoto ); 00243 lastPhoto = newPhoto; 00244 } 00245 00246 numPhotos++; 00247 albm->setModified(); 00248 return true; 00249 }
void Subalbum::exportToXML | ( | StatusWidget * | status, | |
QTextStream & | stream | |||
) |
Exports subalbum to xml.
Definition at line 312 of file subalbum.cpp.
References description, Photo::exportToXML(), firstPhoto, fixXMLString(), Photo::getNext(), getRepresentativeImage(), LARGE, name, and number.
Referenced by Album::exportToXML().
00313 { 00314 //write subalbum information 00315 stream << " <subalbum>\n"; 00316 00317 //if subalbum has a represenatative image save it's path 00318 if(getRepresentativeImage(LARGE) != NULL ) 00319 { 00320 stream << " <thumb path=\"img/" << number << "_thumb.jpg\"/>\n"; 00321 stream << " <name>" << fixXMLString(name) << "</name>\n"; 00322 } 00323 //else if the name is empty or just whitespace override it with "Subalbum #" so 00324 //it is not invisible on the coverpage 00325 else 00326 { 00327 QString strippedName = fixXMLString(name); 00328 if(strippedName.stripWhiteSpace() == "") 00329 stream << QString(" <name>%1 %2</name>\n").arg(qApp->translate("Subalbum", "Collection")).arg(number); 00330 else 00331 stream << " <name>" << fixXMLString(name) << "</name>\n"; 00332 } 00333 00334 stream << " <description>" << fixXMLString(description) << "</description>\n"; 00335 00336 //write photos 00337 Photo* current = firstPhoto; 00338 while(current != NULL) 00339 { 00340 current->exportToXML(stream); 00341 current = current->getNext(); 00342 } 00343 00344 //close subalbum 00345 stream << " </subalbum>\n"; 00346 00347 }
Album * Subalbum::getAlbum | ( | ) |
returns the album pointer
Definition at line 94 of file subalbum.cpp.
References albm.
Referenced by Photo::applyTransformation(), Photo::originalImageFilename(), and Photo::setImage().
00094 { return albm; }
QString Subalbum::getDescription | ( | ) |
Gets the Subalbum description.
Definition at line 84 of file subalbum.cpp.
References description.
Referenced by TitleWidget::refreshCollectionAnnotations().
00084 { return QString(description); }
Photo * Subalbum::getFirst | ( | ) |
Returns first photo in subalbum.
Definition at line 99 of file subalbum.cpp.
References firstPhoto.
Referenced by SlideshowWidget::advanceCollection(), AlbumStatistics::AlbumStatistics(), SlideshowWidget::beginSlideshow(), Album::exportCompressedWebAlbum(), Album::exportLargeImages(), Album::exportSubalbumImages(), Album::getThumbnailFilenames(), SubalbumWidget::refreshPhotos(), Album::removeStagnantOrigFiles(), Album::reorderSubalbumImages(), SlideshowWidget::showCollectionPage(), EditingInterface::showFirstPhoto(), and SlideshowWidget::skipToFirstPhoto().
00099 { return firstPhoto; }
Photo * Subalbum::getLast | ( | ) |
Returns last photo in subalbum.
Definition at line 100 of file subalbum.cpp.
References lastPhoto.
Referenced by SubalbumWidget::addImageAction(), addPhoto(), SlideshowWidget::backupCollection(), importFromDisk(), EditingInterface::showLastPhoto(), and SlideshowWidget::skipToLastPhoto().
00100 { return lastPhoto; }
QString Subalbum::getName | ( | ) |
Gets the Subalbum Name.
Definition at line 83 of file subalbum.cpp.
References name.
Referenced by TitleWidget::refreshCollectionAnnotations(), and TitleWidget::storeAnnotations().
00083 { return QString(name); }
Subalbum * Subalbum::getNext | ( | ) |
Returns pointer to next subalbum.
Definition at line 97 of file subalbum.cpp.
References nextSubalbum.
Referenced by SlideshowWidget::advanceCollection(), AlbumStatistics::AlbumStatistics(), SlideshowWidget::beginSlideshow(), Album::exportCompressedWebAlbum(), Album::exportLargeImages(), Album::exportSubalbumImages(), Album::exportToDisk(), Album::exportTopLevelImages(), Album::exportToXML(), Album::getNumPhotos(), Album::getThumbnailFilenames(), SubalbumsWidget::refreshCollectionsList(), Album::removeStagnantImages(), Album::removeStagnantOrigFiles(), Album::removeSubalbum(), Album::reorderSubalbumImages(), Album::syncSubalbumList(), and Album::~Album().
00097 { return nextSubalbum; }
int Subalbum::getNumLoadedPhotos | ( | ) |
Returns the number of loaded photos in subalbum.
Definition at line 104 of file subalbum.cpp.
References loadedPhotos.
00104 { return loadedPhotos; }
int Subalbum::getNumPhotos | ( | ) |
Returns the number of photos in the subalbum.
Definition at line 103 of file subalbum.cpp.
References numPhotos.
Referenced by SlideshowWidget::backupCollection(), Album::exportLargeImages(), Album::exportToDisk(), Album::getNumPhotos(), SlideshowWidget::paintOverlaidControls(), Album::removeStagnantImages(), and SlideshowWidget::skipToLastPhoto().
00103 { return numPhotos; }
Subalbum * Subalbum::getPrev | ( | ) |
Returns pointer to prev subalbum.
Definition at line 96 of file subalbum.cpp.
References prevSubalbum.
Referenced by SlideshowWidget::backupCollection(), and Album::removeSubalbum().
00096 { return prevSubalbum; }
QPixmap * Subalbum::getRepresentativeImage | ( | int | size | ) |
gets a sized representative image
Definition at line 86 of file subalbum.cpp.
References LARGE, largeRepresentativeImage, MEDIUM, mediumRepresentativeImage, SMALL, and smallRepresentativeImage.
Referenced by Album::exportCompressedWebAlbum(), Album::exportTopLevelImages(), exportToXML(), TitleWidget::refreshCollectionAnnotations(), TitleWidget::setSubalbumImage(), and TitleWidget::unsetSubalbumImage().
00087 { 00088 if(size == SMALL) return smallRepresentativeImage; 00089 if(size == MEDIUM) return mediumRepresentativeImage; 00090 if(size == LARGE) return largeRepresentativeImage; 00091 else return NULL; 00092 }
int Subalbum::getSubalbumNumber | ( | ) |
Returns subalbum number.
Definition at line 102 of file subalbum.cpp.
References number.
Referenced by Photo::Photo().
00102 { return number; }
void Subalbum::importFromDisk | ( | QDomNode * | root, | |
int | subalbumNum, | |||
StatusWidget * | status, | |||
QString | dirName, | |||
bool | disableCheckPhotoMods | |||
) |
Builds subalbum from XML DOM node.
Definition at line 349 of file subalbum.cpp.
References addPhoto(), description, Photo::getImageChecksum(), getLast(), getMD5(), Photo::getSlideshowChecksum(), Photo::getThumbnailChecksum(), Photo::importFromDisk(), StatusWidget::incrementProgress(), lazyAddPhoto(), name, resetNumLoadedPhotos(), and setRepresentativeImage().
Referenced by Album::importFromDisk().
00354 { 00355 //if representative image exists load 00356 QString repName = QString(dirName + "/img/%1_thumb.jpg").arg(subalbumNum); 00357 QImage repImage(repName); 00358 if(!repImage.isNull()) 00359 { 00360 setRepresentativeImage(repName); 00361 } 00362 00363 QDomNode node = root->firstChild(); 00364 QDomText val; 00365 int photoNum = 0; 00366 while( !node.isNull() ) 00367 { 00368 //------------------------------------------------------------ 00369 //subalbum name 00370 if( node.isElement() && node.nodeName() == "name" ) 00371 { 00372 val = node.firstChild().toText(); 00373 if(!val.isNull()) 00374 name = val.nodeValue(); 00375 name.replace("\\"","\""); 00376 } 00377 //------------------------------------------------------------ 00378 //subalbum description 00379 else if( node.isElement() && node.nodeName() == "description" ) 00380 { 00381 val = node.firstChild().toText(); 00382 if(!val.isNull()) 00383 description = val.nodeValue(); 00384 description.replace("\\"","\""); 00385 } 00386 //------------------------------------------------------------ 00387 //photo 00388 else if( node.isElement() && node.nodeName() == "photo" ) 00389 { 00390 //increase counter 00391 photoNum++; 00392 00393 //create new photo object 00394 QString imageName = QString(dirName + "img/%1/%2.jpg").arg(subalbumNum).arg(photoNum); 00395 QString slideshowName = QString(dirName + "img/%1/%2_slideshow.jpg").arg(subalbumNum).arg(photoNum); 00396 QString thumbName = QString(dirName + "img/%1/%2_thumb.jpg").arg(subalbumNum).arg(photoNum); 00397 Photo* newPhoto = new Photo(this, getLast(), photoNum); 00398 00399 //load photo information from disk 00400 QDateTime* modificationTimes = newPhoto->importFromDisk( &node ); 00401 00402 //first check to see if modifications times have changed 00403 bool lazyLoad = true; //assume no modifications 00404 00405 //skip checking for mods if disable checking is set 00406 if(!disableCheckPhotoMods) 00407 { 00408 QFileInfo info[3]; 00409 info[0].setFile( imageName ); 00410 info[1].setFile( slideshowName ); 00411 info[2].setFile( thumbName ); 00412 if( 00413 modificationTimes[0] != info[0].lastModified() || 00414 modificationTimes[1] != info[1].lastModified() || 00415 modificationTimes[2] != info[2].lastModified() 00416 ) 00417 lazyLoad = false; 00418 } 00419 00420 //if no changes have occured do lazy load - don't 00421 //bother scaling down thumbnail and slideshow images 00422 //from original image 00423 std::ifstream imageFile ( QFile::encodeName(imageName) ); 00424 std::ifstream slideshowFile( QFile::encodeName(slideshowName) ); 00425 std::ifstream thumbnailFile( QFile::encodeName(thumbName) ); 00426 00427 if( imageFile.is_open() && 00428 thumbnailFile.is_open() && 00429 slideshowFile.is_open() && 00430 ( 00431 lazyLoad || 00432 ( 00433 getMD5(imageFile) == newPhoto->getImageChecksum() && 00434 getMD5(slideshowFile) == newPhoto->getSlideshowChecksum() && 00435 getMD5(thumbnailFile) == newPhoto->getThumbnailChecksum() 00436 ) 00437 ) 00438 ) 00439 { 00440 //close ifstreams 00441 imageFile.close(); 00442 slideshowFile.close(); 00443 thumbnailFile.close(); 00444 00445 //populate image 00446 lazyAddPhoto(imageName, slideshowName, thumbName, newPhoto); 00447 } 00448 //else reload image and scale it since changes have occured. 00449 else 00450 { 00451 //close ifstreams if open 00452 if(imageFile.is_open()) 00453 imageFile.close(); 00454 if(thumbnailFile.is_open()) 00455 thumbnailFile.close(); 00456 00457 //populate image 00458 addPhoto(imageName, false, newPhoto); 00459 } 00460 00461 if(imageFile.is_open()) 00462 imageFile.close(); 00463 if(slideshowFile.is_open()) 00464 slideshowFile.close(); 00465 if(thumbnailFile.is_open()) 00466 thumbnailFile.close(); 00467 00468 //update progress bar 00469 status->incrementProgress(); 00470 qApp->processEvents(); 00471 } 00472 //------------------------------------------------------------ 00473 //advance to next node 00474 node = node.nextSibling(); 00475 //------------------------------------------------------------ 00476 } 00477 //------------------------------------------------------------ 00478 //set loaded number 00479 resetNumLoadedPhotos(); 00480 //------------------------------------------------------------ 00481 }
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 251 of file subalbum.cpp.
References albm, firstPhoto, lastPhoto, numPhotos, Photo::setImage(), Album::setModified(), Photo::setNext(), and Photo::setPrev().
Referenced by importFromDisk().
00253 { 00254 //attempt to set image 00255 if(!newPhoto->setImage(imageName, slideshowName, thumbnailName)) 00256 { 00257 delete newPhoto; 00258 return false; 00259 } 00260 00261 //if this is the first photo set as the head 00262 if(firstPhoto == NULL) 00263 { 00264 firstPhoto = newPhoto; 00265 lastPhoto = newPhoto; 00266 } 00267 //else append to end of list 00268 else 00269 { 00270 lastPhoto->setNext(newPhoto); 00271 newPhoto->setPrev( lastPhoto ); 00272 lastPhoto = newPhoto; 00273 } 00274 00275 numPhotos++; 00276 albm->setModified(); 00277 return true; 00278 }
void Subalbum::photoMoved | ( | Photo * | val | ) |
Removes a specified photo without deleting the object.
Definition at line 483 of file subalbum.cpp.
References albm, firstPhoto, Photo::getNext(), Photo::getPrev(), lastPhoto, numPhotos, Album::setModified(), Photo::setNext(), and Photo::setPrev().
Referenced by SubalbumPreviewWidget::dropped().
00484 { 00485 //if null pointer bail 00486 if(val == NULL) return; 00487 00488 //update first and last pointers if necessary 00489 if(val == firstPhoto) firstPhoto = val->getNext(); 00490 if(val == lastPhoto) lastPhoto = val->getPrev(); 00491 00492 //splice out 00493 if(val->getPrev() != NULL) val->getPrev()->setNext( val->getNext() ); 00494 if(val->getNext() != NULL) val->getNext()->setPrev( val->getPrev() ); 00495 00496 numPhotos--; 00497 albm->setModified(); 00498 }
void Subalbum::removePhoto | ( | Photo * | val | ) |
Removes a specified photo.
Definition at line 280 of file subalbum.cpp.
References albm, firstPhoto, Photo::getNext(), Photo::getPrev(), lastPhoto, numPhotos, Album::setModified(), Photo::setNext(), and Photo::setPrev().
Referenced by SubalbumWidget::removeImageAction().
00281 { 00282 //if photo pointer is null then bail 00283 if(val == NULL) return; 00284 00285 //reset head and tail pointers if necessary 00286 if( val == firstPhoto ) firstPhoto = val->getNext(); 00287 if( val == lastPhoto ) lastPhoto = val->getPrev(); 00288 00289 //splice out 00290 if( val->getPrev() != NULL ) val->getPrev()->setNext( val->getNext() ); 00291 if( val->getNext() != NULL ) val->getNext()->setPrev( val->getPrev() ); 00292 00293 //delete object 00294 delete val; 00295 val = NULL; 00296 numPhotos--; 00297 albm->setModified(); 00298 }
void Subalbum::resetNumLoadedPhotos | ( | ) |
Definition at line 170 of file subalbum.cpp.
References loadedPhotos, and numPhotos.
Referenced by importFromDisk(), and Album::removeStagnantImages().
00170 { loadedPhotos = numPhotos; }
void Subalbum::setDescription | ( | QString | val | ) |
Sets the Subalbum description.
Definition at line 115 of file subalbum.cpp.
References albm, description, and Album::setModified().
Referenced by TitleWidget::storeAnnotations().
00116 { 00117 if(description != val) 00118 { 00119 description = val; 00120 albm->setModified(); 00121 } 00122 }
void Subalbum::setModified | ( | ) |
Definition at line 171 of file subalbum.cpp.
References albm, and Album::setModified().
Referenced by Photo::constructSmallerImages(), Photo::setDescription(), Photo::setNext(), and Photo::setPrev().
00171 { albm->setModified(); }
void Subalbum::setName | ( | QString | val | ) |
Sets the Subalbum Name.
Definition at line 106 of file subalbum.cpp.
References albm, name, and Album::setModified().
Referenced by TitleWidget::storeAnnotations().
00107 { 00108 if(name != val) 00109 { 00110 name = val; 00111 albm->setModified(); 00112 } 00113 }
void Subalbum::setNext | ( | Subalbum * | val | ) |
Sets pointer of next subalbum.
Definition at line 306 of file subalbum.cpp.
References albm, nextSubalbum, and Album::setModified().
Referenced by Album::appendSubalbum(), Album::removeSubalbum(), and Album::syncSubalbumList().
00307 { 00308 nextSubalbum = val; 00309 albm->setModified(); 00310 }
void Subalbum::setPrev | ( | Subalbum * | val | ) |
Sets pointer of prev subalbum.
Definition at line 300 of file subalbum.cpp.
References albm, prevSubalbum, and Album::setModified().
Referenced by Album::appendSubalbum(), Album::removeSubalbum(), and Album::syncSubalbumList().
00301 { 00302 prevSubalbum = val; 00303 albm->setModified(); 00304 }
void Subalbum::setRepresentativeImage | ( | QString | imageFilename | ) |
sets a sized representative image
Definition at line 124 of file subalbum.cpp.
References albm, calcScaledImageDimensions(), SubalbumPreviewWidget::createSubalbumPixmap(), getImageSize(), IMAGE_PATH, largeRepresentativeImage, mediumRepresentativeImage, REP_IMAGE_HEIGHT, scaleImage(), Album::setModified(), and smallRepresentativeImage.
Referenced by importFromDisk(), TitleWidget::setSubalbumImage(), and TitleWidget::unsetSubalbumImage().
00125 { 00126 //delete old representative images 00127 delete smallRepresentativeImage; 00128 delete mediumRepresentativeImage; 00129 delete largeRepresentativeImage; 00130 00131 //if being set to null, set back to defaults 00132 if(imageFilename.isNull()) 00133 { 00134 smallRepresentativeImage = NULL; 00135 largeRepresentativeImage = NULL; 00136 00137 mediumRepresentativeImage = SubalbumPreviewWidget::createSubalbumPixmap 00138 ( QString(IMAGE_PATH)+"miscImages/subalbum.png" ); 00139 } 00140 //else create various sized cover images 00141 else 00142 { 00143 int imageWidth, imageHeight; 00144 getImageSize( imageFilename, imageWidth, imageHeight ); 00145 00146 //small version (show at top) 00147 int smallRepWidth = 0; 00148 int smallRepHeight = 0; 00149 calcScaledImageDimensions( imageWidth, imageHeight, 00150 107, REP_IMAGE_HEIGHT, 00151 smallRepWidth, smallRepHeight); 00152 QImage thumbnailSmall; 00153 scaleImage( imageFilename, thumbnailSmall, smallRepWidth, smallRepHeight ); 00154 smallRepresentativeImage = new QPixmap( thumbnailSmall.width(), thumbnailSmall.height() ); 00155 smallRepresentativeImage->convertFromImage( thumbnailSmall ); 00156 00157 //medium version (seen in collections listing) 00158 mediumRepresentativeImage = SubalbumPreviewWidget::createSubalbumPixmap( imageFilename ); 00159 00160 //large version, used for actually saving out 00161 largeRepresentativeImage = new QPixmap( imageFilename ); 00162 //--------------------------------------------------------- 00163 } 00164 00165 //set modified 00166 albm->setModified(); 00167 }
void Subalbum::setSubalbumNumber | ( | int | newVal | ) |
Sets the subalbum number to newVal.
Definition at line 169 of file subalbum.cpp.
References number.
Referenced by Album::exportToDisk().
00169 { number = newVal; }
void Subalbum::syncPhotoList | ( | PhotoPreviewWidget * | item | ) |
Syncs photo ordering with front end gui ordering.
Definition at line 500 of file subalbum.cpp.
References firstPhoto, Photo::getNext(), PhotoPreviewWidget::getPhoto(), lastPhoto, Photo::setNext(), and Photo::setPrev().
Referenced by SubalbumWidget::reorder().
00501 { 00502 //base case, no items 00503 if(item == NULL) 00504 { 00505 firstPhoto = NULL; 00506 lastPhoto = NULL; 00507 return; 00508 } 00509 00510 //set first and last pointers 00511 firstPhoto = item->getPhoto(); 00512 firstPhoto->setNext(NULL); 00513 firstPhoto->setPrev(NULL); 00514 lastPhoto = firstPhoto; 00515 00516 //set all next/prev pointers 00517 while(item->nextItem() != NULL) 00518 { 00519 item->getPhoto()->setNext( ((PhotoPreviewWidget*)item->nextItem())->getPhoto() ); 00520 item->getPhoto()->getNext()->setPrev( item->getPhoto() ); 00521 item = (PhotoPreviewWidget*)item->nextItem(); 00522 lastPhoto = item->getPhoto(); 00523 lastPhoto->setNext(NULL); 00524 } 00525 00526 }
Album* Subalbum::albm [private] |
Pointer to album subalbum is in.
Definition at line 177 of file subalbum.h.
Referenced by addPhoto(), getAlbum(), lazyAddPhoto(), photoMoved(), removePhoto(), setDescription(), setModified(), setName(), setNext(), setPrev(), and setRepresentativeImage().
QString Subalbum::description [private] |
Longer description of subalbum.
Definition at line 157 of file subalbum.h.
Referenced by exportToXML(), getDescription(), importFromDisk(), setDescription(), and Subalbum().
Photo* Subalbum::firstPhoto [private] |
Pointer to first photo.
Definition at line 165 of file subalbum.h.
Referenced by addPhoto(), exportToXML(), getFirst(), lazyAddPhoto(), photoMoved(), removePhoto(), Subalbum(), syncPhotoList(), and ~Subalbum().
QPixmap* Subalbum::largeRepresentativeImage [private] |
Definition at line 162 of file subalbum.h.
Referenced by getRepresentativeImage(), setRepresentativeImage(), Subalbum(), and ~Subalbum().
Photo* Subalbum::lastPhoto [private] |
Pointer to last photo.
Definition at line 168 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 151 of file subalbum.h.
Referenced by getNumLoadedPhotos(), resetNumLoadedPhotos(), and Subalbum().
QPixmap* Subalbum::mediumRepresentativeImage [private] |
Definition at line 161 of file subalbum.h.
Referenced by getRepresentativeImage(), setRepresentativeImage(), Subalbum(), and ~Subalbum().
QString Subalbum::name [private] |
Short Name for subalbum.
Definition at line 154 of file subalbum.h.
Referenced by exportToXML(), getName(), importFromDisk(), setName(), and Subalbum().
Subalbum* Subalbum::nextSubalbum [private] |
Pointer to next subalbum.
Definition at line 174 of file subalbum.h.
Referenced by getNext(), setNext(), and Subalbum().
int Subalbum::number [private] |
Subalbum Number.
Definition at line 145 of file subalbum.h.
Referenced by exportToXML(), getSubalbumNumber(), and setSubalbumNumber().
int Subalbum::numPhotos [private] |
Number of photos in subalbum.
Definition at line 148 of file subalbum.h.
Referenced by addPhoto(), getNumPhotos(), lazyAddPhoto(), photoMoved(), removePhoto(), resetNumLoadedPhotos(), and Subalbum().
Subalbum* Subalbum::prevSubalbum [private] |
Pointer to prev subalbum.
Definition at line 171 of file subalbum.h.
Referenced by getPrev(), setPrev(), and Subalbum().
QPixmap* Subalbum::smallRepresentativeImage [private] |
Definition at line 160 of file subalbum.h.
Referenced by getRepresentativeImage(), setRepresentativeImage(), Subalbum(), and ~Subalbum().