<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>AlbumShaper: window.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.6.2 --> <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>window.cpp</h1><a href="window_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 <qframe.h></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <qlayout.h></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <qpixmap.h></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <qtooltip.h></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <qdir.h></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <qapplication.h></span> <a name="l00018"></a>00018 <span class="preprocessor">#include <qiconview.h></span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="comment">//PLATFORM_SPECIFIC_CODE</span> <a name="l00021"></a>00021 <span class="preprocessor">#if defined(Q_OS_MACX)</span> <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#include "/Developer/Headers/FlatCarbon/Carbon.h"</span> <a name="l00023"></a>00023 <span class="preprocessor">#endif</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="comment">//Projectwide includes</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="window_8h.html">window.h</a>"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="titleWidget_8h.html">titleWidget.h</a>"</span> <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="layoutWidget_8h.html">layoutWidget.h</a>"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="statusWidget_8h.html">statusWidget.h</a>"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="subalbumsWidget_8h.html">subalbumsWidget.h</a>"</span> <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="subalbumWidget_8h.html">subalbumWidget.h</a>"</span> <a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="questionDialog_8h.html">dialogs/questionDialog.h</a>"</span> <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="alertDialog_8h.html">dialogs/alertDialog.h</a>"</span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="comment">//#include "presentation/presentationWidget.h"</span> <a name="l00036"></a>00036 <span class="preprocessor">#include "../config.h"</span> <a name="l00037"></a>00037 <span class="preprocessor">#include "../backend/album.h"</span> <a name="l00038"></a>00038 <span class="preprocessor">#include "../backend/subalbum.h"</span> <a name="l00039"></a>00039 <span class="preprocessor">#include "../backend/photo.h"</span> <a name="l00040"></a>00040 <span class="preprocessor">#include "../backend/recentAlbums.h"</span> <a name="l00041"></a>00041 <span class="preprocessor">#include "../configuration/configuration.h"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "../configuration/loadingSavingWidget.h"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "../configuration/layoutSettingsWidget.h"</span> <a name="l00044"></a>00044 <span class="preprocessor">#include "../configuration/alertsWidget.h"</span> <a name="l00045"></a>00045 <span class="preprocessor">#include "../configuration/miscSettings.h"</span> <a name="l00046"></a>00046 <a name="l00047"></a>00047 <span class="comment">//==============================================</span> <a name="l00048"></a><a class="code" href="classWindow.html#aa40ae5e98a938fa8bc9a372bcb131f07">00048</a> <a class="code" href="classWindow.html#aa40ae5e98a938fa8bc9a372bcb131f07" title="Creates title area, layout, and tool bar and places them in grid.">Window::Window</a>( <a class="code" href="classQWidget.html">QWidget</a>* parent, <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) : <a class="code" href="classQWidget.html">QWidget</a>(parent,name) <a name="l00049"></a>00049 { <a name="l00050"></a>00050 <span class="comment">//don't clear pixmap area before painting, prevents flicker</span> <a name="l00051"></a>00051 setWFlags(WRepaintNoErase); <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="comment">//load shadow pixmaps</span> <a name="l00054"></a>00054 <a class="code" href="classWindow.html#ad68f87a6a1e7fdd961b9f61a6dc5b77e">shadowBL</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/photoGradientBottomLeft.png"</span> ); <a name="l00055"></a>00055 <a class="code" href="classWindow.html#a3a7de75fd4ecd6de02bb84768a477a30">shadowB</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/photoGradientBottom.png"</span> ); <a name="l00056"></a>00056 <a class="code" href="classWindow.html#abd26badbcdfdcefe9068074ce49f2e07">shadowBR</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/photoGradientBottomRight.png"</span> ); <a name="l00057"></a>00057 <a class="code" href="classWindow.html#a9aead52d78f783c05ccf575c957e9cc4">shadowR</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/photoGradientRight.png"</span> ); <a name="l00058"></a>00058 <a class="code" href="classWindow.html#a20283cd11a7dd0d1ec4bd3d501d99f36">shadowTR</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/photoGradientTopRight.png"</span> ); <a name="l00059"></a>00059 <a name="l00060"></a>00060 <span class="comment">//load photo info pixmap</span> <a name="l00061"></a>00061 <a class="code" href="classWindow.html#a4aa8dad7bc3967dc8802a5a93970dca8">photoInfo</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"buttonIcons/photoInfo.png"</span>); <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="comment">//------------------------------------------------</span> <a name="l00064"></a>00064 <span class="comment">//create configuration object with default settings</span> <a name="l00065"></a>00065 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a> = <span class="keyword">new</span> <a class="code" href="classConfiguration.html" title="Configuration object manages all user-specific application settings.">Configuration</a>(); <a name="l00066"></a>00066 <a class="code" href="classLoadingSavingWidget.html#ae20b24bc2f6f042012e2e9616c6032f3">LoadingSavingWidget::setDefaults</a>(<a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>); <a name="l00067"></a>00067 <a class="code" href="classLayoutSettingsWidget.html#a08b7955c9e94b21cbb7815d8bc88db0d">LayoutSettingsWidget::setDefaults</a>(<a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>); <a name="l00068"></a>00068 <a class="code" href="classAlertsWidget.html#a4e1dc5d9c45b34b65629aa26ed4b6eff">AlertsWidget::setDefaults</a>(<a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>); <a name="l00069"></a>00069 <a class="code" href="classMiscSettings.html#a8fafaea474307f3b748c22c9bd6ad729">MiscSettings::setDefaults</a>(<a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>); <a name="l00070"></a>00070 <span class="comment">//------------------------------------------------</span> <a name="l00071"></a>00071 <span class="comment">//load user settings</span> <a name="l00072"></a>00072 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#aa944e4bdd70019c53598af97cff052a9" title="Loads settings.">loadSettings</a>(); <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="comment">//if temorary image directory does not exist create it</span> <a name="l00075"></a>00075 QDir homeDir; <a name="l00076"></a>00076 <span class="keywordtype">bool</span> configDirMade = <span class="keyword">true</span>; <a name="l00077"></a>00077 <span class="keywordflow">if</span>(!homeDir.exists( <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#af39a96d2cd773570ef1aecf502a3cc90" title="Fetch string setting.">getString</a>( <span class="stringliteral">"loadSave"</span>, <span class="stringliteral">"tempImageDirectory"</span>)) ) <a name="l00078"></a>00078 { configDirMade = homeDir.mkdir( <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#af39a96d2cd773570ef1aecf502a3cc90" title="Fetch string setting.">getString</a>( <span class="stringliteral">"loadSave"</span>, <span class="stringliteral">"tempImageDirectory"</span>)); } <a name="l00079"></a>00079 <span class="comment">//if directory could not be made attempt to revert to default directory</span> <a name="l00080"></a>00080 <span class="keywordflow">if</span>(!configDirMade) <a name="l00081"></a>00081 { <a name="l00082"></a>00082 <a class="code" href="classAlertDialog.html" title="A configurable alert dialog that displays an alert/error message.">AlertDialog</a> alert( <span class="stringliteral">"unable to create temp dir"</span>, QString(<span class="stringliteral">"unable to make temporary directory! ("</span> + <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#af39a96d2cd773570ef1aecf502a3cc90" title="Fetch string setting.">getString</a>( <span class="stringliteral">"loadSave"</span>, <span class="stringliteral">"tempImageDirectory"</span>) ), <a name="l00083"></a>00083 <span class="stringliteral">"alertIcons/warning.png"</span>, <span class="keyword">this</span> ); <a name="l00084"></a>00084 alert.exec(); <a name="l00085"></a>00085 <a name="l00086"></a>00086 <a name="l00087"></a>00087 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#aea454423722c57c7c47a2703c5fac88f" title="Resets a setting to it&#39;s default value.">resetSetting</a>( <span class="stringliteral">"loadSave"</span>, <span class="stringliteral">"tempImageDirectory"</span> ); <a name="l00088"></a>00088 configDirMade = <span class="keyword">true</span>; <a name="l00089"></a>00089 <span class="keywordflow">if</span>(!homeDir.exists( <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#af39a96d2cd773570ef1aecf502a3cc90" title="Fetch string setting.">getString</a>( <span class="stringliteral">"loadSave"</span>, <span class="stringliteral">"tempImageDirectory"</span>)) ) <a name="l00090"></a>00090 { configDirMade = homeDir.mkdir( <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#af39a96d2cd773570ef1aecf502a3cc90" title="Fetch string setting.">getString</a>( <span class="stringliteral">"loadSave"</span>, <span class="stringliteral">"tempImageDirectory"</span>)); } <a name="l00091"></a>00091 } <a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="comment">//if we are still unable to create the temporary image directory then immediately abort</span> <a name="l00094"></a>00094 <span class="keywordflow">if</span>(!configDirMade) <a name="l00095"></a>00095 { <a name="l00096"></a>00096 <a class="code" href="classAlertDialog.html" title="A configurable alert dialog that displays an alert/error message.">AlertDialog</a> alert( <span class="stringliteral">"unable to create temp dir"</span>, QString(<span class="stringliteral">"unable to make temporary directory! ("</span> + <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#af39a96d2cd773570ef1aecf502a3cc90" title="Fetch string setting.">getString</a>( <span class="stringliteral">"loadSave"</span>, <span class="stringliteral">"tempImageDirectory"</span>) ), <a name="l00097"></a>00097 <span class="stringliteral">"alertIcons/warning.png"</span>, <span class="keyword">this</span> ); <a name="l00098"></a>00098 alert.exec(); <a name="l00099"></a>00099 <a name="l00100"></a>00100 close(); <a name="l00101"></a>00101 } <a name="l00102"></a>00102 <a name="l00103"></a>00103 <span class="comment">//------------------------------------------------</span> <a name="l00104"></a>00104 <span class="comment">//create top level widgets</span> <a name="l00105"></a>00105 <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a> = <span class="keyword">new</span> <a class="code" href="classTitleWidget.html" title="Widget which displays album name, description, representative image, and album shaper...">TitleWidget</a> (<span class="keyword">this</span>, <span class="stringliteral">"title"</span>); <a name="l00106"></a>00106 <a class="code" href="classWindow.html#aa9256112e47e84f8b9169bcd9b964e94" title="Layout includes subalbums listing and particular subalbum layout.">layout</a> = <span class="keyword">new</span> <a class="code" href="classLayoutWidget.html" title="Displays list of subalbums and a particular subalbum layout.">LayoutWidget</a>(<span class="keyword">this</span>, <span class="stringliteral">"layout"</span>); <a name="l00107"></a>00107 <a class="code" href="classWindow.html#a4772a1f167bbfaa4c76eb3f91e7e5728" title="Status widget either displays a status message or progress bar.">status</a> = <span class="keyword">new</span> <a class="code" href="classStatusWidget.html">StatusWidget</a>(<span class="keyword">this</span>, <span class="stringliteral">"status"</span>); <a name="l00108"></a>00108 <a name="l00110"></a>00110 connect( <a class="code" href="classWindow.html#aa9256112e47e84f8b9169bcd9b964e94" title="Layout includes subalbums listing and particular subalbum layout.">layout</a>, SIGNAL(collectionSelected(<a class="code" href="classSubalbum.html" title="A subalbum contains photos.">Subalbum</a>*)), <a name="l00111"></a>00111 <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>, SLOT(refreshCollectionAnnotations(<a class="code" href="classSubalbum.html" title="A subalbum contains photos.">Subalbum</a>*)) ); <a name="l00112"></a>00112 <a name="l00114"></a>00114 connect( <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>, SIGNAL(subalbumNameChanged()), <a name="l00115"></a>00115 <a class="code" href="classWindow.html#aa9256112e47e84f8b9169bcd9b964e94" title="Layout includes subalbums listing and particular subalbum layout.">layout</a>, SLOT(refreshSelectedCollectionIconName()) ); <a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="comment">// slideshow = new SlideshowWidget(this, "slideshow", WResizeNoErase);</span> <a name="l00118"></a>00118 <span class="comment">// slideshow->hide();</span> <a name="l00119"></a>00119 <span class="comment">// connect( slideshow, SIGNAL(endSlideshow()), this, SLOT(endSlideshow()) );</span> <a name="l00120"></a>00120 <a name="l00121"></a>00121 <span class="comment">//refresh subalbums listing</span> <a name="l00122"></a>00122 <a class="code" href="classWindow.html#aa9256112e47e84f8b9169bcd9b964e94" title="Layout includes subalbums listing and particular subalbum layout.">layout</a>-><a class="code" href="classLayoutWidget.html#a675b2bae5415c2ca668edb460d9f908e" title="Refreshes layout.">refresh</a>(); <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="comment">//place widgets in main frame</span> <a name="l00125"></a>00125 <a class="code" href="classWindow.html#afa745bef5497e32d03fcf2c0a9b43c33" title="Grid objects placed in.">grid</a> = <span class="keyword">new</span> QGridLayout( <span class="keyword">this</span>, 3, 2, 0); <a name="l00126"></a>00126 <a class="code" href="classWindow.html#afa745bef5497e32d03fcf2c0a9b43c33" title="Grid objects placed in.">grid</a>->addWidget( <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>, 0, 0 ); <a name="l00127"></a>00127 <a class="code" href="classWindow.html#afa745bef5497e32d03fcf2c0a9b43c33" title="Grid objects placed in.">grid</a>->addWidget( <a class="code" href="classWindow.html#aa9256112e47e84f8b9169bcd9b964e94" title="Layout includes subalbums listing and particular subalbum layout.">layout</a>, 1, 0 ); <a name="l00128"></a>00128 <a class="code" href="classWindow.html#afa745bef5497e32d03fcf2c0a9b43c33" title="Grid objects placed in.">grid</a>->setRowStretch( 1, 1 ); <a name="l00129"></a>00129 <a class="code" href="classWindow.html#afa745bef5497e32d03fcf2c0a9b43c33" title="Grid objects placed in.">grid</a>->addWidget( <a class="code" href="classWindow.html#a4772a1f167bbfaa4c76eb3f91e7e5728" title="Status widget either displays a status message or progress bar.">status</a>, 2, 0 ); <a name="l00130"></a>00130 <a class="code" href="classWindow.html#afa745bef5497e32d03fcf2c0a9b43c33" title="Grid objects placed in.">grid</a>->setRowSpacing( 2, 24 ); <a name="l00131"></a>00131 <span class="comment">// grid->addMultiCellWidget( slideshow, 0, 2, 1, 1 );</span> <a name="l00132"></a>00132 <a class="code" href="classWindow.html#afa745bef5497e32d03fcf2c0a9b43c33" title="Grid objects placed in.">grid</a>->setColStretch(0, 1 ); <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="comment">//PLATFORM_SPECIFIC_CODE</span> <a name="l00135"></a>00135 <span class="comment">//create and set application icon</span> <a name="l00136"></a>00136 <span class="preprocessor"> #if( !defined(Q_OS_MACX) && !defined(Q_OS_WIN) )</span> <a name="l00137"></a>00137 <span class="preprocessor"></span> setIcon( QPixmap(QString(<a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/as32.png"</span>) ); <a name="l00138"></a>00138 <span class="preprocessor"> #endif</span> <a name="l00139"></a>00139 <span class="preprocessor"></span> <a name="l00140"></a>00140 setCaption( <a name="l00141"></a>00141 #ifdef CVS_CODE <a name="l00142"></a>00142 <span class="stringliteral">"(CVS BUILD) "</span> + <a name="l00143"></a>00143 #endif <a name="l00144"></a>00144 tr(<span class="stringliteral">"Album Shaper"</span>)); <a name="l00145"></a>00145 <span class="comment">//------------------------------------------------</span> <a name="l00146"></a>00146 <span class="comment">//apply settings</span> <a name="l00147"></a>00147 QToolTip::setGloballyEnabled( <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a0d92de22ace3b90de4d73b6b32468a42" title="Fetch bool setting.">getBool</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"showTooltips"</span> ) ); <a name="l00148"></a>00148 <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>-><a class="code" href="classTitleWidget.html#afe13bee199cee2ae3c952e12d6cb760b" title="Use animation for rep images?">useAnimation</a>( <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a0d92de22ace3b90de4d73b6b32468a42" title="Fetch bool setting.">getBool</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"animation"</span> ) ); <a name="l00149"></a>00149 <span class="comment">//------------------------------------------------</span> <a name="l00150"></a>00150 } <a name="l00151"></a>00151 <span class="comment">//==============================================</span> <a name="l00152"></a><a class="code" href="classWindow.html#a245d821e6016fa1f6970ccbbedd635f6">00152</a> <a class="code" href="classWindow.html#a245d821e6016fa1f6970ccbbedd635f6" title="Save user settings on destruct.">Window::~Window</a>() <a name="l00153"></a>00153 { <a name="l00154"></a>00154 <span class="comment">//flush and reinsert recent albums listing</span> <a name="l00155"></a>00155 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a38d952550fafd2bc05317cad18a9c24e" title="Removes an entire group of settings.">removeGroup</a>( <span class="stringliteral">"recentAlbums"</span> ); <a name="l00156"></a>00156 <a class="code" href="classRecentAlbums.html" title="This class maintains and handles saving and loading a list of recently viewed albums...">RecentAlbums</a>* recentAlbums = <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>-><a class="code" href="classTitleWidget.html#a2a0da317e4152e366dd459ee9ebf54cb" title="returns handle to recent albums object">getRecentAlbums</a>(); <a name="l00157"></a>00157 <span class="keywordtype">int</span> num = recentAlbums-><a class="code" href="classRecentAlbums.html#a9317f48a9b255a663f8581dccd7871a1">numEntries</a>(); <a name="l00158"></a>00158 <span class="keywordtype">int</span> i; <a name="l00159"></a>00159 QString albumName, albumLocation, albumPhotoCount; <a name="l00160"></a>00160 <span class="keywordflow">for</span>(i=0; i<num; i++) <a name="l00161"></a>00161 { <a name="l00162"></a>00162 recentAlbums-><a class="code" href="classRecentAlbums.html#a42c965a7ddc3cd255c99489ce08ffd9f">getEntry</a>( i, albumName, albumLocation, albumPhotoCount ); <a name="l00163"></a>00163 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#acc6935858bf26f6d44c78401fc93d975" title="Sets a setting value, if group does not exist it is created, if setting does not...">setString</a>( <span class="stringliteral">"recentAlbums"</span>, QString(<span class="stringliteral">"%1_name"</span>).arg(i), albumName ); <a name="l00164"></a>00164 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#acc6935858bf26f6d44c78401fc93d975" title="Sets a setting value, if group does not exist it is created, if setting does not...">setString</a>( <span class="stringliteral">"recentAlbums"</span>, QString(<span class="stringliteral">"%1_location"</span>).arg(i), albumLocation ); <a name="l00165"></a>00165 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#acc6935858bf26f6d44c78401fc93d975" title="Sets a setting value, if group does not exist it is created, if setting does not...">setString</a>( <span class="stringliteral">"recentAlbums"</span>, QString(<span class="stringliteral">"%1_photoCount"</span>).arg(i), albumPhotoCount ); <a name="l00166"></a>00166 } <a name="l00167"></a>00167 <a name="l00168"></a>00168 <span class="comment">//store window size and placement in config object</span> <a name="l00169"></a>00169 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a735d3e91a3a767567371e8ccd940b6e3" title="Set int setting.">setInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowPosX"</span>, pos().x() ); <a name="l00170"></a>00170 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a735d3e91a3a767567371e8ccd940b6e3" title="Set int setting.">setInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowPosY"</span>, pos().y() ); <a name="l00171"></a>00171 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a735d3e91a3a767567371e8ccd940b6e3" title="Set int setting.">setInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowWidth"</span>, size().<a class="code" href="blur_8cpp.html#a2474a5474cbff19523a51eb1de01cda4">width</a>() ); <a name="l00172"></a>00172 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a735d3e91a3a767567371e8ccd940b6e3" title="Set int setting.">setInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowHeight"</span>, size().<a class="code" href="blur_8cpp.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>() ); <a name="l00173"></a>00173 <a name="l00174"></a>00174 <span class="comment">//save user settings</span> <a name="l00175"></a>00175 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#ac50b64311aca702f82bb6b5aabba7d2c" title="Saves settings.">saveSettings</a>(); <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="comment">//delete non-qt objects</span> <a name="l00178"></a>00178 <span class="keyword">delete</span> <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>; <a name="l00179"></a>00179 <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a> = NULL; <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <span class="comment">//==============================================</span> <a name="l00182"></a><a class="code" href="classWindow.html#a04266b8ffe0013bee23b57701e1e6b61">00182</a> <a class="code" href="classTitleWidget.html" title="Widget which displays album name, description, representative image, and album shaper...">TitleWidget</a>* <a class="code" href="classWindow.html#a04266b8ffe0013bee23b57701e1e6b61" title="returns a pointer to the title widget">Window::getTitle</a>() <a name="l00183"></a>00183 { <a name="l00184"></a>00184 <span class="keywordflow">return</span> <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>; <a name="l00185"></a>00185 } <a name="l00186"></a>00186 <span class="comment">//==============================================</span> <a name="l00187"></a><a class="code" href="classWindow.html#a28288fa350835ef1ddfc8709c5299d1a">00187</a> <a class="code" href="classLayoutWidget.html" title="Displays list of subalbums and a particular subalbum layout.">LayoutWidget</a>* <a class="code" href="classWindow.html#a28288fa350835ef1ddfc8709c5299d1a" title="returns a pointer to the layout object">Window::getLayout</a>() <a name="l00188"></a>00188 { <a name="l00189"></a>00189 <span class="keywordflow">return</span> <a class="code" href="classWindow.html#aa9256112e47e84f8b9169bcd9b964e94" title="Layout includes subalbums listing and particular subalbum layout.">layout</a>; <a name="l00190"></a>00190 } <a name="l00191"></a>00191 <span class="comment">//==============================================</span> <a name="l00192"></a><a class="code" href="classWindow.html#a8bc149788c6ed44ae27f22e72392cdf6">00192</a> <a class="code" href="classStatusWidget.html">StatusWidget</a>* <a class="code" href="classWindow.html#a8bc149788c6ed44ae27f22e72392cdf6" title="returns a pointer to the status widget">Window::getStatus</a>() <a name="l00193"></a>00193 { <a name="l00194"></a>00194 <span class="keywordflow">return</span> <a class="code" href="classWindow.html#a4772a1f167bbfaa4c76eb3f91e7e5728" title="Status widget either displays a status message or progress bar.">status</a>; <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <span class="comment">//==============================================</span> <a name="l00197"></a><a class="code" href="classWindow.html#ad1a027c3630d4e1a6395bcf1f761e5d8">00197</a> <span class="keywordtype">void</span> <a class="code" href="classWindow.html#ad1a027c3630d4e1a6395bcf1f761e5d8" title="refreshes the layout">Window::refresh</a>() <a name="l00198"></a>00198 { <a name="l00199"></a>00199 <a class="code" href="classWindow.html#aa9256112e47e84f8b9169bcd9b964e94" title="Layout includes subalbums listing and particular subalbum layout.">layout</a>-><a class="code" href="classLayoutWidget.html#a675b2bae5415c2ca668edb460d9f908e" title="Refreshes layout.">refresh</a>(); <a name="l00200"></a>00200 } <a name="l00201"></a>00201 <span class="comment">//==============================================</span> <a name="l00202"></a><a class="code" href="classWindow.html#ae178e8e59e66b1a57b095b9cde086ce2">00202</a> <span class="keywordtype">void</span> <a class="code" href="classWindow.html#ae178e8e59e66b1a57b095b9cde086ce2">Window::closeEvent</a>( QCloseEvent* e) <a name="l00203"></a>00203 { <a name="l00204"></a>00204 <span class="comment">//check if unsaved modifications exist, warn user they</span> <a name="l00205"></a>00205 <span class="comment">//will lose these if they quit now</span> <a name="l00206"></a>00206 <span class="keywordflow">if</span>(<a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>-><a class="code" href="classTitleWidget.html#a13e859247711ac55672705c663d793a4" title="Returns a pointer to the album object.">getAlbum</a>()-><a class="code" href="classAlbum.html#aeaa0e1b807c47f47d96bf5e3d500e1b3" title="Returns true if album has been modified since the last save operation.">albumModified</a>() ) <a name="l00207"></a>00207 { <a name="l00208"></a>00208 <span class="comment">//if user has chosen to not receive destructive action warnings, or agrees to the action then quit</span> <a name="l00209"></a>00209 <span class="keywordtype">bool</span> proceed = (!<a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>-><a class="code" href="classConfiguration.html#a0d92de22ace3b90de4d73b6b32468a42" title="Fetch bool setting.">getBool</a>( <span class="stringliteral">"alerts"</span>, <span class="stringliteral">"showDestructiveAlerts"</span> )); <a name="l00210"></a>00210 <span class="keywordflow">if</span>(!proceed) <a name="l00211"></a>00211 { <a name="l00212"></a>00212 <a class="code" href="classQuestionDialog.html" title="A configurable question dialog that returns true/false.">QuestionDialog</a> sure( tr(<span class="stringliteral">"Quit without saving?"</span>), <a name="l00213"></a>00213 tr(<span class="stringliteral">"You have unsaved work. Are you sure you want to quit without saving?"</span>), <a name="l00214"></a>00214 <span class="stringliteral">"alertIcons/warning.png"</span>, <a name="l00215"></a>00215 <span class="keyword">this</span> ); <a name="l00216"></a>00216 proceed = sure.exec(); <a name="l00217"></a>00217 } <a name="l00218"></a>00218 <span class="keywordflow">if</span>(proceed) <a name="l00219"></a>00219 e->accept(); <a name="l00220"></a>00220 <span class="keywordflow">else</span> <a name="l00221"></a>00221 e->ignore(); <a name="l00222"></a>00222 } <a name="l00223"></a>00223 <span class="keywordflow">else</span> <a name="l00224"></a>00224 { <a name="l00225"></a>00225 e->accept(); <a name="l00226"></a>00226 } <a name="l00227"></a>00227 } <a name="l00228"></a>00228 <span class="comment">//==============================================</span> <a name="l00229"></a><a class="code" href="classWindow.html#aec811812e8330b6a01ee9b424b98935b">00229</a> <a class="code" href="classConfiguration.html" title="Configuration object manages all user-specific application settings.">Configuration</a>* <a class="code" href="classWindow.html#aec811812e8330b6a01ee9b424b98935b" title="get setting object">Window::getConfig</a>() <a name="l00230"></a>00230 { <a name="l00231"></a>00231 <span class="keywordflow">return</span> <a class="code" href="classWindow.html#ae1d7398fa6a244bf126b6ee5d5c88491" title="Configuration settings.">config</a>; <a name="l00232"></a>00232 } <a name="l00233"></a>00233 <span class="comment">//==============================================</span> <a name="l00234"></a>00234 <span class="comment">/*</span> <a name="l00235"></a>00235 <span class="comment"> void Window::startSlideshowAtBeginning()</span> <a name="l00236"></a>00236 <span class="comment">{</span> <a name="l00237"></a>00237 <span class="comment"> startSlideshow(true);</span> <a name="l00238"></a>00238 <span class="comment">} </span> <a name="l00239"></a>00239 <span class="comment">//==============================================</span> <a name="l00240"></a>00240 <span class="comment">void Window::startSlideshowWithSelectedPhoto()</span> <a name="l00241"></a>00241 <span class="comment">{</span> <a name="l00242"></a>00242 <span class="comment"> startSlideshow(false); </span> <a name="l00243"></a>00243 <span class="comment">}</span> <a name="l00244"></a>00244 <span class="comment">//==============================================</span> <a name="l00245"></a>00245 <span class="comment"> void Window::startSlideshow( bool startAtBeginning )</span> <a name="l00246"></a>00246 <span class="comment">{ </span> <a name="l00247"></a>00247 <span class="comment"> //setup presentation</span> <a name="l00248"></a>00248 <span class="comment"> if( startAtBeginning ) </span> <a name="l00249"></a>00249 <span class="comment"> {</span> <a name="l00250"></a>00250 <span class="comment"> //start the slideshow</span> <a name="l00251"></a>00251 <span class="comment"> slideshow->beginSlideshow(title->getAlbum());</span> <a name="l00252"></a>00252 <span class="comment"> }</span> <a name="l00253"></a>00253 <span class="comment"> else</span> <a name="l00254"></a>00254 <span class="comment"> {</span> <a name="l00255"></a>00255 <span class="comment"> //get selected collection</span> <a name="l00256"></a>00256 <span class="comment"> Subalbum* startCollection = layout->getSubalbums()->getSelectedSubalbum();</span> <a name="l00257"></a>00257 <span class="comment"> </span> <a name="l00258"></a>00258 <span class="comment"> //get selected photo.if no photos selected in collection then we'll start with first photo in collection</span> <a name="l00259"></a>00259 <span class="comment"> Photo* startPhoto = layout->getSubalbum()->getFirstSelectedPhoto();</span> <a name="l00260"></a>00260 <span class="comment"> if(startPhoto == NULL) startPhoto = startCollection->getFirst();</span> <a name="l00261"></a>00261 <span class="comment"></span> <a name="l00262"></a>00262 <span class="comment"> //start the slideshow</span> <a name="l00263"></a>00263 <span class="comment"> slideshow->beginSlideshow( title->getAlbum(), </span> <a name="l00264"></a>00264 <span class="comment"> startCollection, startPhoto );</span> <a name="l00265"></a>00265 <span class="comment"> }</span> <a name="l00266"></a>00266 <span class="comment"></span> <a name="l00267"></a>00267 <span class="comment"> //hide title, layout, and status widgets</span> <a name="l00268"></a>00268 <span class="comment"> //show slideshow region fullscreen</span> <a name="l00269"></a>00269 <span class="comment"> grid->setColStretch(0, 0 ); </span> <a name="l00270"></a>00270 <span class="comment"> grid->setColStretch(1, 1 ); </span> <a name="l00271"></a>00271 <span class="comment"> title->hide();</span> <a name="l00272"></a>00272 <span class="comment"> layout->hide();</span> <a name="l00273"></a>00273 <span class="comment"> status->hide();</span> <a name="l00274"></a>00274 <span class="comment"> slideshow->show();</span> <a name="l00275"></a>00275 <span class="comment"> slideshow->setFocus(); </span> <a name="l00276"></a>00276 <span class="comment"> </span> <a name="l00277"></a>00277 <span class="comment"> //PLATFORM_SPECIFIC_CODE</span> <a name="l00278"></a>00278 <span class="comment"> #if defined(Q_OS_MACX)</span> <a name="l00279"></a>00279 <span class="comment"> SetSystemUIMode(kUIModeAllHidden, NULL);</span> <a name="l00280"></a>00280 <span class="comment"> #endif</span> <a name="l00281"></a>00281 <span class="comment"></span> <a name="l00282"></a>00282 <span class="comment"> showFullScreen();</span> <a name="l00283"></a>00283 <span class="comment">}</span> <a name="l00284"></a>00284 <span class="comment">//==============================================</span> <a name="l00285"></a>00285 <span class="comment">void Window::endSlideshow()</span> <a name="l00286"></a>00286 <span class="comment">{</span> <a name="l00287"></a>00287 <span class="comment"> //exit from fullscreen mode</span> <a name="l00288"></a>00288 <span class="comment"> showNormal();</span> <a name="l00289"></a>00289 <span class="comment"></span> <a name="l00290"></a>00290 <span class="comment"> //PLATFORM_SPECIFIC_CODE</span> <a name="l00291"></a>00291 <span class="comment"> #if defined(Q_OS_MACX)</span> <a name="l00292"></a>00292 <span class="comment"> SetSystemUIMode(kUIModeNormal, NULL);</span> <a name="l00293"></a>00293 <span class="comment"> #endif</span> <a name="l00294"></a>00294 <span class="comment"> </span> <a name="l00295"></a>00295 <span class="comment"> //give collection contents keyboard focus and select</span> <a name="l00296"></a>00296 <span class="comment"> //and ensure visibility of last shown photo during presentation</span> <a name="l00297"></a>00297 <span class="comment"> layout->getSubalbum()->getPhotos()->setFocus();</span> <a name="l00298"></a>00298 <span class="comment"> </span> <a name="l00299"></a>00299 <span class="comment"> Subalbum* tmpCollection = slideshow->getCurCollection();</span> <a name="l00300"></a>00300 <span class="comment"> Photo* tmpPhoto = slideshow->getCurPhoto();</span> <a name="l00301"></a>00301 <span class="comment"></span> <a name="l00302"></a>00302 <span class="comment"> if(tmpCollection != NULL)</span> <a name="l00303"></a>00303 <span class="comment"> {</span> <a name="l00304"></a>00304 <span class="comment"> layout->getSubalbums()->setSelectedSubalbum( tmpCollection ); </span> <a name="l00305"></a>00305 <span class="comment"> if(tmpPhoto != NULL) </span> <a name="l00306"></a>00306 <span class="comment"> { </span> <a name="l00307"></a>00307 <span class="comment"> layout->getSubalbum()->setSelectedPhoto( tmpPhoto ); </span> <a name="l00308"></a>00308 <span class="comment"> } </span> <a name="l00309"></a>00309 <span class="comment"> }</span> <a name="l00310"></a>00310 <span class="comment"> </span> <a name="l00311"></a>00311 <span class="comment"> //hide slideshow and bring title, layout, and status back up</span> <a name="l00312"></a>00312 <span class="comment"> title->show();</span> <a name="l00313"></a>00313 <span class="comment"> layout->show();</span> <a name="l00314"></a>00314 <span class="comment"> status->show();</span> <a name="l00315"></a>00315 <span class="comment"> slideshow->hide();</span> <a name="l00316"></a>00316 <span class="comment"> grid->setColStretch(1, 0 ); </span> <a name="l00317"></a>00317 <span class="comment"> grid->setColStretch(0, 1 ); </span> <a name="l00318"></a>00318 <span class="comment"> </span> <a name="l00319"></a>00319 <span class="comment">}</span> <a name="l00320"></a>00320 <span class="comment">*/</span> <a name="l00321"></a>00321 <span class="comment">//==============================================</span> <a name="l00322"></a><a class="code" href="classWindow.html#ac9bfe27da2eeb607e01d609176ac6352">00322</a> <span class="keywordtype">bool</span> <a class="code" href="classWindow.html#ac9bfe27da2eeb607e01d609176ac6352">Window::event</a>( QEvent *e ) <a name="l00323"></a>00323 { <a name="l00324"></a>00324 <span class="comment">//if base class handles event return immediately</span> <a name="l00325"></a>00325 <span class="keywordflow">if</span> (QWidget::event( e ) ) <a name="l00326"></a>00326 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00327"></a>00327 <a name="l00328"></a>00328 <span class="comment">//handle showMinimized events</span> <a name="l00329"></a>00329 <span class="keywordflow">if</span> ( e->type() == QEvent::ShowMinimized ) <a name="l00330"></a>00330 { <a name="l00331"></a>00331 <span class="comment">//update menu entries as per window state change</span> <a name="l00332"></a>00332 <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>-><a class="code" href="classTitleWidget.html#a0a6f3639ae6754822b109705d13a0b6c" title="Enables/disables &quot;minimize&quot; window menu entry depending on window state...">windowStateChanged</a>( <span class="keyword">false</span> ); <a name="l00333"></a>00333 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00334"></a>00334 } <a name="l00335"></a>00335 <a name="l00336"></a>00336 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00337"></a>00337 } <a name="l00338"></a>00338 <span class="comment">//==============================================</span> <a name="l00339"></a><a class="code" href="classWindow.html#ab4ef602b5a726a6a05c002b987ca2bc2">00339</a> <span class="keywordtype">void</span> <a class="code" href="classWindow.html#ab4ef602b5a726a6a05c002b987ca2bc2">Window::hideEvent</a>( QHideEvent *) <a name="l00340"></a>00340 { <a name="l00341"></a>00341 <span class="comment">//update menu entries as per window state change</span> <a name="l00342"></a>00342 <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>-><a class="code" href="classTitleWidget.html#a0a6f3639ae6754822b109705d13a0b6c" title="Enables/disables &quot;minimize&quot; window menu entry depending on window state...">windowStateChanged</a>( <span class="keyword">false</span> ); <a name="l00343"></a>00343 } <a name="l00344"></a>00344 <span class="comment">//==============================================</span> <a name="l00345"></a><a class="code" href="classWindow.html#a559488ac63221b8ef70a2c132a48f0f9">00345</a> <span class="keywordtype">void</span> <a class="code" href="classWindow.html#a559488ac63221b8ef70a2c132a48f0f9">Window::showEvent</a> ( QShowEvent * ) <a name="l00346"></a>00346 { <a name="l00347"></a>00347 <span class="comment">//update menu entries as per window state change</span> <a name="l00348"></a>00348 <a class="code" href="classWindow.html#a1fba4880e5580e15778428ba5d499499" title="Title widget cont ains menu&#39;s, album information and Album Shaper icon.">title</a>-><a class="code" href="classTitleWidget.html#a0a6f3639ae6754822b109705d13a0b6c" title="Enables/disables &quot;minimize&quot; window menu entry depending on window state...">windowStateChanged</a>( <span class="keyword">true</span> ); <a name="l00349"></a>00349 } <a name="l00350"></a>00350 <span class="comment">//==============================================</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>