#include <photo.h>
Definition at line 40 of file photo.h.
Public Member Functions | |
Photo (Subalbum *subalbum, int number) | |
Sets default information. | |
~Photo () | |
Destructor. | |
void | setImageFilename (QString val) |
Sets the image filename. | |
void | setSlideshowFilename (QString val) |
Sets the slideshow filename. | |
QString | getImageFilename () |
Gets the image filename. | |
QString | getSlideshowFilename () |
Gets the slideshow filename. | |
bool | setImage (QString imageName) |
Sets image, returns TRUE if successful, this method used when loading and image from file for the first time (aka when photo added to subalbum). | |
bool | setImage (QString imageName, QString slideshowName, QString thumbnailName) |
Sets the image, uses loads thumbnail and slideshow from file (no scaling), returns TRUE if successful. | |
bool | setImage (QImage *fullImage) |
Sets the image. | |
void | setDescription (QString val) |
Sets the description. | |
QString | getDescription () |
Gets the description. | |
Photo * | getNext () |
Gets pointer to next photo. | |
void | setNext (Photo *val) |
Sets pointer to next photo. | |
QImage * | getImage (int size) |
Gets image. | |
void | importFromDisk (QDomNode *root) |
Builds subalbum from XML DOM node. | |
void | exportToXML (QTextStream &stream) |
Exports photo to xml. | |
void | exportThumbnailHTML (QTextStream &stream) |
Exports to thumbnail html format. | |
void | exportSlideshowHTML (QTextStream &stream) |
Exports to slideshow html format. | |
void | rotate90 () |
Rotates image clockwise by 90 degrees. | |
void | rotate270 () |
Rotates image clockwise by 270 degrees. | |
void | flipHorizontally () |
Flips image about horizontal axis. | |
void | flipVertically () |
Flips image about vertical axis. | |
void | setThumbnailChecksum (QString val) |
Update thumbnail checksum. | |
void | setSlideshowChecksum (QString val) |
Update slideshow checksum. | |
void | setImageChecksum (QString val) |
Update image checksum. | |
QString | getThumbnailChecksum () |
Get thumbanil checksum. | |
QString | getSlideshowChecksum () |
Get thumbanil checksum. | |
QString | getImageChecksum () |
Get image checksum. | |
void | deallocateLargeImages () |
Frees full image and slideshow versions to conserve memory. | |
void | setNeedsSavingVal (bool val) |
Sets if the image needs to be saved to its permanent location. | |
bool | getNeedsSavingVal () |
Returns if the image needs to be saved to its permament location. | |
int | getInitialPhotoNumber () |
Returns initial photo number. | |
int | getInitialSubalbumNumber () |
Returns intiial subalbum number. | |
void | setInitialPhotoNumber (int val) |
Sets initial photo number. | |
void | setInitialSubalbumNumber (int val) |
Sets initial subalbum number. | |
int | actualSlideshowWidth () |
Return actual slideshow image width (not including whitespace). | |
int | actualSlideshowHeight () |
Return actual slideshow image height (not including whitespace). | |
void | setActualSlideshowDimensions (int w, int h) |
Sets actual slideshow image size. | |
Private Attributes | |
Subalbum * | subalbum |
Subalbum photo is in. | |
int | initialNumber |
int | initialSubalbumNumber |
Photo * | next |
Pointer to next photo. | |
QString | description |
Longer description of subalbum. | |
QImage * | thumbnailImage |
Thumbnail used for saving to disk. | |
QImage * | paddedThumbnailImage |
A padded thumbnail used for subalbum layout. | |
QImage * | slideshowImage |
Slideshow iamge. | |
QImage * | fullImage |
Actual image. | |
QString | imageChecksum |
MD5 checksums, ued to determine if image/thumbnail have been changed. | |
QString | slideshowChecksum |
QString | thumbnailChecksum |
QString | imageLocation |
Image filename. | |
QString | slideshowLocation |
Slideshow filename. | |
bool | needsSaving |
Does the image need to be saved to the permanent location? | |
int | slideshowWidth |
Unpadded width of slideshow image. | |
int | slideshowHeight |
Unpadded height of slideshow image. |
|
Sets default information.
Definition at line 36 of file photo.cpp. References description, fullImage, imageChecksum, imageLocation, initialNumber, initialSubalbumNumber, needsSaving, next, paddedThumbnailImage, slideshowChecksum, slideshowHeight, slideshowImage, slideshowLocation, slideshowWidth, thumbnailChecksum, and thumbnailImage.
00037 { 00038 //set subalbum pointer 00039 this->subalbum = subalbum; 00040 00041 //set initial photo number and subalbum number 00042 initialNumber = number; 00043 initialSubalbumNumber = subalbum->getSubalbumNumber(); 00044 00045 //set strings to default values 00046 description =""; 00047 00048 //set next pointer to NULL 00049 next = NULL; 00050 00051 //set thumbnail image 00052 thumbnailImage = NULL; 00053 paddedThumbnailImage = NULL; 00054 slideshowImage = NULL; 00055 fullImage = NULL; 00056 00057 //set checksums to the empty string by default 00058 imageChecksum = ""; 00059 slideshowChecksum = ""; 00060 thumbnailChecksum = ""; 00061 00062 //image does not need to be saved by default 00063 needsSaving = false; 00064 00065 //filenames not set by default 00066 imageLocation = ""; 00067 slideshowLocation = ""; 00068 00069 //no dimension of slideshow image known yet 00070 slideshowWidth = -1; 00071 slideshowHeight = -1; 00072 } |
|
Destructor.
Definition at line 75 of file photo.cpp. References fullImage, paddedThumbnailImage, slideshowImage, and thumbnailImage.
00076 { 00077 if(paddedThumbnailImage != thumbnailImage) 00078 delete paddedThumbnailImage; 00079 delete thumbnailImage; 00080 delete slideshowImage; 00081 delete fullImage; 00082 } |
|
Return actual slideshow image height (not including whitespace).
Definition at line 664 of file photo.cpp. References slideshowHeight. Referenced by PhotoViewWidget::cropSelectedPoint(), PhotoEditWidget::cropToRegion(), PhotoViewWidget::getSelection(), PhotoEditWidget::invertSelection(), and PhotoViewWidget::selectAll().
00665 { 00666 return slideshowHeight; 00667 } |
|
Return actual slideshow image width (not including whitespace).
Definition at line 659 of file photo.cpp. References slideshowWidth. Referenced by PhotoViewWidget::cropSelectedPoint(), PhotoEditWidget::cropToRegion(), PhotoViewWidget::getSelection(), PhotoEditWidget::invertSelection(), and PhotoViewWidget::selectAll().
00660 { 00661 return slideshowWidth;; 00662 } |
|
Frees full image and slideshow versions to conserve memory.
Definition at line 600 of file photo.cpp. References fullImage, and slideshowImage. Referenced by Subalbum::addPhoto(), flipHorizontally(), flipVertically(), rotate270(), rotate90(), and setImage().
00601 { 00602 delete fullImage; 00603 fullImage = NULL; 00604 00605 delete slideshowImage; 00606 slideshowImage = NULL; 00607 } |
|
Exports to slideshow html format.
Definition at line 303 of file photo.cpp.
00304 { 00305 //write photo information 00306 stream << "?"; 00307 } |
|
Exports to thumbnail html format.
Definition at line 297 of file photo.cpp.
00298 { 00299 //write photo information 00300 stream << "?"; 00301 } |
|
Exports photo to xml.
Definition at line 286 of file photo.cpp. References description, fixXMLString(), imageChecksum, slideshowChecksum, and thumbnailChecksum. Referenced by Subalbum::exportToXML().
00287 { 00288 //write photo information 00289 stream << " <photo>\n"; 00290 stream << " <description>" << fixXMLString(description) << "</description>\n"; 00291 stream << " <imageMD5>" << fixXMLString(imageChecksum) << "</imageMD5>\n"; 00292 stream << " <slideMD5>" << fixXMLString(slideshowChecksum) << "</slideMD5>\n"; 00293 stream << " <thumbMD5>" << fixXMLString(thumbnailChecksum) << "</thumbMD5>\n"; 00294 stream << " </photo>\n"; 00295 } |
|
Flips image about horizontal axis.
Definition at line 467 of file photo.cpp. References createImages(), deallocateLargeImages(), fullImage, imageLocation, initialNumber, initialSubalbumNumber, needsSaving, paddedThumbnailImage, slideshowHeight, slideshowImage, slideshowLocation, slideshowWidth, and thumbnailImage.
00468 { 00469 //load up image 00470 //if not modified load from permanent location 00471 fullImage = new QImage(imageLocation); 00472 00473 //create new image 00474 QImage* rotatedImage = new QImage(fullImage->width(), 00475 fullImage->height(), 00476 fullImage->depth()); 00477 rotatedImage->setAlphaBuffer(true); 00478 //copy data 00479 int x,y; 00480 for(x=0; x < fullImage->width(); x++) 00481 { 00482 for(y=0; y < fullImage->height(); y++) 00483 { 00484 rotatedImage->setPixel(x, fullImage->height() - 1 - y, fullImage->pixel(x, y) ); 00485 } 00486 } 00487 00488 //delete old image and set new pointer 00489 delete fullImage; 00490 fullImage = rotatedImage; 00491 00492 //create thumbnail 00493 createImages(fullImage, 00494 &slideshowImage, 00495 &thumbnailImage, 00496 &paddedThumbnailImage, 00497 slideshowWidth, 00498 slideshowHeight); 00499 00500 //save out updated full and slideshow images to temp folder and deallocate memory 00501 imageLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2.jpg") 00502 .arg(initialSubalbumNumber) 00503 .arg(initialNumber); 00504 slideshowLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2_slideshow.jpg") 00505 .arg(initialSubalbumNumber) 00506 .arg(initialNumber); 00507 00508 fullImage->save( imageLocation, "JPEG", 100); 00509 slideshowImage->save( slideshowLocation, "JPEG", 100); 00510 00511 //mark image as having been modified and hence in the tmp folder 00512 needsSaving = true; 00513 00514 //deallocate qimage objects 00515 deallocateLargeImages(); 00516 } |
|
Flips image about vertical axis.
Definition at line 518 of file photo.cpp. References createImages(), deallocateLargeImages(), fullImage, imageLocation, initialNumber, initialSubalbumNumber, needsSaving, paddedThumbnailImage, slideshowHeight, slideshowImage, slideshowLocation, slideshowWidth, and thumbnailImage.
00519 { 00520 //load up image 00521 //if not modified load from permanent location 00522 fullImage = new QImage(imageLocation); 00523 00524 //create new image 00525 QImage* rotatedImage = new QImage(fullImage->width(), 00526 fullImage->height(), 00527 fullImage->depth()); 00528 rotatedImage->setAlphaBuffer(true); 00529 //copy data 00530 int x,y; 00531 for(x=0; x < fullImage->width(); x++) 00532 { 00533 for(y=0; y < fullImage->height(); y++) 00534 { 00535 rotatedImage->setPixel(fullImage->width() - 1 - x, y, fullImage->pixel(x, y) ); 00536 } 00537 } 00538 00539 //delete old image and set new pointer 00540 delete fullImage; 00541 fullImage = rotatedImage; 00542 00543 //create thumbnail 00544 createImages(fullImage, 00545 &slideshowImage, 00546 &thumbnailImage, 00547 &paddedThumbnailImage, 00548 slideshowWidth, 00549 slideshowHeight); 00550 00551 //save out updated full and slideshow images to temp folder and deallocate memory 00552 imageLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2.jpg") 00553 .arg(initialSubalbumNumber) 00554 .arg(initialNumber); 00555 slideshowLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2_slideshow.jpg") 00556 .arg(initialSubalbumNumber) 00557 .arg(initialNumber); 00558 00559 fullImage->save( imageLocation, "JPEG", 100); 00560 slideshowImage->save( slideshowLocation, "JPEG", 100); 00561 00562 00563 //mark image as having been modified and hence in the tmp folder 00564 needsSaving = true; 00565 00566 //deallocate qimage objects 00567 deallocateLargeImages(); 00568 } |
|
Gets the description.
Definition at line 221 of file photo.cpp. References description. Referenced by Subalbum::exportSlideshowHTML(), Subalbum::exportThumbnailHTML(), and PhotoWidget::updateDescription().
00222 {
00223 return QString(description);
00224 }
|
|
Gets image.
Definition at line 238 of file photo.cpp. References fullImage, IMAGE, imageLocation, initialNumber, initialSubalbumNumber, needsSaving, PADDED_THUMBNAIL, paddedThumbnailImage, SLIDESHOW, slideshowImage, slideshowLocation, THUMBNAIL, and thumbnailImage. Referenced by Subalbum::addPhoto(), Album::exportSubalbumImages(), TitleWidget::setImageAction(), SubalbumWidget::setImageAction(), and PhotoWidget::updateImage().
00239 { 00240 if(size == THUMBNAIL) 00241 return thumbnailImage; 00242 else if(size == PADDED_THUMBNAIL) 00243 return paddedThumbnailImage; 00244 else if(size == SLIDESHOW) 00245 { 00246 if( slideshowImage != NULL) 00247 return slideshowImage; 00248 else 00249 { 00250 if(!needsSaving) 00251 { 00252 return new QImage(slideshowLocation); 00253 } 00254 else 00255 { 00256 QString tmpImageLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2_slideshow.jpg") 00257 .arg(initialSubalbumNumber) 00258 .arg(initialNumber); 00259 return new QImage(tmpImageLocation); 00260 } 00261 } 00262 } 00263 else if(size == IMAGE) 00264 { 00265 if( fullImage != NULL) 00266 return fullImage; 00267 else 00268 { 00269 if(!needsSaving) 00270 { 00271 return new QImage(imageLocation); 00272 } 00273 else 00274 { 00275 QString tmpImageLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2.jpg") 00276 .arg(initialSubalbumNumber) 00277 .arg(initialNumber); 00278 return new QImage(tmpImageLocation); 00279 } 00280 } 00281 } 00282 else 00283 return NULL; 00284 } |
|
Get image checksum.
Definition at line 595 of file photo.cpp. References imageChecksum. Referenced by Subalbum::importFromDisk().
00596 { 00597 return imageChecksum; 00598 } |
|
Gets the image filename.
Definition at line 619 of file photo.cpp. References imageLocation. Referenced by PhotoEditWidget::adjustExposure(), PhotoEditWidget::cropToRegion(), Album::exportSubalbumImages(), and PhotoEditWidget::invertSelection().
00620 { 00621 return imageLocation; 00622 } |
|
Returns initial photo number.
Definition at line 639 of file photo.cpp. References initialNumber. Referenced by Album::exportSubalbumImages(), and Album::reorderSubalbumImages().
00640 { 00641 return initialNumber; 00642 } |
|
Returns intiial subalbum number.
Definition at line 644 of file photo.cpp. References initialSubalbumNumber. Referenced by Album::exportSubalbumImages(), and Album::reorderSubalbumImages().
00645 { 00646 return initialSubalbumNumber; 00647 } |
|
Returns if the image needs to be saved to its permament location.
Definition at line 634 of file photo.cpp. References needsSaving. Referenced by Album::exportSubalbumImages().
00635 { 00636 return needsSaving; 00637 } |
|
Gets pointer to next photo.
Definition at line 227 of file photo.cpp. References next. Referenced by Subalbum::exportSlideshowHTML(), Album::exportSubalbumImages(), Subalbum::exportThumbnailHTML(), Subalbum::exportToXML(), Subalbum::photoMoved(), SubalbumWidget::refreshPhotos(), Subalbum::removePhoto(), Album::reorderSubalbumImages(), and Subalbum::~Subalbum().
00228 { 00229 return next; 00230 } |
|
Get thumbanil checksum.
Definition at line 590 of file photo.cpp. References slideshowChecksum. Referenced by Subalbum::importFromDisk().
00591 { 00592 return slideshowChecksum; 00593 } |
|
Gets the slideshow filename.
Definition at line 624 of file photo.cpp. References slideshowLocation. Referenced by Album::exportSubalbumImages(), and PhotoViewWidget::setPhoto().
00625 { 00626 return slideshowLocation; 00627 } |
|
Get thumbanil checksum.
Definition at line 585 of file photo.cpp. References thumbnailChecksum. Referenced by Subalbum::importFromDisk().
00586 { 00587 return thumbnailChecksum; 00588 } |
|
Builds subalbum from XML DOM node.
Definition at line 309 of file photo.cpp. References description, imageChecksum, slideshowChecksum, and thumbnailChecksum. Referenced by Subalbum::importFromDisk().
00310 { 00311 QDomNode node = root->firstChild(); 00312 QDomText val; 00313 while( !node.isNull() ) 00314 { 00315 //------------------------------------------------------------ 00316 //photo description 00317 if( node.isElement() && node.nodeName() == "description" ) 00318 { 00319 val = node.firstChild().toText(); 00320 if(!val.isNull()) 00321 description = val.nodeValue(); 00322 } 00323 //------------------------------------------------------------ 00324 //image md5 00325 if( node.isElement() && node.nodeName() == "imageMD5" ) 00326 { 00327 val = node.firstChild().toText(); 00328 if(!val.isNull()) 00329 imageChecksum = val.nodeValue(); 00330 } 00331 //------------------------------------------------------------ 00332 //slideshow md5 00333 if( node.isElement() && node.nodeName() == "slideMD5" ) 00334 { 00335 val = node.firstChild().toText(); 00336 if(!val.isNull()) 00337 slideshowChecksum = val.nodeValue(); 00338 } 00339 //------------------------------------------------------------ 00340 //thumbnail md5 00341 if( node.isElement() && node.nodeName() == "thumbMD5" ) 00342 { 00343 val = node.firstChild().toText(); 00344 if(!val.isNull()) 00345 thumbnailChecksum = val.nodeValue(); 00346 } 00347 //------------------------------------------------------------ 00348 //advance to next node 00349 node = node.nextSibling(); 00350 //------------------------------------------------------------ 00351 } 00352 } |
|
Rotates image clockwise by 270 degrees.
Definition at line 410 of file photo.cpp. References createImages(), deallocateLargeImages(), fullImage, imageLocation, initialNumber, initialSubalbumNumber, needsSaving, paddedThumbnailImage, slideshowHeight, slideshowImage, slideshowLocation, slideshowWidth, and thumbnailImage.
00411 { 00412 //load up image 00413 //if not modified load from permanent location 00414 fullImage = new QImage(imageLocation); 00415 00416 //create new image 00417 QImage* rotatedImage = new QImage(fullImage->height(), 00418 fullImage->width(), 00419 fullImage->depth()); 00420 rotatedImage->setAlphaBuffer(true); 00421 //copy data 00422 int x,y; 00423 for(x=0; x < fullImage->height(); x++) 00424 { 00425 for(y=0; y < fullImage->width(); y++) 00426 { 00427 rotatedImage->setPixel(x, fullImage->width() - 1 - y, fullImage->pixel(y, x) ); 00428 } 00429 } 00430 00431 //delete old image and set new pointer 00432 delete fullImage; 00433 fullImage = rotatedImage; 00434 00435 //create thumbnail 00436 createImages(fullImage, 00437 &slideshowImage, 00438 &thumbnailImage, 00439 &paddedThumbnailImage, 00440 slideshowWidth, 00441 slideshowHeight); 00442 00443 //save out updated full and slideshow images to temp folder and deallocate memory 00444 imageLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2.jpg") 00445 .arg(initialSubalbumNumber) 00446 .arg(initialNumber); 00447 slideshowLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2_slideshow.jpg") 00448 .arg(initialSubalbumNumber) 00449 .arg(initialNumber); 00450 00451 fullImage->save( imageLocation, "JPEG", 100); 00452 slideshowImage->save( slideshowLocation, "JPEG", 100); 00453 00454 00455 //mark image as having been modified and hence in the tmp folder 00456 needsSaving = true; 00457 00458 //deallocate qimage objects 00459 deallocateLargeImages(); 00460 00461 //update slideshow width/height 00462 int temp = slideshowWidth; 00463 slideshowWidth = slideshowHeight; 00464 slideshowHeight = temp; 00465 } |
|
Rotates image clockwise by 90 degrees.
Definition at line 354 of file photo.cpp. References createImages(), deallocateLargeImages(), fullImage, imageLocation, initialNumber, initialSubalbumNumber, needsSaving, paddedThumbnailImage, slideshowHeight, slideshowImage, slideshowLocation, slideshowWidth, and thumbnailImage.
00355 { 00356 //load up image 00357 //if not modified load from permanent location 00358 fullImage = new QImage(imageLocation); 00359 00360 //create new image 00361 QImage* rotatedImage = new QImage(fullImage->height(), 00362 fullImage->width(), 00363 fullImage->depth()); 00364 rotatedImage->setAlphaBuffer(true); 00365 //copy data 00366 int x,y; 00367 for(x=0; x < fullImage->height(); x++) 00368 { 00369 for(y=0; y < fullImage->width(); y++) 00370 { 00371 rotatedImage->setPixel(fullImage->height() - 1 - x, y, fullImage->pixel(y, x) ); 00372 } 00373 } 00374 00375 //delete old image and set new pointer 00376 delete fullImage; 00377 fullImage = rotatedImage; 00378 00379 //create thumbnail 00380 createImages(fullImage, 00381 &slideshowImage, 00382 &thumbnailImage, 00383 &paddedThumbnailImage, 00384 slideshowWidth, 00385 slideshowHeight); 00386 00387 //save out updated full and slideshow images to temp folder and deallocate memory 00388 imageLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2.jpg") 00389 .arg(initialSubalbumNumber) 00390 .arg(initialNumber); 00391 slideshowLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2_slideshow.jpg") 00392 .arg(initialSubalbumNumber) 00393 .arg(initialNumber); 00394 00395 fullImage->save( imageLocation, "JPEG", 100); 00396 slideshowImage->save( slideshowLocation, "JPEG", 100); 00397 00398 //mark image as having been modified and hence in the tmp folder 00399 needsSaving = true; 00400 00401 //deallocate qimage objects 00402 deallocateLargeImages(); 00403 00404 //update slideshow width/height 00405 int temp = slideshowWidth; 00406 slideshowWidth = slideshowHeight; 00407 slideshowHeight = temp; 00408 } |
|
Sets actual slideshow image size.
Definition at line 669 of file photo.cpp. References slideshowHeight, and slideshowWidth.
00670 { 00671 slideshowWidth = w; 00672 slideshowHeight = h; 00673 } |
|
Sets the description.
Definition at line 215 of file photo.cpp. References description. Referenced by Subalbum::addPhoto(), PhotoWidget::sync(), and PhotoEditWidget::updateDescription().
00216 { 00217 description = val; 00218 } |
|
Sets the image. this method used when modifications have been preformed like cropping, etc. Recreates slideshow and thumnail forms, marks photo for saving Definition at line 180 of file photo.cpp. References createImages(), deallocateLargeImages(), fullImage, imageLocation, initialNumber, initialSubalbumNumber, needsSaving, paddedThumbnailImage, slideshowHeight, slideshowImage, slideshowLocation, slideshowWidth, and thumbnailImage.
00181 { 00182 //reset image object 00183 delete fullImage; 00184 fullImage = newFullImage; 00185 if(fullImage->isNull()) return false; 00186 00187 //create slideshow and thumbnail formats 00188 createImages(fullImage, 00189 &slideshowImage, 00190 &thumbnailImage, 00191 &paddedThumbnailImage, 00192 slideshowWidth, 00193 slideshowHeight); 00194 00195 //save out updated full and slideshow images to temp folder and deallocate memory 00196 imageLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2.jpg") 00197 .arg(initialSubalbumNumber) 00198 .arg(initialNumber); 00199 slideshowLocation = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2_slideshow.jpg") 00200 .arg(initialSubalbumNumber) 00201 .arg(initialNumber); 00202 00203 fullImage->save( imageLocation, "JPEG", 100); 00204 slideshowImage->save( slideshowLocation, "JPEG", 100); 00205 00206 //mark image as having been modified and hence in the tmp folder 00207 needsSaving = true; 00208 00209 //deallocate qimage objects 00210 deallocateLargeImages(); 00211 00212 return true; 00213 } |
|
Sets the image, uses loads thumbnail and slideshow from file (no scaling), returns TRUE if successful. THis method used when loading from xml and no scaling should need to be done, we hope Definition at line 107 of file photo.cpp. References fullImage, imageLocation, needsSaving, paddedThumbnailImage, slideshowImage, slideshowLocation, THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH, and thumbnailImage.
00110 { 00111 //--------------------------------------------------------- 00112 //free old images 00113 delete fullImage; 00114 if(paddedThumbnailImage != thumbnailImage) 00115 delete paddedThumbnailImage; 00116 delete thumbnailImage; 00117 delete slideshowImage; 00118 00119 fullImage = NULL; 00120 paddedThumbnailImage = NULL; 00121 thumbnailImage = NULL; 00122 slideshowImage = NULL; 00123 //--------------------------------------------------------- 00124 //construct thumbnail image 00125 thumbnailImage = new QImage(thumbnailName); 00126 if(thumbnailImage->isNull()) return false; 00127 //--------------------------------------------------------- 00128 //construct padded thumbnail image 00129 //if scaled thumbnail image is same size as padded thumbnail should be reuse object 00130 if(thumbnailImage->width() == THUMBNAIL_WIDTH && 00131 thumbnailImage->height() == THUMBNAIL_HEIGHT) 00132 { 00133 paddedThumbnailImage = thumbnailImage; 00134 } 00135 //else pad thumbnail 00136 else 00137 { 00138 //created padded thumbnail image 00139 paddedThumbnailImage = new QImage(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, thumbnailImage->depth()); 00140 paddedThumbnailImage->setAlphaBuffer(true); 00141 00142 //copy scaled image into centered portion of padded image 00143 int xDiff = THUMBNAIL_WIDTH - thumbnailImage->width(); 00144 int yDiff = THUMBNAIL_HEIGHT - thumbnailImage->height(); 00145 00146 //set all pixels to white 00147 int x,y; 00148 for(x=0; x< THUMBNAIL_WIDTH; x++) 00149 { 00150 for(y=0; y<THUMBNAIL_HEIGHT; y++) 00151 { 00152 paddedThumbnailImage->setPixel(x, y, QColor(255, 255, 255).rgb()); 00153 } 00154 } 00155 00156 int x2 = 0; 00157 int y2; 00158 for(x = xDiff/2; x< (xDiff/2) + thumbnailImage->width(); x++) 00159 { 00160 y2 = 0; 00161 for(y = yDiff/2; y < (yDiff/2) + thumbnailImage->height(); y++) 00162 { 00163 paddedThumbnailImage->setPixel(x, y, thumbnailImage->pixel(x2, y2)); 00164 y2++; 00165 } 00166 x2++; 00167 } 00168 } 00169 //--------------------------------------------------------- 00170 //save new image filenames 00171 imageLocation = imageName; 00172 slideshowLocation = slideshowName; 00173 //--------------------------------------------------------- 00174 //image loaded from file, no need to save it again just yet 00175 needsSaving = false; 00176 return true; 00177 //--------------------------------------------------------- 00178 } |
|
Sets image, returns TRUE if successful, this method used when loading and image from file for the first time (aka when photo added to subalbum).
Definition at line 84 of file photo.cpp. References createImages(), fullImage, imageLocation, needsSaving, paddedThumbnailImage, slideshowHeight, slideshowImage, slideshowWidth, and thumbnailImage. Referenced by Subalbum::addPhoto(), PhotoEditWidget::adjustExposure(), PhotoEditWidget::cropToRegion(), PhotoEditWidget::invertSelection(), Subalbum::lazyAddPhoto(), and PhotoEditWidget::resetImageAction().
00085 { 00086 //reset image object 00087 delete fullImage; 00088 fullImage = new QImage(filename); 00089 if(fullImage->isNull()) return false; 00090 00091 //create slideshow and thumbnail formats 00092 createImages(fullImage, 00093 &slideshowImage, 00094 &thumbnailImage, 00095 &paddedThumbnailImage, 00096 slideshowWidth, 00097 slideshowHeight); 00098 00099 //store image and slideshow filenames 00100 imageLocation = filename; 00101 00102 //image is being stored in temp location, needs saving! 00103 needsSaving = true; 00104 return true; 00105 } |
|
Update image checksum.
Definition at line 580 of file photo.cpp. References imageChecksum. Referenced by Album::exportSubalbumImages().
00581 { 00582 imageChecksum = val; 00583 } |
|
Sets the image filename.
Definition at line 609 of file photo.cpp. References imageLocation. Referenced by Subalbum::addPhoto(), and Album::exportSubalbumImages().
00610 { 00611 imageLocation = val; 00612 } |
|
Sets initial photo number.
Definition at line 649 of file photo.cpp. References initialNumber. Referenced by Album::reorderSubalbumImages().
00650 { 00651 initialNumber = val; 00652 } |
|
Sets initial subalbum number.
Definition at line 654 of file photo.cpp. References initialSubalbumNumber. Referenced by Album::reorderSubalbumImages().
00655 { 00656 initialSubalbumNumber = val; 00657 } |
|
Sets if the image needs to be saved to its permanent location.
Definition at line 629 of file photo.cpp. References needsSaving. Referenced by Album::exportSubalbumImages().
00630 { 00631 needsSaving = val; 00632 } |
|
Sets pointer to next photo.
Definition at line 233 of file photo.cpp. References next. Referenced by Subalbum::addPhoto(), Subalbum::lazyAddPhoto(), Subalbum::photoMoved(), Subalbum::removePhoto(), and Subalbum::syncPhotoList().
00234 { 00235 next = val; 00236 } |
|
Update slideshow checksum.
Definition at line 575 of file photo.cpp. References slideshowChecksum. Referenced by Album::exportSubalbumImages().
00576 { 00577 slideshowChecksum = val; 00578 } |
|
Sets the slideshow filename.
Definition at line 614 of file photo.cpp. References slideshowLocation. Referenced by Subalbum::addPhoto(), and Album::exportSubalbumImages().
00615 { 00616 slideshowLocation = val; 00617 } |
|
Update thumbnail checksum.
Definition at line 570 of file photo.cpp. References thumbnailChecksum. Referenced by Album::exportSubalbumImages().
00571 { 00572 thumbnailChecksum = val; 00573 } |
|
Longer description of subalbum.
Definition at line 179 of file photo.h. Referenced by exportToXML(), getDescription(), importFromDisk(), Photo(), and setDescription(). |
|
Actual image.
Definition at line 191 of file photo.h. Referenced by deallocateLargeImages(), flipHorizontally(), flipVertically(), getImage(), Photo(), rotate270(), rotate90(), setImage(), and ~Photo(). |
|
MD5 checksums, ued to determine if image/thumbnail have been changed.
Definition at line 194 of file photo.h. Referenced by exportToXML(), getImageChecksum(), importFromDisk(), Photo(), and setImageChecksum(). |
|
Image filename.
Definition at line 199 of file photo.h. Referenced by flipHorizontally(), flipVertically(), getImage(), getImageFilename(), Photo(), rotate270(), rotate90(), setImage(), and setImageFilename(). |
|
Definition at line 170 of file photo.h. Referenced by flipHorizontally(), flipVertically(), getImage(), getInitialPhotoNumber(), Photo(), rotate270(), rotate90(), setImage(), and setInitialPhotoNumber(). |
|
Definition at line 173 of file photo.h. Referenced by flipHorizontally(), flipVertically(), getImage(), getInitialSubalbumNumber(), Photo(), rotate270(), rotate90(), setImage(), and setInitialSubalbumNumber(). |
|
Does the image need to be saved to the permanent location?
Definition at line 205 of file photo.h. Referenced by flipHorizontally(), flipVertically(), getImage(), getNeedsSavingVal(), Photo(), rotate270(), rotate90(), setImage(), and setNeedsSavingVal(). |
|
Pointer to next photo.
|
|
A padded thumbnail used for subalbum layout.
Definition at line 185 of file photo.h. Referenced by flipHorizontally(), flipVertically(), getImage(), Photo(), rotate270(), rotate90(), setImage(), and ~Photo(). |
|
Definition at line 195 of file photo.h. Referenced by exportToXML(), getSlideshowChecksum(), importFromDisk(), Photo(), and setSlideshowChecksum(). |
|
Unpadded height of slideshow image.
Definition at line 211 of file photo.h. Referenced by actualSlideshowHeight(), flipHorizontally(), flipVertically(), Photo(), rotate270(), rotate90(), setActualSlideshowDimensions(), and setImage(). |
|
Slideshow iamge.
Definition at line 188 of file photo.h. Referenced by deallocateLargeImages(), flipHorizontally(), flipVertically(), getImage(), Photo(), rotate270(), rotate90(), setImage(), and ~Photo(). |
|
Slideshow filename.
Definition at line 202 of file photo.h. Referenced by flipHorizontally(), flipVertically(), getImage(), getSlideshowFilename(), Photo(), rotate270(), rotate90(), setImage(), and setSlideshowFilename(). |
|
Unpadded width of slideshow image.
Definition at line 208 of file photo.h. Referenced by actualSlideshowWidth(), flipHorizontally(), flipVertically(), Photo(), rotate270(), rotate90(), setActualSlideshowDimensions(), and setImage(). |
|
Subalbum photo is in.
|
|
Definition at line 196 of file photo.h. Referenced by exportToXML(), getThumbnailChecksum(), importFromDisk(), Photo(), and setThumbnailChecksum(). |
|
Thumbnail used for saving to disk.
Definition at line 182 of file photo.h. Referenced by flipHorizontally(), flipVertically(), getImage(), Photo(), rotate270(), rotate90(), setImage(), and ~Photo(). |