<!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: main.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>main.cpp</h1><a href="main_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 <qapplication.h></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <qlayout.h></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <qtranslator.h></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <qtextcodec.h></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <qdir.h></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <iostream></span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="comment">//PLATFORM_SPECIFIC_CODE</span> <a name="l00020"></a>00020 <span class="preprocessor">#if defined(Q_OS_MACX)</span> <a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#include <CoreFoundation/CFURL.h></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <CoreFoundation/CFBundle.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">//PLATFORM_SPECIFIC_CODE</span> <a name="l00026"></a>00026 <span class="comment">//VC7 or later, building with pre-VC7 runtime libraries</span> <a name="l00027"></a>00027 <span class="preprocessor">#if defined(Q_OS_WIN)</span> <a name="l00028"></a>00028 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> <span class="keywordtype">long</span> _ftol( <span class="keywordtype">double</span> ); <span class="comment">//defined by VC6 C libs</span> <a name="l00029"></a>00029 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> <span class="keywordtype">long</span> _ftol2( <span class="keywordtype">double</span> dblSource ) { <span class="keywordflow">return</span> _ftol( dblSource ); } <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="preprocessor">#include <stdlib.h></span> <a name="l00032"></a>00032 <span class="preprocessor">#endif</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00034"></a>00034 <span class="comment">//Projectwide includes</span> <a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="cursors_8h.html">gui/cursors.h</a>"</span> <a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="window_8h.html">gui/window.h</a>"</span> <a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="alertDialog_8h.html">gui/dialogs/alertDialog.h</a>"</span> <a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="welcomeWindow_8h.html">gui/welcomeWindow/welcomeWindow.h</a>"</span> <a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="guiTools_8h.html">backend/tools/guiTools.h</a>"</span> <a name="l00040"></a>00040 <span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span> <a name="l00041"></a>00041 <span class="preprocessor">#include "<a class="code" href="configuration_8h.html">configuration/configuration.h</a>"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="layoutSettingsWidget_8h.html">configuration/layoutSettingsWidget.h</a>"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="fileTools_8h.html">backend/tools/fileTools.h</a>"</span> <a name="l00044"></a>00044 <a name="l00050"></a><a class="code" href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">00050</a> <span class="keywordtype">int</span> <a class="code" href="main_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>( <span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv) <a name="l00051"></a>00051 { <a name="l00052"></a>00052 <span class="comment">//create app</span> <a name="l00053"></a>00053 QApplication a(argc, argv); <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="comment">//----------------------------------------------</span> <a name="l00056"></a>00056 <span class="comment">//set material path</span> <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="comment">//PLATFORM_SPECIFIC_CODE</span> <a name="l00059"></a>00059 <a name="l00060"></a>00060 <span class="comment">//if using mac os x material dir in bundle</span> <a name="l00061"></a>00061 <span class="preprocessor"> #if defined(Q_OS_MACX)</span> <a name="l00062"></a>00062 <span class="preprocessor"></span> CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); <a name="l00063"></a>00063 CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, kCFURLPOSIXPathStyle); <a name="l00064"></a>00064 <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> = QString( CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding())) + <span class="stringliteral">"/Contents/Resources"</span>; <a name="l00065"></a>00065 <a name="l00066"></a>00066 <span class="comment">//Windows</span> <a name="l00067"></a>00067 <span class="preprocessor"> #elif defined(Q_OS_WIN)</span> <a name="l00068"></a>00068 <span class="preprocessor"></span> <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> = a.applicationDirPath(); <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="comment">//Linux/FreeBSD - material path may be passed in or assumed to be the local path</span> <a name="l00071"></a>00071 <span class="preprocessor"> #else</span> <a name="l00072"></a>00072 <span class="preprocessor"></span> <span class="keywordflow">if</span>( argc > 1 ) <a name="l00073"></a>00073 { <a name="l00074"></a>00074 <span class="comment">//user is running program from installed location (e.g. /usr/bin)</span> <a name="l00075"></a>00075 <span class="comment">//in which case we must assume material files are installed in the defined location</span> <a name="l00076"></a>00076 <span class="keywordflow">if</span>( QString(argv[1]).contains(QString(BIN_DIR)) != 0 ) <a name="l00077"></a>00077 { <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> = DATA_DIR; } <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="comment">//if the above is not the case assume the user is running a non-installed copy of Album Shaper</span> <a name="l00080"></a>00080 <span class="comment">// (say right after compiling it, in which case the materials should be in the same location so</span> <a name="l00081"></a>00081 <span class="comment">//use application dir path directly</span> <a name="l00082"></a>00082 <span class="keywordflow">else</span> <a name="l00083"></a>00083 { <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> = QString(argv[1]); } <a name="l00084"></a>00084 } <a name="l00085"></a>00085 <span class="comment">//if the binary is run directly assume we're in the same directory as it and use the</span> <a name="l00086"></a>00086 <span class="comment">//current directory to load materials from</span> <a name="l00087"></a>00087 <span class="keywordflow">else</span> <a name="l00088"></a>00088 <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> = <span class="stringliteral">"./"</span>; <a name="l00089"></a>00089 <span class="preprocessor"> #endif</span> <a name="l00090"></a>00090 <span class="preprocessor"></span> <a name="l00091"></a>00091 <span class="comment">//----------------------------------------------</span> <a name="l00092"></a>00092 <span class="comment">//set image path</span> <a name="l00093"></a>00093 <a class="code" href="config_8cpp.html#a59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a> = <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/images/"</span>; <a name="l00094"></a>00094 <span class="comment">//----------------------------------------------</span> <a name="l00095"></a>00095 <span class="comment">//set handbook path, attempt to use locale specific directory, otherwise fall back on english default</span> <a name="l00096"></a>00096 <a class="code" href="config_8cpp.html#a4bc87c92b168e603498fe15b28731546">HANDBOOK_PATH</a> = <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/handbook_"</span> + QTextCodec::locale() + <span class="stringliteral">"/"</span>; <a name="l00097"></a>00097 QDir handbookDir( <a class="code" href="config_8cpp.html#a4bc87c92b168e603498fe15b28731546">HANDBOOK_PATH</a> ); <a name="l00098"></a>00098 <span class="keywordflow">if</span>(!handbookDir.exists()) <a name="l00099"></a>00099 <a class="code" href="config_8cpp.html#a4bc87c92b168e603498fe15b28731546">HANDBOOK_PATH</a> = <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/handbook/"</span>; <a name="l00100"></a>00100 <span class="comment">//----------------------------------------------</span> <a name="l00101"></a>00101 <span class="comment">//set text path, attempt to use locale specific directory, otherwise fall back on english default</span> <a name="l00102"></a>00102 <a class="code" href="config_8cpp.html#a38a1225755e3d73fbeac5c25b68dd5bc">TEXT_PATH</a> = <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/text_"</span> + QTextCodec::locale() + <span class="stringliteral">"/"</span>; <a name="l00103"></a>00103 QDir textDir( <a class="code" href="config_8cpp.html#a38a1225755e3d73fbeac5c25b68dd5bc">TEXT_PATH</a> ); <a name="l00104"></a>00104 <span class="keywordflow">if</span>(!textDir.exists()) <a name="l00105"></a>00105 <a class="code" href="config_8cpp.html#a38a1225755e3d73fbeac5c25b68dd5bc">TEXT_PATH</a> = <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/text/"</span>; <a name="l00106"></a>00106 <span class="comment">//----------------------------------------------</span> <a name="l00107"></a>00107 <span class="comment">//set themes path</span> <a name="l00108"></a>00108 <a class="code" href="config_8cpp.html#aee0cb822aa7f2b785c390ae0099e22a9">THEMES_PATH</a> = <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/themes/"</span>; <a name="l00109"></a>00109 <span class="comment">//----------------------------------------------</span> <a name="l00110"></a>00110 <span class="comment">//set xml conversion path</span> <a name="l00111"></a>00111 <a class="code" href="config_8cpp.html#a37fb048dd9e688cc6db1f51b8c132971">XMLCONVERSION_PATH</a> = <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/xmlConversion/"</span>; <a name="l00112"></a>00112 <span class="comment">//----------------------------------------------</span> <a name="l00113"></a>00113 <span class="comment">//check that directory where user settings is stored exists, if not create</span> <a name="l00114"></a>00114 <span class="comment">//that directory at this time.</span> <a name="l00115"></a>00115 <span class="keywordflow">if</span>( !<a class="code" href="classConfiguration.html#af1a925453f6440cea68e5f216cfa62b7" title="Constructs any necessary directories for loading and saving user settings, returns...">Configuration::constructSettingsDirectory</a>() ) <a name="l00116"></a>00116 { <a name="l00117"></a>00117 std::cout << <span class="stringliteral">"Error! Unable to make configurations directory!\n"</span>; <a name="l00118"></a>00118 <span class="keywordflow">return</span> -1; <a name="l00119"></a>00119 } <a name="l00120"></a>00120 <span class="comment">//----------------------------------------------</span> <a name="l00121"></a>00121 <span class="comment">//where temporary files can be placed</span> <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="comment">//PLATFORM_SPECIFIC_CODE</span> <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="keywordtype">bool</span> tempDirMade = <span class="keyword">true</span>; <a name="l00126"></a>00126 QDir homeDir; <a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="comment">//Mac OS X</span> <a name="l00129"></a>00129 <span class="preprocessor"> #if defined(Q_OS_MACX)</span> <a name="l00130"></a>00130 <span class="preprocessor"></span> homeDir = QDir::homeDirPath(); <a name="l00131"></a>00131 homeDir.cd(<span class="stringliteral">"Library"</span>); <a name="l00132"></a>00132 homeDir.cd(<span class="stringliteral">"Application Support"</span>); <a name="l00133"></a>00133 <span class="keywordflow">if</span>(!homeDir.exists(<span class="stringliteral">"Album Shaper"</span>)) <a name="l00134"></a>00134 { tempDirMade = homeDir.mkdir(<span class="stringliteral">"Album Shaper"</span>); } <a name="l00135"></a>00135 <a class="code" href="config_8cpp.html#a8e603096352908a187b5364096a8d581">TEMP_DIR</a> = QDir::convertSeparators( QDir::homeDirPath() + QString(<span class="stringliteral">"/Library/Application Support/Album Shaper"</span>) ); <a name="l00136"></a>00136 <a name="l00137"></a>00137 <span class="comment">//Windows</span> <a name="l00138"></a>00138 <span class="preprocessor"> #elif defined(Q_OS_WIN)</span> <a name="l00139"></a>00139 <span class="preprocessor"></span> QString folderLoc; <a name="l00140"></a>00140 <span class="keywordflow">if</span>( !getWindowsFolderLocation(APPLICATION_DATA, folderLoc) ) <a name="l00141"></a>00141 { <a name="l00142"></a>00142 std::cout << <span class="stringliteral">"Error! Unable to identify Application Data folder!\n"</span>; <a name="l00143"></a>00143 <span class="keywordflow">return</span> -1; <a name="l00144"></a>00144 } <a name="l00145"></a>00145 <a name="l00146"></a>00146 QDir applicationDataDir( folderLoc ); <a name="l00147"></a>00147 <span class="keywordflow">if</span>(!applicationDataDir.exists(<span class="stringliteral">"Album Shaper"</span>)) <a name="l00148"></a>00148 { tempDirMade = applicationDataDir.mkdir(<span class="stringliteral">"Album Shaper"</span>); } <a name="l00149"></a>00149 <a class="code" href="config_8cpp.html#a8e603096352908a187b5364096a8d581">TEMP_DIR</a> = QDir::convertSeparators ( folderLoc + QString(<span class="stringliteral">"/Album Shaper"</span>) ); <a name="l00150"></a>00150 <a name="l00151"></a>00151 <span class="comment">//Unix/Linux/BSD</span> <a name="l00152"></a>00152 <span class="preprocessor"> #else</span> <a name="l00153"></a>00153 <span class="preprocessor"></span> homeDir = QDir::homeDirPath(); <a name="l00154"></a>00154 <span class="keywordflow">if</span>(!homeDir.exists(<span class="stringliteral">".albumShaper"</span>)) { tempDirMade = homeDir.mkdir(<span class="stringliteral">".albumShaper"</span>); } <a name="l00155"></a>00155 <a class="code" href="config_8cpp.html#a8e603096352908a187b5364096a8d581">TEMP_DIR</a> = QDir::homeDirPath() + QString(<span class="stringliteral">"/.albumShaper"</span>); <a name="l00156"></a>00156 <span class="preprocessor"> #endif</span> <a name="l00157"></a>00157 <span class="preprocessor"></span> <a name="l00158"></a>00158 <span class="comment">//if unable to make configuration directory then abort</span> <a name="l00159"></a>00159 <span class="keywordflow">if</span>(!tempDirMade) <a name="l00160"></a>00160 { <a name="l00161"></a>00161 std::cout << <span class="stringliteral">"Error! Unable to make temp files directory!\n"</span>; <a name="l00162"></a>00162 <span class="keywordflow">return</span> -1; <a name="l00163"></a>00163 } <a name="l00164"></a>00164 <span class="comment">//----------------------------------------------</span> <a name="l00165"></a>00165 <span class="comment">//create translator for current locale and attempt to install</span> <a name="l00166"></a>00166 QTranslator translator( 0 ); <a name="l00167"></a>00167 translator.load( QString(<span class="stringliteral">"AlbumShaper_"</span>) + <a name="l00168"></a>00168 <span class="comment">// "sv",</span> <a name="l00169"></a>00169 QTextCodec::locale(), <a name="l00170"></a>00170 <a class="code" href="config_8cpp.html#af98302372be62540a6ee5b814fc1b0d0">MATERIAL_DIR</a> + <span class="stringliteral">"/translations"</span>); <a name="l00171"></a>00171 <a name="l00172"></a>00172 a.installTranslator( &translator ); <a name="l00173"></a>00173 <a name="l00174"></a>00174 <span class="comment">//create main window and show</span> <a name="l00175"></a>00175 <a class="code" href="classWindow.html" title="Top level widget, encapsulates the title widget, the layout widget, and the toolbar...">Window</a> window; <a name="l00176"></a>00176 a.setMainWidget( &window ); <a name="l00177"></a>00177 <span class="comment">//----------------------------------------------</span> <a name="l00178"></a>00178 <span class="comment">//set window size and position</span> <a name="l00179"></a>00179 <a class="code" href="classConfiguration.html" title="Configuration object manages all user-specific application settings.">Configuration</a>* config = window.<a class="code" href="classWindow.html#aec811812e8330b6a01ee9b424b98935b" title="get setting object">getConfig</a>(); <a name="l00180"></a>00180 <span class="keywordflow">if</span>( config-><a class="code" href="classConfiguration.html#a0d92de22ace3b90de4d73b6b32468a42" title="Fetch bool setting.">getBool</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"restoreWindowPlacementSize"</span>) ) <a name="l00181"></a>00181 { <a name="l00182"></a>00182 window.resize( config-><a class="code" href="classConfiguration.html#af4e92490c6799dddb0eb0c69ead27a0a" title="Fetch int setting.">getInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowWidth"</span> ), <a name="l00183"></a>00183 config-><a class="code" href="classConfiguration.html#af4e92490c6799dddb0eb0c69ead27a0a" title="Fetch int setting.">getInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowHeight"</span> ) ); <a name="l00184"></a>00184 <a name="l00185"></a>00185 window.move( config-><a class="code" href="classConfiguration.html#af4e92490c6799dddb0eb0c69ead27a0a" title="Fetch int setting.">getInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowPosX"</span> ), <a name="l00186"></a>00186 config-><a class="code" href="classConfiguration.html#af4e92490c6799dddb0eb0c69ead27a0a" title="Fetch int setting.">getInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"windowPosY"</span> ) ); <a name="l00187"></a>00187 } <a name="l00188"></a>00188 <span class="keywordflow">else</span> <a name="l00189"></a>00189 { <a name="l00190"></a>00190 QDesktopWidget *desktop = QApplication::desktop(); <a name="l00191"></a>00191 <span class="keywordtype">int</span> size = config-><a class="code" href="classConfiguration.html#af4e92490c6799dddb0eb0c69ead27a0a" title="Fetch int setting.">getInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"defaultWindowSize"</span> ); <a name="l00192"></a>00192 <span class="keywordtype">int</span> placement = config-><a class="code" href="classConfiguration.html#af4e92490c6799dddb0eb0c69ead27a0a" title="Fetch int setting.">getInt</a>( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"defaultWindowPlacement"</span> ); <a name="l00193"></a>00193 <a name="l00194"></a>00194 QRect availRect = desktop->availableGeometry(); <a name="l00195"></a>00195 <span class="keywordtype">int</span> <a class="code" href="blur_8cpp.html#a2474a5474cbff19523a51eb1de01cda4">width</a> = (size*availRect.width()) / 100; <a name="l00196"></a>00196 <span class="keywordtype">int</span> <a class="code" href="blur_8cpp.html#ad12fc34ce789bce6c8a05d8a17138534">height</a> = (size*availRect.height()) / 100; <a name="l00197"></a>00197 <a name="l00198"></a>00198 window.resize( width, height ); <a name="l00199"></a>00199 width = window.frameGeometry().width(); <a name="l00200"></a>00200 height = window.frameGeometry().height(); <a name="l00201"></a>00201 <a name="l00202"></a>00202 <span class="keywordtype">int</span> x, y; <a name="l00203"></a>00203 <span class="comment">//top left</span> <a name="l00204"></a>00204 <span class="keywordflow">if</span>(placement == <a class="code" href="layoutSettingsWidget_8h.html#a1b0c3083ed9973911de4767aa677f673">TOP_LEFT</a>) <a name="l00205"></a>00205 { <a name="l00206"></a>00206 x = availRect.left(); <a name="l00207"></a>00207 y = availRect.top(); <a name="l00208"></a>00208 } <a name="l00209"></a>00209 <span class="comment">//top right</span> <a name="l00210"></a>00210 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(placement == <a class="code" href="layoutSettingsWidget_8h.html#a80473d4f5c5ff853d7342618295ba314">TOP_RIGHT</a>) <a name="l00211"></a>00211 { <a name="l00212"></a>00212 x = availRect.right() - width; <a name="l00213"></a>00213 y = availRect.top(); <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <span class="comment">//bottom left</span> <a name="l00216"></a>00216 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(placement == <a class="code" href="layoutSettingsWidget_8h.html#a85d1ada414f4f1f10df50ef254c79c75">BOTTOM_LEFT</a>) <a name="l00217"></a>00217 { <a name="l00218"></a>00218 x = availRect.left(); <a name="l00219"></a>00219 y = availRect.bottom() - height; <a name="l00220"></a>00220 } <a name="l00221"></a>00221 <span class="comment">//bottom right</span> <a name="l00222"></a>00222 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(placement == <a class="code" href="layoutSettingsWidget_8h.html#a9c05beaff6794473029413f2d78589f1">BOTTOM_RIGHT</a>) <a name="l00223"></a>00223 { <a name="l00224"></a>00224 x = availRect.right() - width; <a name="l00225"></a>00225 y = availRect.bottom() - height; <a name="l00226"></a>00226 } <a name="l00227"></a>00227 <span class="comment">//center</span> <a name="l00228"></a>00228 <span class="keywordflow">else</span> <a name="l00229"></a>00229 { <a name="l00230"></a>00230 x = availRect.left() + (availRect.width() - width) / 2; <a name="l00231"></a>00231 y = availRect.top() + (availRect.height() - height) / 2; <a name="l00232"></a>00232 } <a name="l00233"></a>00233 <a name="l00234"></a>00234 <span class="comment">//place window</span> <a name="l00235"></a>00235 window.move( x, y ); <a name="l00236"></a>00236 } <a name="l00237"></a>00237 window.show(); <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="comment">//load cursors</span> <a name="l00240"></a>00240 <a class="code" href="cursors_8cpp.html#a764dca27451cf6c1c418e7e753fc336c">loadCursors</a>(); <a name="l00241"></a>00241 <a name="l00242"></a>00242 <span class="comment">//-----------------------------------</span> <a name="l00243"></a>00243 <span class="comment">//if this is a CVS build and cvsWarn set warn</span> <a name="l00244"></a>00244 <span class="comment">//user that application is potentially unstable!</span> <a name="l00245"></a>00245 <span class="preprocessor"> #ifdef CVS_CODE</span> <a name="l00246"></a>00246 <span class="preprocessor"></span> <span class="keywordflow">if</span>( config-><a class="code" href="classConfiguration.html#a0d92de22ace3b90de4d73b6b32468a42" title="Fetch bool setting.">getBool</a> ( <span class="stringliteral">"misc"</span>, <span class="stringliteral">"cvsWarn"</span> ) ) <a name="l00247"></a>00247 { <a name="l00248"></a>00248 <a class="code" href="classAlertDialog.html" title="A configurable alert dialog that displays an alert/error message.">AlertDialog</a> alert( <span class="stringliteral">"Warning! Unstable build!"</span>, <a name="l00249"></a>00249 QString(<span class="stringliteral">"Warning! You are running a potentially unstable (CVS) build of Album Shaper! It is strongly suggested you only use this copy for testing and evaluation purposes. Data loss may occur!"</span>), <a name="l00250"></a>00250 <span class="stringliteral">"alertIcons/warning.png"</span>, &window ); <a name="l00251"></a>00251 alert.exec(); <a name="l00252"></a>00252 } <a name="l00253"></a>00253 <span class="preprocessor"> #endif</span> <a name="l00254"></a>00254 <span class="preprocessor"></span> <span class="comment">//-----------------------------------</span> <a name="l00255"></a>00255 <span class="comment">//if this is the first time the program is being run then show welcome screen</span> <a name="l00256"></a>00256 <a class="code" href="classWelcomeWindow.html">WelcomeWindow</a>* welcome; <a name="l00257"></a>00257 <span class="keywordflow">if</span>(config-><a class="code" href="classConfiguration.html#a0d92de22ace3b90de4d73b6b32468a42" title="Fetch bool setting.">getBool</a>( <span class="stringliteral">"misc"</span>, <span class="stringliteral">"firstRun"</span> ) ) <a name="l00258"></a>00258 { <a name="l00259"></a>00259 welcome = <span class="keyword">new</span> <a class="code" href="classWelcomeWindow.html">WelcomeWindow</a>(); <a name="l00260"></a>00260 welcome->show(); <a name="l00261"></a>00261 <a class="code" href="guiTools_8cpp.html#a83ad2663db4147621f3ff0007e27bbdb">centerWindow</a>(welcome); <a name="l00262"></a>00262 config-><a class="code" href="classConfiguration.html#a9dd8bba47dda7f0964567656f9514852" title="Set bool setting.">setBool</a>( <span class="stringliteral">"misc"</span>, <span class="stringliteral">"firstRun"</span>, <span class="keyword">false</span> ); <a name="l00263"></a>00263 } <a name="l00264"></a>00264 <span class="comment">//-----------------------------------</span> <a name="l00265"></a>00265 <span class="keywordflow">return</span> a.exec(); <a name="l00266"></a>00266 } </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>