Sophie

Sophie

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

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: photosIconView.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>photosIconView.cpp</h1><a href="photosIconView_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 &lt;qpixmap.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;qpainter.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;qpopupmenu.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;qiconset.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;qapplication.h&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;qstringlist.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;qcursor.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;qdragobject.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;qstringlist.h&gt;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="comment">//Projectwide includes</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="photosIconView_8h.html">photosIconView.h</a>"</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="layoutWidget_8h.html">layoutWidget.h</a>"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="window_8h.html">window.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="titleWidget_8h.html">titleWidget.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="photoPreviewWidget_8h.html">photoPreviewWidget.h</a>"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="photoDescEdit_8h.html">photoDescEdit.h</a>"</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include "../config.h"</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include "../backend/photo.h"</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include "../backend/album.h"</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include "../configuration/configuration.h"</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="comment">//==============================================</span>
<a name="l00035"></a><a class="code" href="classPhotoDrag.html">00035</a> <span class="keyword">class </span><a class="code" href="classPhotoDrag.html">PhotoDrag</a> : <span class="keyword">public</span> <a class="code" href="classQUriDrag.html">QUriDrag</a> 
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037 <span class="keyword">public</span>:
<a name="l00038"></a><a class="code" href="classPhotoDrag.html#3dce03c3c18621ea21697354d659fe9c">00038</a>   <a class="code" href="classPhotoDrag.html#3dce03c3c18621ea21697354d659fe9c">PhotoDrag</a>( <a class="code" href="classQWidget.html">QWidget</a>* dragSource=0, <span class="keyword">const</span> <span class="keywordtype">char</span>* name=0)
<a name="l00039"></a>00039   { <a class="code" href="classQUriDrag.html">QUriDrag</a>(dragSource, name); }
<a name="l00040"></a>00040   
<a name="l00042"></a><a class="code" href="classPhotoDrag.html#3612ec53301e56746ae0958d115d0ad0">00042</a>   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classPhotoDrag.html#3612ec53301e56746ae0958d115d0ad0" title="force all drags to COPY (not move/delete) original files!!!">drag</a>(DragMode mode)  
<a name="l00043"></a>00043   { <span class="keywordflow">return</span> <a class="code" href="classPhotoDrag.html#3612ec53301e56746ae0958d115d0ad0" title="force all drags to COPY (not move/delete) original files!!!">QDragObject::drag</a>( QDragObject::DragCopy ); }
<a name="l00044"></a>00044 };
<a name="l00045"></a>00045 <span class="comment">//==============================================</span>
<a name="l00046"></a><a class="code" href="classPhotosIconView.html#95fcd5d468102f79169f9da4fc1772b9">00046</a> <a class="code" href="classPhotosIconView.html#95fcd5d468102f79169f9da4fc1772b9">PhotosIconView::PhotosIconView</a>( <a class="code" href="classQWidget.html">QWidget</a> *parent ) : <a class="code" href="classQIconView.html">QIconView</a>( parent, <span class="stringliteral">"iconView"</span>, WNoAutoErase )
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048   viewport()-&gt;setBackgroundMode( Qt::NoBackground );
<a name="l00049"></a>00049 
<a name="l00050"></a>00050   <a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a> = NULL;
<a name="l00051"></a>00051   <a class="code" href="classPhotosIconView.html#029414c23cafc64bb47f3ff881c6eccd">handCursorShown</a> = <span class="keyword">false</span>;
<a name="l00052"></a>00052   
<a name="l00053"></a>00053   <a class="code" href="classPhotosIconView.html#6dcd7e363e4fbacfd12c8fa30e2455e8">curPhotoDescEdit</a> = NULL;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055   <span class="comment">//by default no photo has been right clicked on</span>
<a name="l00056"></a>00056   <a class="code" href="classPhotosIconView.html#54cdd4b886b21bf37a6312f13361386b">rightClickedPhoto</a> = NULL;
<a name="l00057"></a>00057 
<a name="l00058"></a>00058   <span class="comment">//load background image</span>
<a name="l00059"></a>00059   <a class="code" href="classPhotosIconView.html#2155ac9cafcba462ce74a3b1250a6063">backgroundImage</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/backgroundImage.png"</span> );
<a name="l00060"></a>00060 
<a name="l00061"></a>00061   <span class="comment">//load drag icon</span>
<a name="l00062"></a>00062   <a class="code" href="classPhotosIconView.html#3cf34379773d6ec12b56acfaa726f0a5">dragIcon</a> = <span class="keyword">new</span> QPixmap( QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"miscImages/moveImage.png"</span> );
<a name="l00063"></a>00063 
<a name="l00064"></a>00064   <span class="comment">//connect mouse over events to paint pseudo selection in ligher blue</span>
<a name="l00065"></a>00065   connect( <span class="keyword">this</span>, SIGNAL(onItem(<a class="code" href="classQIconViewItem.html">QIconViewItem</a>*)),
<a name="l00066"></a>00066                 <span class="keyword">this</span>, SLOT(<a class="code" href="classPhotosIconView.html#a0ce756ea9a71c972c8080311625ae36">repaintGroup</a>(<a class="code" href="classQIconViewItem.html">QIconViewItem</a>*)) );
<a name="l00067"></a>00067 
<a name="l00068"></a>00068   <span class="comment">//clear any pseudo selection when mouse moves off icons</span>
<a name="l00069"></a>00069   connect( <span class="keyword">this</span>, SIGNAL(onViewport()),
<a name="l00070"></a>00070                 <span class="keyword">this</span>, SLOT(<a class="code" href="classPhotosIconView.html#5c4c31c9606f464dacd3afeaa0195210">clearPseudoSelection</a>()) );
<a name="l00071"></a>00071 
<a name="l00072"></a>00072   connect( <span class="keyword">this</span>, SIGNAL(pressed( <a class="code" href="classQIconViewItem.html">QIconViewItem</a>*, <span class="keyword">const</span> QPoint&amp; )),
<a name="l00073"></a>00073                  <span class="keyword">this</span>, SLOT(<a class="code" href="classPhotosIconView.html#ce38db899ee0da6ef9690418eed2f33e">captureClick</a>(<a class="code" href="classQIconViewItem.html">QIconViewItem</a>*, <span class="keyword">const</span> QPoint&amp;)) );
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 <span class="comment">//==============================================</span>
<a name="l00076"></a><a class="code" href="classPhotosIconView.html#0f941d6af5721fd8aae8f85c91af9abf">00076</a> QDragObject* <a class="code" href="classPhotosIconView.html#0f941d6af5721fd8aae8f85c91af9abf">PhotosIconView::dragObject</a>()
<a name="l00077"></a>00077 {
<a name="l00078"></a>00078   <span class="comment">//no item selected?</span>
<a name="l00079"></a>00079   <span class="keywordflow">if</span>( !currentItem() )
<a name="l00080"></a>00080     <span class="keywordflow">return</span> 0;
<a name="l00081"></a>00081   
<a name="l00082"></a>00082   <span class="comment">//create drag object</span>
<a name="l00083"></a>00083 <span class="comment">//  PhotoDrag *drag = new PhotoDrag( viewport() );</span>
<a name="l00084"></a>00084   QIconDrag *drag = <span class="keyword">new</span> QIconDrag( viewport() );
<a name="l00085"></a>00085   
<a name="l00086"></a>00086   <span class="comment">//use small icon to represent drag, does not cover up too much of the screen</span>
<a name="l00087"></a>00087   drag-&gt;setPixmap( *<a class="code" href="classPhotosIconView.html#3cf34379773d6ec12b56acfaa726f0a5">dragIcon</a> );
<a name="l00088"></a>00088   
<a name="l00090"></a>00090   <span class="comment">//TODO find out how we can add filenames and PREVENT them from being MOVED to new location</span>
<a name="l00091"></a>00091   <span class="comment">//like whendropping photoson the desktop!!!</span>
<a name="l00092"></a>00092   <span class="comment">//create stringlist of all selected photo filenames</span>
<a name="l00093"></a>00093   <span class="comment">//QStringList filenames;</span>
<a name="l00094"></a>00094   <span class="comment">//QIconViewItem* current = firstItem();</span>
<a name="l00095"></a>00095   <span class="comment">//while(current != NULL)</span>
<a name="l00096"></a>00096   <span class="comment">//{</span>
<a name="l00097"></a>00097   <span class="comment">//  if(current-&gt;isSelected())</span>
<a name="l00098"></a>00098   <span class="comment">//  { </span>
<a name="l00099"></a>00099   <span class="comment">//    filenames.append( ((PhotoPreviewWidget*)current)-&gt;getPhoto()-&gt;getImageFilename() ); </span>
<a name="l00100"></a>00100   <span class="comment">//  }</span>
<a name="l00101"></a>00101   <span class="comment">//  </span>
<a name="l00102"></a>00102   <span class="comment">//  current = current-&gt;nextItem();</span>
<a name="l00103"></a>00103   <span class="comment">//}</span>
<a name="l00104"></a>00104   <span class="comment">//  drag-&gt;setFileNames( filenames );</span>
<a name="l00106"></a>00106 <span class="comment"></span>
<a name="l00107"></a>00107   <span class="keywordflow">return</span> drag;
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109 <span class="comment">//==============================================</span>
<a name="l00110"></a><a class="code" href="classPhotosIconView.html#06b0a2c221445bc2c1fe2e55bd35e68b">00110</a> <span class="keywordtype">bool</span> <a class="code" href="classPhotosIconView.html#06b0a2c221445bc2c1fe2e55bd35e68b">PhotosIconView::findNearestUnselectedPhoto</a>( <span class="keyword">const</span> QPoint &amp;pos,
<a name="l00111"></a>00111                                                  <a class="code" href="classQIconViewItem.html">QIconViewItem</a>** nearestItem,
<a name="l00112"></a>00112                                                  <span class="keywordtype">bool</span> &amp;posIsleftOfItem )
<a name="l00113"></a>00113 {
<a name="l00114"></a>00114   <span class="comment">//if there are no items we can't find one now can we?</span>
<a name="l00115"></a>00115   <span class="keywordflow">if</span> ( firstItem() == NULL )
<a name="l00116"></a>00116     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00117"></a>00117   
<a name="l00118"></a>00118   <span class="comment">//------------------------------------------------</span>
<a name="l00119"></a>00119   <span class="comment">//first see if there is an unselected photo here</span>
<a name="l00120"></a>00120   <a class="code" href="classQIconViewItem.html">QIconViewItem</a>* item = firstItem();
<a name="l00121"></a>00121   <span class="keywordflow">while</span>(item != NULL)
<a name="l00122"></a>00122   {
<a name="l00123"></a>00123     <span class="keywordflow">if</span>( !item-&gt;isSelected() &amp;&amp; item-&gt;contains(pos) )
<a name="l00124"></a>00124     {
<a name="l00125"></a>00125       (*nearestItem) = item;
<a name="l00126"></a>00126       posIsleftOfItem = pos.x() &lt; item-&gt;x() + (item-&gt;width()/2);
<a name="l00127"></a>00127       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00128"></a>00128     }
<a name="l00129"></a>00129     
<a name="l00130"></a>00130     item = item-&gt;nextItem();
<a name="l00131"></a>00131   }
<a name="l00132"></a>00132   <span class="comment">//------------------------------------------------</span>
<a name="l00133"></a>00133   <span class="comment">//see if drop occurred below the last unselected photo</span>
<a name="l00134"></a>00134   
<a name="l00135"></a>00135   <span class="comment">//find last unselected photo</span>
<a name="l00136"></a>00136   item = lastItem();
<a name="l00137"></a>00137   <span class="keywordflow">while</span>( item != NULL &amp;&amp; item-&gt;isSelected() )
<a name="l00138"></a>00138   { item = item-&gt;prevItem(); }
<a name="l00139"></a>00139     
<a name="l00140"></a>00140   <span class="comment">//is point below last unselected photo?</span>
<a name="l00141"></a>00141   <span class="keywordflow">if</span>( item != NULL &amp;&amp; pos.y() &gt; (item-&gt;y() + item-&gt;height()) )
<a name="l00142"></a>00142   {
<a name="l00143"></a>00143     (*nearestItem) = item;
<a name="l00144"></a>00144     posIsleftOfItem = <span class="keyword">false</span>;
<a name="l00145"></a>00145     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00146"></a>00146   }
<a name="l00147"></a>00147   <span class="comment">//------------------------------------------------</span>
<a name="l00148"></a>00148   <span class="comment">//see if drop occurred above the first unselected photo</span>
<a name="l00149"></a>00149   
<a name="l00150"></a>00150   <span class="comment">//find first unselected photo</span>
<a name="l00151"></a>00151   item = firstItem();
<a name="l00152"></a>00152   <span class="keywordflow">while</span>( item != NULL &amp;&amp; item-&gt;isSelected() )
<a name="l00153"></a>00153   { item = item-&gt;nextItem(); }
<a name="l00154"></a>00154   
<a name="l00155"></a>00155   <span class="comment">//is point below last unselected photo?</span>
<a name="l00156"></a>00156   <span class="keywordflow">if</span>( item != NULL &amp;&amp; pos.y() &lt; item-&gt;y() )
<a name="l00157"></a>00157   {
<a name="l00158"></a>00158     (*nearestItem) = item;
<a name="l00159"></a>00159     posIsleftOfItem = <span class="keyword">true</span>;
<a name="l00160"></a>00160     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00161"></a>00161   }
<a name="l00162"></a>00162   <span class="comment">//------------------------------------------------</span>
<a name="l00163"></a>00163   <span class="comment">//next try checking within this row, walk left first</span>
<a name="l00164"></a>00164   <span class="keywordtype">int</span> x;
<a name="l00165"></a>00165   <span class="keywordflow">for</span>(x = pos.x()-1; x&gt;=0; x--)
<a name="l00166"></a>00166   {
<a name="l00167"></a>00167     item = findItem( QPoint(x, pos.y()) );
<a name="l00168"></a>00168     <span class="keywordflow">if</span>( item == NULL || item-&gt;isSelected() ) <span class="keywordflow">continue</span>;
<a name="l00169"></a>00169     <span class="keywordflow">else</span>
<a name="l00170"></a>00170     {
<a name="l00171"></a>00171       (*nearestItem) = item;
<a name="l00172"></a>00172       posIsleftOfItem = <span class="keyword">false</span>;
<a name="l00173"></a>00173       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00174"></a>00174     }
<a name="l00175"></a>00175   }
<a name="l00176"></a>00176   <span class="comment">//walking left failed, try walking right</span>
<a name="l00177"></a>00177   <span class="keywordflow">for</span>(x = pos.x()+1; x&lt;<a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>(); x++)
<a name="l00178"></a>00178   {
<a name="l00179"></a>00179     item = findItem( QPoint(x, pos.y()) );
<a name="l00180"></a>00180     <span class="keywordflow">if</span>( item == NULL || item-&gt;isSelected() ) <span class="keywordflow">continue</span>;
<a name="l00181"></a>00181     <span class="keywordflow">else</span>
<a name="l00182"></a>00182     {
<a name="l00183"></a>00183       (*nearestItem) = item;
<a name="l00184"></a>00184       posIsleftOfItem = <span class="keyword">true</span>;
<a name="l00185"></a>00185       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00186"></a>00186     }
<a name="l00187"></a>00187   }
<a name="l00188"></a>00188   <span class="comment">//------------------------------------------------ </span>
<a name="l00189"></a>00189   <span class="comment">//ok, no unselected item is at this point, to the left, to the right, and the point</span>
<a name="l00190"></a>00190   <span class="comment">//is not above the first unselected photo or below the last unselected photo. the</span>
<a name="l00191"></a>00191   <span class="comment">//only way this is possible is if the point is between two rows of photos in the margin.</span>
<a name="l00192"></a>00192 
<a name="l00193"></a>00193   <span class="comment">//while it's certain there are photos both above and below, it is possible </span>
<a name="l00194"></a>00194   <span class="comment">//either of the adjacent rows of photos only contain selected photos so searching </span>
<a name="l00195"></a>00195   <span class="comment">//a single row will not necessarily find the nearest photo.</span>
<a name="l00196"></a>00196   
<a name="l00197"></a>00197   <span class="comment">//however, we are guaranteed to find an unselected photo both above and below </span>
<a name="l00198"></a>00198   <span class="comment">//this point, somewhere, so only searching up or down is necessary. we'll search </span>
<a name="l00199"></a>00199   <span class="comment">//up and the first unselected photo we find we'll use as the nearst. All selects </span>
<a name="l00200"></a>00200   <span class="comment">//photos must come after (aka to the right of) this photo.</span>
<a name="l00201"></a>00201   <span class="keywordtype">int</span> itemWidth  = firstItem()-&gt;width();
<a name="l00202"></a>00202   <span class="keywordtype">int</span> itemHeight = firstItem()-&gt;height();
<a name="l00203"></a>00203   <span class="keywordtype">int</span> y;
<a name="l00204"></a>00204   <span class="keywordflow">for</span>(y = pos.y()-(itemHeight/2); y &gt;= 0; y-=(itemHeight/2) )
<a name="l00205"></a>00205   {
<a name="l00206"></a>00206     <span class="keywordflow">for</span>(x = <a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>(); x &gt;= 0; x-=(itemWidth/2))
<a name="l00207"></a>00207     {
<a name="l00208"></a>00208       item = findItem( QPoint(x, y) );
<a name="l00209"></a>00209       <span class="keywordflow">if</span>( item == NULL || item-&gt;isSelected() ) { <span class="keywordflow">continue</span>; }
<a name="l00210"></a>00210       <span class="keywordflow">else</span>
<a name="l00211"></a>00211       {
<a name="l00212"></a>00212         (*nearestItem) = item;
<a name="l00213"></a>00213         posIsleftOfItem = <span class="keyword">false</span>;
<a name="l00214"></a>00214         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00215"></a>00215       }
<a name="l00216"></a>00216     }
<a name="l00217"></a>00217   }
<a name="l00218"></a>00218   <span class="comment">//------------------------------------------------ </span>
<a name="l00219"></a>00219   <span class="comment">//unable to find nearest unselected item</span>
<a name="l00220"></a>00220   <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00221"></a>00221 }
<a name="l00222"></a>00222 <span class="comment">//==============================================</span>
<a name="l00223"></a><a class="code" href="classPhotosIconView.html#05a12f0eadcc2a2489b59671a19ae2ee">00223</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#05a12f0eadcc2a2489b59671a19ae2ee">PhotosIconView::contentsDropEvent</a>( QDropEvent *e )
<a name="l00224"></a>00224 {
<a name="l00225"></a>00225   <a class="code" href="classPhotosIconView.html#05a12f0eadcc2a2489b59671a19ae2ee">QIconView::contentsDropEvent</a>( e );
<a name="l00226"></a>00226   
<a name="l00227"></a>00227   <span class="comment">//if item is from the viewport emit item moved signal</span>
<a name="l00228"></a>00228   <span class="keywordflow">if</span>(e-&gt;source() == viewport() )
<a name="l00229"></a>00229   { 
<a name="l00230"></a>00230     <span class="comment">//find nearest unselected item</span>
<a name="l00231"></a>00231     <a class="code" href="classQIconViewItem.html">QIconViewItem</a>* item; <span class="keywordtype">bool</span> leftOf;
<a name="l00232"></a>00232     <span class="keywordflow">if</span>( !<a class="code" href="classPhotosIconView.html#06b0a2c221445bc2c1fe2e55bd35e68b">findNearestUnselectedPhoto</a>( e-&gt;pos(), &amp;item, leftOf ) )
<a name="l00233"></a>00233     {
<a name="l00234"></a>00234       <span class="comment">//unable to find nearest item. this should be impossible</span>
<a name="l00235"></a>00235     <span class="comment">//  cout &lt;&lt; "ERROR! Failed to find nearest item!\n";</span>
<a name="l00236"></a>00236       emit <a class="code" href="classPhotosIconView.html#667d40dd345ab52932b774898e77e618">itemHasMoved</a>();
<a name="l00237"></a>00237     }  
<a name="l00238"></a>00238     
<a name="l00239"></a>00239     <span class="comment">//selected photos dropped on LEFT of nearest item</span>
<a name="l00240"></a>00240     <span class="keywordflow">if</span>( leftOf )
<a name="l00241"></a>00241     {
<a name="l00242"></a>00242       <span class="comment">//count number of items being moved</span>
<a name="l00243"></a>00243       <span class="keywordtype">int</span> num=0;
<a name="l00244"></a>00244       <a class="code" href="classQIconViewItem.html">QIconViewItem</a>* current = firstItem();
<a name="l00245"></a>00245       <span class="keywordflow">while</span>(current != NULL)
<a name="l00246"></a>00246       {
<a name="l00247"></a>00247         <span class="keywordflow">if</span>(current-&gt;isSelected()) { num++; }
<a name="l00248"></a>00248         current = current-&gt;nextItem();
<a name="l00249"></a>00249       }
<a name="l00250"></a>00250     
<a name="l00251"></a>00251       <span class="comment">//move items to their new locations</span>
<a name="l00252"></a>00252       <span class="keywordtype">int</span> xpos = item-&gt;x() - num;
<a name="l00253"></a>00253       current = firstItem();
<a name="l00254"></a>00254       <span class="keywordflow">while</span>(current != NULL)
<a name="l00255"></a>00255       {
<a name="l00256"></a>00256         <span class="keywordflow">if</span>(current-&gt;isSelected())
<a name="l00257"></a>00257         {
<a name="l00258"></a>00258           current-&gt;move(xpos, item-&gt;y()); 
<a name="l00259"></a>00259           xpos++;
<a name="l00260"></a>00260         }
<a name="l00261"></a>00261         current = current-&gt;nextItem();
<a name="l00262"></a>00262       }
<a name="l00263"></a>00263     }
<a name="l00264"></a>00264     <span class="comment">//selected phtos dropped on RIGHT of nearest item</span>
<a name="l00265"></a>00265     <span class="keywordflow">else</span>
<a name="l00266"></a>00266     {
<a name="l00267"></a>00267       <span class="comment">//move items to their new locations</span>
<a name="l00268"></a>00268       <span class="keywordtype">int</span> xpos = item-&gt;x() + (item-&gt;width()/2) + 1;
<a name="l00269"></a>00269       <a class="code" href="classQIconViewItem.html">QIconViewItem</a>* current = firstItem();
<a name="l00270"></a>00270       <span class="keywordflow">while</span>(current != NULL)
<a name="l00271"></a>00271       {
<a name="l00272"></a>00272         <span class="keywordflow">if</span>(current-&gt;isSelected())
<a name="l00273"></a>00273         {
<a name="l00274"></a>00274           current-&gt;move(xpos, item-&gt;y());
<a name="l00275"></a>00275           xpos++;
<a name="l00276"></a>00276         }
<a name="l00277"></a>00277         current = current-&gt;nextItem();
<a name="l00278"></a>00278       }
<a name="l00279"></a>00279     }
<a name="l00280"></a>00280 
<a name="l00281"></a>00281     <span class="comment">//items have moved!</span>
<a name="l00282"></a>00282     emit <a class="code" href="classPhotosIconView.html#667d40dd345ab52932b774898e77e618">itemHasMoved</a>();
<a name="l00283"></a>00283   }
<a name="l00284"></a>00284   <span class="comment">//else it's from off the viewport, if we can get filename then try adding photos being added to subalbum</span>
<a name="l00285"></a>00285   <span class="keywordflow">else</span>
<a name="l00286"></a>00286   {
<a name="l00287"></a>00287     QStringList fileNames;
<a name="l00288"></a>00288     <span class="keywordflow">if</span>( QUriDrag::decodeLocalFiles( e, fileNames ) )
<a name="l00289"></a>00289     {
<a name="l00290"></a>00290       <span class="comment">//for some reason the order in which we receive file names is entire illogical.</span>
<a name="l00291"></a>00291       <span class="comment">//it does not appear to be based on filename, data, modified data, size, anything!</span>
<a name="l00292"></a>00292       <span class="comment">//thus, before adding files, first sort by ascending filename</span>
<a name="l00293"></a>00293       fileNames.sort();
<a name="l00294"></a>00294       emit <a class="code" href="classPhotosIconView.html#876451017d54c370ec74d53efd48d25d">addPhotos</a>(fileNames);
<a name="l00295"></a>00295     }
<a name="l00296"></a>00296   }
<a name="l00297"></a>00297   
<a name="l00298"></a>00298 }
<a name="l00299"></a>00299 <span class="comment">//==============================================</span>
<a name="l00300"></a><a class="code" href="classPhotosIconView.html#0aeae24dce6e3eb865a2270bc888edc7">00300</a> <span class="keywordtype">int</span> <a class="code" href="classPhotosIconView.html#0aeae24dce6e3eb865a2270bc888edc7">PhotosIconView::numSelected</a>()
<a name="l00301"></a>00301 {
<a name="l00302"></a>00302   <span class="keywordtype">int</span> num = 0;
<a name="l00303"></a>00303   <a class="code" href="classQIconViewItem.html">QIconViewItem</a>* current = firstItem();
<a name="l00304"></a>00304   <span class="keywordflow">while</span>(current != NULL)
<a name="l00305"></a>00305   {
<a name="l00306"></a>00306     <span class="keywordflow">if</span>(current-&gt;isSelected())
<a name="l00307"></a>00307       num++;
<a name="l00308"></a>00308     current = current-&gt;nextItem();
<a name="l00309"></a>00309   }
<a name="l00310"></a>00310   <span class="keywordflow">return</span> num;
<a name="l00311"></a>00311 }
<a name="l00312"></a>00312 <span class="comment">//==============================================</span>
<a name="l00313"></a><a class="code" href="classPhotosIconView.html#47188609f436a73e7d0e02668263c065">00313</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#47188609f436a73e7d0e02668263c065">PhotosIconView::contextMenuEvent</a> ( QContextMenuEvent * e )
<a name="l00314"></a>00314 {
<a name="l00315"></a>00315   <a class="code" href="classPhotosIconView.html#54cdd4b886b21bf37a6312f13361386b">rightClickedPhoto</a> = (<a class="code" href="classPhotoPreviewWidget.html" title="Displays photo thumbnail and description.">PhotoPreviewWidget</a>*) findItem( QPoint(e-&gt;x(), e-&gt;y()+contentsY()) );
<a name="l00316"></a>00316   <span class="keywordflow">if</span>(<a class="code" href="classPhotosIconView.html#54cdd4b886b21bf37a6312f13361386b">rightClickedPhoto</a> == NULL)
<a name="l00317"></a>00317     <span class="keywordflow">return</span>;
<a name="l00318"></a>00318 
<a name="l00319"></a>00319   QPopupMenu contextMenu( <span class="keyword">this</span> );
<a name="l00320"></a>00320 
<a name="l00321"></a>00321   contextMenu.insertItem( QIconSet( QPixmap(QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"menuIcons/setAlbumImage.png"</span>) ),
<a name="l00322"></a>00322                           tr(<span class="stringliteral">"Set album image"</span>), <span class="keyword">this</span>, SLOT(<a class="code" href="classPhotosIconView.html#7c791a8e8bf2ebb2125e3989bb6ae89e">setAlbumImage</a>()) );
<a name="l00323"></a>00323 
<a name="l00324"></a>00324   contextMenu.insertItem( QIconSet( QPixmap(QString(<a class="code" href="config_8cpp.html#59e02362a9a29a755712dc830a3eb513">IMAGE_PATH</a>)+<span class="stringliteral">"menuIcons/setSubalbumImage.png"</span>) ),
<a name="l00325"></a>00325                           tr(<span class="stringliteral">"Set collection image"</span>), <span class="keyword">this</span>, SLOT(<a class="code" href="classPhotosIconView.html#e46ad5afe66a81b708818562b6d03ade">setSubalbumImage</a>()) );
<a name="l00326"></a>00326 
<a name="l00327"></a>00327   contextMenu.exec( QPoint(e-&gt;globalX(), e-&gt;globalY()) );
<a name="l00328"></a>00328 }
<a name="l00329"></a>00329 <span class="comment">//==============================================</span>
<a name="l00330"></a><a class="code" href="classPhotosIconView.html#7c791a8e8bf2ebb2125e3989bb6ae89e">00330</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#7c791a8e8bf2ebb2125e3989bb6ae89e">PhotosIconView::setAlbumImage</a>( )
<a name="l00331"></a>00331 {
<a name="l00332"></a>00332   ((<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()-&gt;setAlbumImage( <a class="code" href="classPhotosIconView.html#54cdd4b886b21bf37a6312f13361386b">rightClickedPhoto</a>-&gt;<a class="code" href="classPhotoPreviewWidget.html#f54da3447e6426891f5a1a40a0e3e1a7" title="Returns photo pointer.">getPhoto</a>() );
<a name="l00333"></a>00333   <a class="code" href="classPhotosIconView.html#54cdd4b886b21bf37a6312f13361386b">rightClickedPhoto</a> = NULL;
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 <span class="comment">//==============================================</span>
<a name="l00336"></a><a class="code" href="classPhotosIconView.html#e46ad5afe66a81b708818562b6d03ade">00336</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#e46ad5afe66a81b708818562b6d03ade">PhotosIconView::setSubalbumImage</a>( )
<a name="l00337"></a>00337 {
<a name="l00338"></a>00338   ((<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()-&gt;setSubalbumImage( <a class="code" href="classPhotosIconView.html#54cdd4b886b21bf37a6312f13361386b">rightClickedPhoto</a>-&gt;<a class="code" href="classPhotoPreviewWidget.html#f54da3447e6426891f5a1a40a0e3e1a7" title="Returns photo pointer.">getPhoto</a>() );
<a name="l00339"></a>00339   <a class="code" href="classPhotosIconView.html#54cdd4b886b21bf37a6312f13361386b">rightClickedPhoto</a> = NULL;
<a name="l00340"></a>00340 }
<a name="l00341"></a>00341 <span class="comment">//==============================================</span>
<a name="l00342"></a><a class="code" href="classPhotosIconView.html#b24829783be08d9eee9b6a0e59d20aac">00342</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#b24829783be08d9eee9b6a0e59d20aac">PhotosIconView::drawBackground</a>( QPainter* p, <span class="keyword">const</span> QRect&amp; r)
<a name="l00343"></a>00343 {
<a name="l00344"></a>00344   QBrush brush;
<a name="l00345"></a>00345   brush.setPixmap( *<a class="code" href="classPhotosIconView.html#2155ac9cafcba462ce74a3b1250a6063">backgroundImage</a> );
<a name="l00346"></a>00346   p-&gt;fillRect( r, brush );
<a name="l00347"></a>00347 }
<a name="l00348"></a>00348 <span class="comment">//==============================================</span>
<a name="l00349"></a><a class="code" href="classPhotosIconView.html#1cfca6a265cdb160098a3d1e681d7fcd">00349</a>  <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#1cfca6a265cdb160098a3d1e681d7fcd">PhotosIconView::drawContents</a> ( QPainter * p, <span class="keywordtype">int</span> clipx, <span class="keywordtype">int</span> clipy, <span class="keywordtype">int</span> clipw, <span class="keywordtype">int</span> cliph )
<a name="l00350"></a>00350 {
<a name="l00351"></a>00351     <span class="keywordflow">if</span>( <a class="code" href="classPhotosIconView.html#98cfc116497525fa26e2f96edd8c50cb">bufferPixmap</a>.size() != size())
<a name="l00352"></a>00352     {  <a class="code" href="classPhotosIconView.html#98cfc116497525fa26e2f96edd8c50cb">bufferPixmap</a>.resize( size() ); }
<a name="l00353"></a>00353     QPainter bufferPainter( &amp;<a class="code" href="classPhotosIconView.html#98cfc116497525fa26e2f96edd8c50cb">bufferPixmap</a>, viewport() );
<a name="l00354"></a>00354     <span class="keywordtype">int</span> xOffset = clipx - contentsX();
<a name="l00355"></a>00355     <span class="keywordtype">int</span> yOffset = clipy - contentsY();
<a name="l00356"></a>00356 
<a name="l00357"></a>00357     bufferPainter.translate( -contentsX(), -contentsY() );
<a name="l00358"></a>00358     <a class="code" href="classPhotosIconView.html#1cfca6a265cdb160098a3d1e681d7fcd">QIconView::drawContents</a>( &amp;bufferPainter, clipx, clipy, clipw, cliph );
<a name="l00359"></a>00359     bitBlt(p-&gt;device(), xOffset, yOffset, &amp;<a class="code" href="classPhotosIconView.html#98cfc116497525fa26e2f96edd8c50cb">bufferPixmap</a>, xOffset, yOffset, clipw, cliph );
<a name="l00360"></a>00360 }
<a name="l00361"></a>00361 <span class="comment">//==============================================</span>
<a name="l00362"></a><a class="code" href="classPhotosIconView.html#a0ce756ea9a71c972c8080311625ae36">00362</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#a0ce756ea9a71c972c8080311625ae36">PhotosIconView::repaintGroup</a>( <a class="code" href="classQIconViewItem.html">QIconViewItem</a>* pseudoSelection)
<a name="l00363"></a>00363 {
<a name="l00364"></a>00364   <span class="comment">//if old pseudo selection unselect it</span>
<a name="l00365"></a>00365   <a class="code" href="classPhotosIconView.html#5c4c31c9606f464dacd3afeaa0195210">clearPseudoSelection</a>();
<a name="l00366"></a>00366 
<a name="l00367"></a>00367   <span class="comment">//paint new selection</span>
<a name="l00368"></a>00368   <span class="keywordflow">if</span>(pseudoSelection != NULL)
<a name="l00369"></a>00369   {
<a name="l00370"></a>00370     <a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a> = (<a class="code" href="classPhotoPreviewWidget.html" title="Displays photo thumbnail and description.">PhotoPreviewWidget</a>*)pseudoSelection;
<a name="l00371"></a>00371     <a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a>-&gt;<a class="code" href="classPhotoPreviewWidget.html#81806a5a36fa6fbae947dd1aa2f09210">setMousedOver</a>(<span class="keyword">true</span>);
<a name="l00372"></a>00372     repaintItem(<a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a>);
<a name="l00373"></a>00373   }
<a name="l00374"></a>00374 }
<a name="l00375"></a>00375 <span class="comment">//==============================================</span>
<a name="l00376"></a><a class="code" href="classPhotosIconView.html#5c4c31c9606f464dacd3afeaa0195210">00376</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#5c4c31c9606f464dacd3afeaa0195210">PhotosIconView::clearPseudoSelection</a>()
<a name="l00377"></a>00377 {
<a name="l00378"></a>00378   <span class="comment">//check to make sure mouse is still off item. when a user expands an image to edit</span>
<a name="l00379"></a>00379   <span class="comment">//it's description, the selection is cleard (since hte mouse is over a new window). however,</span>
<a name="l00380"></a>00380   <span class="comment">//when that window disappears repaintGroup never got recalled (if the mouse was still on the original window),</span>
<a name="l00381"></a>00381   <span class="comment">//so just ignore the original clear (it was invalid anyways right?)</span>
<a name="l00382"></a>00382  <span class="keywordflow">if</span>( findItem( viewport()-&gt;mapFromGlobal( QCursor::pos() )+=QPoint( contentsX(), contentsY() )  ) == <a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a> )
<a name="l00383"></a>00383    <span class="keywordflow">return</span>;
<a name="l00384"></a>00384 
<a name="l00385"></a>00385   <span class="comment">//if old pseudo selection unselect it</span>
<a name="l00386"></a>00386   <span class="keywordflow">if</span>(<a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a> != NULL)
<a name="l00387"></a>00387   {
<a name="l00388"></a>00388     <a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a>-&gt;<a class="code" href="classPhotoPreviewWidget.html#81806a5a36fa6fbae947dd1aa2f09210">setMousedOver</a>(<span class="keyword">false</span>);
<a name="l00389"></a>00389     repaintItem(<a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a>);
<a name="l00390"></a>00390     <a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a> = NULL;
<a name="l00391"></a>00391   }
<a name="l00392"></a>00392 }
<a name="l00393"></a>00393 <span class="comment">//==============================================</span>
<a name="l00394"></a><a class="code" href="classPhotosIconView.html#ce38db899ee0da6ef9690418eed2f33e">00394</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#ce38db899ee0da6ef9690418eed2f33e">PhotosIconView::captureClick</a>(<a class="code" href="classQIconViewItem.html">QIconViewItem</a> *item, <span class="keyword">const</span> QPoint&amp; point)
<a name="l00395"></a>00395 {
<a name="l00396"></a>00396   <span class="comment">//if no item has been clicked then ignore</span>
<a name="l00397"></a>00397   <span class="keywordflow">if</span>(item == NULL)
<a name="l00398"></a>00398     <span class="keywordflow">return</span>;
<a name="l00399"></a>00399 
<a name="l00400"></a>00400   <span class="comment">//get info button rect</span>
<a name="l00401"></a>00401   QRect infoButtonRec = ((<a class="code" href="classPhotoPreviewWidget.html" title="Displays photo thumbnail and description.">PhotoPreviewWidget</a>*)item)-&gt;getPhotoInfoRect();
<a name="l00402"></a>00402 
<a name="l00403"></a>00403   <span class="comment">//remove scroll offset</span>
<a name="l00404"></a>00404   infoButtonRec.moveBy( -contentsX(), -contentsY() );
<a name="l00405"></a>00405 
<a name="l00406"></a>00406   <span class="comment">//convert to screen coordinates by shifting by offset of topleft of widget</span>
<a name="l00407"></a>00407   QPoint <a class="code" href="redEye__internal_8h.html#6a9aebec61b1a6732045c187a6156f4f">topLeft</a> = mapToGlobal( QPoint(0,0) );
<a name="l00408"></a>00408   infoButtonRec.moveBy( topLeft.x(), topLeft.y() );
<a name="l00409"></a>00409 
<a name="l00410"></a>00410   <span class="comment">//if screen coordinates of mouse click are in rectangle then button pressed</span>
<a name="l00411"></a>00411   <span class="keywordflow">if</span>( infoButtonRec.contains( point.x(), point.y() ) )
<a name="l00412"></a>00412   {
<a name="l00413"></a>00413     <span class="comment">//make sure all events have been processed first. if were just</span>
<a name="l00414"></a>00414     <span class="comment">//editing a differnt photo description it is first necessary to </span>
<a name="l00415"></a>00415     <span class="comment">//repaint before we start editing the next</span>
<a name="l00416"></a>00416     qApp-&gt;processEvents();
<a name="l00417"></a>00417 
<a name="l00418"></a>00418     <span class="keywordflow">if</span>( <a class="code" href="classPhotosIconView.html#6dcd7e363e4fbacfd12c8fa30e2455e8">curPhotoDescEdit</a> != NULL ) { <span class="keyword">delete</span> <a class="code" href="classPhotosIconView.html#6dcd7e363e4fbacfd12c8fa30e2455e8">curPhotoDescEdit</a>; }
<a name="l00419"></a>00419 
<a name="l00420"></a>00420     <a class="code" href="classPhotoPreviewWidget.html" title="Displays photo thumbnail and description.">PhotoPreviewWidget</a>* ppw = (<a class="code" href="classPhotoPreviewWidget.html" title="Displays photo thumbnail and description.">PhotoPreviewWidget</a>*)item;
<a name="l00421"></a>00421     <a class="code" href="classPhotosIconView.html#6dcd7e363e4fbacfd12c8fa30e2455e8">curPhotoDescEdit</a> = <span class="keyword">new</span> <a class="code" href="classPhotoDescEdit.html">PhotoDescEdit</a>( ppw,
<a name="l00422"></a>00422         ((<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;getConfig()-&gt;getBool( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"animation"</span> ) );
<a name="l00423"></a>00423   }
<a name="l00424"></a>00424 }
<a name="l00425"></a>00425 <span class="comment">//==============================================</span>
<a name="l00426"></a><a class="code" href="classPhotosIconView.html#080d42c26426c43106a9bfdfcad07035">00426</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#080d42c26426c43106a9bfdfcad07035">PhotosIconView::contentsMousePressEvent</a> ( QMouseEvent * e )
<a name="l00427"></a>00427 {
<a name="l00428"></a>00428   <a class="code" href="classPhotosIconView.html#855453561d3625e913c4dd3f2bfcf9ba">dragStartPos</a> = e-&gt;pos();
<a name="l00429"></a>00429   <a class="code" href="classPhotosIconView.html#080d42c26426c43106a9bfdfcad07035">QIconView::contentsMousePressEvent</a>( e );
<a name="l00430"></a>00430 }
<a name="l00431"></a>00431 <span class="comment">//==============================================</span>
<a name="l00432"></a><a class="code" href="classPhotosIconView.html#6eabe8bfa6a64f67146acc638e9ccb72">00432</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#6eabe8bfa6a64f67146acc638e9ccb72">PhotosIconView::contentsMouseMoveEvent</a>( QMouseEvent *e)
<a name="l00433"></a>00433 {
<a name="l00434"></a>00434   <a class="code" href="classPhotosIconView.html#6eabe8bfa6a64f67146acc638e9ccb72">QIconView::contentsMouseMoveEvent</a>( e );
<a name="l00435"></a>00435 
<a name="l00436"></a>00436   <span class="comment">//if no item is under mouse then return</span>
<a name="l00437"></a>00437   <span class="keywordflow">if</span>(<a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a> == NULL)
<a name="l00438"></a>00438   {
<a name="l00439"></a>00439     <span class="keywordflow">if</span>(<a class="code" href="classPhotosIconView.html#029414c23cafc64bb47f3ff881c6eccd">handCursorShown</a>)
<a name="l00440"></a>00440     {
<a name="l00441"></a>00441       setCursor( QCursor( Qt::ArrowCursor ) );
<a name="l00442"></a>00442       <a class="code" href="classPhotosIconView.html#029414c23cafc64bb47f3ff881c6eccd">handCursorShown</a> = <span class="keyword">false</span>;
<a name="l00443"></a>00443     }
<a name="l00444"></a>00444     <span class="keywordflow">return</span>;
<a name="l00445"></a>00445   }
<a name="l00446"></a>00446 
<a name="l00447"></a>00447   QRect photoInfoRect = <a class="code" href="classPhotosIconView.html#4201309c2fac1607967d69a8f44d5523">currentPseudoSelection</a>-&gt;<a class="code" href="classPhotoPreviewWidget.html#a0a4a1da54f1ce102f3d3512afd2fb49">getPhotoInfoRect</a>();
<a name="l00448"></a>00448 
<a name="l00449"></a>00449   <span class="comment">//if hand not shown but over hover over image then turn hand cursor on</span>
<a name="l00450"></a>00450   <span class="keywordflow">if</span>( !<a class="code" href="classPhotosIconView.html#029414c23cafc64bb47f3ff881c6eccd">handCursorShown</a> &amp;&amp; photoInfoRect.contains( e-&gt;x(), e-&gt;y() ) )
<a name="l00451"></a>00451   {
<a name="l00452"></a>00452     setCursor( QCursor( Qt::PointingHandCursor ) );
<a name="l00453"></a>00453     <a class="code" href="classPhotosIconView.html#029414c23cafc64bb47f3ff881c6eccd">handCursorShown</a> = <span class="keyword">true</span>;
<a name="l00454"></a>00454     <span class="keywordflow">return</span>;
<a name="l00455"></a>00455   }
<a name="l00456"></a>00456 
<a name="l00457"></a>00457   <span class="comment">//if hand cursor shown but nolonger over hover over image set cursor back to normal</span>
<a name="l00458"></a>00458   <span class="keywordflow">if</span>( <a class="code" href="classPhotosIconView.html#029414c23cafc64bb47f3ff881c6eccd">handCursorShown</a> &amp;&amp; !photoInfoRect.contains( e-&gt;x(), e-&gt;y() ) )
<a name="l00459"></a>00459   {
<a name="l00460"></a>00460     setCursor( QCursor( Qt::ArrowCursor ) );
<a name="l00461"></a>00461     <a class="code" href="classPhotosIconView.html#029414c23cafc64bb47f3ff881c6eccd">handCursorShown</a> = <span class="keyword">false</span>;
<a name="l00462"></a>00462     <span class="keywordflow">return</span>;
<a name="l00463"></a>00463   }
<a name="l00464"></a>00464 }
<a name="l00465"></a>00465 <span class="comment">//==============================================</span>
<a name="l00466"></a><a class="code" href="classPhotosIconView.html#8b5099e9be06e119999a88bde25544d0">00466</a> <span class="keywordtype">void</span> <a class="code" href="classPhotosIconView.html#8b5099e9be06e119999a88bde25544d0">PhotosIconView::keyPressEvent</a>( QKeyEvent *e )
<a name="l00467"></a>00467 {
<a name="l00468"></a>00468   <span class="comment">//next handle additional keys</span>
<a name="l00469"></a>00469   <span class="keywordflow">switch</span>( e-&gt;key() )
<a name="l00470"></a>00470   {
<a name="l00471"></a>00471     <span class="comment">//edit selected photo</span>
<a name="l00472"></a>00472     <span class="keywordflow">case</span> Qt::Key_Enter:
<a name="l00473"></a>00473     <span class="keywordflow">case</span> Qt::Key_Return:
<a name="l00474"></a>00474       <span class="comment">//only edit photo if one is selected</span>
<a name="l00475"></a>00475       <span class="keywordflow">if</span>(<a class="code" href="classPhotosIconView.html#0aeae24dce6e3eb865a2270bc888edc7">numSelected</a>() == 1)
<a name="l00476"></a>00476       {
<a name="l00477"></a>00477         <span class="keywordflow">if</span>( <a class="code" href="classPhotosIconView.html#6dcd7e363e4fbacfd12c8fa30e2455e8">curPhotoDescEdit</a> != NULL ) { <span class="keyword">delete</span> <a class="code" href="classPhotosIconView.html#6dcd7e363e4fbacfd12c8fa30e2455e8">curPhotoDescEdit</a>; }
<a name="l00478"></a>00478 
<a name="l00479"></a>00479         <a class="code" href="classPhotoPreviewWidget.html" title="Displays photo thumbnail and description.">PhotoPreviewWidget</a>* ppw = (<a class="code" href="classPhotoPreviewWidget.html" title="Displays photo thumbnail and description.">PhotoPreviewWidget</a>*)currentItem();
<a name="l00480"></a>00480         <a class="code" href="classPhotosIconView.html#6dcd7e363e4fbacfd12c8fa30e2455e8">curPhotoDescEdit</a> = <span class="keyword">new</span> <a class="code" href="classPhotoDescEdit.html">PhotoDescEdit</a>( ppw, ((<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;getConfig()-&gt;getBool
<a name="l00481"></a>00481                                               ( <span class="stringliteral">"layout"</span>, <span class="stringliteral">"animation"</span> ) );
<a name="l00482"></a>00482       }
<a name="l00483"></a>00483       <span class="keywordflow">break</span>;
<a name="l00484"></a>00484     <span class="comment">//delete - remove selected photos</span>
<a name="l00485"></a>00485     <span class="keywordflow">case</span> Qt::Key_Delete:
<a name="l00486"></a>00486       <span class="keywordflow">if</span>(<a class="code" href="classPhotosIconView.html#0aeae24dce6e3eb865a2270bc888edc7">numSelected</a>() &gt; 0) emit <a class="code" href="classPhotosIconView.html#c8121d7909a0b6dcd4c43a41e9dbc1c8">removeSelectedPhotos</a>();
<a name="l00487"></a>00487       <span class="keywordflow">break</span>;
<a name="l00488"></a>00488     <span class="comment">//ctrl + r - rotate photo right</span>
<a name="l00489"></a>00489     <span class="keywordflow">case</span> Qt::Key_R:
<a name="l00490"></a>00490       <span class="keywordflow">if</span>( e-&gt;state() &amp; Qt::ControlButton &amp;&amp; <a class="code" href="classPhotosIconView.html#0aeae24dce6e3eb865a2270bc888edc7">numSelected</a>() &gt; 0)
<a name="l00491"></a>00491         emit <a class="code" href="classPhotosIconView.html#46d6fc2f0a8dff316e23ea77080471ff">rotate90SelectedPhotos</a>();
<a name="l00492"></a>00492       <span class="keywordflow">break</span>;
<a name="l00493"></a>00493     <span class="comment">//ctrl + l - rotate photo left</span>
<a name="l00494"></a>00494     <span class="keywordflow">case</span> Qt::Key_L:
<a name="l00495"></a>00495       <span class="keywordflow">if</span>(e-&gt;state() &amp; Qt::ControlButton &amp;&amp; <a class="code" href="classPhotosIconView.html#0aeae24dce6e3eb865a2270bc888edc7">numSelected</a>() &gt; 0) 
<a name="l00496"></a>00496         emit <a class="code" href="classPhotosIconView.html#066e872af6134379d6d3e46768456060">rotate270SelectedPhotos</a>();
<a name="l00497"></a>00497       <span class="keywordflow">break</span>;
<a name="l00498"></a>00498     <span class="comment">//e - edit photo using editing interface</span>
<a name="l00499"></a>00499     <span class="keywordflow">case</span> Qt::Key_E:
<a name="l00500"></a>00500       <span class="keywordflow">if</span>(e-&gt;state() &amp; Qt::ControlButton &amp;&amp; <a class="code" href="classPhotosIconView.html#0aeae24dce6e3eb865a2270bc888edc7">numSelected</a>() &gt;= 1) emit <a class="code" href="classPhotosIconView.html#cf39853afad46c2c73e9f3901ddbb595">editSelectedPhoto</a>();
<a name="l00501"></a>00501       <span class="keywordflow">break</span>;
<a name="l00502"></a>00502     <span class="comment">//allow base class to handle key event</span>
<a name="l00503"></a>00503     <span class="keywordflow">default</span>:
<a name="l00504"></a>00504       <a class="code" href="classPhotosIconView.html#8b5099e9be06e119999a88bde25544d0">QIconView::keyPressEvent</a>(e);
<a name="l00505"></a>00505       <span class="keywordflow">break</span>;
<a name="l00506"></a>00506   }
<a name="l00507"></a>00507 }
<a name="l00508"></a>00508 <span class="comment">//==============================================</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:26 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>