#include <subalbum.h>
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, 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 * | getNext () |
Returns pointer to next 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 (QTextStream &stream) |
Exports subalbum to xml. | |
void | exportThumbnailHTML (QTextStream &stream, int subalbumNumber) |
Exports to thumbnail html format. | |
void | exportSlideshowHTML (QTextStream &stream, int subalbumNumber) |
Exports to slideshow html format. | |
void | importFromDisk (QDomNode *root, int subalbumNum, LoadDialog *dialog, 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 () |
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 * | nextSubalbum |
Pointer to next subalbum. | |
Album * | albm |
Pointer to album subalbum is in. |
|
Sets default information is the Subalbum number.
Definition at line 42 of file subalbum.cpp. References description, firstPhoto, IMAGE_PATH, largeRepresentativeImage, lastPhoto, loadedPhotos, mediumRepresentativeImage, name, nextSubalbum, numPhotos, and smallRepresentativeImage.
00043 { 00044 //set subalbum number 00045 this->number = number; 00046 00047 //by default no photos in subalbum 00048 numPhotos = 0; 00049 loadedPhotos = 0; 00050 00051 //set strings to default values 00052 name = ""; 00053 description =""; 00054 00055 //set default rep images 00056 smallRepresentativeImage = new QPixmap( QString(IMAGE_PATH)+"notSpecified.png" ); 00057 mediumRepresentativeImage = new QPixmap( QString(IMAGE_PATH)+"subalbum.png" ); 00058 largeRepresentativeImage = NULL; 00059 00060 //no photos by default 00061 firstPhoto = NULL; 00062 lastPhoto = NULL; 00063 00064 //next pointer null by default 00065 nextSubalbum = NULL; 00066 00067 //set album pointer 00068 this->albm = albm; 00069 } |
|
Frees photos.
Definition at line 72 of file subalbum.cpp. References firstPhoto, Photo::getNext(), largeRepresentativeImage, mediumRepresentativeImage, and smallRepresentativeImage.
00073 { 00074 //delete representative images 00075 delete smallRepresentativeImage; 00076 delete mediumRepresentativeImage; 00077 delete largeRepresentativeImage; 00078 00079 //delete all photos 00080 Photo* current = firstPhoto; 00081 Photo* temp; 00082 while(current != NULL) 00083 { 00084 temp = current->getNext(); 00085 delete current; 00086 current = temp; 00087 } 00088 } |
|
Adds a preexisting photo object to the Subalbum, appending it to the end.
Definition at line 737 of file subalbum.cpp. References firstPhoto, lastPhoto, numPhotos, and Photo::setNext().
00738 { 00739 //increase counter 00740 numPhotos++; 00741 00742 //set it's next pointer to null 00743 newPhoto->setNext(NULL); 00744 00745 //if this is the only photo, set first and last 00746 //pointers to this photo. 00747 if(firstPhoto == NULL) 00748 { 00749 firstPhoto = newPhoto; 00750 lastPhoto = newPhoto; 00751 } 00752 //else append to end of list 00753 else 00754 { 00755 lastPhoto->setNext(newPhoto); 00756 lastPhoto = newPhoto; 00757 } 00758 } |
|
Adds a new photo to the Subalbum and appends it to the end, returns TRUE if successful.
Definition at line 194 of file subalbum.cpp. References Photo::deallocateLargeImages(), firstPhoto, Photo::getImage(), IMAGE, lastPhoto, number, numPhotos, Photo::setDescription(), Photo::setImage(), Photo::setImageFilename(), Photo::setNext(), Photo::setSlideshowFilename(), and SLIDESHOW. Referenced by SubalbumWidget::addImageAction(), SubalbumPreviewWidget::dropped(), and importFromDisk().
00195 { 00196 numPhotos++; 00197 00198 //create new photo if necessary 00199 if(newPhoto == NULL) 00200 newPhoto = new Photo(this, numPhotos); 00201 00202 QString desc(fileName); 00203 desc = desc.section( QRegExp("/"), -1); 00204 desc.truncate(desc.length() - 4); 00205 newPhoto->setDescription( desc ); 00206 00207 //attempt to set image 00208 if(!newPhoto->setImage(fileName)) 00209 { 00210 cout << "Error! Unable to load " << fileName << endl; 00211 delete newPhoto; 00212 return false; 00213 } 00214 00215 //if this is the only photo, set first and last 00216 //pointers to this photo. 00217 if(firstPhoto == NULL) 00218 { 00219 firstPhoto = newPhoto; 00220 lastPhoto = newPhoto; 00221 } 00222 //else append to end of list 00223 else 00224 { 00225 lastPhoto->setNext(newPhoto); 00226 lastPhoto = newPhoto; 00227 } 00228 00229 //copy image file over 00230 QString saveName = QDir::homeDirPath() + QString("/.albumShaper/tmp/%1_%2") 00231 .arg(number) 00232 .arg(numPhotos); 00233 00234 newPhoto->getImage(IMAGE)->save( saveName + ".jpg", "JPEG", 100); 00235 newPhoto->getImage(SLIDESHOW)->save( saveName + "_slideshow.jpg", "JPEG", 100); 00236 00237 newPhoto->setImageFilename(saveName + ".jpg"); 00238 newPhoto->setSlideshowFilename(saveName + "_slideshow.jpg"); 00239 00240 //deallocate full image and slideshow versions to conserve memory 00241 newPhoto->deallocateLargeImages(); 00242 00243 return true; 00244 } |
|
Exports to slideshow html format.
Definition at line 464 of file subalbum.cpp. References description, firstPhoto, Photo::getDescription(), Photo::getNext(), name, and numPhotos. Referenced by Album::exportSublabumsToHTML().
00465 { 00466 stream << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; 00467 stream << "<html>\n"; 00468 stream << " <head>\n"; 00469 stream << " <style type=\"text/html\">\n"; 00470 stream << " <!--\n"; 00471 stream << " A{text-decoration:none}\n"; 00472 stream << " -->\n"; 00473 stream << " </style>\n"; 00474 stream << " <style type=\"text/css\">\n"; 00475 stream << " <!--\n"; 00476 stream << " h3 {font-size: 12pt; font-weight: bold; text-align: center}\n"; 00477 stream << " h4 {font-size: 10pt; font-weight: normal; text-align: center}\n"; 00478 stream << " h4.ital {font-size: 10pt; font-weight: normal; text-align: center}\n"; 00479 stream << " -->\n"; 00480 stream << " </style>\n"; 00481 stream << " <title>" << name << "</title>\n"; 00482 stream << " <meta name=\"generator\" content=\"Album Shaper (c.) Will Stokes\">\n"; 00483 stream << " <script type=\"text/javascript\" language=\"JavaScript\">\n"; 00484 stream << " <!-- HIDE FROM OLD BROWSERS\n"; 00485 stream << " var imageNumber=1\n\n"; 00486 stream << " var photoTitles = new Array(" << numPhotos << ");\n"; 00487 00488 Photo* current = firstPhoto; 00489 int n = 0; 00490 while(current != NULL) 00491 { 00492 stream << " photoTitles[" << n << "] = \"" << current->getDescription() << "\";\n"; 00493 n++; 00494 current = current->getNext(); 00495 } 00496 00497 stream << " //###################################### \n"; 00498 stream << " //Define functions used to change images \n"; 00499 stream << " //###################################### \n"; 00500 stream << " function expandImage() \n"; 00501 stream << " { \n"; 00502 stream << " fileToOpen = \"img/" << subalbumNumber << "/\"+imageNumber+\".jpg\" \n"; 00503 stream << " new_window = window.open(fileToOpen,'albulmifyRules') \n"; 00504 stream << " } \n\n"; 00505 stream << " function reloadImage() \n"; 00506 stream << " { \n"; 00507 stream << " document.currentPhoto.src=\"img/" << subalbumNumber << "/\"+imageNumber+\"_slideshow.jpg\"\n"; 00508 stream << " document.currentPhoto.alt=photoTitles[imageNumber-1];\n"; 00509 stream << " document.photoInfo.whichPhoto.value=\"Photo \" + imageNumber + \" of " << numPhotos << "\"\n"; 00510 stream << " document.photoInfo.photoDesc.value=photoTitles[imageNumber-1];\n"; 00511 stream << " } \n\n"; 00512 stream << " function firstImage() \n"; 00513 stream << " { \n"; 00514 stream << " //set image number to first \n"; 00515 stream << " imageNumber = 1 \n\n"; 00516 stream << " //reset image src value based on variable \n"; 00517 stream << " reloadImage() \n"; 00518 stream << " } \n\n"; 00519 stream << " function lastImage() \n"; 00520 stream << " { \n"; 00521 stream << " //set image number to last \n"; 00522 stream << " imageNumber = " << numPhotos << "\n\n"; 00523 stream << " //reset image src value based on variable \n"; 00524 stream << " reloadImage() \n"; 00525 stream << " } \n\n"; 00526 stream << " function nextImage() \n"; 00527 stream << " { \n"; 00528 stream << " //increment image number \n"; 00529 stream << " imageNumber = imageNumber + 1 \n\n"; 00530 stream << " //wrap to begining if reached the end \n"; 00531 stream << " if (imageNumber==" << (numPhotos+1) << ") \n"; 00532 stream << " {imageNumber = 1} \n\n"; 00533 stream << " //reset image src value based on variable \n"; 00534 stream << " reloadImage() \n"; 00535 stream << " } \n\n"; 00536 stream << " function previousImage() \n"; 00537 stream << " { \n"; 00538 stream << " //decrement image number \n"; 00539 stream << " imageNumber = imageNumber - 1 \n"; 00540 stream << " //wrap to begining if reached the end \n"; 00541 stream << " if (imageNumber==(1 - 1)) \n"; 00542 stream << " {imageNumber = " << numPhotos << "} \n\n"; 00543 stream << " //reset image src value based on variable \n"; 00544 stream << " reloadImage() \n"; 00545 stream << " }\n\n"; 00546 stream << " -->\n"; 00547 stream << " </script> \n"; 00548 stream << " </head> \n"; 00549 stream << " <body> \n"; 00550 stream << " <center> \n"; 00551 stream << " <table>\n"; 00552 stream << " <tr>\n"; 00553 stream << " <td width=\"450\">\n"; 00554 stream << " <h3>\n"; 00555 stream << " " << name << "\n"; 00556 stream << " </h3>\n"; 00557 stream << " <h4>\n"; 00558 stream << " " << description << "\n"; 00559 stream << " </h4>\n"; 00560 stream << " </td>\n"; 00561 stream << " </tr>\n"; 00562 stream << " </table>\n"; 00563 stream << " </center> \n"; 00564 stream << " <h4>\n"; 00565 stream << " <a href=\"subalbum_" << subalbumNumber << "_thumbs.html\">\n"; 00566 stream << " Thumbnails\n"; 00567 stream << " </a>\n"; 00568 stream << " - \n"; 00569 stream << " <a href=\"Album.html\">\n"; 00570 stream << " Album Index\n"; 00571 stream << " </a>\n"; 00572 stream << " </h4>\n"; 00573 stream << " <center> \n"; 00574 stream << " <a href=\"JavaScript:expandImage()\"> \n"; 00575 stream << " <img alt=\"current photo\" src=\"img/" << subalbumNumber << "/1_slideshow.jpg\" name=\"currentPhoto\" border=\"0\"> \n"; 00576 stream << " </a> \n"; 00577 stream << " </center> \n"; 00578 stream << " <center> \n"; 00579 stream << " <form name=\"photoInfo\" action=\"\"> \n"; 00580 stream << " <table border=\"0\"> \n"; 00581 stream << " <tr> \n"; 00582 stream << " <td valign=\"middle\" align=\"center\" width=\"100\"> \n"; 00583 stream << " <a href=\"JavaScript:firstImage()\"> (First) </a> \n"; 00584 stream << " </td> \n"; 00585 stream << " <td valign=\"middle\" align=\"center\" width=\"100\"> \n"; 00586 stream << " <a href=\"JavaScript:previousImage()\"> Previous </a> \n"; 00587 stream << " </td> \n"; 00588 stream << " <td valign=\"middle\" align=\"center\">\n"; 00589 stream << " <input type=\"text\" maxlength=\"100\" name=\"whichPhoto\" readonly value=\"Photo 1 of " << numPhotos << "\">\n"; 00590 stream << " </td>\n"; 00591 stream << " <td valign=\"middle\" align=\"center\" width=\"100\"> \n"; 00592 stream << " <a href=\"JavaScript:nextImage()\"> Next </a> \n"; 00593 stream << " </td> \n"; 00594 stream << " <td valign=\"middle\" align=\"center\" width=\"100\"> \n"; 00595 stream << " <a href=\"JavaScript:lastImage()\"> (Last) </a> \n"; 00596 stream << " </td> \n"; 00597 stream << " </tr> \n"; 00598 stream << " <tr> \n"; 00599 stream << " <td colspan=\"5\" valign=\"middle\" align=\"center\"> \n"; 00600 stream << " <textarea cols=\"40\" rows=\"2\" name=\"photoDesc\" readonly>\n"; 00601 if( firstPhoto == NULL || firstPhoto->getDescription() == "" ) 00602 { 00603 stream << "Photo 1 of " << numPhotos << "\n"; 00604 } 00605 else 00606 { 00607 stream << firstPhoto->getDescription() << "\n"; 00608 } 00609 stream << " </textarea>\n"; 00610 stream << " </td> \n"; 00611 stream << " </tr> \n"; 00612 stream << " </table> \n"; 00613 stream << " </form> \n"; 00614 stream << " </center> \n"; 00615 stream << " <h4 class=\"ital\">\n"; 00616 stream << " (Generated by <a href=\"http://albumshaper.sourceforge.net\">Album Shaper</a>)\n"; 00617 stream << " </h4>\n"; 00618 stream << " </body> \n"; 00619 stream << "</html> \n"; 00620 } |
|
Exports to thumbnail html format.
Definition at line 339 of file subalbum.cpp. References description, firstPhoto, Photo::getDescription(), Photo::getNext(), and name. Referenced by Album::exportSublabumsToHTML().
00340 { 00341 stream << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; 00342 stream << "<html>\n"; 00343 stream << " <head>\n"; 00344 stream << " <style type=\"text/html\">\n"; 00345 stream << " <!--\n"; 00346 stream << " A{text-decoration:none}\n"; 00347 stream << " -->\n"; 00348 stream << " </style>\n"; 00349 stream << " <style type=\"text/css\">\n"; 00350 stream << " <!--\n"; 00351 stream << " h3 {font-size: 12pt; font-weight: bold; text-align: center}\n"; 00352 stream << " h4 {font-size: 10pt; font-weight: normal; text-align: center}\n"; 00353 stream << " h4.ital {font-size: 10pt; font-weight: normal; text-align: center}\n"; 00354 stream << " -->\n"; 00355 stream << " </style>\n"; 00356 stream << " <title>" << name << "</title>\n"; 00357 stream << " <meta name=\"generator\" "; 00358 stream << "content=\"Album Shaper (c.) Will Stokes\">\n"; 00359 stream << " </head>\n"; 00360 stream << " <body>\n"; 00361 stream << " <center>\n"; 00362 stream << " <table>\n"; 00363 stream << " <tr>\n"; 00364 stream << " <td width=\"450\">\n"; 00365 stream << " <h3>\n"; 00366 stream << " " << name << "\n"; 00367 stream << " </h3>\n"; 00368 stream << " <h4>\n"; 00369 stream << " " << description << "\n"; 00370 stream << " </h4>\n"; 00371 stream << " </td>\n"; 00372 stream << " </tr>\n"; 00373 stream << " </table>\n"; 00374 stream << " </center>\n"; 00375 stream << " <h4>\n"; 00376 stream << " <script type=\"text/javascript\" language=\"JavaScript\">\n"; 00377 stream << " <!-- HIDE FROM OLD BROWSERS\n"; 00378 stream << " document.write(\"<a href=\\\"subalbum_" << subalbumNumber << "_slideshow.html\\\">Begin Slide Show</a>\")\n"; 00379 stream << " document.write(\" - \")\n"; 00380 stream << " -->\n"; 00381 stream << " </script>\n"; 00382 stream << " <a href=\"Album.html\">\n"; 00383 stream << " Album Index\n"; 00384 stream << " </a>\n"; 00385 stream << " </h4>\n"; 00386 00387 int photoNumber = 0; 00388 00389 //write photo thumbnails 00390 Photo* current = firstPhoto; 00391 if(current != NULL) 00392 { 00393 stream << " <center>\n"; 00394 stream << " <table border=\"0\">\n"; 00395 while(current != NULL) 00396 { 00397 Photo* backupCurrent = current; 00398 int backupNumber = photoNumber; 00399 //--------------------------------------- 00400 //Print row of images 00401 //--------------------------------------- 00402 int n = 3; 00403 stream << " <tr>\n"; 00404 while(current != NULL && n > 0) 00405 { 00406 n--; 00407 photoNumber++; 00408 stream << " <td valign=\"bottom\" width=\"220\">\n"; 00409 stream << " <center>\n"; 00410 stream << " <a href=\"img/" << subalbumNumber << "/" << photoNumber << ".jpg\">\n"; 00411 stream << " <img alt=\"" << current->getDescription() << "\" src=\"img/" << subalbumNumber << "/" << photoNumber << "_thumb.jpg\">\n"; 00412 stream << " </a>\n"; 00413 stream << " </center>\n"; 00414 stream << " </td>\n"; 00415 current = current->getNext(); 00416 } 00417 00418 while(n != 0 && photoNumber > 2) 00419 { 00420 stream << " <td width=\"220\"></td>\n"; 00421 n--; 00422 } 00423 stream << " </tr>\n"; 00424 //--------------------------------------- 00425 //Print row of image descriptions 00426 //--------------------------------------- 00427 current = backupCurrent; 00428 photoNumber = backupNumber; 00429 n = 3; 00430 stream << " <tr>\n"; 00431 while(current != NULL && n > 0) 00432 { 00433 n--; 00434 photoNumber++; 00435 stream << " <td valign=\"top\" width=\"220\">\n"; 00436 stream << " <center>\n"; 00437 stream << " <a href=\"img/" << subalbumNumber << "/" << photoNumber << ".jpg\">\n"; 00438 stream << " " << current->getDescription() << "\n"; 00439 stream << " </a>\n"; 00440 stream << " </center>\n"; 00441 stream << " </td>\n"; 00442 current = current->getNext(); 00443 } 00444 00445 while(n != 0 && photoNumber > 2) 00446 { 00447 stream << " <td width=\"220\"></td>\n"; 00448 n--; 00449 } 00450 stream << " </tr>\n"; 00451 } 00452 00453 stream << " </table>\n"; 00454 stream << " </center>\n"; 00455 } //end if 00456 00457 stream << " <h4 class=\"ital\">\n"; 00458 stream << " (Generated by <a href=\"http://albumshaper.sourceforge.net\">Album Shaper</a>)\n"; 00459 stream << " </h4>\n"; 00460 stream << " </body>\n"; 00461 stream << "</html>\n"; 00462 } |
|
Exports subalbum to xml.
Definition at line 319 of file subalbum.cpp. References description, Photo::exportToXML(), firstPhoto, fixXMLString(), Photo::getNext(), and name. Referenced by Album::exportToXML().
00320 { 00321 //write subalbum information 00322 stream << " <subalbum>\n"; 00323 stream << " <name>" << fixXMLString(name) << "</name>\n"; 00324 stream << " <description>" << fixXMLString(description) << "</description>\n"; 00325 00326 //write photos 00327 Photo* current = firstPhoto; 00328 while(current != NULL) 00329 { 00330 current->exportToXML(stream); 00331 current = current->getNext(); 00332 } 00333 00334 //close subalbum 00335 stream << " </subalbum>\n"; 00336 00337 } |
|
Gets the Subalbum description.
Definition at line 109 of file subalbum.cpp. References description. Referenced by SubalbumWidget::setSubalbum(), and SubalbumWidget::SubalbumWidget().
00110 {
00111 return QString(description);
00112 }
|
|
Returns first photo in subalbum.
Definition at line 622 of file subalbum.cpp. References firstPhoto. Referenced by Album::exportSubalbumImages(), SubalbumWidget::refreshPhotos(), and Album::reorderSubalbumImages().
00623 { 00624 return firstPhoto; 00625 } |
|
Returns last photo in subalbum.
Definition at line 627 of file subalbum.cpp. References lastPhoto. Referenced by SubalbumWidget::addImageAction().
00628 { 00629 return lastPhoto; 00630 } |
|
Gets the Subalbum Name.
Definition at line 97 of file subalbum.cpp. References name. Referenced by Album::exportToHTML(), SubalbumWidget::setSubalbum(), and SubalbumWidget::SubalbumWidget().
00098 {
00099 return QString(name);
00100 }
|
|
Returns pointer to next subalbum.
Definition at line 309 of file subalbum.cpp. References nextSubalbum. Referenced by Album::exportSubalbumImages(), Album::exportSublabumsToHTML(), Album::exportToHTML(), Album::exportTopLevelImages(), Album::exportToXML(), SubalbumsWidget::refresh(), Album::removeStagnantImages(), Album::removeSubalbum(), Album::reorderSubalbumImages(), and Album::~Album().
00310 { 00311 return nextSubalbum; 00312 } |
|
Returns the number of loaded photos in subalbum.
Definition at line 824 of file subalbum.cpp. References loadedPhotos. Referenced by Album::removeStagnantImages().
00825 { 00826 return loadedPhotos;; 00827 } |
|
Returns the number of photos in the subalbum.
Definition at line 819 of file subalbum.cpp. References numPhotos. Referenced by Album::removeStagnantImages().
00820 { 00821 return numPhotos;; 00822 } |
|
gets a sized representative image
Definition at line 115 of file subalbum.cpp. References LARGE, largeRepresentativeImage, MEDIUM, mediumRepresentativeImage, SMALL, and smallRepresentativeImage. Referenced by Album::exportToHTML(), Album::exportTopLevelImages(), SubalbumWidget::setImageAction(), SubalbumWidget::setSubalbum(), and SubalbumWidget::SubalbumWidget().
00116 { 00117 if(size == SMALL) 00118 return smallRepresentativeImage; 00119 if(size == MEDIUM) 00120 return mediumRepresentativeImage; 00121 if(size == LARGE) 00122 return largeRepresentativeImage; 00123 else 00124 return NULL; 00125 } |
|
Returns subalbum number.
Definition at line 814 of file subalbum.cpp. References number.
00815 { 00816 return number; 00817 } |
|
Builds subalbum from XML DOM node.
Definition at line 632 of file subalbum.cpp. References addPhoto(), description, Photo::getImageChecksum(), getMD5(), Photo::getSlideshowChecksum(), Photo::getThumbnailChecksum(), Photo::importFromDisk(), lazyAddPhoto(), name, LoadDialog::printSubalbumPhoto(), resetNumLoadedPhotos(), and setRepresentativeImages(). Referenced by Album::importFromDisk().
00633 { 00634 //if representative image exists load 00635 QString repName = QString(dirName + "/img/%1_thumb.jpg").arg(subalbumNum); 00636 QImage repImage(repName); 00637 if(!repImage.isNull()) 00638 { 00639 setRepresentativeImages(&repImage); 00640 } 00641 00642 QDomNode node = root->firstChild(); 00643 QDomText val; 00644 int photoNum = 0; 00645 while( !node.isNull() ) 00646 { 00647 //------------------------------------------------------------ 00648 //subalbum name 00649 if( node.isElement() && node.nodeName() == "name" ) 00650 { 00651 val = node.firstChild().toText(); 00652 if(!val.isNull()) 00653 name = val.nodeValue(); 00654 } 00655 //------------------------------------------------------------ 00656 //subalbum description 00657 else if( node.isElement() && node.nodeName() == "description" ) 00658 { 00659 val = node.firstChild().toText(); 00660 if(!val.isNull()) 00661 description = val.nodeValue(); 00662 } 00663 //------------------------------------------------------------ 00664 //photo 00665 else if( node.isElement() && node.nodeName() == "photo" ) 00666 { 00667 //increase counter 00668 photoNum++; 00669 00670 00671 dialog->printSubalbumPhoto(subalbumNum, photoNum); 00672 00673 //create new photo object 00674 QString imageName = QString(dirName + "img/%1/%2.jpg").arg(subalbumNum).arg(photoNum); 00675 QString slideshowName = QString(dirName + "img/%1/%2_slideshow.jpg").arg(subalbumNum).arg(photoNum); 00676 QString thumbName = QString(dirName + "img/%1/%2_thumb.jpg").arg(subalbumNum).arg(photoNum); 00677 Photo* newPhoto = new Photo(this, photoNum); 00678 00679 //load photo information from disk 00680 newPhoto->importFromDisk( &node ); 00681 00682 //if no changes have occured do lazy load - don't 00683 //bother scaling down thumbnail and slideshow images 00684 //from original image 00685 ifstream imageFile( imageName ); 00686 ifstream slideshowFile( slideshowName ); 00687 ifstream thumbnailFile( thumbName ); 00688 00689 if( 00690 imageFile.is_open() && 00691 thumbnailFile.is_open() && 00692 slideshowFile.is_open() && 00693 getMD5(imageFile) == newPhoto->getImageChecksum() && 00694 getMD5(slideshowFile) == newPhoto->getSlideshowChecksum() && 00695 getMD5(thumbnailFile) == newPhoto->getThumbnailChecksum() 00696 ) 00697 { 00698 //close ifstreams 00699 imageFile.close(); 00700 slideshowFile.close(); 00701 thumbnailFile.close(); 00702 00703 //populate image 00704 lazyAddPhoto(imageName, slideshowName, thumbName, newPhoto); 00705 } 00706 //else reload image and scale it since changes have occured. 00707 else 00708 { 00709 //close ifstreams if open 00710 if(imageFile.is_open()) 00711 imageFile.close(); 00712 if(thumbnailFile.is_open()) 00713 thumbnailFile.close(); 00714 00715 //populate image 00716 addPhoto(imageName, newPhoto); 00717 } 00718 00719 if(imageFile.is_open()) 00720 imageFile.close(); 00721 if(slideshowFile.is_open()) 00722 slideshowFile.close(); 00723 if(thumbnailFile.is_open()) 00724 thumbnailFile.close(); 00725 } 00726 //------------------------------------------------------------ 00727 //advance to next node 00728 node = node.nextSibling(); 00729 //------------------------------------------------------------ 00730 } 00731 //------------------------------------------------------------ 00732 //set loaded number 00733 resetNumLoadedPhotos(); 00734 //------------------------------------------------------------ 00735 } |
|
Lazily adds a new photo to the subalbum without rescaling from scrath, returns TRUE if successful.
Definition at line 246 of file subalbum.cpp. References firstPhoto, lastPhoto, numPhotos, Photo::setImage(), and Photo::setNext(). Referenced by importFromDisk().
00250 { 00251 numPhotos++; 00252 00253 //attempt to set image 00254 if(!newPhoto->setImage(imageName, slideshowName, thumbnailName)) 00255 { 00256 cout << "Error! Unable to load " << imageName << endl; 00257 delete newPhoto; 00258 return false; 00259 } 00260 00261 //if this is the only photo, set first and last 00262 //pointers to this photo. 00263 if(firstPhoto == NULL) 00264 { 00265 firstPhoto = newPhoto; 00266 lastPhoto = newPhoto; 00267 } 00268 //else append to end of list 00269 else 00270 { 00271 lastPhoto->setNext(newPhoto); 00272 lastPhoto = newPhoto; 00273 } 00274 00275 return true; 00276 } |
|
Removes a specified photo without deleting the object.
Definition at line 760 of file subalbum.cpp. References firstPhoto, Photo::getNext(), lastPhoto, numPhotos, and Photo::setNext(). Referenced by SubalbumPreviewWidget::dropped().
00761 { 00762 //decrease counter 00763 numPhotos--; 00764 00765 //walk through list of photos and find specified photo 00766 Photo* current = firstPhoto; 00767 Photo* prev = NULL; 00768 while(current != NULL && 00769 current != val) 00770 { 00771 prev = current; 00772 current = current->getNext(); 00773 } 00774 00775 if(current == val) 00776 { 00777 //update prev next pointer 00778 if(prev != NULL) 00779 prev->setNext(current->getNext()); 00780 00781 //update first and last pointers if necessary 00782 if(current == firstPhoto) 00783 firstPhoto = current->getNext(); 00784 if(current == lastPhoto) 00785 lastPhoto = prev; 00786 } 00787 } |
|
Removes a specified photo.
Definition at line 279 of file subalbum.cpp. References firstPhoto, Photo::getNext(), lastPhoto, numPhotos, and Photo::setNext(). Referenced by SubalbumWidget::removeImageAction().
00280 { 00281 //walk through list of photos and find specified photo 00282 Photo* current = firstPhoto; 00283 Photo* prev = NULL; 00284 while(current != val && current->getNext() != NULL) 00285 { 00286 prev = current; 00287 current = current->getNext(); 00288 } 00289 00290 if(current == val) 00291 { 00292 //update prev next pointer 00293 if(prev != NULL) 00294 prev->setNext(current->getNext()); 00295 00296 //update first and last pointers if necessary 00297 if(current == firstPhoto) 00298 firstPhoto = current->getNext(); 00299 if(current == lastPhoto) 00300 lastPhoto = prev; 00301 00302 //free Photo 00303 delete current; 00304 current = NULL; 00305 numPhotos--; 00306 } 00307 } |
|
Definition at line 829 of file subalbum.cpp. References loadedPhotos, and numPhotos. Referenced by importFromDisk(), and Album::removeStagnantImages().
00830 { 00831 loadedPhotos = numPhotos; 00832 } |
|
Sets the Subalbum description.
Definition at line 103 of file subalbum.cpp. References description. Referenced by SubalbumWidget::updateDescription().
00104 { 00105 description = val; 00106 } |
|
Sets the Subalbum Name.
Definition at line 91 of file subalbum.cpp. References name. Referenced by SubalbumWidget::updateName().
00092 { 00093 name = val; 00094 } |
|
Sets pointer of next subalbum.
Definition at line 314 of file subalbum.cpp. References nextSubalbum. Referenced by Album::appendSubalbum(), Album::removeSubalbum(), and Album::syncSubalbumList().
00315 { 00316 nextSubalbum = val; 00317 } |
|
sets a sized representative iamge
Definition at line 128 of file subalbum.cpp. References largeRepresentativeImage, mediumRepresentativeImage, resizeImage(), and smallRepresentativeImage. Referenced by importFromDisk(), and SubalbumWidget::setImageAction().
00129 { 00130 //--------------------------------------------------------- 00131 //delete old representative images 00132 delete smallRepresentativeImage; 00133 delete mediumRepresentativeImage; 00134 delete largeRepresentativeImage; 00135 //--------------------------------------------------------- 00136 //compute various representative image sizes 00137 int smallRepWidth = 0; 00138 int smallRepHeight = 0; 00139 int mediumRepWidth = 0; 00140 int mediumRepHeight = 0; 00141 resizeImage( rawThumbnail->width(), rawThumbnail->height(), 00142 131, 98, 00143 mediumRepWidth, mediumRepHeight); 00144 resizeImage( rawThumbnail->width(), rawThumbnail->height(), 00145 107, 80, 00146 smallRepWidth, smallRepHeight); 00147 //--------------------------------------------------------- 00148 //create various representative images 00149 //--------------------------------------------------------- 00150 //copy and scale small version 00151 QImage thumbnailSmall = rawThumbnail->smoothScale( smallRepWidth, smallRepHeight ); 00152 smallRepresentativeImage = new QPixmap( smallRepWidth, smallRepHeight ); 00153 smallRepresentativeImage->convertFromImage( thumbnailSmall ); 00154 00155 //copy and scale medium version 00156 QImage thumbnailMedium = rawThumbnail->smoothScale( mediumRepWidth, mediumRepHeight ); 00157 QImage* centeredThumbnailMedium = new QImage(131, 98, thumbnailMedium.depth()); 00158 centeredThumbnailMedium->setAlphaBuffer(true); 00159 00160 int xDiff = 131 - mediumRepWidth; 00161 int yDiff = 98 - mediumRepHeight; 00162 00163 //set all pixels to white 00164 int x, y; 00165 for(x=0; x< 131; x++) 00166 { 00167 for(y=0; y<98; y++) 00168 { 00169 centeredThumbnailMedium->setPixel(x, y, QColor(255, 255, 255).rgb()); 00170 } 00171 } 00172 00173 int x2 = 0; 00174 for(x= xDiff/2; x < (xDiff/2) + mediumRepWidth; x++) 00175 { 00176 int y2 = 0; 00177 for(y= yDiff/2; y < (yDiff/2) + mediumRepHeight; y++) 00178 { 00179 centeredThumbnailMedium->setPixel(x, y, thumbnailMedium.pixel(x2, y2)); 00180 y2++; 00181 } 00182 x2++; 00183 } 00184 00185 mediumRepresentativeImage = new QPixmap( centeredThumbnailMedium->width(), centeredThumbnailMedium->height() ); 00186 mediumRepresentativeImage->convertFromImage( *centeredThumbnailMedium ); 00187 delete centeredThumbnailMedium; 00188 //copy large version 00189 largeRepresentativeImage = new QPixmap(*rawThumbnail); 00190 //--------------------------------------------------------- 00191 } |
|
Syncs photo ordering with front end gui ordering.
Definition at line 789 of file subalbum.cpp. References firstPhoto, PhotoWidget::getPhoto(), lastPhoto, and Photo::setNext(). Referenced by SubalbumWidget::reorder().
00790 { 00791 //base case, no items 00792 if(item == NULL) 00793 { 00794 firstPhoto = NULL; 00795 lastPhoto = NULL; 00796 return; 00797 } 00798 00799 //set first and last pointers 00800 firstPhoto = item->getPhoto(); 00801 firstPhoto->setNext(NULL); 00802 lastPhoto = firstPhoto; 00803 00804 //set all next pointers 00805 while(item->nextItem() != NULL) 00806 { 00807 item->getPhoto()->setNext( ((PhotoWidget*)item->nextItem())->getPhoto() ); 00808 item = (PhotoWidget*)item->nextItem(); 00809 lastPhoto = item->getPhoto(); 00810 lastPhoto->setNext(NULL); 00811 } 00812 } |
|
Pointer to album subalbum is in.
Definition at line 170 of file subalbum.h. |
|
Longer description of subalbum.
Definition at line 153 of file subalbum.h. Referenced by exportSlideshowHTML(), exportThumbnailHTML(), exportToXML(), getDescription(), importFromDisk(), setDescription(), and Subalbum(). |
|
Pointer to first photo.
Definition at line 161 of file subalbum.h. Referenced by addPhoto(), exportSlideshowHTML(), exportThumbnailHTML(), exportToXML(), getFirst(), lazyAddPhoto(), photoMoved(), removePhoto(), Subalbum(), syncPhotoList(), and ~Subalbum(). |
|
Definition at line 158 of file subalbum.h. Referenced by getRepresentativeImage(), setRepresentativeImages(), Subalbum(), and ~Subalbum(). |
|
Pointer to last photo.
Definition at line 164 of file subalbum.h. Referenced by addPhoto(), getLast(), lazyAddPhoto(), photoMoved(), removePhoto(), Subalbum(), and syncPhotoList(). |
|
Number of photos in subalbum when last loaded.
Definition at line 147 of file subalbum.h. Referenced by getNumLoadedPhotos(), resetNumLoadedPhotos(), and Subalbum(). |
|
Definition at line 157 of file subalbum.h. Referenced by getRepresentativeImage(), setRepresentativeImages(), Subalbum(), and ~Subalbum(). |
|
Short Name for subalbum.
Definition at line 150 of file subalbum.h. Referenced by exportSlideshowHTML(), exportThumbnailHTML(), exportToXML(), getName(), importFromDisk(), setName(), and Subalbum(). |
|
Pointer to next subalbum.
Definition at line 167 of file subalbum.h. Referenced by getNext(), setNext(), and Subalbum(). |
|
Subalbum Number.
Definition at line 141 of file subalbum.h. Referenced by addPhoto(), and getSubalbumNumber(). |
|
Number of photos in subalbum.
Definition at line 144 of file subalbum.h. Referenced by addPhoto(), exportSlideshowHTML(), getNumPhotos(), lazyAddPhoto(), photoMoved(), removePhoto(), resetNumLoadedPhotos(), and Subalbum(). |
|
Definition at line 156 of file subalbum.h. Referenced by getRepresentativeImage(), setRepresentativeImages(), Subalbum(), and ~Subalbum(). |