Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > 9601c7beb4ff23e834bfa171795ed560 > files > 381

vidalia-0.2.9-1mdv2010.1.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Vidalia: UpdateProcess.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</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>
      <li><a href="dirs.html"><span>Directories</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 class="navpath"><a class="el" href="dir_b47abd1aad201a152869566145babb61.html">src</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_695ba8f8357372e02d38c40b3c6dbe81.html">vidalia</a>
  </div>
</div>
<div class="contents">
<h1>UpdateProcess.h</h1><a href="_update_process_8h.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">**  This file is part of Vidalia, and is subject to the license terms in the</span>
<a name="l00003"></a>00003 <span class="comment">**  LICENSE file, found in the top level directory of this distribution. If you</span>
<a name="l00004"></a>00004 <span class="comment">**  did not receive the LICENSE file with this file, you may obtain it from the</span>
<a name="l00005"></a>00005 <span class="comment">**  Vidalia source package distributed by the Vidalia Project at</span>
<a name="l00006"></a>00006 <span class="comment">**  http://www.vidalia-project.net/. No part of Vidalia, including this file,</span>
<a name="l00007"></a>00007 <span class="comment">**  may be copied, modified, propagated, or distributed except according to the</span>
<a name="l00008"></a>00008 <span class="comment">**  terms described in the LICENSE file.</span>
<a name="l00009"></a>00009 <span class="comment">*/</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#ifndef _UPDATEPROCESS_H</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#define _UPDATEPROCESS_H</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="_package_info_8h.html">PackageInfo.h</a>&quot;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;QProcess&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;QDateTime&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;QStringList&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;QUrl&gt;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 
<a name="l00022"></a><a class="code" href="class_update_process.html">00022</a> <span class="keyword">class </span><a class="code" href="class_update_process.html">UpdateProcess</a> : <span class="keyword">public</span> QProcess
<a name="l00023"></a>00023 {
<a name="l00024"></a>00024   Q_OBJECT
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="keyword">public</span>:
<a name="l00027"></a><a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505a">00027</a>   <span class="keyword">enum</span> <a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505a">BundleInfo</a> {
<a name="l00028"></a><a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505aaeedc102a1d827bd521456d530472ffa4">00028</a>     <a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505aaeedc102a1d827bd521456d530472ffa4">TorBundleInfo</a>,
<a name="l00029"></a>00029   };
<a name="l00030"></a>00030 <span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment">  /** Default constructor.</span>
<a name="l00032"></a>00032 <span class="comment">   */</span>
<a name="l00033"></a>00033   <a class="code" href="class_update_process.html#a1fc9d03ee0a4e7d8824b41d3ccf5a50a">UpdateProcess</a>(QObject *parent = 0);
<a name="l00034"></a>00034 <span class="comment"></span>
<a name="l00035"></a>00035 <span class="comment">  /** Begin a check for software updates that may be available for the</span>
<a name="l00036"></a>00036 <span class="comment">   * software package specified by &lt;b&gt;bi&lt;/b&gt;.</span>
<a name="l00037"></a>00037 <span class="comment">   */</span>
<a name="l00038"></a>00038   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a54e487ec966b73a18d503a01beb39b5b">checkForUpdates</a>(<a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505a">BundleInfo</a> bi);
<a name="l00039"></a>00039 <span class="comment"></span>
<a name="l00040"></a>00040 <span class="comment">  /** Instructs the software update process to install previously downloaded</span>
<a name="l00041"></a>00041 <span class="comment">   * files for &lt;b&gt;bi&lt;/b&gt;.</span>
<a name="l00042"></a>00042 <span class="comment">   */</span>
<a name="l00043"></a>00043   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a7f5215ea87f91e23d08d99e5af43b25f">installUpdates</a>(<a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505a">BundleInfo</a> bi);
<a name="l00044"></a>00044 <span class="comment"></span>
<a name="l00045"></a>00045 <span class="comment">  /** Returns true if the update process is currently in the middle of an</span>
<a name="l00046"></a>00046 <span class="comment">   * operation, such as checking for or installing updates.</span>
<a name="l00047"></a>00047 <span class="comment">   */</span>
<a name="l00048"></a>00048   <span class="keywordtype">bool</span> <a class="code" href="class_update_process.html#aa4653e307cc553334fdba8bb98e8e46a">isRunning</a>() <span class="keyword">const</span>;
<a name="l00049"></a>00049 <span class="comment"></span>
<a name="l00050"></a>00050 <span class="comment">  /** Sets the port to use as a SOCKS proxy to &lt;b&gt;port&lt;/b&gt;. If &lt;b&gt;port&lt;/b&gt; is</span>
<a name="l00051"></a>00051 <span class="comment">   * set to 0, then no SOCKS proxy will be used when checking for updates.</span>
<a name="l00052"></a>00052 <span class="comment">   */</span>
<a name="l00053"></a>00053   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a5cafa5631df3a12997dde3b67c89b620">setSocksPort</a>(quint16 port);
<a name="l00054"></a>00054 <span class="comment"></span>
<a name="l00055"></a>00055 <span class="comment">  /** Return the time at which we should next check for available updates,</span>
<a name="l00056"></a>00056 <span class="comment">   * given the last we checked was at &lt;b&gt;lastCheckedAt&lt;/b&gt;.</span>
<a name="l00057"></a>00057 <span class="comment">   */</span>
<a name="l00058"></a>00058   <span class="keyword">static</span> QDateTime <a class="code" href="class_update_process.html#acc5db0f95435463db6229a12c6b33b47">nextCheckForUpdates</a>(<span class="keyword">const</span> QDateTime &amp;lastCheckedAt);
<a name="l00059"></a>00059 <span class="comment"></span>
<a name="l00060"></a>00060 <span class="comment">  /** Return true if we should check for available software udpates, given</span>
<a name="l00061"></a>00061 <span class="comment">   * the last time we checked was at &lt;b&gt;lastCheckedAt&lt;/b&gt;. The returned</span>
<a name="l00062"></a>00062 <span class="comment">   * QDateTime will be in UTC.</span>
<a name="l00063"></a>00063 <span class="comment">   */</span>
<a name="l00064"></a>00064   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_update_process.html#afe8256e9bfeac91f946b73036fbec004">shouldCheckForUpdates</a>(<span class="keyword">const</span> QDateTime &amp;lastCheckedAt);
<a name="l00065"></a>00065 <span class="comment"></span>
<a name="l00066"></a>00066 <span class="comment">  /** Returns the preferred interval (in seconds) between executions of the</span>
<a name="l00067"></a>00067 <span class="comment">   * Glider process to check for available software updates.</span>
<a name="l00068"></a>00068 <span class="comment">   */</span>
<a name="l00069"></a>00069   <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_update_process.html#a54d4d22cb36b1690d3c476f908681878">checkForUpdatesInterval</a>();
<a name="l00070"></a>00070 <span class="comment"></span>
<a name="l00071"></a>00071 <span class="comment">  /** Returns the path and filename of the software update executable.</span>
<a name="l00072"></a>00072 <span class="comment">   */</span>
<a name="l00073"></a>00073   <span class="keyword">static</span> QString <a class="code" href="class_update_process.html#a5d6ecf49da3e0d37e99ac5794d78c145">updateExecutable</a>();
<a name="l00074"></a>00074 <span class="comment"></span>
<a name="l00075"></a>00075 <span class="comment">  /** Returns the path in which the software update executable should write</span>
<a name="l00076"></a>00076 <span class="comment">   * all of its state information.</span>
<a name="l00077"></a>00077 <span class="comment">   */</span>
<a name="l00078"></a>00078   <span class="keyword">static</span> QString <a class="code" href="class_update_process.html#abedc59438d71f84d07f8ae1558a2145f">updateRepositoryDir</a>();
<a name="l00079"></a>00079 
<a name="l00080"></a>00080 signals:<span class="comment"></span>
<a name="l00081"></a>00081 <span class="comment">  /** Emitted when the check for available software updates failed.</span>
<a name="l00082"></a>00082 <span class="comment">   * &lt;b&gt;errmsg&lt;/b&gt; contains a human-readable description of the problem</span>
<a name="l00083"></a>00083 <span class="comment">   * encountered.</span>
<a name="l00084"></a>00084 <span class="comment">   */</span>
<a name="l00085"></a>00085   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#add9bbf76630b289df3681e18b487fd5f">checkForUpdatesFailed</a>(QString errmsg);
<a name="l00086"></a>00086 <span class="comment"></span>
<a name="l00087"></a>00087 <span class="comment">  /** Emitted while an updated package download is in progress. &lt;b&gt;url&lt;/b&gt; is</span>
<a name="l00088"></a>00088 <span class="comment">   * location of the update, &lt;b&gt;bytesReceived&lt;/b&gt; is how many bytes have been</span>
<a name="l00089"></a>00089 <span class="comment">   * downloaded so far and &lt;b&gt;bytesTotal&lt;/b&gt; is the total size of the package</span>
<a name="l00090"></a>00090 <span class="comment">   * being downloaded. */</span>
<a name="l00091"></a>00091   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#ae3893a1e2f6eaf338e5d35c1967a4e43">downloadProgress</a>(QString url, <span class="keywordtype">int</span> bytesReceived, <span class="keywordtype">int</span> bytesTotal);
<a name="l00092"></a>00092 <span class="comment"></span>
<a name="l00093"></a>00093 <span class="comment">  /** Emitted when updated software packages in bundle &lt;b&gt;bi&lt;/b&gt; are</span>
<a name="l00094"></a>00094 <span class="comment">   * are available. &lt;b&gt;packages&lt;/b&gt; contains a collection of PackageInfo objects</span>
<a name="l00095"></a>00095 <span class="comment">   * describing the updates available for installation.</span>
<a name="l00096"></a>00096 <span class="comment">   */</span>
<a name="l00097"></a>00097   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a0ba81f11f9fc4300291830d5ca095951">updatesAvailable</a>(<a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505a">UpdateProcess::BundleInfo</a> bi, <a class="code" href="_package_info_8h.html#ae1b3835486d49f6ee4483714e49f019b">PackageList</a> packages);
<a name="l00098"></a>00098 <span class="comment"></span>
<a name="l00099"></a>00099 <span class="comment">  /** Emitted after all available updated packages have been successfully</span>
<a name="l00100"></a>00100 <span class="comment">   * installed.</span>
<a name="l00101"></a>00101 <span class="comment">   */</span>
<a name="l00102"></a>00102   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#ac082af6a8e6d7ea066561c721f4fd9ae">updatesInstalled</a>(<span class="keywordtype">int</span> nPackagesInstalled);
<a name="l00103"></a>00103 <span class="comment"></span>
<a name="l00104"></a>00104 <span class="comment">  /** Emitted when there is an error installing one or more updated software</span>
<a name="l00105"></a>00105 <span class="comment">   * packages. &lt;b&gt;errmsg&lt;/b&gt; might even contain a useful description of the</span>
<a name="l00106"></a>00106 <span class="comment">   * error encountered (but don&#39;t bet the farm on it).</span>
<a name="l00107"></a>00107 <span class="comment">   */</span>
<a name="l00108"></a>00108   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a5c44f3f6eb1ec1253d11dad1e94f2b23">installUpdatesFailed</a>(QString errmsg);
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <span class="keyword">public</span> slots:<span class="comment"></span>
<a name="l00111"></a>00111 <span class="comment">    /** Cancels the currently running software update operation immediately. */</span>
<a name="l00112"></a>00112   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#ab95cffe3f9fcb73e648f17304fa6b15c">cancel</a>();
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="keyword">protected</span> slots:<span class="comment"></span>
<a name="l00115"></a>00115 <span class="comment">  /** Called when there is data to be read from the update process&#39;s stdout.</span>
<a name="l00116"></a>00116 <span class="comment">   * Reads and parses all available data.</span>
<a name="l00117"></a>00117 <span class="comment">   */</span>
<a name="l00118"></a>00118   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#abb9ea44d23dc24a2d4b74d229aec3405">readStandardOutput</a>();
<a name="l00119"></a>00119 <span class="comment"></span>
<a name="l00120"></a>00120 <span class="comment">  /** Called when there is data to be read from the update process&#39;s stderr.</span>
<a name="l00121"></a>00121 <span class="comment">   * Reads and parses all available data.</span>
<a name="l00122"></a>00122 <span class="comment">   */</span>
<a name="l00123"></a>00123   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a9ef904f0434b701cf8d1c8ac68473194">readStandardError</a>();
<a name="l00124"></a>00124 <span class="comment"></span>
<a name="l00125"></a>00125 <span class="comment">  /** Called when the underlying QProcess encounters an error.</span>
<a name="l00126"></a>00126 <span class="comment">   */</span>
<a name="l00127"></a>00127   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a8779681b5b2cdd58fe38909e4af3d13c">onError</a>(QProcess::ProcessError <a class="code" href="namespacetc.html#aa7353218fd7baef0876bbb422ce818af">error</a>);
<a name="l00128"></a>00128 <span class="comment"></span>
<a name="l00129"></a>00129 <span class="comment">  /** Called when the auto-update process has terminated.</span>
<a name="l00130"></a>00130 <span class="comment">   */</span>
<a name="l00131"></a>00131   <span class="keywordtype">void</span> <a class="code" href="class_update_process.html#a6ade5ac73e733c8feb2a621f8e2fba0e">onFinished</a>(<span class="keywordtype">int</span> exitCode, QProcess::ExitStatus exitStatus);
<a name="l00132"></a>00132 
<a name="l00133"></a>00133 <span class="keyword">protected</span>:
<a name="l00134"></a><a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892">00134</a>   <span class="keyword">enum</span> <a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892">UpdateCommand</a> {
<a name="l00135"></a><a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892a8ba38d0257ecabf0e9c21728b27ed9cd">00135</a>     <a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892a8ba38d0257ecabf0e9c21728b27ed9cd">NoCommand</a>,
<a name="l00136"></a><a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892aa14277377dbaab311cdd2bf895c07307">00136</a>     <a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892aa14277377dbaab311cdd2bf895c07307">CheckForUpdates</a>,
<a name="l00137"></a><a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892a359c42bed4c86ef4763c9a08ebfc95f6">00137</a>     <a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892a359c42bed4c86ef4763c9a08ebfc95f6">InstallUpdates</a>,
<a name="l00138"></a>00138   };
<a name="l00139"></a>00139 <span class="comment"></span>
<a name="l00140"></a>00140 <span class="comment">  /** Converts a BundleInfo enum value to its proper Thandy-recognized URL</span>
<a name="l00141"></a>00141 <span class="comment">   * for the current OS and architecture. */</span>
<a name="l00142"></a>00142   QString <a class="code" href="class_update_process.html#aa4faf0b0513bca7ae5b0a10d4c077df1">bundleInfoToString</a>(<a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505a">BundleInfo</a> bundleInfo);
<a name="l00143"></a>00143 <span class="comment"></span>
<a name="l00144"></a>00144 <span class="comment">  /** Returns a PackageInfo object containing information about the updated</span>
<a name="l00145"></a>00145 <span class="comment">   * package specified by the /pkginfo/ URL in &lt;b&gt;package&lt;/b&gt;.</span>
<a name="l00146"></a>00146 <span class="comment">   */</span>
<a name="l00147"></a>00147   <span class="keyword">static</span> <a class="code" href="class_package_info.html">PackageInfo</a> <a class="code" href="class_update_process.html#a8304b8d0832f18048a138ff4ee9676f1">packageInfo</a>(<span class="keyword">const</span> QString &amp;package);
<a name="l00148"></a>00148 <span class="comment"></span>
<a name="l00149"></a>00149 <span class="comment">  /** Returns a PackageInfo object populated with information extracted</span>
<a name="l00150"></a>00150 <span class="comment">   * from a Thandy-formatted XML document given by &lt;b&gt;xml&lt;/b&gt;.</span>
<a name="l00151"></a>00151 <span class="comment">   */</span>
<a name="l00152"></a>00152   <span class="keyword">static</span> <a class="code" href="class_package_info.html">PackageInfo</a> <a class="code" href="class_update_process.html#a1da3e9862f8f95ca894b7c03959a8647">packageInfoFromXml</a>(<span class="keyword">const</span> QByteArray &amp;xml);
<a name="l00153"></a>00153 
<a name="l00154"></a>00154 <span class="keyword">private</span>:<span class="comment"></span>
<a name="l00155"></a>00155 <span class="comment">  /** Enum value of the current auto-update operation. */</span>
<a name="l00156"></a><a class="code" href="class_update_process.html#a5af899e34cb30d7968559c360b872812">00156</a>   <a class="code" href="class_update_process.html#ac5239113ac6cd658d43e7f85ae941892">UpdateCommand</a> <a class="code" href="class_update_process.html#a5af899e34cb30d7968559c360b872812">_currentCommand</a>;
<a name="l00157"></a>00157 <span class="comment"></span>
<a name="l00158"></a>00158 <span class="comment">  /** Enum value of the last bundle for which we performed some action</span>
<a name="l00159"></a>00159 <span class="comment">   * (e.g., check for updates, install an update, etc. */</span>
<a name="l00160"></a><a class="code" href="class_update_process.html#a02082dfdfd6d195d3b60d58a9851414b">00160</a>   <a class="code" href="class_update_process.html#a7f96e69b1f212525d935655e9c00505a">BundleInfo</a> <a class="code" href="class_update_process.html#a02082dfdfd6d195d3b60d58a9851414b">_currentBundle</a>;
<a name="l00161"></a>00161 <span class="comment"></span>
<a name="l00162"></a>00162 <span class="comment">  /** List of packages that have available updates. */</span>
<a name="l00163"></a><a class="code" href="class_update_process.html#aeb464d61d31ea758449d6aa81f915031">00163</a>   <a class="code" href="_package_info_8h.html#ae1b3835486d49f6ee4483714e49f019b">PackageList</a> <a class="code" href="class_update_process.html#aeb464d61d31ea758449d6aa81f915031">_packageList</a>;
<a name="l00164"></a>00164 <span class="comment"></span>
<a name="l00165"></a>00165 <span class="comment">  /** Currently configured SOCKS port. */</span>
<a name="l00166"></a><a class="code" href="class_update_process.html#a4b3773b05113c02ecfb1de2f3d116421">00166</a>   quint16 <a class="code" href="class_update_process.html#a4b3773b05113c02ecfb1de2f3d116421">_socksPort</a>;
<a name="l00167"></a>00167 };
<a name="l00168"></a>00168 
<a name="l00169"></a>00169 <span class="preprocessor">#endif</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Mon Aug 30 22:58:55 2010 for Vidalia by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>