<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>AlbumShaper: albumStatistics.cpp Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>albumStatistics.cpp</h1><a href="albumStatistics_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==============================================</span> <a name="l00002"></a>00002 <span class="comment">// copyright : (C) 2003-2005 by Will Stokes</span> <a name="l00003"></a>00003 <span class="comment">//==============================================</span> <a name="l00004"></a>00004 <span class="comment">// This program is free software; you can redistribute it</span> <a name="l00005"></a>00005 <span class="comment">// and/or modify it under the terms of the GNU General</span> <a name="l00006"></a>00006 <span class="comment">// Public License as published by the Free Software</span> <a name="l00007"></a>00007 <span class="comment">// Foundation; either version 2 of the License, or</span> <a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment">//==============================================</span> <a name="l00010"></a>00010 <a name="l00011"></a>00011 <span class="comment">//Systemwide includes</span> <a name="l00012"></a>00012 <span class="preprocessor">#include <qlayout.h></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <qlabel.h></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <qfont.h></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <qpixmap.h></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <qimage.h></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <qpushbutton.h></span> <a name="l00018"></a>00018 <span class="preprocessor">#include <qfileinfo.h></span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="preprocessor">#include <qtoolbutton.h></span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="comment">//Projectwide includes</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="albumStatistics_8h.html">albumStatistics.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "../../config.h"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "../../backend/album.h"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "../../backend/subalbum.h"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "../../backend/photo.h"</span> <a name="l00028"></a>00028 <span class="preprocessor">#include "../../backend/tools/imageTools.h"</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="comment">//==============================================</span> <a name="l00031"></a><a class="code" href="classAlbumStatistics.html#8b303f604020119e338c64fdd1c2d247">00031</a> <a class="code" href="classAlbumStatistics.html#8b303f604020119e338c64fdd1c2d247">AlbumStatistics::AlbumStatistics</a>( <a class="code" href="classAlbum.html" title="An album contains Subalbums.">Album</a>* album, <a name="l00032"></a>00032 <a class="code" href="classQWidget.html">QWidget</a>* parent, <a name="l00033"></a>00033 <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) : <a name="l00034"></a>00034 <a class="code" href="classQDialog.html">QDialog</a>(parent,name) <a name="l00035"></a>00035 { <a name="l00036"></a>00036 <span class="comment">//--------------------------------------------------------------</span> <a name="l00037"></a>00037 QColor white(255, 255, 255); <a name="l00038"></a>00038 QColor darkBlue(35, 75, 139); <a name="l00039"></a>00039 <span class="comment">//--------------------------------------------------------------</span> <a name="l00040"></a>00040 <span class="comment">//this album pointer</span> <a name="l00041"></a>00041 this->album = album; <a name="l00042"></a>00042 <span class="comment">//--</span> <a name="l00043"></a>00043 <span class="comment">//compute size on disk</span> <a name="l00044"></a>00044 <span class="keywordtype">int</span> albumSize = 0; <a name="l00045"></a>00045 <a class="code" href="classSubalbum.html" title="A subalbum contains photos.">Subalbum</a>* curSubalbum = album-><a class="code" href="classAlbum.html#0870f79ed21521222c97a704bad0d50f" title="Returns a pointer to the first Subalbum.">getFirstSubalbum</a>(); <a name="l00046"></a>00046 QFileInfo info; <a name="l00047"></a>00047 <span class="keywordflow">while</span>(curSubalbum != NULL) <a name="l00048"></a>00048 { <a name="l00049"></a>00049 <a class="code" href="classPhoto.html" title="A photo consists of a full size image, a smaller slide show image, a very small thumbnail...">Photo</a>* curPhoto = curSubalbum-><a class="code" href="classSubalbum.html#a38b7736f58738d25426bf0cd93fc28a" title="Returns first photo in subalbum.">getFirst</a>(); <a name="l00050"></a>00050 <span class="keywordflow">while</span>(curPhoto != NULL) <a name="l00051"></a>00051 { <a name="l00052"></a>00052 info.setFile( curPhoto-><a class="code" href="classPhoto.html#5ebb6fccddd609df5d407498957e1089" title="Gets the image filename.">getImageFilename</a>() ); <a name="l00053"></a>00053 albumSize+=info.size(); <a name="l00054"></a>00054 <a name="l00055"></a>00055 info.setFile( curPhoto-><a class="code" href="classPhoto.html#d16ff6833a7ddc4340d7c296e2eeac99" title="Gets the slideshow filename.">getSlideshowFilename</a>() ); <a name="l00056"></a>00056 albumSize+=info.size(); <a name="l00057"></a>00057 <a name="l00058"></a>00058 curPhoto = curPhoto-><a class="code" href="classPhoto.html#357f9d79451532a37f41142d3aaba9f9" title="Returns next photo pointer.">getNext</a>(); <a name="l00059"></a>00059 } <a name="l00060"></a>00060 curSubalbum = curSubalbum-><a class="code" href="classSubalbum.html#510a01088f04712e93ae202cc758065f" title="Returns pointer to next subalbum.">getNext</a>(); <a name="l00061"></a>00061 } <a name="l00062"></a>00062 <span class="comment">//--</span> <a name="l00063"></a>00063 <span class="comment">//set window title</span> <a name="l00064"></a>00064 setCaption( tr(<span class="stringliteral">"Album Statistics"</span>)); <a name="l00065"></a>00065 <span class="comment">//--</span> <a name="l00066"></a>00066 <span class="comment">//create title</span> <a name="l00067"></a>00067 <a class="code" href="classAlbumStatistics.html#fde62179a37f2b0555ef232955c652ab">titleMessage</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( tr(<span class="stringliteral">"Album Statistics:"</span>), <span class="keyword">this</span>); <a name="l00068"></a>00068 <a name="l00069"></a>00069 QFont titleFont = <a class="code" href="classAlbumStatistics.html#fde62179a37f2b0555ef232955c652ab">titleMessage</a>->font(); <a name="l00070"></a>00070 titleFont.setWeight(QFont::Bold); <a name="l00071"></a>00071 titleFont.setPointSize( titleFont.pointSize() + 2 ); <a name="l00072"></a>00072 <a name="l00073"></a>00073 QFont statsFont = <a class="code" href="classAlbumStatistics.html#fde62179a37f2b0555ef232955c652ab">titleMessage</a>->font(); <a name="l00074"></a>00074 statsFont.setWeight(QFont::Bold); <a name="l00075"></a>00075 <a name="l00076"></a>00076 <a class="code" href="classAlbumStatistics.html#fde62179a37f2b0555ef232955c652ab">titleMessage</a>->setFont( titleFont ); <a name="l00077"></a>00077 <span class="comment">//--</span> <a name="l00078"></a>00078 <span class="comment">//create stats</span> <a name="l00079"></a>00079 <span class="comment">//--</span> <a name="l00080"></a>00080 <a class="code" href="classAlbumStatistics.html#04525b4b2c218bb7163ac0b41c30646a">numSubalbums</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( tr(<span class="stringliteral">"Collections:"</span>), <span class="keyword">this</span>); <a name="l00081"></a>00081 <a class="code" href="classAlbumStatistics.html#04525b4b2c218bb7163ac0b41c30646a">numSubalbums</a>->setFont( statsFont ); <a name="l00082"></a>00082 <a class="code" href="classAlbumStatistics.html#2f987ab310abc96d7734214d4424b3b6">numSubalbumsVal</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>(<span class="keyword">this</span>); <a name="l00083"></a>00083 <a class="code" href="classAlbumStatistics.html#2f987ab310abc96d7734214d4424b3b6">numSubalbumsVal</a>->setText( QString(<span class="stringliteral">"%1"</span>).arg(album-><a class="code" href="classAlbum.html#612d94f8a24a71110343722e8f9d45f9" title="Returns number of subalbums.">getNumSubalbums</a>()) ); <a name="l00084"></a>00084 <a class="code" href="classAlbumStatistics.html#2f987ab310abc96d7734214d4424b3b6">numSubalbumsVal</a>->setFont( statsFont ); <a name="l00085"></a>00085 <span class="comment">//--</span> <a name="l00086"></a>00086 <a class="code" href="classAlbumStatistics.html#4153cba0246e15b96d40c79caf80c2ee">numPhotos</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( tr(<span class="stringliteral">"Photos:"</span>), <span class="keyword">this</span>); <a name="l00087"></a>00087 <a class="code" href="classAlbumStatistics.html#4153cba0246e15b96d40c79caf80c2ee">numPhotos</a>->setFont( statsFont ); <a name="l00088"></a>00088 <a class="code" href="classAlbumStatistics.html#1e4a0ebf25e22632c7818bbd98e6135e">numPhotosVal</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>(<span class="keyword">this</span>); <a name="l00089"></a>00089 <a class="code" href="classAlbumStatistics.html#1e4a0ebf25e22632c7818bbd98e6135e">numPhotosVal</a>->setText( QString(<span class="stringliteral">"%1"</span>).arg(album-><a class="code" href="classAlbum.html#b804bb42d0657f68b9ee4a695c3a775b" title="Returns the number of photos.">getNumPhotos</a>()) ); <a name="l00090"></a>00090 <a class="code" href="classAlbumStatistics.html#1e4a0ebf25e22632c7818bbd98e6135e">numPhotosVal</a>->setFont( statsFont ); <a name="l00091"></a>00091 <span class="comment">//--</span> <a name="l00092"></a>00092 <a class="code" href="classAlbumStatistics.html#1c3286c265f76b16855c88dfbd14693c">sizeOnDisk</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( tr(<span class="stringliteral">"Size:"</span>), <span class="keyword">this</span>); <a name="l00093"></a>00093 <a class="code" href="classAlbumStatistics.html#1c3286c265f76b16855c88dfbd14693c">sizeOnDisk</a>->setFont( statsFont ); <a name="l00094"></a>00094 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>(<span class="keyword">this</span>); <a name="l00095"></a>00095 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>->setFont( statsFont ); <a name="l00096"></a>00096 <span class="keywordflow">if</span>(albumSize < 1024) <a name="l00097"></a>00097 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>->setText( QString(tr(<span class="stringliteral">"~%1 Bytes"</span>)).arg(albumSize) ); <a name="l00098"></a>00098 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( albumSize/1024 < 1024) <a name="l00099"></a>00099 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>->setText( QString(tr(<span class="stringliteral">"~%1 Kb"</span>)).arg( ((<span class="keywordtype">float</span>)albumSize)/1024 ) ); <a name="l00100"></a>00100 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( albumSize/(1024*1024) < 1024) <a name="l00101"></a>00101 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>->setText( QString(tr(<span class="stringliteral">"~%1 Mb"</span>)).arg( ((<span class="keywordtype">float</span>)albumSize)/(1024*1024) ) ); <a name="l00102"></a>00102 <span class="keywordflow">else</span> <a name="l00103"></a>00103 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>->setText( QString(tr(<span class="stringliteral">"~%1 Gigs"</span>)).arg( ((<span class="keywordtype">float</span>)albumSize)/(1024*1024*1024) ) ); <a name="l00104"></a>00104 <span class="comment">//--</span> <a name="l00105"></a>00105 QString months[] = { tr(<span class="stringliteral">"January"</span>), <a name="l00106"></a>00106 tr(<span class="stringliteral">"February"</span>), <a name="l00107"></a>00107 tr(<span class="stringliteral">"March"</span>), <a name="l00108"></a>00108 tr(<span class="stringliteral">"April"</span>), <a name="l00109"></a>00109 tr(<span class="stringliteral">"May"</span>), <a name="l00110"></a>00110 tr(<span class="stringliteral">"June"</span>), <a name="l00111"></a>00111 tr(<span class="stringliteral">"July"</span>), <a name="l00112"></a>00112 tr(<span class="stringliteral">"August"</span>), <a name="l00113"></a>00113 tr(<span class="stringliteral">"September"</span>), <a name="l00114"></a>00114 tr(<span class="stringliteral">"October"</span>), <a name="l00115"></a>00115 tr(<span class="stringliteral">"November"</span>), <a name="l00116"></a>00116 tr(<span class="stringliteral">"December"</span>) }; <a name="l00117"></a>00117 <a name="l00118"></a>00118 <a class="code" href="classAlbumStatistics.html#42b95e1641ce1ee025c4094445d76555">created</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( tr(<span class="stringliteral">"Created:"</span>), <span class="keyword">this</span>); <a name="l00119"></a>00119 <a class="code" href="classAlbumStatistics.html#42b95e1641ce1ee025c4094445d76555">created</a>->setFont( statsFont ); <a name="l00120"></a>00120 QString cVal = QString(<span class="stringliteral">"%1 %2"</span>).arg(months[album-><a class="code" href="classAlbum.html#a8519b202333bf67f06e93813a272530" title="Returns the creation month.">getCreationMonth</a>()-1]).arg(album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>()); <a name="l00121"></a>00121 <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>() == 1 || <a name="l00122"></a>00122 album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>() == 21 || <a name="l00123"></a>00123 album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>() == 31) <a name="l00124"></a>00124 cVal = cVal + <span class="stringliteral">"st"</span>; <a name="l00125"></a>00125 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>() == 2 || <a name="l00126"></a>00126 album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>() == 22) <a name="l00127"></a>00127 cVal = cVal + <span class="stringliteral">"nd"</span>; <a name="l00128"></a>00128 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>() == 3 || <a name="l00129"></a>00129 album-><a class="code" href="classAlbum.html#1dfb171cebca3f254918b79b88f18fdc" title="Returnst he creation day.">getCreationDay</a>() == 23) <a name="l00130"></a>00130 cVal = cVal + <span class="stringliteral">"rd"</span>; <a name="l00131"></a>00131 <span class="keywordflow">else</span> <a name="l00132"></a>00132 cVal = cVal + <span class="stringliteral">"th"</span>; <a name="l00133"></a>00133 cVal = QString(<span class="stringliteral">"%1, %2"</span>).arg(cVal).arg(album-><a class="code" href="classAlbum.html#e16d9e5691111231864aa57645811d0f" title="Returns the creation year.">getCreationYear</a>()); <a name="l00134"></a>00134 <a name="l00135"></a>00135 <a class="code" href="classAlbumStatistics.html#aa77ac79f6803d1784c266f7f969739b">createdVal</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( cVal, <span class="keyword">this</span> ); <a name="l00136"></a>00136 <a class="code" href="classAlbumStatistics.html#aa77ac79f6803d1784c266f7f969739b">createdVal</a>->setFont( statsFont ); <a name="l00137"></a>00137 <a name="l00138"></a>00138 <a class="code" href="classAlbumStatistics.html#93bc5ac17e6a7eee46a3d42529c7550e">modified</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( tr(<span class="stringliteral">"Modified:"</span>), <span class="keyword">this</span>); <a name="l00139"></a>00139 <a class="code" href="classAlbumStatistics.html#93bc5ac17e6a7eee46a3d42529c7550e">modified</a>->setFont( statsFont ); <a name="l00140"></a>00140 QString mVal = QString(<span class="stringliteral">"%1 %2"</span>).arg(months[album-><a class="code" href="classAlbum.html#9fe3b765967a17904843a2eade9d774e" title="Returns the last modified month.">getModificationMonth</a>()-1]).arg(album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>()); <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>() == 1 || <a name="l00143"></a>00143 album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>() == 21 || <a name="l00144"></a>00144 album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>() == 31) <a name="l00145"></a>00145 mVal = mVal + <span class="stringliteral">"st"</span>; <a name="l00146"></a>00146 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>() == 2 || <a name="l00147"></a>00147 album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>() == 22) <a name="l00148"></a>00148 mVal = mVal + <span class="stringliteral">"nd"</span>; <a name="l00149"></a>00149 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>() == 3 || <a name="l00150"></a>00150 album-><a class="code" href="classAlbum.html#023dc5f5a0a1df5055c5091657860037" title="Returns the last modified day.">getModificationDay</a>() == 23) <a name="l00151"></a>00151 mVal = mVal + <span class="stringliteral">"rd"</span>; <a name="l00152"></a>00152 <span class="keywordflow">else</span> <a name="l00153"></a>00153 mVal = mVal + <span class="stringliteral">"th"</span>; <a name="l00154"></a>00154 mVal = QString(<span class="stringliteral">"%1, %2"</span>).arg(mVal).arg(album-><a class="code" href="classAlbum.html#2b80ccec03b4f9a573a094df196bad52" title="Returns the last modified year.">getModificationYear</a>()); <a name="l00155"></a>00155 <a class="code" href="classAlbumStatistics.html#fd64f2c650128f12f3d02ab67e1a5d92">modifiedVal</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( mVal, <span class="keyword">this</span> ); <a name="l00156"></a>00156 <a class="code" href="classAlbumStatistics.html#fd64f2c650128f12f3d02ab67e1a5d92">modifiedVal</a>->setFont( statsFont ); <a name="l00157"></a>00157 <span class="comment">//--</span> <a name="l00158"></a>00158 <span class="comment">//create album image and title labels</span> <a name="l00159"></a>00159 <a class="code" href="classAlbumStatistics.html#0bf76700c427440d913fe947053fca54">albumPreview</a> = <span class="keyword">new</span> <a class="code" href="classQFrame.html">QFrame</a>( <span class="keyword">this</span> ); <a name="l00160"></a>00160 <a class="code" href="classAlbumStatistics.html#a2a68b12f44004148b5b8d3aede08b9d">albumIcon</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( <a class="code" href="classAlbumStatistics.html#0bf76700c427440d913fe947053fca54">albumPreview</a> ); <a name="l00161"></a>00161 <a name="l00162"></a>00162 <span class="comment">//if no rep image use small version</span> <a name="l00163"></a>00163 <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#fa2da20aeb08bf27c10243a8886a32c8" title="Returns the representative image.">getRepresentativeImage</a>(<a class="code" href="album_8h.html#c27c2124ca2aed651e06aba3a1468ecb">LARGE</a>) != NULL) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 QImage tImage = album-><a class="code" href="classAlbum.html#fa2da20aeb08bf27c10243a8886a32c8" title="Returns the representative image.">getRepresentativeImage</a>( <a class="code" href="album_8h.html#c27c2124ca2aed651e06aba3a1468ecb">LARGE</a> )->convertToImage(); <a name="l00166"></a>00166 <span class="keywordtype">int</span> newWidth, newHeight; <a name="l00167"></a>00167 <a class="code" href="imageTools_8cpp.html#b6483215237a72d6b725adc644d40f0b" title="Computes scale of image dimensions while respecting aspect ratio, equivalent to a...">calcScaledImageDimensions</a>( tImage.width(), tImage.height(), <a name="l00168"></a>00168 300, 300, <a name="l00169"></a>00169 newWidth, newHeight); <a name="l00170"></a>00170 QImage tImage2 = tImage.smoothScale( newWidth, newHeight ); <a name="l00171"></a>00171 <a class="code" href="classAlbumStatistics.html#7ae7e4c24708a8311dfda844c46fa22c">albumImage</a> = <span class="keyword">new</span> QPixmap( newWidth, newHeight ); <a name="l00172"></a>00172 <a class="code" href="classAlbumStatistics.html#7ae7e4c24708a8311dfda844c46fa22c">albumImage</a>->convertFromImage( tImage2 ); <a name="l00173"></a>00173 <a class="code" href="classAlbumStatistics.html#a2a68b12f44004148b5b8d3aede08b9d">albumIcon</a>->setPixmap( *<a class="code" href="classAlbumStatistics.html#7ae7e4c24708a8311dfda844c46fa22c">albumImage</a> ); <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <a name="l00176"></a>00176 <a class="code" href="classAlbumStatistics.html#c4ff7850b4843c980f1cec0d9abde64f">albumTitle</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( <a class="code" href="classAlbumStatistics.html#0bf76700c427440d913fe947053fca54">albumPreview</a> ); <a name="l00177"></a>00177 <span class="keywordflow">if</span>(album-><a class="code" href="classAlbum.html#f10928e547a4403df72008364544cea6" title="Gets the album name.">getName</a>().compare(<span class="stringliteral">""</span>) != 0) <a name="l00178"></a>00178 { <a name="l00179"></a>00179 <a class="code" href="classAlbumStatistics.html#c4ff7850b4843c980f1cec0d9abde64f">albumTitle</a>->setText( <span class="stringliteral">"\""</span> + album-><a class="code" href="classAlbum.html#f10928e547a4403df72008364544cea6" title="Gets the album name.">getName</a>() + <span class="stringliteral">"\""</span> ); <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <a class="code" href="classAlbumStatistics.html#c4ff7850b4843c980f1cec0d9abde64f">albumTitle</a>->setFont( statsFont ); <a name="l00182"></a>00182 <span class="comment">//--</span> <a name="l00183"></a>00183 <span class="comment">//create close button</span> <a name="l00184"></a>00184 <a class="code" href="classAlbumStatistics.html#f224bdfe94907d633d05a0a69f2bb398" title="Close button.">closeButton</a> = <span class="keyword">new</span> QPushButton( tr(<span class="stringliteral">"Close"</span>), <span class="keyword">this</span> ); <a name="l00185"></a>00185 <a class="code" href="classAlbumStatistics.html#f224bdfe94907d633d05a0a69f2bb398" title="Close button.">closeButton</a>->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); <a name="l00186"></a>00186 <a class="code" href="classAlbumStatistics.html#f224bdfe94907d633d05a0a69f2bb398" title="Close button.">closeButton</a>->setDefault(<span class="keyword">true</span>); <a name="l00187"></a>00187 <a class="code" href="classAlbumStatistics.html#f224bdfe94907d633d05a0a69f2bb398" title="Close button.">closeButton</a>->setFocus(); <a name="l00188"></a>00188 connect( <a class="code" href="classAlbumStatistics.html#f224bdfe94907d633d05a0a69f2bb398" title="Close button.">closeButton</a>, SIGNAL(clicked()), SLOT(close()) ); <a name="l00189"></a>00189 <span class="comment">//--</span> <a name="l00190"></a>00190 setPaletteBackgroundColor( darkBlue ); <a name="l00191"></a>00191 <a class="code" href="classAlbumStatistics.html#fde62179a37f2b0555ef232955c652ab">titleMessage</a>->setPaletteForegroundColor( white ); <a name="l00192"></a>00192 <a class="code" href="classAlbumStatistics.html#fde62179a37f2b0555ef232955c652ab">titleMessage</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00193"></a>00193 <a class="code" href="classAlbumStatistics.html#04525b4b2c218bb7163ac0b41c30646a">numSubalbums</a>->setPaletteForegroundColor( white ); <a name="l00194"></a>00194 <a class="code" href="classAlbumStatistics.html#04525b4b2c218bb7163ac0b41c30646a">numSubalbums</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00195"></a>00195 <a class="code" href="classAlbumStatistics.html#2f987ab310abc96d7734214d4424b3b6">numSubalbumsVal</a>->setPaletteForegroundColor( white ); <a name="l00196"></a>00196 <a class="code" href="classAlbumStatistics.html#2f987ab310abc96d7734214d4424b3b6">numSubalbumsVal</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00197"></a>00197 <a class="code" href="classAlbumStatistics.html#4153cba0246e15b96d40c79caf80c2ee">numPhotos</a>->setPaletteForegroundColor( white ); <a name="l00198"></a>00198 <a class="code" href="classAlbumStatistics.html#4153cba0246e15b96d40c79caf80c2ee">numPhotos</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00199"></a>00199 <a class="code" href="classAlbumStatistics.html#1e4a0ebf25e22632c7818bbd98e6135e">numPhotosVal</a>->setPaletteForegroundColor( white ); <a name="l00200"></a>00200 <a class="code" href="classAlbumStatistics.html#1e4a0ebf25e22632c7818bbd98e6135e">numPhotosVal</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00201"></a>00201 <a class="code" href="classAlbumStatistics.html#1c3286c265f76b16855c88dfbd14693c">sizeOnDisk</a>->setPaletteForegroundColor( white ); <a name="l00202"></a>00202 <a class="code" href="classAlbumStatistics.html#1c3286c265f76b16855c88dfbd14693c">sizeOnDisk</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00203"></a>00203 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>->setPaletteForegroundColor( white ); <a name="l00204"></a>00204 <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00205"></a>00205 <a class="code" href="classAlbumStatistics.html#42b95e1641ce1ee025c4094445d76555">created</a>->setPaletteForegroundColor( white ); <a name="l00206"></a>00206 <a class="code" href="classAlbumStatistics.html#42b95e1641ce1ee025c4094445d76555">created</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00207"></a>00207 <a class="code" href="classAlbumStatistics.html#aa77ac79f6803d1784c266f7f969739b">createdVal</a>->setPaletteForegroundColor( white ); <a name="l00208"></a>00208 <a class="code" href="classAlbumStatistics.html#aa77ac79f6803d1784c266f7f969739b">createdVal</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00209"></a>00209 <a class="code" href="classAlbumStatistics.html#93bc5ac17e6a7eee46a3d42529c7550e">modified</a>->setPaletteForegroundColor( white ); <a name="l00210"></a>00210 <a class="code" href="classAlbumStatistics.html#93bc5ac17e6a7eee46a3d42529c7550e">modified</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00211"></a>00211 <a class="code" href="classAlbumStatistics.html#fd64f2c650128f12f3d02ab67e1a5d92">modifiedVal</a>->setPaletteForegroundColor( white ); <a name="l00212"></a>00212 <a class="code" href="classAlbumStatistics.html#fd64f2c650128f12f3d02ab67e1a5d92">modifiedVal</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00213"></a>00213 <a class="code" href="classAlbumStatistics.html#c4ff7850b4843c980f1cec0d9abde64f">albumTitle</a>->setPaletteForegroundColor( white ); <a name="l00214"></a>00214 <a class="code" href="classAlbumStatistics.html#c4ff7850b4843c980f1cec0d9abde64f">albumTitle</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00215"></a>00215 <a class="code" href="classAlbumStatistics.html#0bf76700c427440d913fe947053fca54">albumPreview</a>->setPaletteBackgroundColor( darkBlue ); <a name="l00216"></a>00216 <a class="code" href="classAlbumStatistics.html#f224bdfe94907d633d05a0a69f2bb398" title="Close button.">closeButton</a>->setEraseColor(darkBlue); <a name="l00217"></a>00217 <span class="comment">//--</span> <a name="l00218"></a>00218 <span class="comment">//place widgets in grid</span> <a name="l00219"></a>00219 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a> = <span class="keyword">new</span> QGridLayout( <span class="keyword">this</span>, 10, 3, 0); <a name="l00220"></a>00220 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->setMargin(<a class="code" href="config_8h.html#07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>); <a name="l00221"></a>00221 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->setSpacing(<a class="code" href="config_8h.html#07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>); <a name="l00222"></a>00222 <a name="l00223"></a>00223 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addRowSpacing( 0, 10 ); <a name="l00224"></a>00224 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->setRowStretch( 0, 1 ); <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="comment">//add statistics text</span> <a name="l00227"></a>00227 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addMultiCellWidget( <a class="code" href="classAlbumStatistics.html#fde62179a37f2b0555ef232955c652ab">titleMessage</a>, 1, 1, 0, 1, Qt::AlignCenter); <a name="l00228"></a>00228 <a name="l00229"></a>00229 <span class="comment">//add space between "Album Statistics" text and actual statistics</span> <a name="l00230"></a>00230 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addRowSpacing( 2, 10 ); <a name="l00231"></a>00231 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->setRowStretch( 2, 1 ); <a name="l00232"></a>00232 <a name="l00233"></a>00233 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#04525b4b2c218bb7163ac0b41c30646a">numSubalbums</a>, 3, 0 ); <a name="l00234"></a>00234 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#2f987ab310abc96d7734214d4424b3b6">numSubalbumsVal</a>, 3, 1, Qt::AlignRight ); <a name="l00235"></a>00235 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#4153cba0246e15b96d40c79caf80c2ee">numPhotos</a>, 4, 0 ); <a name="l00236"></a>00236 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#1e4a0ebf25e22632c7818bbd98e6135e">numPhotosVal</a>, 4, 1, Qt::AlignRight ); <a name="l00237"></a>00237 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#1c3286c265f76b16855c88dfbd14693c">sizeOnDisk</a>, 5, 0 ); <a name="l00238"></a>00238 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#ef5ea85c926faf03a5dd68736232aa81">sizeOnDiskVal</a>, 5, 1, Qt::AlignRight ); <a name="l00239"></a>00239 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#42b95e1641ce1ee025c4094445d76555">created</a>, 6,0 ); <a name="l00240"></a>00240 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#aa77ac79f6803d1784c266f7f969739b">createdVal</a>, 6, 1, Qt::AlignRight ); <a name="l00241"></a>00241 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#93bc5ac17e6a7eee46a3d42529c7550e">modified</a>, 7,0 ); <a name="l00242"></a>00242 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addWidget( <a class="code" href="classAlbumStatistics.html#fd64f2c650128f12f3d02ab67e1a5d92">modifiedVal</a>, 7, 1, Qt::AlignRight ); <a name="l00243"></a>00243 <a name="l00244"></a>00244 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->setRowStretch( 8, 1 ); <a name="l00245"></a>00245 <a name="l00246"></a>00246 <a name="l00247"></a>00247 <span class="comment">//add album image and name</span> <a name="l00248"></a>00248 <a class="code" href="classAlbumStatistics.html#fce481a1c3093b70fdc8bab44635ad25">grid2</a> = <span class="keyword">new</span> QGridLayout( <a class="code" href="classAlbumStatistics.html#0bf76700c427440d913fe947053fca54">albumPreview</a>, 2, 1, 0 ); <a name="l00249"></a>00249 <a class="code" href="classAlbumStatistics.html#fce481a1c3093b70fdc8bab44635ad25">grid2</a>->setSpacing(<a class="code" href="config_8h.html#07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>); <a name="l00250"></a>00250 <a name="l00251"></a>00251 <a class="code" href="classAlbumStatistics.html#fce481a1c3093b70fdc8bab44635ad25">grid2</a>->addWidget( <a class="code" href="classAlbumStatistics.html#a2a68b12f44004148b5b8d3aede08b9d">albumIcon</a>, 0, 0, Qt::AlignCenter ); <a name="l00252"></a>00252 <a class="code" href="classAlbumStatistics.html#fce481a1c3093b70fdc8bab44635ad25">grid2</a>->addWidget( <a class="code" href="classAlbumStatistics.html#c4ff7850b4843c980f1cec0d9abde64f">albumTitle</a>, 1, 0, Qt::AlignCenter ); <a name="l00253"></a>00253 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addMultiCellWidget( <a class="code" href="classAlbumStatistics.html#0bf76700c427440d913fe947053fca54">albumPreview</a>, 0,8, 2, 2, Qt::AlignCenter ); <a name="l00254"></a>00254 <a name="l00255"></a>00255 <span class="comment">//add ok button</span> <a name="l00256"></a>00256 <a class="code" href="classAlbumStatistics.html#5b8052d06fb70654dff4257d35d75975">grid</a>->addMultiCellWidget( <a class="code" href="classAlbumStatistics.html#f224bdfe94907d633d05a0a69f2bb398" title="Close button.">closeButton</a>, 9,9, 0, 2, Qt::AlignCenter ); <a name="l00257"></a>00257 <span class="comment">//--</span> <a name="l00258"></a>00258 <span class="comment">//set window to not be resizeable</span> <a name="l00259"></a>00259 show(); <a name="l00260"></a>00260 setFixedSize(size()); <a name="l00261"></a>00261 <span class="comment">//-------------------------------</span> <a name="l00262"></a>00262 } <a name="l00263"></a>00263 <span class="comment">//==============================================</span> <a name="l00264"></a><a class="code" href="classAlbumStatistics.html#d92b5f344007c70e1458a02f1d970657">00264</a> <span class="keywordtype">void</span> <a class="code" href="classAlbumStatistics.html#d92b5f344007c70e1458a02f1d970657">AlbumStatistics::setCreationDate</a>() <a name="l00265"></a>00265 { <a name="l00266"></a>00266 <a name="l00267"></a>00267 } <a name="l00268"></a>00268 <span class="comment">//==============================================</span> <a name="l00269"></a><a class="code" href="classAlbumStatistics.html#800381cb92dd28e26957f171c75ed843">00269</a> <span class="keywordtype">void</span> <a class="code" href="classAlbumStatistics.html#800381cb92dd28e26957f171c75ed843">AlbumStatistics::closeEvent</a>( QCloseEvent* e) <a name="l00270"></a>00270 { <a name="l00271"></a>00271 <a class="code" href="classAlbumStatistics.html#800381cb92dd28e26957f171c75ed843">QWidget::closeEvent</a>( e ); <a name="l00272"></a>00272 emit <a class="code" href="classAlbumStatistics.html#32162316f53465a076030ae450c73d86">closed</a>(); <a name="l00273"></a>00273 } <a name="l00274"></a>00274 <span class="comment">//==============================================</span> <a name="l00275"></a><a class="code" href="classAlbumStatistics.html#49c9ef7a01aebec1a0775faabb95aaa9">00275</a> <span class="keywordtype">void</span> <a class="code" href="classAlbumStatistics.html#49c9ef7a01aebec1a0775faabb95aaa9">AlbumStatistics::reject</a>() <a name="l00276"></a>00276 { <a name="l00277"></a>00277 <a class="code" href="classAlbumStatistics.html#49c9ef7a01aebec1a0775faabb95aaa9">QDialog::reject</a>(); <a name="l00278"></a>00278 emit <a class="code" href="classAlbumStatistics.html#32162316f53465a076030ae450c73d86">closed</a>(); <a name="l00279"></a>00279 } <a name="l00280"></a>00280 <span class="comment">//==============================================</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:25 2009 for AlbumShaper by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>