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_ALBUM_H 00018 #define BACKEND_ALBUM_H 00019 00020 //representative image sizes 00021 #define SMALL 1 00022 #define MEDIUM 2 00023 #define LARGE 3 00024 00025 //define loading success values 00026 #define ALBUM_LOADED 1 00027 #define ALBUM_READ_ERROR 2 00028 #define ALBUM_XML_ERROR 3 00029 #define ALBUM_EXPORTED 1 00030 #define ALBUM_ERROR_OPEN_FILE 2 00031 //-------------------- 00032 //forward declarations 00033 class QString; 00034 class QPixmap; 00035 class Subalbum; 00036 class SubalbumPreviewWidget; 00037 class StatusWidget; 00038 //-------------------- 00039 00040 //===================================== 00053 //===================================== 00054 00055 class Album 00056 { 00057 //------------------------------------------------------ 00058 public: 00059 00061 Album(); 00062 00064 ~Album(); 00065 00067 void setName(QString val); 00068 00070 QString getName(); 00071 00073 void setDescription(QString val); 00074 00076 QString getDescription(); 00077 00079 void setAuthor(QString val); 00080 00082 QString getAuthor(); 00083 00085 void setRepresentativeImages(QImage* val); 00086 00088 QPixmap* getRepresentativeImage(int size); 00089 00091 Subalbum* getFirstSubalbum(); 00092 00094 Subalbum* getLastSubalbum(); 00095 00097 void appendSubalbum(Subalbum* val); 00098 00100 void removeSubalbum(Subalbum* val); 00101 00103 int getModificationYear(); 00104 00106 int getModificationMonth(); 00107 00109 int getModificationDay(); 00110 00112 void Album::updateCreationDate(); 00113 00115 void updateModificationDate(); 00116 00118 int importFromDisk(StatusWidget* status, QString fileName);; 00119 00121 int exportToDisk(StatusWidget* status, 00122 bool smallSave, 00123 QString dirName, 00124 QString themeName); 00125 00129 int exportToDisk(StatusWidget* status, 00130 bool smallSave, 00131 bool forceSave=false); 00132 00134 bool prevSave(); 00135 00137 bool albumModified(); 00138 00140 void setModified(bool val=true); 00141 00143 void syncSubalbumList(SubalbumPreviewWidget* item); 00144 00146 QString getSaveLocation(); 00147 00149 int getNumSubalbums(); 00150 00152 QString getTheme(); 00153 //------------------------------------------------------ 00154 private: 00156 int exportToXML(); 00157 00159 void exportTopLevelImages(); 00160 00162 void exportSubalbumImages(StatusWidget* status, bool smallSave, bool forceSave); 00163 00165 void reorderSubalbumImages(StatusWidget* status); 00166 00168 void removeStagnantImages(); 00169 00171 void exportThemeResources( QString theme ); 00172 00174 QString name; 00175 00177 QString description; 00178 00180 QString author; 00181 00183 QPixmap* smallRepresentativeImage; 00184 QPixmap* largeRepresentativeImage; 00185 00187 Subalbum* firstSubalbum; 00188 00190 Subalbum* lastSubalbum; 00191 00193 int modificationYear; 00194 00196 int modificationMonth; 00197 00199 int modificationDay; 00200 00202 int creationYear; 00203 00205 int creationMonth; 00206 00208 int creationDay; 00209 00211 int numSubalbums; 00212 00214 int numLoadedSubalbums; 00215 00217 bool savedToDisk; 00218 00220 QString saveLocation; 00221 00223 QString theme; 00224 00226 bool modified; 00227 //------------------------------------------------------ 00228 }; 00229 00230 #endif //BACKEND_ALBUM_H
1.3.4