Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 4f45e7bdfd4a5ff17f5f8eaab90d017f > files > 1749

albumshaper-2.1-6mdv2010.0.i586.rpm

<!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: welcomeWindow.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&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>welcomeWindow.cpp</h1><a href="welcomeWindow_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 
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;qlayout.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;qpixmap.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;qlabel.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;qfont.h&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;qpushbutton.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;qpushbutton.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;qapplication.h&gt;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="comment">//Projectwide includes</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="welcomeWindow_8h.html">welcomeWindow.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="items_8h.html">items.h</a>"</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="item_8h.html">item.h</a>"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "../window.h"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "../titleWidget.h"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "../../config.h"</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="comment">//==============================================</span>
<a name="l00030"></a><a class="code" href="classWelcomeWindow.html#be6c7a5c546fe6f496e976ab1ca7ab0b">00030</a> <a class="code" href="classWelcomeWindow.html#be6c7a5c546fe6f496e976ab1ca7ab0b">WelcomeWindow::WelcomeWindow</a>( <a class="code" href="classQWidget.html">QWidget</a>* parent,
<a name="l00031"></a>00031                                                            <span class="keyword">const</span> <span class="keywordtype">char</span>* name ) :
<a name="l00032"></a>00032                                                            <a class="code" href="classQDialog.html">QDialog</a>(parent,name)
<a name="l00033"></a>00033 {
<a name="l00034"></a>00034   <span class="comment">//--------------------------------------------------------------</span>
<a name="l00035"></a>00035   <span class="comment">//set window title</span>
<a name="l00036"></a>00036   setCaption( tr(<span class="stringliteral">"Welcome to Album Shaper"</span>));
<a name="l00037"></a>00037   <span class="comment">//--</span>
<a name="l00038"></a>00038   <a class="code" href="classWelcomeWindow.html#08de3790a2c3050ba8d082f0cfa8c7ae">sideImage</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( <span class="keyword">this</span> );
<a name="l00039"></a>00039   <a class="code" href="classWelcomeWindow.html#08de3790a2c3050ba8d082f0cfa8c7ae">sideImage</a>-&gt;setPixmap( QPixmap( QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>) + <span class="stringliteral">"miscImages/welcome.png"</span> ) );
<a name="l00040"></a>00040   <a class="code" href="classWelcomeWindow.html#08de3790a2c3050ba8d082f0cfa8c7ae">sideImage</a>-&gt;setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
<a name="l00041"></a>00041   <span class="comment">//--</span>
<a name="l00042"></a>00042   <a class="code" href="classQFrame.html">QFrame</a>* itemsFrame = <span class="keyword">new</span> <a class="code" href="classQFrame.html">QFrame</a>(<span class="keyword">this</span>);
<a name="l00043"></a>00043 
<a name="l00044"></a>00044   <a class="code" href="classWelcomeWindow.html#77a1bebe37fb1159678f6cdb32d3ded9">welcomeTitle</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( QString(tr(<span class="stringliteral">"Welcome to Album Shaper %1"</span>)).arg(<a class="code" href="config_8h.html#bb92ba64f4db628dfcc469f96f3af746">ALBUMSHAPER_VERSION</a>), itemsFrame );
<a name="l00045"></a>00045   QFont textFont = <a class="code" href="classWelcomeWindow.html#77a1bebe37fb1159678f6cdb32d3ded9">welcomeTitle</a>-&gt;font();
<a name="l00046"></a>00046   textFont.setWeight(QFont::Bold);
<a name="l00047"></a>00047   textFont.setPointSize( textFont.pointSize() + 2 );
<a name="l00048"></a>00048   <a class="code" href="classWelcomeWindow.html#77a1bebe37fb1159678f6cdb32d3ded9">welcomeTitle</a>-&gt;setFont( textFont );
<a name="l00049"></a>00049   <span class="comment">//--</span>
<a name="l00050"></a>00050   <a class="code" href="classWelcomeWindow.html#e72a27312f7f7a7e218250f7831218e7">welcomeMessage</a> = <span class="keyword">new</span> <a class="code" href="classQLabel.html">QLabel</a>( QString(tr(<span class="stringliteral">"It appears you are a new Album Shaper user! Before you begin creating photo albums, you may want to explore the following features of this program:"</span> ) ), itemsFrame );
<a name="l00051"></a>00051   <a class="code" href="classWelcomeWindow.html#e72a27312f7f7a7e218250f7831218e7">welcomeMessage</a>-&gt;setAlignment( Qt::AlignLeft | Qt::WordBreak | Qt::BreakAnywhere );
<a name="l00052"></a>00052   <span class="comment">//--</span>
<a name="l00053"></a>00053   <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a> = <span class="keyword">new</span> <a class="code" href="classItems.html">Items</a>(itemsFrame);
<a name="l00054"></a>00054   <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;setItemTextPos( QIconView::Right );
<a name="l00055"></a>00055   <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;setMaxItemWidth(500);
<a name="l00056"></a>00056   <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;setFrameShape ( QFrame::NoFrame );
<a name="l00057"></a>00057   <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;setSelectionMode( QIconView::NoSelection ) ;
<a name="l00058"></a>00058 
<a name="l00059"></a>00059   <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
<a name="l00060"></a>00060 
<a name="l00061"></a>00061   <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;setSpacing( <a class="code" href="config_8h.html#07d364596a27705c900f07340515d5db">WIDGET_SPACING</a> );
<a name="l00062"></a>00062 
<a name="l00063"></a>00063   connect( <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>, SIGNAL(clicked(<a class="code" href="classQIconViewItem.html">QIconViewItem</a>*)), <span class="keyword">this</span>, SLOT(<a class="code" href="classWelcomeWindow.html#583b944699ab663b758953b52d6585bf">itemClicked</a>(<a class="code" href="classQIconViewItem.html">QIconViewItem</a>*)) );
<a name="l00064"></a>00064 
<a name="l00065"></a>00065   <a class="code" href="classWelcomeWindow.html#e5d8ff66e51ac915f80d9f0e46743373">help</a> = <span class="keyword">new</span> <a class="code" href="classItem.html">Item</a>( <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>, QPixmap(QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"welcomeImages/handbook.png"</span>),
<a name="l00066"></a>00066                     tr(<span class="stringliteral">"Read short tutorials which cover all of the program's ins and outs."</span>) );
<a name="l00067"></a>00067   <a class="code" href="classWelcomeWindow.html#b761b6dd559e3a6fabddc08a68068121">updates</a> = <span class="keyword">new</span> <a class="code" href="classItem.html">Item</a>( <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>, QPixmap(QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"welcomeImages/updates.png"</span>),
<a name="l00068"></a>00068                     tr(<span class="stringliteral">"Keep up to date. If a new version of Album Shaper is available you'll see a pulsing light bulb appear in the bottom right corner of the application."</span>) );
<a name="l00069"></a>00069   <a class="code" href="classWelcomeWindow.html#a84e8c8b247091eebd8ed2602316aac8">upcoming</a> = <span class="keyword">new</span> <a class="code" href="classItem.html">Item</a>( <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>, QPixmap(QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"welcomeImages/upcoming.png"</span>),
<a name="l00070"></a>00070                     tr(<span class="stringliteral">"Take advantage of the power of open source development! Read about ongoing improvements and communicate with developers working on the project."</span>) );
<a name="l00071"></a>00071 
<a name="l00072"></a>00072     <span class="comment">//set text rects of icons</span>
<a name="l00073"></a>00073   <span class="keywordtype">int</span> maxWidth = 0;
<a name="l00074"></a>00074   <a class="code" href="classQIconViewItem.html">QIconViewItem</a> *item;
<a name="l00075"></a>00075   <span class="keywordflow">for</span>( item = <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;firstItem(); item != NULL; item = item-&gt;nextItem() )
<a name="l00076"></a>00076   {
<a name="l00077"></a>00077     <span class="keywordflow">if</span>(item-&gt;textRect().width() &gt; maxWidth)
<a name="l00078"></a>00078       maxWidth = item-&gt;textRect().width();
<a name="l00079"></a>00079   }
<a name="l00080"></a>00080   <span class="keywordflow">for</span>( item = <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>-&gt;firstItem(); item != NULL; item = item-&gt;nextItem() )
<a name="l00081"></a>00081   {
<a name="l00082"></a>00082     ((<a class="code" href="classItem.html">Item</a>*)item)-&gt;setTextWidth( maxWidth );
<a name="l00083"></a>00083   }
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 
<a name="l00086"></a>00086   <span class="comment">//--</span>
<a name="l00087"></a>00087   <a class="code" href="classWelcomeWindow.html#20c51b4452cc18cf4b127acd5cf77dc7" title="Close button.">closeButton</a> = <span class="keyword">new</span> QPushButton( 
<a name="l00088"></a>00088   <span class="comment">//PLATFORM_SPECIFIC_CODE</span>
<a name="l00089"></a>00089   #ifndef Q_OS_MACX  
<a name="l00090"></a>00090   QPixmap(QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"buttonIcons/button_ok.png"</span>),
<a name="l00091"></a>00091   #endif
<a name="l00092"></a>00092                               tr(<span class="stringliteral">"Close"</span>),
<a name="l00093"></a>00093                               itemsFrame );
<a name="l00094"></a>00094   <a class="code" href="classWelcomeWindow.html#20c51b4452cc18cf4b127acd5cf77dc7" title="Close button.">closeButton</a>-&gt;setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
<a name="l00095"></a>00095   <a class="code" href="classWelcomeWindow.html#20c51b4452cc18cf4b127acd5cf77dc7" title="Close button.">closeButton</a>-&gt;setDefault(<span class="keyword">true</span>);
<a name="l00096"></a>00096   connect( <a class="code" href="classWelcomeWindow.html#20c51b4452cc18cf4b127acd5cf77dc7" title="Close button.">closeButton</a>, SIGNAL(clicked()), SLOT(close()) );
<a name="l00097"></a>00097   <span class="comment">//--</span>
<a name="l00098"></a>00098   setPaletteBackgroundColor( white );
<a name="l00099"></a>00099   <a class="code" href="classWelcomeWindow.html#20c51b4452cc18cf4b127acd5cf77dc7" title="Close button.">closeButton</a>-&gt;setEraseColor( white );
<a name="l00100"></a>00100   <span class="comment">//--</span>
<a name="l00101"></a>00101   QGridLayout* <a class="code" href="classWelcomeWindow.html#e693d382f56bd0872cf49e370e4e079c">grid</a> = <span class="keyword">new</span> QGridLayout( <span class="keyword">this</span>, 1, 2, 0);
<a name="l00102"></a>00102   grid-&gt;addWidget( <a class="code" href="classWelcomeWindow.html#08de3790a2c3050ba8d082f0cfa8c7ae">sideImage</a>, 0, 0 );
<a name="l00103"></a>00103   grid-&gt;addWidget( itemsFrame, 0, 1 );
<a name="l00104"></a>00104 
<a name="l00105"></a>00105   QGridLayout* itemsGrid = <span class="keyword">new</span> QGridLayout( itemsFrame, 4, 3, 0 );
<a name="l00106"></a>00106 
<a name="l00107"></a>00107   itemsGrid-&gt;addMultiCellWidget( <a class="code" href="classWelcomeWindow.html#77a1bebe37fb1159678f6cdb32d3ded9">welcomeTitle</a>,  0, 0, 0, 2 );
<a name="l00108"></a>00108   itemsGrid-&gt;addMultiCellWidget( <a class="code" href="classWelcomeWindow.html#e72a27312f7f7a7e218250f7831218e7">welcomeMessage</a>,  1, 1, 0, 2 );
<a name="l00109"></a>00109   itemsGrid-&gt;addMultiCellWidget( <a class="code" href="classWelcomeWindow.html#717b127d993c874b79e799f1c5d6c611">items</a>,  2, 2, 0, 2 );
<a name="l00110"></a>00110   itemsGrid-&gt;addWidget( <a class="code" href="classWelcomeWindow.html#20c51b4452cc18cf4b127acd5cf77dc7" title="Close button.">closeButton</a>,  3, 1 );
<a name="l00111"></a>00111 
<a name="l00112"></a>00112   itemsGrid-&gt;setRowStretch( 2, 1 );
<a name="l00113"></a>00113   itemsGrid-&gt;setColStretch( 0, 1 );
<a name="l00114"></a>00114   itemsGrid-&gt;setColStretch( 2, 1 );
<a name="l00115"></a>00115 
<a name="l00116"></a>00116   itemsGrid-&gt;setMargin(<a class="code" href="config_8h.html#07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>);
<a name="l00117"></a>00117   itemsGrid-&gt;setSpacing(<a class="code" href="config_8h.html#07d364596a27705c900f07340515d5db">WIDGET_SPACING</a>);
<a name="l00118"></a>00118   <span class="comment">//--</span>
<a name="l00119"></a>00119   this-&gt;show();
<a name="l00120"></a>00120   setFixedSize(size());
<a name="l00121"></a>00121   <span class="comment">//-------------------------------</span>
<a name="l00122"></a>00122 }
<a name="l00123"></a>00123 <span class="comment">//==============================================</span>
<a name="l00124"></a><a class="code" href="classWelcomeWindow.html#583b944699ab663b758953b52d6585bf">00124</a> <span class="keywordtype">void</span> <a class="code" href="classWelcomeWindow.html#583b944699ab663b758953b52d6585bf">WelcomeWindow::itemClicked</a>(<a class="code" href="classQIconViewItem.html">QIconViewItem</a>* item)
<a name="l00125"></a>00125 {
<a name="l00126"></a>00126   <span class="keywordflow">if</span>(item == NULL)
<a name="l00127"></a>00127    <span class="keywordflow">return</span>;
<a name="l00128"></a>00128 
<a name="l00129"></a>00129   <a class="code" href="classTitleWidget.html" title="Widget which displays album name, description, representative image, and album shaper...">TitleWidget</a>* tw =  ((<a class="code" href="classWindow.html" title="Top level widget, encapsulates the title widget, the layout widget, and the toolbar...">Window</a>*)qApp-&gt;mainWidget())-&gt;getTitle();
<a name="l00130"></a>00130 
<a name="l00131"></a>00131   <span class="comment">//help</span>
<a name="l00132"></a>00132   <span class="keywordflow">if</span>(item == <a class="code" href="classWelcomeWindow.html#e5d8ff66e51ac915f80d9f0e46743373">help</a>)
<a name="l00133"></a>00133   {
<a name="l00134"></a>00134     tw-&gt;<a class="code" href="classTitleWidget.html#b89ce3c1d7a29c92eb52d6f9ffe1050c" title="Pops up HelpWindow.">help</a>();
<a name="l00135"></a>00135     <span class="keywordflow">return</span>;
<a name="l00136"></a>00136   }
<a name="l00137"></a>00137   <span class="comment">//updates</span>
<a name="l00138"></a>00138   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(item == <a class="code" href="classWelcomeWindow.html#b761b6dd559e3a6fabddc08a68068121">updates</a>)
<a name="l00139"></a>00139   {
<a name="l00140"></a>00140     tw-&gt;<a class="code" href="classTitleWidget.html#788ec0261eb74b90026c02a50d822407" title="Pops up about dialog.">aboutProgram</a>(<a class="code" href="titleWidget_8h.html#0d700b3de72d990fb378835e49aedab8">UPDATES</a>);
<a name="l00141"></a>00141     <span class="keywordflow">return</span>;
<a name="l00142"></a>00142   }
<a name="l00143"></a>00143   <span class="comment">//upcoming</span>
<a name="l00144"></a>00144   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(item == <a class="code" href="classWelcomeWindow.html#a84e8c8b247091eebd8ed2602316aac8">upcoming</a>)
<a name="l00145"></a>00145   {
<a name="l00146"></a>00146     tw-&gt;<a class="code" href="classTitleWidget.html#788ec0261eb74b90026c02a50d822407" title="Pops up about dialog.">aboutProgram</a>(<a class="code" href="titleWidget_8h.html#27c7f8c3adbde6c95ea28826c358985b">UPCOMING</a>);
<a name="l00147"></a>00147     <span class="keywordflow">return</span>;
<a name="l00148"></a>00148   }
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 <span class="comment">//==============================================</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:28 2009 for AlbumShaper by&nbsp;
<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>