00001 //============================================== 00002 // copyright : (C) 2003 by Will Stokes 00003 //============================================== 00004 // This program is free software; you can redistribute it 00005 // and/or modify it under the terms of the GNU General 00006 // Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // As a special exception, Will Stokes gives permission to 00011 // link this program with Qt non-commercial edition, and 00012 // distribute the resulting executable, without including the 00013 // source code for the Qt non-commercial edition in the 00014 // source distribution. 00015 //============================================== 00016 00017 #ifndef BACKEND_PHOTO_H 00018 #define BACKEND_PHOTO_H 00019 00020 //define image sizes 00021 #define THUMBNAIL 1 00022 #define PADDED_THUMBNAIL 2 00023 #define SLIDESHOW 3 00024 #define IMAGE 4 00025 00026 //-------------------- 00027 //forward declarations 00028 class QString; 00029 class QPixmap; 00030 class QImage; 00031 class QDomNode; 00032 class Subalbum; 00033 //-------------------- 00034 00035 //===================================== 00038 //===================================== 00039 00040 class Photo 00041 { 00042 //------------------------------------------------------ 00043 public: 00044 00046 Photo(Subalbum* subalbum, int number); 00047 00049 ~Photo(); 00050 //---------------------------- 00052 void setImageFilename(QString val); 00053 00055 void setSlideshowFilename(QString val); 00056 //---------------------------- 00058 QString getImageFilename(); 00059 00061 QString getSlideshowFilename(); 00062 //---------------------------- 00065 bool setImage(QString imageName); 00066 00070 bool setImage(QString imageName, 00071 QString slideshowName, 00072 QString thumbnailName); 00073 00076 bool setImage(QImage* fullImage); 00077 00079 void setDescription(QString val); 00080 00082 QString getDescription(); 00083 00085 Photo* getNext(); 00086 00088 void setNext(Photo* val); 00089 00091 QImage* getImage(int size); 00092 00094 void importFromDisk(QDomNode* root); 00095 00097 void exportToXML(QTextStream& stream); 00098 00100 void exportThumbnailHTML(QTextStream& stream); 00101 00103 void exportSlideshowHTML(QTextStream& stream); 00104 00106 void rotate90(); 00107 00109 void rotate270(); 00110 00112 void flipHorizontally(); 00113 00115 void flipVertically(); 00116 00118 void setThumbnailChecksum(QString val); 00119 00121 void setSlideshowChecksum(QString val); 00122 00124 void setImageChecksum(QString val); 00125 00127 QString getThumbnailChecksum(); 00128 00130 QString getSlideshowChecksum(); 00131 00133 QString getImageChecksum(); 00134 00136 void deallocateLargeImages(); 00137 00139 void setNeedsSavingVal(bool val); 00140 00142 bool getNeedsSavingVal(); 00143 00145 int getInitialPhotoNumber(); 00146 00148 int getInitialSubalbumNumber(); 00149 00151 void setInitialPhotoNumber(int val); 00152 00154 void setInitialSubalbumNumber(int val); 00155 00157 int actualSlideshowWidth(); 00158 00160 int actualSlideshowHeight(); 00161 00163 void setActualSlideshowDimensions(int w, int h); 00164 //------------------------------------------------------ 00165 private: 00167 Subalbum* subalbum; 00168 00169 //Initial photo number (when first created) 00170 int initialNumber; 00171 00172 //Initial subalbum number of photo 00173 int initialSubalbumNumber; 00174 00176 Photo* next; 00177 00179 QString description; 00180 00182 QImage* thumbnailImage; 00183 00185 QImage* paddedThumbnailImage; 00186 00188 QImage* slideshowImage; 00189 00191 QImage* fullImage; 00192 00194 QString imageChecksum; 00195 QString slideshowChecksum; 00196 QString thumbnailChecksum; 00197 00199 QString imageLocation; 00200 00202 QString slideshowLocation; 00203 00205 bool needsSaving; 00206 00208 int slideshowWidth; 00209 00211 int slideshowHeight; 00212 00213 //------------------------------------------------------ 00214 }; 00215 00216 #endif //BACKEND_PHOTO_H