#include <albumStatistics.h>
Inheritance diagram for AlbumStatistics:


Definition at line 36 of file albumStatistics.h.
Signals | |
| void | albumStatisticsClosed () |
Public Member Functions | |
| AlbumStatistics (Album *album, QWidget *parent=0, const char *name=0) | |
| void | closeEvent (QCloseEvent *e) |
Private Attributes | |
| Album * | album |
| QGridLayout * | grid |
| QGridLayout * | grid2 |
| QLabel * | titleMessage |
| QLabel * | numSubalbums |
| QLabel * | numSubalbumsVal |
| QLabel * | numPhotos |
| QLabel * | numPhotosVal |
| QLabel * | sizeOnDisk |
| QLabel * | sizeOnDiskVal |
| QFrame * | albumPreview |
| QPixmap * | albumImage |
| QLabel * | albumIcon |
| QLabel * | albumTitle |
| QPushButton * | okButton |
| Ok button. | |
|
||||||||||||||||
|
Definition at line 35 of file albumStatistics.cpp. References albumIcon, albumImage, albumPreview, albumTitle, Subalbum::getFirst(), Album::getFirstSubalbum(), Photo::getImageFilename(), Subalbum::getNext(), Photo::getNext(), Subalbum::getNumPhotos(), Photo::getSlideshowFilename(), grid, grid2, IMAGE_PATH, LARGE, numPhotos, numPhotosVal, numSubalbums, numSubalbumsVal, okButton, resizeImage(), sizeOnDisk, sizeOnDiskVal, SMALL, and titleMessage.
00037 : 00038 QDialog(parent,name) 00039 { 00040 //-- 00041 //this album pointer 00042 this->album = album; 00043 //-- 00044 //compute number of photos and size on disk 00045 int photos = 0; 00046 int albumSize = 0; 00047 Subalbum* curSubalbum = album->getFirstSubalbum(); 00048 QFileInfo info; 00049 while(curSubalbum != NULL) 00050 { 00051 photos+= curSubalbum->getNumPhotos(); 00052 Photo* curPhoto = curSubalbum->getFirst(); 00053 while(curPhoto != NULL) 00054 { 00055 info.setFile( curPhoto->getImageFilename() ); 00056 albumSize+=info.size(); 00057 00058 info.setFile( curPhoto->getSlideshowFilename() ); 00059 albumSize+=info.size(); 00060 00061 curPhoto = curPhoto->getNext(); 00062 } 00063 curSubalbum = curSubalbum->getNext(); 00064 } 00065 //-- 00066 //set window title 00067 setCaption( tr("Album Statistics")); 00068 //-- 00069 //set the background of the widget to be white 00070 setPaletteBackgroundColor( QColor(255, 255, 255) ); 00071 //-- 00072 //create title 00073 titleMessage = new QLabel( tr("Album Statistics"), this); 00074 QFont titleFont( "Times", 14, QFont::Bold ); 00075 titleFont.setUnderline(true); 00076 titleMessage->setFont( titleFont ); 00077 //-- 00078 //create stats 00079 QFont statsFont( "Times", 12, QFont::Bold ); 00080 00081 numSubalbums = new QLabel( tr("Subalbums:"), this); 00082 numSubalbums->setFont( statsFont ); 00083 numSubalbumsVal = new QLabel(this); 00084 numSubalbumsVal->setText( QString("%1").arg(album->getNumSubalbums()) ); 00085 numSubalbumsVal->setFont( statsFont ); 00086 00087 numPhotos = new QLabel( tr("Photos:"), this); 00088 numPhotos->setFont( statsFont ); 00089 numPhotosVal = new QLabel(this); 00090 numPhotosVal->setText( QString("%1").arg(photos) ); 00091 numPhotosVal->setFont( statsFont ); 00092 00093 sizeOnDisk = new QLabel( tr("Size:"), this); 00094 sizeOnDisk->setFont( statsFont ); 00095 sizeOnDiskVal = new QLabel(this); 00096 sizeOnDiskVal->setFont( statsFont ); 00097 if(albumSize < 1024) 00098 sizeOnDiskVal->setText( QString(tr("~%1 Bytes")).arg(albumSize) ); 00099 else if( albumSize/1024 < 1024) 00100 sizeOnDiskVal->setText( QString(tr("~%1 Kb")).arg( ((float)albumSize)/1024 ) ); 00101 else if( albumSize/(1024*1024) < 1024) 00102 sizeOnDiskVal->setText( QString(tr("~%1 Mb")).arg( ((float)albumSize)/(1024*1024) ) ); 00103 else 00104 sizeOnDiskVal->setText( QString(tr("~%1 Gigs")).arg( ((float)albumSize)/(1024*1024*1024) ) ); 00105 //-- 00106 //create album image and title labels 00107 albumPreview = new QFrame( this ); 00108 albumIcon = new QLabel( albumPreview ); 00109 00110 //if no rep image use small version 00111 if(album->getRepresentativeImage(LARGE) == NULL) 00112 albumIcon->setPixmap( *album->getRepresentativeImage( SMALL ) ); 00113 else 00114 { 00115 QImage tImage = album->getRepresentativeImage( LARGE )->convertToImage(); 00116 int newWidth, newHeight; 00117 resizeImage( tImage.width(), tImage.height(), 00118 300, 300, 00119 newWidth, newHeight); 00120 QImage tImage2 = tImage.smoothScale( newWidth, newHeight ); 00121 albumImage = new QPixmap( newWidth, newHeight ); 00122 albumImage->convertFromImage( tImage2 ); 00123 albumIcon->setPixmap( *albumImage ); 00124 } 00125 00126 albumTitle = new QLabel( albumPreview ); 00127 if(album->getName().compare("") != 0) 00128 { 00129 albumTitle->setText( "\"" + album->getName() + "\"" ); 00130 } 00131 albumTitle->setFont( statsFont ); 00132 //-- 00133 //create ok button 00134 okButton = new QPushButton( QPixmap(QString(IMAGE_PATH)+"button_ok.png"), 00135 tr("Ok"), 00136 this ); 00137 okButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum ); 00138 okButton->setDefault(true); 00139 connect( okButton, SIGNAL(clicked()), SLOT(close()) ); 00140 //-- 00141 //place widgets in grid 00142 grid = new QGridLayout( this, 8, 3, 0); 00143 00144 //add statistics text 00145 grid->addMultiCellWidget( titleMessage, 1, 1, 0, 1, Qt::AlignCenter); 00146 grid->addWidget( numSubalbums, 3, 0 ); 00147 grid->addWidget( numSubalbumsVal, 3, 1, Qt::AlignRight ); 00148 grid->addWidget( numPhotos, 4, 0 ); 00149 grid->addWidget( numPhotosVal, 4, 1, Qt::AlignRight ); 00150 grid->addWidget( sizeOnDisk, 5, 0 ); 00151 grid->addWidget( sizeOnDiskVal, 5, 1, Qt::AlignRight ); 00152 00153 //add album image and name 00154 grid2 = new QGridLayout( albumPreview, 2, 1, 0 ); 00155 grid2->addWidget( albumIcon, 0, 0, Qt::AlignCenter ); 00156 grid2->addWidget( albumTitle, 1, 0, Qt::AlignCenter ); 00157 grid->addMultiCellWidget( albumPreview, 0, 6, 2, 2, Qt::AlignCenter ); 00158 00159 //add ok button 00160 grid->addMultiCellWidget( okButton, 7, 7, 0, 2, Qt::AlignCenter ); 00161 00162 //add space between "Album Statistics" text and actual statistics 00163 grid->addRowSpacing( 2, 10 ); 00164 00165 //create expanding white space above and below text on left 00166 grid->setRowStretch( 0, 1 ); 00167 grid->setRowStretch( 6, 1 ); 00168 00169 //set the text area to stretch width-wise 00170 grid->setColStretch( 1, 1 ); 00171 //-- 00172 //set window to not be resizeable 00173 this->show(); 00174 setFixedSize(size()); 00175 //------------------------------- 00176 } |
|
|
Referenced by closeEvent(). |
|
|
Definition at line 178 of file albumStatistics.cpp. References albumStatisticsClosed().
00179 {
00180 albumStatisticsClosed();
00181 QWidget::closeEvent( e );
00182 }
|
|
|
Definition at line 48 of file albumStatistics.h. |
|
|
Definition at line 65 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 64 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 63 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 67 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 49 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 50 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 57 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 58 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 54 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 55 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Ok button.
Definition at line 70 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 60 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 61 of file albumStatistics.h. Referenced by AlbumStatistics(). |
|
|
Definition at line 52 of file albumStatistics.h. Referenced by AlbumStatistics(). |
1.3.4