Sophie

Sophie

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

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: wallpaperTools.h File Reference</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>
</div>
<div class="contents">
<h1>wallpaperTools.h File Reference</h1>
<p>
<div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dynsection">
</div>

<p>
<a href="wallpaperTools_8h_source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="wallpaperTools_8h.html#909394ff2837866b916bf25d09c028b7">setWallpaper</a> (<a class="el" href="classPhoto.html">Photo</a> *phto)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets desktop wallpaper using specified photo.  <a href="#909394ff2837866b916bf25d09c028b7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="wallpaperTools_8h.html#9ad0cb98fe8883f614c68cfe3d7b5a8b">setWallpaperSupported</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Does <a class="el" href="classAlbum.html" title="An album contains Subalbums.">Album</a> Shaper support setting the wallpaper on this system?  <a href="#9ad0cb98fe8883f614c68cfe3d7b5a8b"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="909394ff2837866b916bf25d09c028b7"></a><!-- doxytag: member="wallpaperTools.h::setWallpaper" ref="909394ff2837866b916bf25d09c028b7" args="(Photo *phto)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void setWallpaper           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classPhoto.html">Photo</a> *&nbsp;</td>
          <td class="paramname"> <em>phto</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets desktop wallpaper using specified photo. 
<p>

<p>Definition at line <a class="el" href="wallpaperTools_8cpp_source.html#l00034">34</a> of file <a class="el" href="wallpaperTools_8cpp_source.html">wallpaperTools.cpp</a>.</p>

<p>References <a class="el" href="fileTools_8cpp_source.html#l00061">copyFile()</a>, <a class="el" href="photo_8cpp_source.html#l00191">Photo::getImageFilename()</a>, <a class="el" href="imageTools_8cpp_source.html#l00192">getImageSize()</a>, and <a class="el" href="imageTools_8cpp_source.html#l00157">scaleImage()</a>.</p>

<p>Referenced by <a class="el" href="subalbumWidget_8cpp_source.html#l00405">SubalbumWidget::setWallpaperAction()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00035"></a>00035 {
<a name="l00036"></a>00036   <span class="comment">//Get full size image dimensions</span>
<a name="l00037"></a>00037   <span class="keywordtype">int</span> imageW, imageH;
<a name="l00038"></a>00038   <a class="code" href="imageTools_8cpp.html#2af7f0a9c4f931ad3213c36796e95288" title="Get image dimensions.">getImageSize</a>( phto-&gt;<a class="code" href="classPhoto.html#5ebb6fccddd609df5d407498957e1089" title="Gets the image filename.">getImageFilename</a>(), imageW, imageH );
<a name="l00039"></a>00039 
<a name="l00040"></a>00040   <span class="comment">//If image is larger than either screen dimension then scale it down</span>
<a name="l00041"></a>00041   <span class="keywordtype">int</span> screenW = qApp-&gt;desktop()-&gt;screenGeometry().size().width();
<a name="l00042"></a>00042   <span class="keywordtype">int</span> screenH = qApp-&gt;desktop()-&gt;screenGeometry().size().height();
<a name="l00043"></a>00043 
<a name="l00044"></a>00044   <span class="comment">//If image is larger than either screen dimensions then scale it to fit</span>
<a name="l00045"></a>00045   QImage scaledImage;
<a name="l00046"></a>00046   <span class="keywordflow">if</span>( imageW &gt; screenW || imageH &gt; screenH )
<a name="l00047"></a>00047   {
<a name="l00048"></a>00048     <a class="code" href="imageTools_8cpp.html#126e11984fb8124e78e3b1b68a24870c" title="Scale image and save copy to disk.">scaleImage</a>( phto-&gt;<a class="code" href="classPhoto.html#5ebb6fccddd609df5d407498957e1089" title="Gets the image filename.">getImageFilename</a>(), scaledImage, screenW, screenH );
<a name="l00049"></a>00049     imageW = scaledImage.width();
<a name="l00050"></a>00050     imageH = scaledImage.height();
<a name="l00051"></a>00051   }
<a name="l00052"></a>00052 
<a name="l00053"></a>00053   <span class="comment">//If image is &lt;75% of either screen dimensions, center it when setting it to the background</span>
<a name="l00054"></a>00054   <span class="comment">//PLATFORM_SPECIFIC_CODE</span>
<a name="l00055"></a>00055 <span class="preprocessor">  #ifndef Q_OS_MACX</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span>  <span class="keyword">const</span> <span class="keywordtype">bool</span> centerImage = (imageW &lt; 0.75*screenW) || (imageH &lt; 0.75*screenH);
<a name="l00057"></a>00057 <span class="preprocessor">  #endif</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span>
<a name="l00059"></a>00059   <span class="comment">//Determine the final output filename. On Windows this is pretty simple, but on OSX and KDE/Unix</span>
<a name="l00060"></a>00060   <span class="comment">//I've found that repeatedly setting the same filename to be used as the background does not result in a </span>
<a name="l00061"></a>00061   <span class="comment">//refreshing of the background image. Apparently these window managers are trying to be "smart" and </span>
<a name="l00062"></a>00062   <span class="comment">//avoid refreshing when the image has not changed, but in our case we are changing the image content,</span>
<a name="l00063"></a>00063   <span class="comment">//just not the image filename. Alas a simple fix to this problem is to alternate using spaces and </span>
<a name="l00064"></a>00064   <span class="comment">//underscores in the image filename and removing the old image. Another option might be to first set the </span>
<a name="l00065"></a>00065   <span class="comment">//background image to null, but this might result in unwanted flicker so we use the slightly more </span>
<a name="l00066"></a>00066   <span class="comment">//complicated approach involving alternating filenames.</span>
<a name="l00067"></a>00067 
<a name="l00068"></a>00068   <span class="comment">//PLATFORM_SPECIFIC_CODE</span>
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   <span class="comment">//Windows</span>
<a name="l00071"></a>00071 <span class="preprocessor">  #if defined(Q_OS_WIN)</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span>
<a name="l00073"></a>00073   <span class="comment">//determine location to store the desktop image</span>
<a name="l00074"></a>00074   QString outFilename;
<a name="l00075"></a>00075   <span class="keywordflow">if</span>( !getWindowsFolderLocation(LOCAL_SETTINGS_APPLICATION_DATA,  outFilename) )
<a name="l00076"></a>00076   {
<a name="l00077"></a>00077     outFilename = getenv(<span class="stringliteral">"USERPROFILE"</span>) + QString(<span class="stringliteral">"/Local Settings/Application Data"</span>);
<a name="l00078"></a>00078   }
<a name="l00079"></a>00079   outFilename = QDir::convertSeparators( outFilename + <span class="stringliteral">"/Album Shaper/Album Shaper Wallpaper.bmp"</span> );
<a name="l00080"></a>00080   
<a name="l00081"></a>00081   <span class="comment">//windows only support setting background image using BMP format, so if image was not scaled</span>
<a name="l00082"></a>00082   <span class="comment">//load it so we can use QImage to save it as a BMP image now</span>
<a name="l00083"></a>00083   <span class="keywordflow">if</span>( scaledImage.isNull() )  
<a name="l00084"></a>00084   { scaledImage.load( phto-&gt;<a class="code" href="classPhoto.html#5ebb6fccddd609df5d407498957e1089" title="Gets the image filename.">getImageFilename</a>() ); }
<a name="l00085"></a>00085   
<a name="l00086"></a>00086   <span class="comment">//save image out</span>
<a name="l00087"></a>00087   scaledImage.save( outFilename, <span class="stringliteral">"BMP"</span> );
<a name="l00088"></a>00088  
<a name="l00089"></a>00089   <span class="comment">//OSX and other forms of UNIX</span>
<a name="l00090"></a>00090 <span class="preprocessor">  #else</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span>
<a name="l00092"></a>00092   <span class="comment">//determine location to store the desktop image</span>
<a name="l00093"></a>00093 <span class="preprocessor">  #if defined(Q_OS_MACX)</span>
<a name="l00094"></a>00094 <span class="preprocessor"></span>  QString outFilename1 = QDir::homeDirPath() + QString(<span class="stringliteral">"/Pictures/Album Shaper Wallpaper.jpg"</span>);
<a name="l00095"></a>00095   QString outFilename2 = QDir::homeDirPath() + QString(<span class="stringliteral">"/Pictures/Album_Shaper_Wallpaper.jpg"</span>);  
<a name="l00096"></a>00096 <span class="preprocessor">  #else</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span>  QString outFilename1 = QDir::homeDirPath() + QString(<span class="stringliteral">"/.albumShaper/Album Shaper Wallpaper.jpg"</span>);
<a name="l00098"></a>00098   QString outFilename2 = QDir::homeDirPath() + QString(<span class="stringliteral">"/.albumShaper/Album_Shaper_Wallpaper.jpg"</span>);
<a name="l00099"></a>00099 <span class="preprocessor">  #endif</span>
<a name="l00100"></a>00100 <span class="preprocessor"></span>
<a name="l00101"></a>00101   QString chosenFilename;
<a name="l00102"></a>00102   QString oldFilename;
<a name="l00103"></a>00103   
<a name="l00104"></a>00104   <span class="comment">//check if outFilename already exists. MacOSX is annoying in that when we create an apple event to </span>
<a name="l00105"></a>00105   <span class="comment">//set the desktop wallpaper the Finder appears to ignore the event if the filename is the same</span>
<a name="l00106"></a>00106   <span class="comment">//the current filename. Ug, so to trick it use the opposite filename (swap spaces with _'s in filename)</span>
<a name="l00107"></a>00107   QDir tmpDir;
<a name="l00108"></a>00108   <span class="keywordflow">if</span>(tmpDir.exists( outFilename1 ) )
<a name="l00109"></a>00109   {
<a name="l00110"></a>00110     chosenFilename = outFilename2;
<a name="l00111"></a>00111     oldFilename = outFilename1;
<a name="l00112"></a>00112   }
<a name="l00113"></a>00113   <span class="keywordflow">else</span> <span class="keywordflow">if</span>( tmpDir.exists( outFilename2 ) )
<a name="l00114"></a>00114   {
<a name="l00115"></a>00115     chosenFilename = outFilename1;
<a name="l00116"></a>00116     oldFilename = outFilename2;
<a name="l00117"></a>00117   }
<a name="l00118"></a>00118   <span class="keywordflow">else</span>
<a name="l00119"></a>00119   {
<a name="l00120"></a>00120     chosenFilename = outFilename1;
<a name="l00121"></a>00121   }
<a name="l00122"></a>00122   
<a name="l00123"></a>00123   <span class="comment">//save out file in JPG format</span>
<a name="l00124"></a>00124   <span class="keywordflow">if</span>( !scaledImage.isNull() )
<a name="l00125"></a>00125   {
<a name="l00126"></a>00126     scaledImage.save( chosenFilename, <span class="stringliteral">"JPEG"</span>, 95 );
<a name="l00127"></a>00127   }
<a name="l00128"></a>00128   <span class="keywordflow">else</span>
<a name="l00129"></a>00129   {
<a name="l00130"></a>00130     <a class="code" href="fileTools_8cpp.html#f41848ecf008f6b6579f5b0975faea5a" title="Copies a file from one location to another.">copyFile</a>( phto-&gt;<a class="code" href="classPhoto.html#5ebb6fccddd609df5d407498957e1089" title="Gets the image filename.">getImageFilename</a>(), chosenFilename );
<a name="l00131"></a>00131   }
<a name="l00132"></a>00132 
<a name="l00133"></a>00133 <span class="preprocessor">  #endif    </span>
<a name="l00134"></a>00134 <span class="preprocessor"></span>
<a name="l00135"></a>00135   <span class="comment">//-------------------------------</span>
<a name="l00136"></a>00136   <span class="comment">// The output filename has been determined, and the image prepared.</span>
<a name="l00137"></a>00137   <span class="comment">// Now save out the scaled image and set the wallpaper using system specific methods.</span>
<a name="l00138"></a>00138   <span class="comment">//-------------------------------</span>
<a name="l00139"></a>00139   <span class="comment">//PLATFORM_SPECIFIC_CODE</span>
<a name="l00140"></a>00140 
<a name="l00141"></a>00141   <span class="comment">//Windows</span>
<a name="l00142"></a>00142 <span class="preprocessor">  #if defined(Q_OS_WIN)</span>
<a name="l00143"></a>00143 <span class="preprocessor"></span>
<a name="l00144"></a>00144   <span class="comment">//Set tile and stretch values</span>
<a name="l00145"></a>00145   HKEY key;
<a name="l00146"></a>00146   <span class="keywordtype">char</span> data[8];
<a name="l00147"></a>00147   <span class="keywordflow">if</span>( RegOpenKeyExA( HKEY_CURRENT_USER, <span class="stringliteral">"Control Panel\\Desktop"</span>, 0, KEY_SET_VALUE, &amp;key) == ERROR_SUCCESS)
<a name="l00148"></a>00148   {
<a name="l00149"></a>00149     <span class="comment">//Set stretch factor, only stretch (2) if not using centering</span>
<a name="l00150"></a>00150     itoa( centerImage ? 0 : 2, data, 10);
<a name="l00151"></a>00151     RegSetValueExA(key, <span class="stringliteral">"WallpaperStyle"</span>, NULL, REG_SZ, (UCHAR*)data, 8);
<a name="l00152"></a>00152 
<a name="l00153"></a>00153     <span class="comment">//Never tile (0)</span>
<a name="l00154"></a>00154     itoa(0, data, 10);
<a name="l00155"></a>00155     RegSetValueExA(key, <span class="stringliteral">"TileWallpaper"</span>, NULL, REG_SZ, (UCHAR*)data, 8);  
<a name="l00156"></a>00156 
<a name="l00157"></a>00157     <span class="comment">//Close the key</span>
<a name="l00158"></a>00158     RegCloseKey(key);
<a name="l00159"></a>00159   }
<a name="l00160"></a>00160   
<a name="l00161"></a>00161   <span class="comment">//set background wallpaper</span>
<a name="l00162"></a>00162   SystemParametersInfoA( SPI_SETDESKWALLPAPER, 0,
<a name="l00163"></a>00163                          (<span class="keywordtype">void</span>*) outFilename.ascii(),
<a name="l00164"></a>00164                          SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE );
<a name="l00165"></a>00165   <span class="comment">//-------------------------------</span>
<a name="l00166"></a>00166   <span class="comment">//MacOSX</span>
<a name="l00167"></a>00167 <span class="preprocessor">  #elif defined(Q_OS_MACX)</span>
<a name="l00168"></a>00168 <span class="preprocessor"></span>
<a name="l00169"></a>00169   <span class="comment">//create script</span>
<a name="l00170"></a>00170   QString scriptFilename = ((<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;getAlbum()-&gt;getTmpDir() +
<a name="l00171"></a>00171     <span class="stringliteral">"/tmpBackgroundScript"</span>;
<a name="l00172"></a>00172 
<a name="l00173"></a>00173   QFile file( scriptFilename );
<a name="l00174"></a>00174   <span class="keywordflow">if</span>(file.open(IO_WriteOnly))
<a name="l00175"></a>00175   {
<a name="l00176"></a>00176     <span class="comment">//-----</span>
<a name="l00177"></a>00177     QTextStream stream;
<a name="l00178"></a>00178     stream.setDevice( &amp;file );
<a name="l00179"></a>00179     stream.setEncoding( QTextStream::UnicodeUTF8 );
<a name="l00180"></a>00180     <span class="comment">//-----</span>
<a name="l00181"></a>00181     stream &lt;&lt; <span class="stringliteral">"tell application \"Finder\"\n"</span>;
<a name="l00182"></a>00182     stream &lt;&lt; <span class="stringliteral">"set pFile to POSIX file \""</span> &lt;&lt; chosenFilename.ascii() &lt;&lt; <span class="stringliteral">"\"\n"</span>;
<a name="l00183"></a>00183     stream &lt;&lt; <span class="stringliteral">"set desktop picture to file pFile\n"</span>;
<a name="l00184"></a>00184     stream &lt;&lt; <span class="stringliteral">"end tell"</span>;
<a name="l00185"></a>00185   }
<a name="l00186"></a>00186   file.close();
<a name="l00187"></a>00187   
<a name="l00188"></a>00188   <span class="comment">//run script to set background</span>
<a name="l00189"></a>00189   QProcess p;
<a name="l00190"></a>00190   p.addArgument( <span class="stringliteral">"/usr/bin/osascript"</span> );
<a name="l00191"></a>00191   p.addArgument( scriptFilename );
<a name="l00192"></a>00192   p.start();
<a name="l00193"></a>00193   
<a name="l00194"></a>00194   <span class="comment">//if there is an old file remove it</span>
<a name="l00195"></a>00195   <span class="keywordflow">if</span>(!oldFilename.isNull())    
<a name="l00196"></a>00196   { tmpDir.remove( oldFilename ); }
<a name="l00197"></a>00197 
<a name="l00198"></a>00198   <span class="comment">//-------------------------------</span>
<a name="l00199"></a>00199   <span class="comment">//UNIX</span>
<a name="l00200"></a>00200 <span class="preprocessor">  #else</span>
<a name="l00201"></a>00201 <span class="preprocessor"></span>
<a name="l00202"></a>00202   <span class="comment">//first try setting KDE background through DCOP interface</span>
<a name="l00203"></a>00203   {
<a name="l00204"></a>00204     QProcess p;   
<a name="l00205"></a>00205     p.clearArguments();
<a name="l00206"></a>00206     p.addArgument( <span class="stringliteral">"dcop"</span> );
<a name="l00207"></a>00207     p.addArgument( <span class="stringliteral">"kdesktop"</span> );
<a name="l00208"></a>00208     p.addArgument( <span class="stringliteral">"KBackgroundIface"</span> );
<a name="l00209"></a>00209     p.addArgument( <span class="stringliteral">"setWallpaper"</span> );
<a name="l00210"></a>00210     p.addArgument( chosenFilename.ascii() );
<a name="l00211"></a>00211 
<a name="l00212"></a>00212     <span class="comment">//if the image width and height are at least 75% of the screen size then</span>
<a name="l00213"></a>00213     <span class="comment">//use CENTERMAXSPECT. This will scale the image to fit the screen but </span>
<a name="l00214"></a>00214     <span class="comment">//will not warp it by changing it's effective aspect ratio. Otherwise scaling up </span>
<a name="l00215"></a>00215     <span class="comment">//will cause visible pixelation so user the CENTERED setting.</span>
<a name="l00216"></a>00216     <span class="keyword">const</span> <span class="keywordtype">int</span> CENTERED = 1;
<a name="l00217"></a>00217     <span class="keyword">const</span> <span class="keywordtype">int</span> CENTER_MAXPECT = 4;
<a name="l00218"></a>00218     <span class="keywordtype">int</span> positionOption = centerImage ? CENTERED : CENTER_MAXPECT;
<a name="l00219"></a>00219     p.addArgument( QString(<span class="stringliteral">"%1"</span>).arg(positionOption) );
<a name="l00220"></a>00220 
<a name="l00221"></a>00221     <span class="comment">//attempt to background now using DCOP interface</span>
<a name="l00222"></a>00222     p.start();
<a name="l00223"></a>00223   }
<a name="l00224"></a>00224   
<a name="l00225"></a>00225   <span class="comment">//try setting GNOME background using gconftool</span>
<a name="l00226"></a>00226   {
<a name="l00227"></a>00227     QProcess p;   
<a name="l00228"></a>00228     p.clearArguments();
<a name="l00229"></a>00229     p.addArgument( <span class="stringliteral">"gconftool-2"</span> );
<a name="l00230"></a>00230     p.addArgument( <span class="stringliteral">"-t"</span> );
<a name="l00231"></a>00231     p.addArgument( <span class="stringliteral">"string"</span> );
<a name="l00232"></a>00232     p.addArgument( <span class="stringliteral">"-s"</span> );
<a name="l00233"></a>00233     p.addArgument( <span class="stringliteral">"/desktop/gnome/background/picture_filename"</span> );
<a name="l00234"></a>00234     p.addArgument( chosenFilename.ascii() );
<a name="l00235"></a>00235     p.start();  
<a name="l00236"></a>00236   }
<a name="l00237"></a>00237 
<a name="l00238"></a>00238   <span class="comment">//try setting WindowMaker background using wmsetbg</span>
<a name="l00239"></a>00239   {
<a name="l00240"></a>00240     QProcess p;   
<a name="l00241"></a>00241     p.clearArguments();
<a name="l00242"></a>00242     p.addArgument( <span class="stringliteral">"wmsetbg"</span> );
<a name="l00243"></a>00243     p.addArgument( <span class="stringliteral">"--maxscale"</span> );
<a name="l00244"></a>00244     p.addArgument( <span class="stringliteral">"-u"</span> );
<a name="l00245"></a>00245     p.addArgument( chosenFilename.ascii() );
<a name="l00246"></a>00246     p.start();  
<a name="l00247"></a>00247   }
<a name="l00248"></a>00248   
<a name="l00249"></a>00249   <span class="comment">//if there is an old file remove it</span>
<a name="l00250"></a>00250   <span class="keywordflow">if</span>(!oldFilename.isNull())    
<a name="l00251"></a>00251   { tmpDir.remove( oldFilename ); }
<a name="l00252"></a>00252   <span class="comment">//-------------------------------</span>
<a name="l00253"></a>00253 <span class="preprocessor">  #endif</span>
<a name="l00254"></a>00254 <span class="preprocessor"></span>}
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="9ad0cb98fe8883f614c68cfe3d7b5a8b"></a><!-- doxytag: member="wallpaperTools.h::setWallpaperSupported" ref="9ad0cb98fe8883f614c68cfe3d7b5a8b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool setWallpaperSupported           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Does <a class="el" href="classAlbum.html" title="An album contains Subalbums.">Album</a> Shaper support setting the wallpaper on this system? 
<p>

<p>Definition at line <a class="el" href="wallpaperTools_8cpp_source.html#l00256">256</a> of file <a class="el" href="wallpaperTools_8cpp_source.html">wallpaperTools.cpp</a>.</p>

<p>Referenced by <a class="el" href="subalbumWidget_8cpp_source.html#l00049">SubalbumWidget::SubalbumWidget()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00257"></a>00257 {
<a name="l00258"></a>00258   <span class="comment">//OSX supported!</span>
<a name="l00259"></a>00259 <span class="preprocessor">  #if defined(Q_OS_MACX)</span>
<a name="l00260"></a>00260 <span class="preprocessor"></span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00261"></a>00261   
<a name="l00262"></a>00262   <span class="comment">//Windows is supported!</span>
<a name="l00263"></a>00263 <span class="preprocessor">  #elif defined(Q_OS_WIN)</span>
<a name="l00264"></a>00264 <span class="preprocessor"></span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00265"></a>00265 
<a name="l00266"></a>00266   <span class="comment">//Last try, check if dcop or gconftool-2 can be used</span>
<a name="l00267"></a>00267 <span class="preprocessor">  #else</span>
<a name="l00268"></a>00268 <span class="preprocessor"></span>  QProcess p;
<a name="l00269"></a>00269 
<a name="l00270"></a>00270   p.addArgument( <span class="stringliteral">"dcop"</span> );
<a name="l00271"></a>00271   <span class="keywordtype">bool</span> DCOP_Present = p.start();
<a name="l00272"></a>00272 
<a name="l00273"></a>00273   p.clearArguments();
<a name="l00274"></a>00274   p.addArgument( <span class="stringliteral">"gconftool-2"</span> );
<a name="l00275"></a>00275   <span class="keywordtype">bool</span> gconftool_Present = p.start();
<a name="l00276"></a>00276 
<a name="l00277"></a>00277   p.clearArguments();
<a name="l00278"></a>00278   p.addArgument( <span class="stringliteral">"wmsetbg"</span> );
<a name="l00279"></a>00279   <span class="keywordtype">bool</span> wmsetbg_Present = p.start();
<a name="l00280"></a>00280 
<a name="l00281"></a>00281   <span class="keywordflow">return</span> ( DCOP_Present || gconftool_Present || wmsetbg_Present );
<a name="l00282"></a>00282 
<a name="l00283"></a>00283 <span class="preprocessor">  #endif</span>
<a name="l00284"></a>00284 <span class="preprocessor"></span>}
</pre></div>
<p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:33 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>