Commit d898efe0e87c2c0102643275903b0864d3783604

Authored by LightBase Consultoria em Software Publico
1 parent 788d0135
Exists in master

cacic daemon

src/qtservice/buildlib/buildlib.pro 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +TEMPLATE=lib
  2 +CONFIG += qt dll qtservice-buildlib
  3 +mac:CONFIG += absolute_library_soname
  4 +win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release build_all
  5 +include(../src/qtservice.pri)
  6 +TARGET = $$QTSERVICE_LIBNAME
  7 +DESTDIR = $$QTSERVICE_LIBDIR
  8 +win32 {
  9 + DLLDESTDIR = $$[QT_INSTALL_BINS]
  10 + QMAKE_DISTCLEAN += $$[QT_INSTALL_BINS]\\$${QTSERVICE_LIBNAME}.dll
  11 +}
  12 +target.path = $$DESTDIR
  13 +INSTALLS += target
... ...
src/qtservice/common.pri 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +exists(config.pri):infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtservice-uselib
  2 +TEMPLATE += fakelib
  3 +QTSERVICE_LIBNAME = QtSolutions_Service-head
  4 +CONFIG(debug, debug|release) {
  5 + mac:QTSERVICE_LIBNAME = $$member(QTSERVICE_LIBNAME, 0)_debug
  6 + else:win32:QTSERVICE_LIBNAME = $$member(QTSERVICE_LIBNAME, 0)d
  7 +}
  8 +TEMPLATE -= fakelib
  9 +QTSERVICE_LIBDIR = $$PWD/lib
  10 +unix:qtservice-uselib:!qtservice-buildlib:QMAKE_RPATHDIR += $$QTSERVICE_LIBDIR
... ...
src/qtservice/doc/html/classic.css 0 → 100644
... ... @@ -0,0 +1,284 @@
  1 +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
  2 + font-family: Arial, Geneva, Helvetica, sans-serif;
  3 +}
  4 +H1 {
  5 + text-align: center;
  6 + font-size: 160%;
  7 +}
  8 +H2 {
  9 + font-size: 120%;
  10 +}
  11 +H3 {
  12 + font-size: 100%;
  13 +}
  14 +
  15 +h3.fn,span.fn
  16 +{
  17 + background-color: #eee;
  18 + border-width: 1px;
  19 + border-style: solid;
  20 + border-color: #ddd;
  21 + font-weight: bold;
  22 + padding: 6px 0px 6px 10px;
  23 + margin: 42px 0px 0px 0px;
  24 +}
  25 +
  26 +hr {
  27 + border: 0;
  28 + color: #a0a0a0;
  29 + background-color: #ccc;
  30 + height: 1px;
  31 + width: 100%;
  32 + text-align: left;
  33 + margin: 34px 0px 34px 0px;
  34 +}
  35 +
  36 +table.valuelist {
  37 + border-width: 1px 1px 1px 1px;
  38 + border-style: solid;
  39 + border-color: #dddddd;
  40 + border-collapse: collapse;
  41 + background-color: #f0f0f0;
  42 +}
  43 +
  44 +table.indextable {
  45 + border-width: 1px 1px 1px 1px;
  46 + border-style: solid;
  47 + border-collapse: collapse;
  48 + background-color: #f0f0f0;
  49 + border-color:#555;
  50 + font-size: 100%;
  51 +}
  52 +
  53 +table td.largeindex {
  54 + border-width: 1px 1px 1px 1px;
  55 + border-collapse: collapse;
  56 + background-color: #f0f0f0;
  57 + border-color:#555;
  58 + font-size: 120%;
  59 +}
  60 +
  61 +table.valuelist th {
  62 + border-width: 1px 1px 1px 2px;
  63 + padding: 4px;
  64 + border-style: solid;
  65 + border-color: #666;
  66 + color:white;
  67 + background-color:#666;
  68 +}
  69 +
  70 +th.titleheader {
  71 + border-width: 1px 0px 1px 0px;
  72 + padding: 2px;
  73 + border-style: solid;
  74 + border-color: #666;
  75 + color:white;
  76 + background-color:#555;
  77 + background-image:url('images/gradient.png')};
  78 + background-repeat: repeat-x;
  79 + font-size: 100%;
  80 +}
  81 +
  82 +
  83 +th.largeheader {
  84 + border-width: 1px 0px 1px 0px;
  85 + padding: 4px;
  86 + border-style: solid;
  87 + border-color: #444;
  88 + color:white;
  89 + background-color:#555555;
  90 + font-size: 120%;
  91 +}
  92 +
  93 +p {
  94 +
  95 + margin-left: 4px;
  96 + margin-top: 8px;
  97 + margin-bottom: 8px;
  98 +}
  99 +
  100 +a:link
  101 +{
  102 + color: #0046ad;
  103 + text-decoration: none
  104 +}
  105 +
  106 +a:visited
  107 +{
  108 + color: #672967;
  109 + text-decoration: none
  110 +}
  111 +
  112 +a.obsolete
  113 +{
  114 + color: #661100;
  115 + text-decoration: none
  116 +}
  117 +
  118 +a.compat
  119 +{
  120 + color: #661100;
  121 + text-decoration: none
  122 +}
  123 +
  124 +a.obsolete:visited
  125 +{
  126 + color: #995500;
  127 + text-decoration: none
  128 +}
  129 +
  130 +a.compat:visited
  131 +{
  132 + color: #995500;
  133 + text-decoration: none
  134 +}
  135 +
  136 +body
  137 +{
  138 + background: #ffffff;
  139 + color: black
  140 +}
  141 +
  142 +table.generic, table.annotated
  143 +{
  144 + border-width: 1px;
  145 + border-color:#bbb;
  146 + border-style:solid;
  147 + border-collapse:collapse;
  148 +}
  149 +
  150 +table td.memItemLeft {
  151 + width: 180px;
  152 + padding: 2px 0px 0px 8px;
  153 + margin: 4px;
  154 + border-width: 1px;
  155 + border-color: #E0E0E0;
  156 + border-style: none;
  157 + font-size: 100%;
  158 + white-space: nowrap
  159 +}
  160 +
  161 +table td.memItemRight {
  162 + padding: 2px 8px 0px 8px;
  163 + margin: 4px;
  164 + border-width: 1px;
  165 + border-color: #E0E0E0;
  166 + border-style: none;
  167 + font-size: 100%;
  168 +}
  169 +
  170 +table tr.odd {
  171 + background: #f0f0f0;
  172 + color: black;
  173 +}
  174 +
  175 +table tr.even {
  176 + background: #e4e4e4;
  177 + color: black;
  178 +}
  179 +
  180 +table.annotated th {
  181 + padding: 3px;
  182 + text-align: left
  183 +}
  184 +
  185 +table.annotated td {
  186 + padding: 3px;
  187 +}
  188 +
  189 +table tr pre
  190 +{
  191 + padding-top: 0px;
  192 + padding-bottom: 0px;
  193 + padding-left: 0px;
  194 + padding-right: 0px;
  195 + border: none;
  196 + background: none
  197 +}
  198 +
  199 +tr.qt-style
  200 +{
  201 + background: #96E066;
  202 + color: black
  203 +}
  204 +
  205 +body pre
  206 +{
  207 + padding: 0.2em;
  208 + border: #e7e7e7 1px solid;
  209 + background: #f1f1f1;
  210 + color: black
  211 +}
  212 +
  213 +table tr.qt-code pre
  214 +{
  215 + padding: 0.2em;
  216 + border: #e7e7e7 1px solid;
  217 + background: #f1f1f1;
  218 + color: black
  219 +}
  220 +
  221 +span.preprocessor, span.preprocessor a
  222 +{
  223 + color: darkblue;
  224 +}
  225 +
  226 +span.comment
  227 +{
  228 + color: darkred;
  229 + font-style: italic
  230 +}
  231 +
  232 +span.string,span.char
  233 +{
  234 + color: darkgreen;
  235 +}
  236 +
  237 +.title
  238 +{
  239 + text-align: center
  240 +}
  241 +
  242 +.subtitle
  243 +{
  244 + font-size: 0.8em
  245 +}
  246 +
  247 +.small-subtitle
  248 +{
  249 + font-size: 0.65em
  250 +}
  251 +
  252 +.qmlitem {
  253 + padding: 0;
  254 +}
  255 +
  256 +.qmlname {
  257 + white-space: nowrap;
  258 +}
  259 +
  260 +.qmltype {
  261 + text-align: center;
  262 + font-size: 160%;
  263 +}
  264 +
  265 +.qmlproto {
  266 + background-color: #eee;
  267 + border-width: 1px;
  268 + border-style: solid;
  269 + border-color: #ddd;
  270 + font-weight: bold;
  271 + padding: 6px 10px 6px 10px;
  272 + margin: 42px 0px 0px 0px;
  273 +}
  274 +
  275 +.qmlreadonly {
  276 + float: right;
  277 + color: red
  278 +}
  279 +
  280 +.qmldoc {
  281 +}
  282 +
  283 +*.qmlitem p {
  284 +}
... ...
src/qtservice/doc/html/images/qt-logo.png 0 → 100644

3.98 KB

src/qtservice/doc/html/index.html 0 → 100644
... ... @@ -0,0 +1,50 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- index.qdoc -->
  6 +<head>
  7 + <title>Service</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">Service<br /><span class="subtitle"></span>
  16 +</h1>
  17 +<a name="description"></a>
  18 +<h2>Description</h2>
  19 +<p>The <a href="qtservice.html">QtService</a> component is useful for developing Windows services and Unix daemons.</p>
  20 +<p>The project provides a <a href="qtservice.html">QtService</a> template class that can be used to implement service applications, and a <a href="qtservicecontroller.html">QtServiceController</a> class to control a service.</p>
  21 +<p>On Windows systems the implementation uses the Service Control Manager.</p>
  22 +<p>On Unix systems services are implemented as daemons.</p>
  23 +<a name="classes"></a>
  24 +<h2>Classes</h2>
  25 +<ul>
  26 +<li><a href="qtservicecontroller.html">QtServiceController</a></li>
  27 +<li><a href="qtservicebase.html">QtServiceBase</a></li>
  28 +<li><a href="qtservice.html">QtService</a></li>
  29 +</ul>
  30 +<a name="examples"></a>
  31 +<h2>Examples</h2>
  32 +<ul>
  33 +<li><a href="qtservice-example-interactive.html">An Interactive Service</a></li>
  34 +<li><a href="qtservice-example-server.html">A simple HTTP Server</a></li>
  35 +<li><a href="qtservice-example-controller.html">A simple Service Controller</a></li>
  36 +</ul>
  37 +<a name="tested-platforms"></a>
  38 +<h2>Tested platforms</h2>
  39 +<ul>
  40 +<li>Qt 4.4, 4.5 / Windows XP / MSVC.NET 2005</li>
  41 +<li>Qt 4.4, 4.5 / Linux / gcc</li>
  42 +<li>Qt 4.4, 4.5 / MacOS X 10.5 / gcc</li>
  43 +</ul>
  44 +<p /><address><hr /><div align="center">
  45 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  46 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  47 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  48 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  49 +</tr></table></div></address></body>
  50 +</html>
... ...
src/qtservice/doc/html/qtservice-example-controller.html 0 → 100644
... ... @@ -0,0 +1,186 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- controller.qdoc -->
  6 +<head>
  7 + <title>A simple Service Controller</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">A simple Service Controller<br /><span class="subtitle"></span>
  16 +</h1>
  17 +<p>It is a very simple implementation of universal command-line controller. This controller can install and control any service written using <a href="qtservice.html">QtService</a> component. It demonstrates how to use <a href="qtservicecontroller.html">QtServiceController</a> class. On Windows, this is an alternative to using the &quot;Services&quot; Administrative Tool or the built-in <tt>sc.exe</tt> command-line tool to control services.</p>
  18 +<p>A note about services on Windows Vista: Installing/uninstalling and starting/stopping services requires security privileges. The simplest way to achieve this is to set the &quot;Run as Administrator&quot; property on the executable (right-click the executable file, select Properties, and choose the Compatibilty tab in the Properties dialog). This applies even if you are logged in as Administrator. Also, the command-line shell should be started with &quot;Run as Administrator&quot;. Note that the service itself does not need special privileges to run. Only if you want the service to be able to install itself (the -i option) or similar, then the service will need to be run as Administrator. Otherwise, the recommended procedure is to use a controller such as this example and/or the &quot;Services&quot; Administrative Tool to manage the service.</p>
  19 +<p>A usability hint: in some circumstances, e.g&#x2e; when running this example on Windows Vista with the &quot;Run as Administrator&quot; property set, output will be sent to a shell window which will close immediately upon termination, not leaving the user enough time to read the output. In such cases, append the -w(ait) argument, which will make the controller wait for a keypress before terminating.</p>
  20 +<p>Here is the complete source code:</p>
  21 +<pre><span class="comment"> /****************************************************************************
  22 + **
  23 + ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
  24 + ** Contact: http://www.qt-project.org/legal
  25 + **
  26 + ** This file is part of the Qt Solutions component.
  27 + **
  28 + ** You may use this file under the terms of the BSD license as follows:
  29 + **
  30 + ** &quot;Redistribution and use in source and binary forms, with or without
  31 + ** modification, are permitted provided that the following conditions are
  32 + ** met:
  33 + ** * Redistributions of source code must retain the above copyright
  34 + ** notice, this list of conditions and the following disclaimer.
  35 + ** * Redistributions in binary form must reproduce the above copyright
  36 + ** notice, this list of conditions and the following disclaimer in
  37 + ** the documentation and/or other materials provided with the
  38 + ** distribution.
  39 + ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
  40 + ** the names of its contributors may be used to endorse or promote
  41 + ** products derived from this software without specific prior written
  42 + ** permission.
  43 + **
  44 + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  45 + ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  46 + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  47 + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  48 + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  49 + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  50 + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  51 + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  52 + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  53 + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  54 + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  55 + **
  56 + ****************************************************************************/</span>
  57 +
  58 + #include &lt;QtCore/QStringList&gt;
  59 + #include &lt;QtCore/QDir&gt;
  60 + #include &lt;QtCore/QSettings&gt;
  61 + #include &quot;qtservice.h&quot;
  62 +
  63 + int processArgs(int argc, char **argv)
  64 + {
  65 + if (argc &gt; 2) {
  66 + QString arg1(argv[1]);
  67 + if (arg1 == QLatin1String(&quot;-i&quot;) ||
  68 + arg1 == QLatin1String(&quot;-install&quot;)) {
  69 + if (argc &gt; 2) {
  70 + QString account;
  71 + QString password;
  72 + QString path(argv[2]);
  73 + if (argc &gt; 3)
  74 + account = argv[3];
  75 + if (argc &gt; 4)
  76 + password = argv[4];
  77 + printf(&quot;The service %s installed.\n&quot;,
  78 + (QtServiceController::install(path, account, password) ? &quot;was&quot; : &quot;was not&quot;));
  79 + return 0;
  80 + }
  81 + } else {
  82 + QString serviceName(argv[1]);
  83 + QtServiceController controller(serviceName);
  84 + QString option(argv[2]);
  85 + if (option == QLatin1String(&quot;-u&quot;) ||
  86 + option == QLatin1String(&quot;-uninstall&quot;)) {
  87 + printf(&quot;The service \&quot;%s\&quot; %s uninstalled.\n&quot;,
  88 + controller.serviceName().toLatin1().constData(),
  89 + (controller.uninstall() ? &quot;was&quot; : &quot;was not&quot;));
  90 + return 0;
  91 + } else if (option == QLatin1String(&quot;-s&quot;) ||
  92 + option == QLatin1String(&quot;-start&quot;)) {
  93 + QStringList args;
  94 + for (int i = 3; i &lt; argc; ++i)
  95 + args.append(QString::fromLocal8Bit(argv[i]));
  96 + printf(&quot;The service \&quot;%s\&quot; %s started.\n&quot;,
  97 + controller.serviceName().toLatin1().constData(),
  98 + (controller.start(args) ? &quot;was&quot; : &quot;was not&quot;));
  99 + return 0;
  100 + } else if (option == QLatin1String(&quot;-t&quot;) ||
  101 + option == QLatin1String(&quot;-terminate&quot;)) {
  102 + printf(&quot;The service \&quot;%s\&quot; %s stopped.\n&quot;,
  103 + controller.serviceName().toLatin1().constData(),
  104 + (controller.stop() ? &quot;was&quot; : &quot;was not&quot;));
  105 + return 0;
  106 + } else if (option == QLatin1String(&quot;-p&quot;) ||
  107 + option == QLatin1String(&quot;-pause&quot;)) {
  108 + printf(&quot;The service \&quot;%s\&quot; %s paused.\n&quot;,
  109 + controller.serviceName().toLatin1().constData(),
  110 + (controller.pause() ? &quot;was&quot; : &quot;was not&quot;));
  111 + return 0;
  112 + } else if (option == QLatin1String(&quot;-r&quot;) ||
  113 + option == QLatin1String(&quot;-resume&quot;)) {
  114 + printf(&quot;The service \&quot;%s\&quot; %s resumed.\n&quot;,
  115 + controller.serviceName().toLatin1().constData(),
  116 + (controller.resume() ? &quot;was&quot; : &quot;was not&quot;));
  117 + return 0;
  118 + } else if (option == QLatin1String(&quot;-c&quot;) ||
  119 + option == QLatin1String(&quot;-command&quot;)) {
  120 + if (argc &gt; 3) {
  121 + QString codestr(argv[3]);
  122 + int code = codestr.toInt();
  123 + printf(&quot;The command %s sent to the service \&quot;%s\&quot;.\n&quot;,
  124 + (controller.sendCommand(code) ? &quot;was&quot; : &quot;was not&quot;),
  125 + controller.serviceName().toLatin1().constData());
  126 + return 0;
  127 + }
  128 + } else if (option == QLatin1String(&quot;-v&quot;) ||
  129 + option == QLatin1String(&quot;-version&quot;)) {
  130 + bool installed = controller.isInstalled();
  131 + printf(&quot;The service\n&quot;
  132 + &quot;\t\&quot;%s\&quot;\n\n&quot;, controller.serviceName().toLatin1().constData());
  133 + printf(&quot;is %s&quot;, (installed ? &quot;installed&quot; : &quot;not installed&quot;));
  134 + printf(&quot; and %s\n\n&quot;, (controller.isRunning() ? &quot;running&quot; : &quot;not running&quot;));
  135 + if (installed) {
  136 + printf(&quot;path: %s\n&quot;, controller.serviceFilePath().toLatin1().data());
  137 + printf(&quot;description: %s\n&quot;, controller.serviceDescription().toLatin1().data());
  138 + printf(&quot;startup: %s\n&quot;, controller.startupType() == QtServiceController::AutoStartup ? &quot;Auto&quot; : &quot;Manual&quot;);
  139 + }
  140 + return 0;
  141 + }
  142 + }
  143 + }
  144 + printf(&quot;controller [-i PATH | SERVICE_NAME [-v | -u | -s | -t | -p | -r | -c CODE] | -h] [-w]\n\n&quot;
  145 + &quot;\t-i(nstall) PATH\t: Install the service\n&quot;
  146 + &quot;\t-v(ersion)\t: Print status of the service\n&quot;
  147 + &quot;\t-u(ninstall)\t: Uninstall the service\n&quot;
  148 + &quot;\t-s(tart)\t: Start the service\n&quot;
  149 + &quot;\t-t(erminate)\t: Stop the service\n&quot;
  150 + &quot;\t-p(ause)\t: Pause the service\n&quot;
  151 + &quot;\t-r(esume)\t: Resume the service\n&quot;
  152 + &quot;\t-c(ommand) CODE\t: Send a command to the service\n&quot;
  153 + &quot;\t-h(elp)\t\t: Print this help info\n&quot;
  154 + &quot;\t-w(ait)\t\t: Wait for keypress when done\n&quot;);
  155 + return 0;
  156 + }
  157 +
  158 + int main(int argc, char **argv)
  159 + {
  160 + #if !defined(Q_OS_WIN)
  161 + <span class="comment">// QtService stores service settings in SystemScope, which normally require root privileges.</span>
  162 + <span class="comment">// To allow testing this example as non-root, we change the directory of the SystemScope settings file.</span>
  163 + QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
  164 + qWarning(&quot;(Example uses dummy settings file: %s/QtSoftware.conf)&quot;, QDir::tempPath().toLatin1().constData());
  165 + #endif
  166 +
  167 + int result = processArgs(argc, argv);
  168 +
  169 + if (QString::fromLocal8Bit(argv[argc-1]) == QLatin1String(&quot;-w&quot;) ||
  170 + QString::fromLocal8Bit(argv[argc-1]) == QLatin1String(&quot;-wait&quot;)) {
  171 + printf(&quot;\nPress Enter to continue...&quot;);
  172 + QFile input;
  173 + input.open(stdin, QIODevice::ReadOnly);
  174 + input.readLine();
  175 + printf(&quot;\n&quot;);
  176 + }
  177 +
  178 + return result;
  179 + }</pre>
  180 +<p /><address><hr /><div align="center">
  181 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  182 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  183 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  184 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  185 +</tr></table></div></address></body>
  186 +</html>
... ...
src/qtservice/doc/html/qtservice-example-interactive.html 0 → 100644
... ... @@ -0,0 +1,152 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- interactive.qdoc -->
  6 +<head>
  7 + <title>An Interactive Service</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">An Interactive Service<br /><span class="subtitle"></span>
  16 +</h1>
  17 +<p>This example implements a service with a simple user interface.</p>
  18 +<p>Services are usually non-interactive console applications. User interaction, if required, is usually implemented in a separate, normal GUI application that communicates with the service through an IPC channel. For simple communication, <a href="qtservicecontroller.html#sendCommand">QtServiceController::sendCommand</a>() and <a href="qtservicebase.html#processCommand">QtService::processCommand</a>() may be used, possibly in combination with a shared settings file. For more complex, interactive communication, a custom IPC channel should be used, e.g&#x2e; based on Qt's networking classes.</p>
  19 +<p>However, although not recommended in the general case, in certain circumstances a service may provide a GUI itself. This is typically only possible if the service process is run as the same user as the one that is logged in, so that it will have access to the screen. Note however that on Windows Vista, service GUIs are not allowed at all, since services run in a diferent session than all user sessions, for security reasons.</p>
  20 +<p>This example demonstrates how to subclass the <a href="qtservice.html">QtService</a> class, the use of start(), stop(), pause(), resume(), and how to use processCommand() to receive control commands while running.</p>
  21 +<p>Here is the complete source code:</p>
  22 +<pre><span class="comment"> /****************************************************************************
  23 + **
  24 + ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
  25 + ** Contact: http://www.qt-project.org/legal
  26 + **
  27 + ** This file is part of the Qt Solutions component.
  28 + **
  29 + ** You may use this file under the terms of the BSD license as follows:
  30 + **
  31 + ** &quot;Redistribution and use in source and binary forms, with or without
  32 + ** modification, are permitted provided that the following conditions are
  33 + ** met:
  34 + ** * Redistributions of source code must retain the above copyright
  35 + ** notice, this list of conditions and the following disclaimer.
  36 + ** * Redistributions in binary form must reproduce the above copyright
  37 + ** notice, this list of conditions and the following disclaimer in
  38 + ** the documentation and/or other materials provided with the
  39 + ** distribution.
  40 + ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
  41 + ** the names of its contributors may be used to endorse or promote
  42 + ** products derived from this software without specific prior written
  43 + ** permission.
  44 + **
  45 + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  46 + ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  47 + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  48 + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  49 + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  50 + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  51 + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  52 + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  53 + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  54 + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  55 + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  56 + **
  57 + ****************************************************************************/</span>
  58 +
  59 + #include &lt;QtGui/QApplication&gt;
  60 + #include &lt;QtGui/QDesktopWidget&gt;
  61 + #include &lt;QtGui/QLabel&gt;
  62 + #include &lt;QtCore/QDir&gt;
  63 + #include &lt;QtCore/QSettings&gt;
  64 + #include &quot;qtservice.h&quot;
  65 +
  66 + class InteractiveService : public QtService&lt;QApplication&gt;
  67 + {
  68 + public:
  69 + InteractiveService(int argc, char **argv);
  70 + ~InteractiveService();
  71 +
  72 + protected:
  73 +
  74 + void start();
  75 + void stop();
  76 + void pause();
  77 + void resume();
  78 + void processCommand(int code);
  79 +
  80 + private:
  81 + QLabel *gui;
  82 + };
  83 +
  84 + InteractiveService::InteractiveService(int argc, char **argv)
  85 + : QtService&lt;QApplication&gt;(argc, argv, &quot;Qt Interactive Service&quot;), gui(0)
  86 + {
  87 + setServiceDescription(&quot;A Qt service with user interface.&quot;);
  88 + setServiceFlags(QtServiceBase::CanBeSuspended);
  89 + }
  90 +
  91 + InteractiveService::~InteractiveService()
  92 + {
  93 + }
  94 +
  95 + void InteractiveService::start()
  96 + {
  97 + #if defined(Q_OS_WIN)
  98 + if ((QSysInfo::WindowsVersion &amp; QSysInfo::WV_NT_based) &amp;&amp;
  99 + (QSysInfo::WindowsVersion &gt;= QSysInfo::WV_VISTA)) {
  100 + logMessage( &quot;Service GUI not allowed on Windows Vista. See the documentation for this example for more information.&quot;, QtServiceBase::Error );
  101 + return;
  102 + }
  103 + #endif
  104 +
  105 + qApp-&gt;setQuitOnLastWindowClosed(false);
  106 +
  107 + gui = new QLabel(&quot;Service&quot;, 0, Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
  108 + gui-&gt;move(QApplication::desktop()-&gt;availableGeometry().topLeft());
  109 + gui-&gt;show();
  110 + }
  111 +
  112 + void InteractiveService::stop()
  113 + {
  114 + delete gui;
  115 + }
  116 +
  117 + void InteractiveService::pause()
  118 + {
  119 + if (gui)
  120 + gui-&gt;hide();
  121 + }
  122 +
  123 + void InteractiveService::resume()
  124 + {
  125 + if (gui)
  126 + gui-&gt;show();
  127 + }
  128 +
  129 + void InteractiveService::processCommand(int code)
  130 + {
  131 + gui-&gt;setText(&quot;Command code &quot; + QString::number(code));
  132 + gui-&gt;adjustSize();
  133 + }
  134 +
  135 + int main(int argc, char **argv)
  136 + {
  137 + #if !defined(Q_OS_WIN)
  138 + <span class="comment">// QtService stores service settings in SystemScope, which normally require root privileges.</span>
  139 + <span class="comment">// To allow testing this example as non-root, we change the directory of the SystemScope settings file.</span>
  140 + QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
  141 + qWarning(&quot;(Example uses dummy settings file: %s/QtSoftware.conf)&quot;, QDir::tempPath().toLatin1().constData());
  142 + #endif
  143 + InteractiveService service(argc, argv);
  144 + return service.exec();
  145 + }</pre>
  146 +<p /><address><hr /><div align="center">
  147 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  148 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  149 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  150 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  151 +</tr></table></div></address></body>
  152 +</html>
... ...
src/qtservice/doc/html/qtservice-example-server.html 0 → 100644
... ... @@ -0,0 +1,159 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- server.qdoc -->
  6 +<head>
  7 + <title>A simple HTTP Server</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">A simple HTTP Server<br /><span class="subtitle"></span>
  16 +</h1>
  17 +<p>It is a very simple implementation of a HTTP daemon that listens on chosen port (defaultly 8080) and sends back a simple HTML page back for every GET request it gets. After sending the page, it closes the connection.</p>
  18 +<pre><span class="comment"> // HttpDaemon is the the class that implements the simple HTTP server.</span>
  19 + class HttpDaemon : public QTcpServer
  20 + {
  21 + Q_OBJECT
  22 + public:
  23 + HttpDaemon(quint16 port, QObject* parent = 0)
  24 + : QTcpServer(parent), disabled(false)
  25 + {
  26 + listen(QHostAddress::Any, port);
  27 + }
  28 +
  29 + void incomingConnection(int socket)
  30 + {
  31 + if (disabled)
  32 + return;
  33 +
  34 + <span class="comment">// When a new client connects, the server constructs a QTcpSocket and all</span>
  35 + <span class="comment">// communication with the client is done over this QTcpSocket. QTcpSocket</span>
  36 + <span class="comment">// works asynchronously, this means that all the communication is done</span>
  37 + <span class="comment">// in the two slots readClient() and discardClient().</span>
  38 + QTcpSocket* s = new QTcpSocket(this);
  39 + connect(s, SIGNAL(readyRead()), this, SLOT(readClient()));
  40 + connect(s, SIGNAL(disconnected()), this, SLOT(discardClient()));
  41 + s-&gt;setSocketDescriptor(socket);
  42 +
  43 + QtServiceBase::instance()-&gt;logMessage(&quot;New Connection&quot;);
  44 + }
  45 +
  46 + void pause()
  47 + {
  48 + disabled = true;
  49 + }
  50 +
  51 + void resume()
  52 + {
  53 + disabled = false;
  54 + }
  55 +
  56 + private slots:
  57 + void readClient()
  58 + {
  59 + if (disabled)
  60 + return;
  61 +
  62 + <span class="comment">// This slot is called when the client sent data to the server. The</span>
  63 + <span class="comment">// server looks if it was a get request and sends a very simple HTML</span>
  64 + <span class="comment">// document back.</span>
  65 + QTcpSocket* socket = (QTcpSocket*)sender();
  66 + if (socket-&gt;canReadLine()) {
  67 + QStringList tokens = QString(socket-&gt;readLine()).split(QRegExp(&quot;[ \r\n][ \r\n]*&quot;));
  68 + if (tokens[0] == &quot;GET&quot;) {
  69 + QTextStream os(socket);
  70 + os.setAutoDetectUnicode(true);
  71 + os &lt;&lt; &quot;HTTP/1.0 200 Ok\r\n&quot;
  72 + &quot;Content-Type: text/html; charset=\&quot;utf-8\&quot;\r\n&quot;
  73 + &quot;\r\n&quot;
  74 + &quot;&lt;h1&gt;Nothing to see here&lt;/h1&gt;\n&quot;
  75 + &lt;&lt; QDateTime::currentDateTime().toString() &lt;&lt; &quot;\n&quot;;
  76 + socket-&gt;close();
  77 +
  78 + QtServiceBase::instance()-&gt;logMessage(&quot;Wrote to client&quot;);
  79 +
  80 + if (socket-&gt;state() == QTcpSocket::UnconnectedState) {
  81 + delete socket;
  82 + QtServiceBase::instance()-&gt;logMessage(&quot;Connection closed&quot;);
  83 + }
  84 + }
  85 + }
  86 + }
  87 + void discardClient()
  88 + {
  89 + QTcpSocket* socket = (QTcpSocket*)sender();
  90 + socket-&gt;deleteLater();
  91 +
  92 + QtServiceBase::instance()-&gt;logMessage(&quot;Connection closed&quot;);
  93 + }
  94 +
  95 + private:
  96 + bool disabled;
  97 + };</pre>
  98 +<p>The server implementation uses the <a href="qtservicebase.html#logMessage">QtService::logMessage</a>() function to send messages and status reports to the system event log. The server also supports a paused state in which case incoming requests are ignored.</p>
  99 +<p>The <tt>HttpService</tt> class subclasses <a href="qtservice.html">QtService</a> to implement the service functionality.</p>
  100 +<pre> class HttpService : public QtService&lt;QCoreApplication&gt;
  101 + {
  102 + public:
  103 + HttpService(int argc, char **argv)
  104 + : QtService&lt;QCoreApplication&gt;(argc, argv, &quot;Qt HTTP Daemon&quot;)
  105 + {
  106 + setServiceDescription(&quot;A dummy HTTP service implemented with Qt&quot;);
  107 + setServiceFlags(QtServiceBase::CanBeSuspended);
  108 + }</pre>
  109 +<p>The constructor calls the <a href="qtservice.html">QtService</a> constructor instantiated with <a href="http://qt.nokia.com/doc/4.6/qcoreapplication.html">QCoreApplication</a> since our service will not use GUI. The first two parameters of our constructor are passed to <a href="qtservice.html">QtService</a>. The last parameter, &quot;Qt HTTP Daemon&quot;, is the name of the service.</p>
  110 +<pre> protected:
  111 + void start()
  112 + {
  113 + QCoreApplication *app = application();
  114 +
  115 + quint16 port = (app-&gt;argc() &gt; 1) ?
  116 + QString::fromLocal8Bit(app-&gt;argv()[1]).toUShort() : 8080;
  117 + daemon = new HttpDaemon(port, app);
  118 +
  119 + if (!daemon-&gt;isListening()) {
  120 + logMessage(QString(&quot;Failed to bind to port %1&quot;).arg(daemon-&gt;serverPort()), QtServiceBase::Error);
  121 + app-&gt;quit();
  122 + }
  123 + }</pre>
  124 +<p>The implementation of <tt>start()</tt> first checks if the user passed a port number. If yes that port is used by server to listen on. Otherwise default 8080 port is used. Then creates an instance of the HTTP server using operator new, passing the application object as the parent to ensure that the object gets destroyed.</p>
  125 +<pre> void pause()
  126 + {
  127 + daemon-&gt;pause();
  128 + }
  129 +
  130 + void resume()
  131 + {
  132 + daemon-&gt;resume();
  133 + }
  134 +
  135 + private:
  136 + HttpDaemon *daemon;
  137 + };</pre>
  138 +<p>The implementations of pause() and resume() forward the request to the server object.</p>
  139 +<pre> #include &quot;main.moc&quot;
  140 +
  141 + int main(int argc, char **argv)
  142 + {
  143 + #if !defined(Q_OS_WIN)
  144 + <span class="comment">// QtService stores service settings in SystemScope, which normally require root privileges.</span>
  145 + <span class="comment">// To allow testing this example as non-root, we change the directory of the SystemScope settings file.</span>
  146 + QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
  147 + qWarning(&quot;(Example uses dummy settings file: %s/QtSoftware.conf)&quot;, QDir::tempPath().toLatin1().constData());
  148 + #endif
  149 + HttpService service(argc, argv);
  150 + return service.exec();
  151 + }</pre>
  152 +<p>The main entry point function creates the service object and uses the <tt>exec()</tt> function to execute the service.</p>
  153 +<p /><address><hr /><div align="center">
  154 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  155 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  156 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  157 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  158 +</tr></table></div></address></body>
  159 +</html>
... ...
src/qtservice/doc/html/qtservice-members.html 0 → 100644
... ... @@ -0,0 +1,52 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- qtservice.cpp -->
  6 +<head>
  7 + <title>List of All Members for QtService</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">List of All Members for QtService</h1>
  16 +<p>This is the complete list of members for <a href="qtservice.html">QtService</a>, including inherited members.</p>
  17 +<p><table class="propsummary" width="100%" border="0" cellpadding="0" cellspacing="0">
  18 +<tr><td width="45%" valign="top"><ul>
  19 +<li><div class="fn">enum <b><a href="qtservicebase.html#MessageType-enum">MessageType</a></b></div></li>
  20 +<li><div class="fn">enum <b><a href="qtservicebase.html#ServiceFlag-enum">ServiceFlag</a></b></div></li>
  21 +<li><div class="fn">flags <b><a href="qtservicebase.html#ServiceFlag-enum">ServiceFlags</a></b></div></li>
  22 +<li><div class="fn"><b><a href="qtservice.html#QtService">QtService</a></b> ( int, char **, const QString &amp; )</div></li>
  23 +<li><div class="fn"><b><a href="qtservice.html#dtor.QtService">~QtService</a></b> ()</div></li>
  24 +<li><div class="fn"><b><a href="qtservice.html#application">application</a></b> () const : Application *</div></li>
  25 +<li><div class="fn"><b><a href="qtservice.html#createApplication">createApplication</a></b> ( int &amp;, char ** )</div></li>
  26 +<li><div class="fn"><b><a href="qtservicebase.html#exec">exec</a></b> () : int</div></li>
  27 +<li><div class="fn"><b><a href="qtservice.html#executeApplication">executeApplication</a></b> () : int</div></li>
  28 +<li><div class="fn"><b><a href="qtservicebase.html#instance">instance</a></b> () : QtServiceBase *</div></li>
  29 +<li><div class="fn"><b><a href="qtservicebase.html#logMessage">logMessage</a></b> ( const QString &amp;, MessageType, int, uint, const QByteArray &amp; )</div></li>
  30 +<li><div class="fn"><b><a href="qtservicebase.html#pause">pause</a></b> ()</div></li>
  31 +</ul></td><td valign="top"><ul>
  32 +<li><div class="fn"><b><a href="qtservicebase.html#processCommand">processCommand</a></b> ( int )</div></li>
  33 +<li><div class="fn"><b><a href="qtservicebase.html#resume">resume</a></b> ()</div></li>
  34 +<li><div class="fn"><b><a href="qtservicebase.html#serviceDescription">serviceDescription</a></b> () const : QString</div></li>
  35 +<li><div class="fn"><b><a href="qtservicebase.html#serviceFlags">serviceFlags</a></b> () const : ServiceFlags</div></li>
  36 +<li><div class="fn"><b><a href="qtservicebase.html#serviceName">serviceName</a></b> () const : QString</div></li>
  37 +<li><div class="fn"><b><a href="qtservicebase.html#setServiceDescription">setServiceDescription</a></b> ( const QString &amp; )</div></li>
  38 +<li><div class="fn"><b><a href="qtservicebase.html#setServiceFlags">setServiceFlags</a></b> ( ServiceFlags )</div></li>
  39 +<li><div class="fn"><b><a href="qtservicebase.html#setStartupType">setStartupType</a></b> ( QtServiceController::StartupType )</div></li>
  40 +<li><div class="fn"><b><a href="qtservicebase.html#start">start</a></b> ()</div></li>
  41 +<li><div class="fn"><b><a href="qtservicebase.html#startupType">startupType</a></b> () const : QtServiceController::StartupType</div></li>
  42 +<li><div class="fn"><b><a href="qtservicebase.html#stop">stop</a></b> ()</div></li>
  43 +</ul>
  44 +</td></tr>
  45 +</table></p>
  46 +<p /><address><hr /><div align="center">
  47 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  48 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  49 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  50 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  51 +</tr></table></div></address></body>
  52 +</html>
... ...
src/qtservice/doc/html/qtservice.dcf 0 → 100644
... ... @@ -0,0 +1,79 @@
  1 +<!DOCTYPE DCF>
  2 +<DCF ref="index.html" icon="qtservice.png" imagedir="../../gif" title="Qt Solutions: Service Documentation">
  3 +<section ref="classes.html" title="Classes">
  4 + <section ref="qtservice.html" title="QtService Class Reference">
  5 + <keyword ref="qtservice.html">QtService</keyword>
  6 + <keyword ref="qtservice.html#application">application</keyword>
  7 + <keyword ref="qtservice.html#createApplication">createApplication</keyword>
  8 + <keyword ref="qtservice.html#executeApplication">executeApplication</keyword>
  9 + <section ref="qtservice-members.html" title="List of all members"/>
  10 + </section>
  11 + <section ref="qtservicebase.html" title="QtServiceBase Class Reference">
  12 + <keyword ref="qtservicebase.html">QtServiceBase</keyword>
  13 + <keyword ref="qtservicebase.html#MessageType-enum">MessageType</keyword>
  14 + <keyword ref="qtservicebase.html#MessageType-enum">QtServiceBase::Warning</keyword>
  15 + <keyword ref="qtservicebase.html#MessageType-enum">QtServiceBase::Error</keyword>
  16 + <keyword ref="qtservicebase.html#MessageType-enum">QtServiceBase::Success</keyword>
  17 + <keyword ref="qtservicebase.html#MessageType-enum">QtServiceBase::Information</keyword>
  18 + <keyword ref="qtservicebase.html#ServiceFlag-enum">ServiceFlag</keyword>
  19 + <keyword ref="qtservicebase.html#ServiceFlag-enum">ServiceFlags</keyword>
  20 + <keyword ref="qtservicebase.html#ServiceFlag-enum">QtServiceBase::Default</keyword>
  21 + <keyword ref="qtservicebase.html#ServiceFlag-enum">QtServiceBase::NeedsStopOnShutdown</keyword>
  22 + <keyword ref="qtservicebase.html#ServiceFlag-enum">QtServiceBase::CannotBeStopped</keyword>
  23 + <keyword ref="qtservicebase.html#ServiceFlag-enum">QtServiceBase::CanBeSuspended</keyword>
  24 + <keyword ref="qtservicebase.html#createApplication">createApplication</keyword>
  25 + <keyword ref="qtservicebase.html#exec">exec</keyword>
  26 + <keyword ref="qtservicebase.html#executeApplication">executeApplication</keyword>
  27 + <keyword ref="qtservicebase.html#instance">instance</keyword>
  28 + <keyword ref="qtservicebase.html#logMessage">logMessage</keyword>
  29 + <keyword ref="qtservicebase.html#pause">pause</keyword>
  30 + <keyword ref="qtservicebase.html#processCommand">processCommand</keyword>
  31 + <keyword ref="qtservicebase.html#resume">resume</keyword>
  32 + <keyword ref="qtservicebase.html#serviceDescription">serviceDescription</keyword>
  33 + <keyword ref="qtservicebase.html#serviceFlags">serviceFlags</keyword>
  34 + <keyword ref="qtservicebase.html#serviceName">serviceName</keyword>
  35 + <keyword ref="qtservicebase.html#setServiceDescription">setServiceDescription</keyword>
  36 + <keyword ref="qtservicebase.html#setServiceFlags">setServiceFlags</keyword>
  37 + <keyword ref="qtservicebase.html#setStartupType">setStartupType</keyword>
  38 + <keyword ref="qtservicebase.html#start">start</keyword>
  39 + <keyword ref="qtservicebase.html#startupType">startupType</keyword>
  40 + <keyword ref="qtservicebase.html#stop">stop</keyword>
  41 + <section ref="qtservicebase-members.html" title="List of all members"/>
  42 + </section>
  43 + <section ref="qtservicecontroller.html" title="QtServiceController Class Reference">
  44 + <keyword ref="qtservicecontroller.html">QtServiceController</keyword>
  45 + <keyword ref="qtservicecontroller.html#StartupType-enum">StartupType</keyword>
  46 + <keyword ref="qtservicecontroller.html#StartupType-enum">QtServiceController::AutoStartup</keyword>
  47 + <keyword ref="qtservicecontroller.html#StartupType-enum">QtServiceController::ManualStartup</keyword>
  48 + <keyword ref="qtservicecontroller.html#install">install</keyword>
  49 + <keyword ref="qtservicecontroller.html#isInstalled">isInstalled</keyword>
  50 + <keyword ref="qtservicecontroller.html#isRunning">isRunning</keyword>
  51 + <keyword ref="qtservicecontroller.html#pause">pause</keyword>
  52 + <keyword ref="qtservicecontroller.html#resume">resume</keyword>
  53 + <keyword ref="qtservicecontroller.html#sendCommand">sendCommand</keyword>
  54 + <keyword ref="qtservicecontroller.html#serviceDescription">serviceDescription</keyword>
  55 + <keyword ref="qtservicecontroller.html#serviceFilePath">serviceFilePath</keyword>
  56 + <keyword ref="qtservicecontroller.html#serviceName">serviceName</keyword>
  57 + <keyword ref="qtservicecontroller.html#start">start</keyword>
  58 + <keyword ref="qtservicecontroller.html#startupType">startupType</keyword>
  59 + <keyword ref="qtservicecontroller.html#stop">stop</keyword>
  60 + <keyword ref="qtservicecontroller.html#uninstall">uninstall</keyword>
  61 + <section ref="qtservicecontroller-members.html" title="List of all members"/>
  62 + </section>
  63 +</section>
  64 +<section ref="overviews.html" title="Overviews">
  65 + <section ref="qtservice-example-server.html" title="A simple HTTP Server">
  66 + <keyword ref="qtservice-example-server.html">A simple HTTP Server</keyword>
  67 + </section>
  68 + <section ref="qtservice-example-controller.html" title="A simple Service Controller">
  69 + <keyword ref="qtservice-example-controller.html">A simple Service Controller</keyword>
  70 + </section>
  71 + <section ref="qtservice-example-interactive.html" title="An Interactive Service">
  72 + <keyword ref="qtservice-example-interactive.html">An Interactive Service</keyword>
  73 + </section>
  74 + <section ref="index.html" title="Service">
  75 + <keyword ref="index.html">Service</keyword>
  76 + </section>
  77 +</section>
  78 +<section ref="examples.html" title="Tutorial &amp; Examples"/>
  79 +</DCF>
... ...
src/qtservice/doc/html/qtservice.html 0 → 100644
... ... @@ -0,0 +1,106 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- qtservice.cpp -->
  6 +<head>
  7 + <title>QtService Class Reference</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">QtService Class Reference</h1>
  16 +<p>The QtService is a convenient template class that allows you to create a service for a particular application type. <a href="#details">More...</a></p>
  17 +<pre> #include &lt;QtService&gt;</pre><p>Inherits <a href="qtservicebase.html">QtServiceBase</a>.</p>
  18 +<ul>
  19 +<li><a href="qtservice-members.html">List of all members, including inherited members</a></li>
  20 +</ul>
  21 +<hr />
  22 +<a name="public-functions"></a>
  23 +<h2>Public Functions</h2>
  24 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  25 +<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtservice.html#QtService">QtService</a></b> ( int <i>argc</i>, char ** <i>argv</i>, const QString &amp; <i>name</i> )</td></tr>
  26 +<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtservice.html#dtor.QtService">~QtService</a></b> ()</td></tr>
  27 +</table>
  28 +<ul>
  29 +<li><div bar="2" class="fn"></div>9 public functions inherited from <a href="qtservicebase.html#public-functions">QtServiceBase</a></li>
  30 +</ul>
  31 +<hr />
  32 +<a name="protected-functions"></a>
  33 +<h2>Protected Functions</h2>
  34 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  35 +<tr><td class="memItemLeft" align="right" valign="top">Application * </td><td class="memItemRight" valign="bottom"><b><a href="qtservice.html#application">application</a></b> () const</td></tr>
  36 +</table>
  37 +<hr />
  38 +<a name="reimplemented-protected-functions"></a>
  39 +<h2>Reimplemented Protected Functions</h2>
  40 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  41 +<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtservice.html#createApplication">createApplication</a></b> ( int &amp; <i>argc</i>, char ** <i>argv</i> )</td></tr>
  42 +<tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><b><a href="qtservice.html#executeApplication">executeApplication</a></b> ()</td></tr>
  43 +</table>
  44 +<ul>
  45 +<li><div bar="2" class="fn"></div>7 protected functions inherited from <a href="qtservicebase.html#protected-functions">QtServiceBase</a></li>
  46 +</ul>
  47 +<h3>Additional Inherited Members</h3>
  48 +<ul>
  49 +<li><div class="fn"></div>1 static public member inherited from <a href="qtservicebase.html#static-public-members">QtServiceBase</a></li>
  50 +</ul>
  51 +<a name="details"></a>
  52 +<hr />
  53 +<h2>Detailed Description</h2>
  54 +<p>The QtService is a convenient template class that allows you to create a service for a particular application type.</p>
  55 +<p>A Windows service or Unix daemon (a &quot;service&quot;), is a program that runs &quot;in the background&quot; independently of whether a user is logged in or not. A service is often set up to start when the machine boots up, and will typically run continuously as long as the machine is on.</p>
  56 +<p>Services are usually non-interactive console applications. User interaction, if required, is usually implemented in a separate, normal GUI application that communicates with the service through an IPC channel. For simple communication, <a href="qtservicecontroller.html#sendCommand">QtServiceController::sendCommand</a>() and <a href="qtservicebase.html#processCommand">QtService::processCommand</a>() may be used, possibly in combination with a shared settings file. For more complex, interactive communication, a custom IPC channel should be used, e.g&#x2e; based on Qt's networking classes. (In certain circumstances, a service may provide a GUI itself, ref. the &quot;interactive&quot; example documentation).</p>
  57 +<p><b>Note:</b> On Unix systems, this class relies on facilities provided by the <a href="http://qt.nokia.com/doc/4.6/qtnetwork.html">QtNetwork</a> module, provided as part of the Qt Open Source Edition and certain <a href="http://qt.nokia.com/doc/4.6/commercialeditions.html">Qt Commercial Editions</a>.</p>
  58 +<p>The QtService class functionality is inherited from <a href="qtservicebase.html">QtServiceBase</a>, but in addition the QtService class binds an instance of <a href="qtservicebase.html">QtServiceBase</a> with an application type.</p>
  59 +<p>Typically, you will create a service by subclassing the QtService template class. For example:</p>
  60 +<pre> class MyService : public QtService&lt;QApplication&gt;
  61 + {
  62 + public:
  63 + MyService(int argc, char **argv);
  64 + ~MyService();
  65 +
  66 + protected:
  67 + void start();
  68 + void stop();
  69 + void pause();
  70 + void resume();
  71 + void processCommand(int code);
  72 + };</pre>
  73 +<p>The application type can be <a href="http://qt.nokia.com/doc/4.6/qcoreapplication.html">QCoreApplication</a> for services without GUI, <a href="http://qt.nokia.com/doc/4.6/qapplication.html">QApplication</a> for services with GUI or you can use your own custom application type.</p>
  74 +<p>You must reimplement the <a href="qtservicebase.html#start">QtServiceBase::start</a>() function to perform the service's work. Usually you create some main object on the heap which is the heart of your service.</p>
  75 +<p>In addition, you might want to reimplement the <a href="qtservicebase.html#pause">QtServiceBase::pause</a>(), <a href="qtservicebase.html#processCommand">QtServiceBase::processCommand</a>(), <a href="qtservicebase.html#resume">QtServiceBase::resume</a>() and <a href="qtservicebase.html#stop">QtServiceBase::stop</a>() to intervene the service's process on controller requests. You can control any given service using an instance of the <a href="qtservicecontroller.html">QtServiceController</a> class which also allows you to control services from separate applications. The mentioned functions are all virtual and won't do anything unless they are reimplemented.</p>
  76 +<p>Your custom service is typically instantiated in the application's main function. Then the main function will call your service's <a href="qtservicebase.html#exec">exec</a>() function, and return the result of that call. For example:</p>
  77 +<pre> int main(int argc, char **argv)
  78 + {
  79 + MyService service(argc, argv);
  80 + return service.exec();
  81 + }</pre>
  82 +<p>When the <a href="qtservicebase.html#exec">exec</a>() function is called, it will parse the <a href="qtservicebase.html#servicespecificarguments">service specific arguments</a> passed in <tt>argv</tt>, perform the required actions, and exit.</p>
  83 +<p>If none of the arguments is recognized as service specific, <a href="qtservicebase.html#exec">exec</a>() will first call the <a href="qtservice.html#createApplication">createApplication</a>() function, then <a href="qtservice.html#executeApplication">executeApplication</a>() and finally the <a href="qtservicebase.html#start">start</a>() function. In the end, <a href="qtservicebase.html#exec">exec</a>() returns while the service continues in its own process waiting for commands from the service controller.</p>
  84 +<p>See also <a href="qtservicebase.html">QtServiceBase</a> and <a href="qtservicecontroller.html">QtServiceController</a>.</p>
  85 +<hr />
  86 +<h2>Member Function Documentation</h2>
  87 +<h3 class="fn"><a name="QtService"></a>QtService::QtService ( int <i>argc</i>, char ** <i>argv</i>, const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>name</i> )</h3>
  88 +<p>Constructs a <a href="qtservice.html">QtService</a> object called <i>name</i>. The <i>argc</i> and <i>argv</i> parameters are parsed after the <a href="qtservicebase.html#exec">exec</a>() function has been called. Then they are passed to the application's constructor.</p>
  89 +<p>There can only be one <a href="qtservice.html">QtService</a> object in a process.</p>
  90 +<p>See also <a href="qtservicebase.html#QtServiceBase">QtServiceBase</a>().</p>
  91 +<h3 class="fn"><a name="dtor.QtService"></a>QtService::~QtService ()</h3>
  92 +<p>Destroys the service object.</p>
  93 +<h3 class="fn"><a name="application"></a>Application * QtService::application () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
  94 +<p>Returns a pointer to the application object.</p>
  95 +<h3 class="fn"><a name="createApplication"></a>void QtService::createApplication ( int &amp; <i>argc</i>, char ** <i>argv</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
  96 +<p>Reimplemented from <a href="qtservicebase.html#createApplication">QtServiceBase::createApplication</a>().</p>
  97 +<p>Creates application object of type Application passing <i>argc</i> and <i>argv</i> to its constructor.</p>
  98 +<h3 class="fn"><a name="executeApplication"></a>int QtService::executeApplication ()&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
  99 +<p>Reimplemented from <a href="qtservicebase.html#executeApplication">QtServiceBase::executeApplication</a>().</p>
  100 +<p /><address><hr /><div align="center">
  101 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  102 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  103 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  104 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  105 +</tr></table></div></address></body>
  106 +</html>
... ...
src/qtservice/doc/html/qtservice.index 0 → 100644
... ... @@ -0,0 +1,117 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE QDOCINDEX>
  3 +<INDEX url="" title="Qt Solutions: Service Documentation" version="">
  4 + <namespace access="public" threadsafety="unspecified" status="commendable" name="" href="" location="" module="">
  5 + <class access="public" threadsafety="unspecified" status="commendable" name="QtServiceController" href="qtservicecontroller.html" location="qtservice.h" bases="" module="">
  6 + <enum access="public" threadsafety="unspecified" status="commendable" name="StartupType" fullname="QtServiceController::StartupType" href="qtservicecontroller.html#StartupType-enum" location="qtservice.h">
  7 + <value name="AutoStartup" value="0"/>
  8 + <value name="ManualStartup" value="1"/>
  9 + </enum>
  10 + <function access="public" threadsafety="unspecified" status="commendable" name="QtServiceController" fullname="QtServiceController::QtServiceController" href="qtservicecontroller.html#QtServiceController" location="qtservice.h" virtual="non" meta="constructor" const="false" static="false" overload="false" type="" signature="QtServiceController(const QString &amp; name)">
  11 + <parameter left="const QString &amp;" right="" name="name" default=""/>
  12 + </function>
  13 + <function access="public" threadsafety="unspecified" status="commendable" name="~QtServiceController" fullname="QtServiceController::~QtServiceController" href="qtservicecontroller.html#dtor.QtServiceController" location="qtservice.h" virtual="impure" meta="destructor" const="false" static="false" overload="false" type="" signature="~QtServiceController()"/>
  14 + <function access="public" threadsafety="unspecified" status="commendable" name="isInstalled" fullname="QtServiceController::isInstalled" href="qtservicecontroller.html#isInstalled" location="qtservice_win.cpp" virtual="non" meta="plain" const="true" static="false" overload="false" type="bool" signature="isInstalled() const"/>
  15 + <function access="public" threadsafety="unspecified" status="commendable" name="isRunning" fullname="QtServiceController::isRunning" href="qtservicecontroller.html#isRunning" location="qtservice_win.cpp" virtual="non" meta="plain" const="true" static="false" overload="false" type="bool" signature="isRunning() const"/>
  16 + <function access="public" threadsafety="unspecified" status="commendable" name="serviceName" fullname="QtServiceController::serviceName" href="qtservicecontroller.html#serviceName" location="qtservice.h" virtual="non" meta="plain" const="true" static="false" overload="false" type="QString" signature="serviceName() const"/>
  17 + <function access="public" threadsafety="unspecified" status="commendable" name="serviceDescription" fullname="QtServiceController::serviceDescription" href="qtservicecontroller.html#serviceDescription" location="qtservice_win.cpp" virtual="non" meta="plain" const="true" static="false" overload="false" type="QString" signature="serviceDescription() const"/>
  18 + <function access="public" threadsafety="unspecified" status="commendable" name="startupType" fullname="QtServiceController::startupType" href="qtservicecontroller.html#startupType" location="qtservice_win.cpp" virtual="non" meta="plain" const="true" static="false" overload="false" type="StartupType" signature="startupType() const"/>
  19 + <function access="public" threadsafety="unspecified" status="commendable" name="serviceFilePath" fullname="QtServiceController::serviceFilePath" href="qtservicecontroller.html#serviceFilePath" location="qtservice_win.cpp" virtual="non" meta="plain" const="true" static="false" overload="false" type="QString" signature="serviceFilePath() const"/>
  20 + <function access="public" threadsafety="unspecified" status="commendable" name="install" fullname="QtServiceController::install" href="qtservicecontroller.html#install" location="qtservice.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="bool" signature="install(const QString &amp; serviceFilePath, const QString &amp; account, const QString &amp; password)">
  21 + <parameter left="const QString &amp;" right="" name="serviceFilePath" default=""/>
  22 + <parameter left="const QString &amp;" right="" name="account" default="QString()"/>
  23 + <parameter left="const QString &amp;" right="" name="password" default="QString()"/>
  24 + </function>
  25 + <function access="public" threadsafety="unspecified" status="commendable" name="uninstall" fullname="QtServiceController::uninstall" href="qtservicecontroller.html#uninstall" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="uninstall()"/>
  26 + <function access="public" threadsafety="unspecified" status="commendable" name="start" fullname="QtServiceController::start" href="qtservicecontroller.html#start" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="start(const QStringList &amp; arguments)">
  27 + <parameter left="const QStringList &amp;" right="" name="arguments" default=""/>
  28 + </function>
  29 + <function access="public" threadsafety="unspecified" status="commendable" name="start" fullname="QtServiceController::start" href="qtservicecontroller.html#start-2" location="qtservice.h" virtual="non" meta="plain" const="false" static="false" overload="true" overload-number="2" type="bool" signature="start()"/>
  30 + <function access="public" threadsafety="unspecified" status="commendable" name="stop" fullname="QtServiceController::stop" href="qtservicecontroller.html#stop" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="stop()"/>
  31 + <function access="public" threadsafety="unspecified" status="commendable" name="pause" fullname="QtServiceController::pause" href="qtservicecontroller.html#pause" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="pause()"/>
  32 + <function access="public" threadsafety="unspecified" status="commendable" name="resume" fullname="QtServiceController::resume" href="qtservicecontroller.html#resume" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="resume()"/>
  33 + <function access="public" threadsafety="unspecified" status="commendable" name="sendCommand" fullname="QtServiceController::sendCommand" href="qtservicecontroller.html#sendCommand" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="sendCommand(int code)">
  34 + <parameter left="int" right="" name="code" default=""/>
  35 + </function>
  36 + </class>
  37 + <class access="public" threadsafety="unspecified" status="commendable" name="QtServiceBase" href="qtservicebase.html" location="qtservice.h" bases="" module="">
  38 + <target name="servicespecificarguments"/>
  39 + <enum access="public" threadsafety="unspecified" status="commendable" name="MessageType" fullname="QtServiceBase::MessageType" href="qtservicebase.html#MessageType-enum" location="qtservice.h">
  40 + <value name="Success" value="0"/>
  41 + <value name="Error" value="1"/>
  42 + <value name="Warning" value="2"/>
  43 + <value name="Information" value="3"/>
  44 + </enum>
  45 + <enum access="public" threadsafety="unspecified" status="commendable" name="ServiceFlag" fullname="QtServiceBase::ServiceFlag" href="qtservicebase.html#ServiceFlag-enum" location="qtservice.h" typedef="QtServiceBase::ServiceFlags">
  46 + <value name="Default" value="0x00"/>
  47 + <value name="CanBeSuspended" value="0x01"/>
  48 + <value name="CannotBeStopped" value="0x02"/>
  49 + <value name="NeedsStopOnShutdown" value="0x04"/>
  50 + </enum>
  51 + <typedef access="public" threadsafety="unspecified" status="commendable" name="ServiceFlags" fullname="QtServiceBase::ServiceFlags" href="qtservicebase.html#ServiceFlags-typedef" location="qtservice.h" enum="QtServiceBase::ServiceFlag"/>
  52 + <function access="public" threadsafety="unspecified" status="commendable" name="QtServiceBase" fullname="QtServiceBase::QtServiceBase" href="qtservicebase.html#QtServiceBase" location="qtservice.h" virtual="non" meta="constructor" const="false" static="false" overload="false" type="" signature="QtServiceBase(int argc, char ** argv, const QString &amp; name)">
  53 + <parameter left="int" right="" name="argc" default=""/>
  54 + <parameter left="char **" right="" name="argv" default=""/>
  55 + <parameter left="const QString &amp;" right="" name="name" default=""/>
  56 + </function>
  57 + <function access="public" threadsafety="unspecified" status="commendable" name="~QtServiceBase" fullname="QtServiceBase::~QtServiceBase" href="qtservicebase.html#dtor.QtServiceBase" location="qtservice.h" virtual="impure" meta="destructor" const="false" static="false" overload="false" type="" signature="~QtServiceBase()"/>
  58 + <function access="public" threadsafety="unspecified" status="commendable" name="serviceName" fullname="QtServiceBase::serviceName" href="qtservicebase.html#serviceName" location="qtservice.h" virtual="non" meta="plain" const="true" static="false" overload="false" type="QString" signature="serviceName() const"/>
  59 + <function access="public" threadsafety="unspecified" status="commendable" name="serviceDescription" fullname="QtServiceBase::serviceDescription" href="qtservicebase.html#serviceDescription" location="qtservice.h" virtual="non" meta="plain" const="true" static="false" overload="false" type="QString" signature="serviceDescription() const"/>
  60 + <function access="public" threadsafety="unspecified" status="commendable" name="setServiceDescription" fullname="QtServiceBase::setServiceDescription" href="qtservicebase.html#setServiceDescription" location="qtservice.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="setServiceDescription(const QString &amp; description)">
  61 + <parameter left="const QString &amp;" right="" name="description" default=""/>
  62 + </function>
  63 + <function access="public" threadsafety="unspecified" status="commendable" name="startupType" fullname="QtServiceBase::startupType" href="qtservicebase.html#startupType" location="qtservice.h" virtual="non" meta="plain" const="true" static="false" overload="false" type="QtServiceController::StartupType" signature="startupType() const"/>
  64 + <function access="public" threadsafety="unspecified" status="commendable" name="setStartupType" fullname="QtServiceBase::setStartupType" href="qtservicebase.html#setStartupType" location="qtservice.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="setStartupType(QtServiceController::StartupType type)">
  65 + <parameter left="QtServiceController::StartupType" right="" name="type" default=""/>
  66 + </function>
  67 + <function access="public" threadsafety="unspecified" status="commendable" name="serviceFlags" fullname="QtServiceBase::serviceFlags" href="qtservicebase.html#serviceFlags" location="qtservice.h" virtual="non" meta="plain" const="true" static="false" overload="false" type="ServiceFlags" signature="serviceFlags() const"/>
  68 + <function access="public" threadsafety="unspecified" status="commendable" name="setServiceFlags" fullname="QtServiceBase::setServiceFlags" href="qtservicebase.html#setServiceFlags" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="setServiceFlags(QFlags&lt;QtServiceBase::ServiceFlag&gt; flags)">
  69 + <parameter left="QFlags&lt;QtServiceBase::ServiceFlag&gt;" right="" name="flags" default=""/>
  70 + </function>
  71 + <function access="public" threadsafety="unspecified" status="commendable" name="exec" fullname="QtServiceBase::exec" href="qtservicebase.html#exec" location="qtservice.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="int" signature="exec()"/>
  72 + <function access="public" threadsafety="unspecified" status="commendable" name="logMessage" fullname="QtServiceBase::logMessage" href="qtservicebase.html#logMessage" location="qtservice_win.cpp" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="logMessage(const QString &amp; message, MessageType type, int id, uint category, const QByteArray &amp; data)">
  73 + <parameter left="const QString &amp;" right="" name="message" default=""/>
  74 + <parameter left="MessageType" right="" name="type" default="Success"/>
  75 + <parameter left="int" right="" name="id" default="0"/>
  76 + <parameter left="uint" right="" name="category" default="0"/>
  77 + <parameter left="const QByteArray &amp;" right="" name="data" default="QByteArray()"/>
  78 + </function>
  79 + <function access="public" threadsafety="unspecified" status="commendable" name="instance" fullname="QtServiceBase::instance" href="qtservicebase.html#instance" location="qtservice.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QtServiceBase *" signature="instance()"/>
  80 + <function access="protected" threadsafety="unspecified" status="commendable" name="start" fullname="QtServiceBase::start" href="qtservicebase.html#start" location="qtservice.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="void" signature="start()"/>
  81 + <function access="protected" threadsafety="unspecified" status="commendable" name="stop" fullname="QtServiceBase::stop" href="qtservicebase.html#stop" location="qtservice.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="void" signature="stop()"/>
  82 + <function access="protected" threadsafety="unspecified" status="commendable" name="pause" fullname="QtServiceBase::pause" href="qtservicebase.html#pause" location="qtservice.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="void" signature="pause()"/>
  83 + <function access="protected" threadsafety="unspecified" status="commendable" name="resume" fullname="QtServiceBase::resume" href="qtservicebase.html#resume" location="qtservice.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="void" signature="resume()"/>
  84 + <function access="protected" threadsafety="unspecified" status="commendable" name="processCommand" fullname="QtServiceBase::processCommand" href="qtservicebase.html#processCommand" location="qtservice.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="void" signature="processCommand(int code)">
  85 + <parameter left="int" right="" name="code" default=""/>
  86 + </function>
  87 + <function access="protected" threadsafety="unspecified" status="commendable" name="createApplication" fullname="QtServiceBase::createApplication" href="qtservicebase.html#createApplication" location="qtservice.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="void" signature="createApplication(int &amp; argc, char ** argv)">
  88 + <parameter left="int &amp;" right="" name="argc" default=""/>
  89 + <parameter left="char **" right="" name="argv" default=""/>
  90 + </function>
  91 + <function access="protected" threadsafety="unspecified" status="commendable" name="executeApplication" fullname="QtServiceBase::executeApplication" href="qtservicebase.html#executeApplication" location="qtservice.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="int" signature="executeApplication()"/>
  92 + </class>
  93 + <class access="public" threadsafety="unspecified" status="commendable" name="QtService" href="qtservice.html" location="qtservice.h" bases="QtServiceBase" module="">
  94 + <function access="public" threadsafety="unspecified" status="commendable" name="QtService" fullname="QtService::QtService" href="qtservice.html#QtService" location="qtservice.h" virtual="non" meta="constructor" const="false" static="false" overload="false" type="" signature="QtService(int argc, char ** argv, const QString &amp; name)">
  95 + <parameter left="int" right="" name="argc" default=""/>
  96 + <parameter left="char **" right="" name="argv" default=""/>
  97 + <parameter left="const QString &amp;" right="" name="name" default=""/>
  98 + </function>
  99 + <function access="public" threadsafety="unspecified" status="commendable" name="~QtService" fullname="QtService::~QtService" href="qtservice.html#dtor.QtService" location="qtservice.h" virtual="non" meta="destructor" const="false" static="false" overload="false" type="" signature="~QtService()"/>
  100 + <function access="protected" threadsafety="unspecified" status="commendable" name="application" fullname="QtService::application" href="qtservice.html#application" location="qtservice.h" virtual="non" meta="plain" const="true" static="false" overload="false" type="Application *" signature="application() const"/>
  101 + <function access="protected" threadsafety="unspecified" status="commendable" name="createApplication" fullname="QtService::createApplication" href="qtservice.html#createApplication" location="qtservice.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="void" signature="createApplication(int &amp; argc, char ** argv)">
  102 + <parameter left="int &amp;" right="" name="argc" default=""/>
  103 + <parameter left="char **" right="" name="argv" default=""/>
  104 + </function>
  105 + <function access="protected" threadsafety="unspecified" status="commendable" name="executeApplication" fullname="QtService::executeApplication" href="qtservice.html#executeApplication" location="qtservice.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="int" signature="executeApplication()"/>
  106 + </class>
  107 + <page access="public" status="commendable" name="index.html" href="index.html" subtype="page" title="Service" fulltitle="Service" subtitle="" location="index.qdoc">
  108 + <contents name="description" title="Description" level="1"/>
  109 + <contents name="classes" title="Classes" level="1"/>
  110 + <contents name="examples" title="Examples" level="1"/>
  111 + <contents name="tested-platforms" title="Tested platforms" level="1"/>
  112 + </page>
  113 + <page access="public" status="commendable" name="qtservice-example-controller.html" href="qtservice-example-controller.html" subtype="page" title="A simple Service Controller" fulltitle="A simple Service Controller" subtitle="" location="controller.qdoc"/>
  114 + <page access="public" status="commendable" name="qtservice-example-interactive.html" href="qtservice-example-interactive.html" subtype="page" title="An Interactive Service" fulltitle="An Interactive Service" subtitle="" location="interactive.qdoc"/>
  115 + <page access="public" status="commendable" name="qtservice-example-server.html" href="qtservice-example-server.html" subtype="page" title="A simple HTTP Server" fulltitle="A simple HTTP Server" subtitle="" location="server.qdoc"/>
  116 + </namespace>
  117 +</INDEX>
... ...
src/qtservice/doc/html/qtservice.qhp 0 → 100644
... ... @@ -0,0 +1,93 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<QtHelpProject version="1.0">
  3 + <namespace>com.nokia.qtsolutions.qtservice_head</namespace>
  4 + <virtualFolder>qdoc</virtualFolder>
  5 + <customFilter name="Qt Solutions: Service">
  6 + <filterAttribute>qt</filterAttribute>
  7 + <filterAttribute>qtservice</filterAttribute>
  8 + <filterAttribute>solutions</filterAttribute>
  9 + </customFilter>
  10 + <filterSection>
  11 + <filterAttribute>qt</filterAttribute>
  12 + <filterAttribute>qtservice</filterAttribute>
  13 + <filterAttribute>solutions</filterAttribute>
  14 + <toc>
  15 + <section ref="index.html" title="Qt Solutions: Service Documentation">
  16 + <section ref="qtservice-example-server.html" title="A simple HTTP Server"/>
  17 + <section ref="qtservice-example-controller.html" title="A simple Service Controller"/>
  18 + <section ref="qtservice-example-interactive.html" title="An Interactive Service"/>
  19 + <section ref="index.html" title="Service"/>
  20 + </section>
  21 + </toc>
  22 + <keywords>
  23 + <keyword name="A simple HTTP Server" id="A simple HTTP Server" ref="qtservice-example-server.html"/>
  24 + <keyword name="A simple Service Controller" id="A simple Service Controller" ref="qtservice-example-controller.html"/>
  25 + <keyword name="An Interactive Service" id="An Interactive Service" ref="qtservice-example-interactive.html"/>
  26 + <keyword name="QtService" id="QtService" ref="qtservice.html"/>
  27 + <keyword name="application" id="QtService::application" ref="qtservice.html#application"/>
  28 + <keyword name="createApplication" id="QtService::createApplication" ref="qtservice.html#createApplication"/>
  29 + <keyword name="executeApplication" id="QtService::executeApplication" ref="qtservice.html#executeApplication"/>
  30 + <keyword name="~QtService" id="QtService::~QtService" ref="qtservice.html#dtor.QtService"/>
  31 + <keyword name="QtServiceBase" id="QtServiceBase" ref="qtservicebase.html"/>
  32 + <keyword name="QtServiceBase::MessageType" id="QtServiceBase::MessageType" ref="qtservicebase.html#MessageType-enum"/>
  33 + <keyword name="QtServiceBase::Success" id="QtServiceBase::Success" ref="qtservicebase.html#MessageType-enum"/>
  34 + <keyword name="QtServiceBase::Error" id="QtServiceBase::Error" ref="qtservicebase.html#MessageType-enum"/>
  35 + <keyword name="QtServiceBase::Warning" id="QtServiceBase::Warning" ref="qtservicebase.html#MessageType-enum"/>
  36 + <keyword name="QtServiceBase::Information" id="QtServiceBase::Information" ref="qtservicebase.html#MessageType-enum"/>
  37 + <keyword name="QtServiceBase::ServiceFlag" id="QtServiceBase::ServiceFlag" ref="qtservicebase.html#ServiceFlag-enum"/>
  38 + <keyword name="QtServiceBase::Default" id="QtServiceBase::Default" ref="qtservicebase.html#ServiceFlag-enum"/>
  39 + <keyword name="QtServiceBase::CanBeSuspended" id="QtServiceBase::CanBeSuspended" ref="qtservicebase.html#ServiceFlag-enum"/>
  40 + <keyword name="QtServiceBase::CannotBeStopped" id="QtServiceBase::CannotBeStopped" ref="qtservicebase.html#ServiceFlag-enum"/>
  41 + <keyword name="QtServiceBase::NeedsStopOnShutdown" id="QtServiceBase::NeedsStopOnShutdown" ref="qtservicebase.html#ServiceFlag-enum"/>
  42 + <keyword name="QtServiceBase::ServiceFlags" id="QtServiceBase::ServiceFlags" ref="qtservicebase.html#ServiceFlag-enum"/>
  43 + <keyword name="createApplication" id="QtServiceBase::createApplication" ref="qtservicebase.html#createApplication"/>
  44 + <keyword name="exec" id="QtServiceBase::exec" ref="qtservicebase.html#exec"/>
  45 + <keyword name="executeApplication" id="QtServiceBase::executeApplication" ref="qtservicebase.html#executeApplication"/>
  46 + <keyword name="instance" id="QtServiceBase::instance" ref="qtservicebase.html#instance"/>
  47 + <keyword name="logMessage" id="QtServiceBase::logMessage" ref="qtservicebase.html#logMessage"/>
  48 + <keyword name="pause" id="QtServiceBase::pause" ref="qtservicebase.html#pause"/>
  49 + <keyword name="processCommand" id="QtServiceBase::processCommand" ref="qtservicebase.html#processCommand"/>
  50 + <keyword name="resume" id="QtServiceBase::resume" ref="qtservicebase.html#resume"/>
  51 + <keyword name="serviceDescription" id="QtServiceBase::serviceDescription" ref="qtservicebase.html#serviceDescription"/>
  52 + <keyword name="serviceFlags" id="QtServiceBase::serviceFlags" ref="qtservicebase.html#serviceFlags"/>
  53 + <keyword name="serviceName" id="QtServiceBase::serviceName" ref="qtservicebase.html#serviceName"/>
  54 + <keyword name="setServiceDescription" id="QtServiceBase::setServiceDescription" ref="qtservicebase.html#setServiceDescription"/>
  55 + <keyword name="setServiceFlags" id="QtServiceBase::setServiceFlags" ref="qtservicebase.html#setServiceFlags"/>
  56 + <keyword name="setStartupType" id="QtServiceBase::setStartupType" ref="qtservicebase.html#setStartupType"/>
  57 + <keyword name="start" id="QtServiceBase::start" ref="qtservicebase.html#start"/>
  58 + <keyword name="startupType" id="QtServiceBase::startupType" ref="qtservicebase.html#startupType"/>
  59 + <keyword name="stop" id="QtServiceBase::stop" ref="qtservicebase.html#stop"/>
  60 + <keyword name="~QtServiceBase" id="QtServiceBase::~QtServiceBase" ref="qtservicebase.html#dtor.QtServiceBase"/>
  61 + <keyword name="QtServiceController" id="QtServiceController" ref="qtservicecontroller.html"/>
  62 + <keyword name="QtServiceController::StartupType" id="QtServiceController::StartupType" ref="qtservicecontroller.html#StartupType-enum"/>
  63 + <keyword name="QtServiceController::AutoStartup" id="QtServiceController::AutoStartup" ref="qtservicecontroller.html#StartupType-enum"/>
  64 + <keyword name="QtServiceController::ManualStartup" id="QtServiceController::ManualStartup" ref="qtservicecontroller.html#StartupType-enum"/>
  65 + <keyword name="install" id="QtServiceController::install" ref="qtservicecontroller.html#install"/>
  66 + <keyword name="isInstalled" id="QtServiceController::isInstalled" ref="qtservicecontroller.html#isInstalled"/>
  67 + <keyword name="isRunning" id="QtServiceController::isRunning" ref="qtservicecontroller.html#isRunning"/>
  68 + <keyword name="pause" id="QtServiceController::pause" ref="qtservicecontroller.html#pause"/>
  69 + <keyword name="resume" id="QtServiceController::resume" ref="qtservicecontroller.html#resume"/>
  70 + <keyword name="sendCommand" id="QtServiceController::sendCommand" ref="qtservicecontroller.html#sendCommand"/>
  71 + <keyword name="serviceDescription" id="QtServiceController::serviceDescription" ref="qtservicecontroller.html#serviceDescription"/>
  72 + <keyword name="serviceFilePath" id="QtServiceController::serviceFilePath" ref="qtservicecontroller.html#serviceFilePath"/>
  73 + <keyword name="serviceName" id="QtServiceController::serviceName" ref="qtservicecontroller.html#serviceName"/>
  74 + <keyword name="start" id="QtServiceController::start" ref="qtservicecontroller.html#start"/>
  75 + <keyword name="startupType" id="QtServiceController::startupType" ref="qtservicecontroller.html#startupType"/>
  76 + <keyword name="stop" id="QtServiceController::stop" ref="qtservicecontroller.html#stop"/>
  77 + <keyword name="uninstall" id="QtServiceController::uninstall" ref="qtservicecontroller.html#uninstall"/>
  78 + <keyword name="~QtServiceController" id="QtServiceController::~QtServiceController" ref="qtservicecontroller.html#dtor.QtServiceController"/>
  79 + <keyword name="Service" id="Service" ref="index.html"/>
  80 + </keywords>
  81 + <files>
  82 + <file>qtservice-example-controller.html</file>
  83 + <file>index.html</file>
  84 + <file>qtservice-example-server.html</file>
  85 + <file>qtservice-example-interactive.html</file>
  86 + <file>qtservicebase.html</file>
  87 + <file>qtservice.html</file>
  88 + <file>qtservicecontroller.html</file>
  89 + <file>classic.css</file>
  90 + <file>images/qt-logo.png</file>
  91 + </files>
  92 + </filterSection>
  93 +</QtHelpProject>
... ...
src/qtservice/doc/html/qtservicebase-members.html 0 → 100644
... ... @@ -0,0 +1,51 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- qtservice.cpp -->
  6 +<head>
  7 + <title>List of All Members for QtServiceBase</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">List of All Members for QtServiceBase</h1>
  16 +<p>This is the complete list of members for <a href="qtservicebase.html">QtServiceBase</a>, including inherited members.</p>
  17 +<p><table class="propsummary" width="100%" border="0" cellpadding="0" cellspacing="0">
  18 +<tr><td width="45%" valign="top"><ul>
  19 +<li><div class="fn">enum <b><a href="qtservicebase.html#MessageType-enum">MessageType</a></b></div></li>
  20 +<li><div class="fn">enum <b><a href="qtservicebase.html#ServiceFlag-enum">ServiceFlag</a></b></div></li>
  21 +<li><div class="fn">flags <b><a href="qtservicebase.html#ServiceFlag-enum">ServiceFlags</a></b></div></li>
  22 +<li><div class="fn"><b><a href="qtservicebase.html#QtServiceBase">QtServiceBase</a></b> ( int, char **, const QString &amp; )</div></li>
  23 +<li><div class="fn"><b><a href="qtservicebase.html#dtor.QtServiceBase">~QtServiceBase</a></b> ()</div></li>
  24 +<li><div class="fn"><b><a href="qtservicebase.html#createApplication">createApplication</a></b> ( int &amp;, char ** )</div></li>
  25 +<li><div class="fn"><b><a href="qtservicebase.html#exec">exec</a></b> () : int</div></li>
  26 +<li><div class="fn"><b><a href="qtservicebase.html#executeApplication">executeApplication</a></b> () : int</div></li>
  27 +<li><div class="fn"><b><a href="qtservicebase.html#instance">instance</a></b> () : QtServiceBase *</div></li>
  28 +<li><div class="fn"><b><a href="qtservicebase.html#logMessage">logMessage</a></b> ( const QString &amp;, MessageType, int, uint, const QByteArray &amp; )</div></li>
  29 +<li><div class="fn"><b><a href="qtservicebase.html#pause">pause</a></b> ()</div></li>
  30 +</ul></td><td valign="top"><ul>
  31 +<li><div class="fn"><b><a href="qtservicebase.html#processCommand">processCommand</a></b> ( int )</div></li>
  32 +<li><div class="fn"><b><a href="qtservicebase.html#resume">resume</a></b> ()</div></li>
  33 +<li><div class="fn"><b><a href="qtservicebase.html#serviceDescription">serviceDescription</a></b> () const : QString</div></li>
  34 +<li><div class="fn"><b><a href="qtservicebase.html#serviceFlags">serviceFlags</a></b> () const : ServiceFlags</div></li>
  35 +<li><div class="fn"><b><a href="qtservicebase.html#serviceName">serviceName</a></b> () const : QString</div></li>
  36 +<li><div class="fn"><b><a href="qtservicebase.html#setServiceDescription">setServiceDescription</a></b> ( const QString &amp; )</div></li>
  37 +<li><div class="fn"><b><a href="qtservicebase.html#setServiceFlags">setServiceFlags</a></b> ( ServiceFlags )</div></li>
  38 +<li><div class="fn"><b><a href="qtservicebase.html#setStartupType">setStartupType</a></b> ( QtServiceController::StartupType )</div></li>
  39 +<li><div class="fn"><b><a href="qtservicebase.html#start">start</a></b> ()</div></li>
  40 +<li><div class="fn"><b><a href="qtservicebase.html#startupType">startupType</a></b> () const : QtServiceController::StartupType</div></li>
  41 +<li><div class="fn"><b><a href="qtservicebase.html#stop">stop</a></b> ()</div></li>
  42 +</ul>
  43 +</td></tr>
  44 +</table></p>
  45 +<p /><address><hr /><div align="center">
  46 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  47 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  48 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  49 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  50 +</tr></table></div></address></body>
  51 +</html>
... ...
src/qtservice/doc/html/qtservicebase.html 0 → 100644
... ... @@ -0,0 +1,204 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- qtservice.cpp -->
  6 +<head>
  7 + <title>QtServiceBase Class Reference</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">QtServiceBase Class Reference</h1>
  16 +<p>The QtServiceBase class provides an API for implementing Windows services and Unix daemons. <a href="#details">More...</a></p>
  17 +<pre> #include &lt;QtServiceBase&gt;</pre><p>Inherited by <a href="qtservice.html">QtService</a>.</p>
  18 +<ul>
  19 +<li><a href="qtservicebase-members.html">List of all members, including inherited members</a></li>
  20 +</ul>
  21 +<hr />
  22 +<a name="public-types"></a>
  23 +<h2>Public Types</h2>
  24 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  25 +<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#MessageType-enum">MessageType</a></b> { Success, Error, Warning, Information }</td></tr>
  26 +<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#ServiceFlag-enum">ServiceFlag</a></b> { Default, CanBeSuspended, CannotBeStopped, NeedsStopOnShutdown }</td></tr>
  27 +<tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#ServiceFlag-enum">ServiceFlags</a></b></td></tr>
  28 +</table>
  29 +<hr />
  30 +<a name="public-functions"></a>
  31 +<h2>Public Functions</h2>
  32 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  33 +<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#QtServiceBase">QtServiceBase</a></b> ( int <i>argc</i>, char ** <i>argv</i>, const QString &amp; <i>name</i> )</td></tr>
  34 +<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#dtor.QtServiceBase">~QtServiceBase</a></b> ()</td></tr>
  35 +<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#exec">exec</a></b> ()</td></tr>
  36 +<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#logMessage">logMessage</a></b> ( const QString &amp; <i>message</i>, MessageType <i>type</i> = Success, int <i>id</i> = 0, uint <i>category</i> = 0, const QByteArray &amp; <i>data</i> = QByteArray() )</td></tr>
  37 +<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#serviceDescription">serviceDescription</a></b> () const</td></tr>
  38 +<tr><td class="memItemLeft" align="right" valign="top">ServiceFlags </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#serviceFlags">serviceFlags</a></b> () const</td></tr>
  39 +<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#serviceName">serviceName</a></b> () const</td></tr>
  40 +<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#setServiceDescription">setServiceDescription</a></b> ( const QString &amp; <i>description</i> )</td></tr>
  41 +<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#setServiceFlags">setServiceFlags</a></b> ( ServiceFlags <i>flags</i> )</td></tr>
  42 +<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#setStartupType">setStartupType</a></b> ( QtServiceController::StartupType <i>type</i> )</td></tr>
  43 +<tr><td class="memItemLeft" align="right" valign="top">QtServiceController::StartupType </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#startupType">startupType</a></b> () const</td></tr>
  44 +</table>
  45 +<hr />
  46 +<a name="static-public-members"></a>
  47 +<h2>Static Public Members</h2>
  48 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  49 +<tr><td class="memItemLeft" align="right" valign="top">QtServiceBase * </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#instance">instance</a></b> ()</td></tr>
  50 +</table>
  51 +<hr />
  52 +<a name="protected-functions"></a>
  53 +<h2>Protected Functions</h2>
  54 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  55 +<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#createApplication">createApplication</a></b> ( int &amp; <i>argc</i>, char ** <i>argv</i> ) = 0</td></tr>
  56 +<tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#executeApplication">executeApplication</a></b> () = 0</td></tr>
  57 +<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#pause">pause</a></b> ()</td></tr>
  58 +<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#processCommand">processCommand</a></b> ( int <i>code</i> )</td></tr>
  59 +<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#resume">resume</a></b> ()</td></tr>
  60 +<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#start">start</a></b> () = 0</td></tr>
  61 +<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtservicebase.html#stop">stop</a></b> ()</td></tr>
  62 +</table>
  63 +<a name="details"></a>
  64 +<hr />
  65 +<h2>Detailed Description</h2>
  66 +<p>The QtServiceBase class provides an API for implementing Windows services and Unix daemons.</p>
  67 +<p>A Windows service or Unix daemon (a &quot;service&quot;), is a program that runs &quot;in the background&quot; independently of whether a user is logged in or not. A service is often set up to start when the machine boots up, and will typically run continuously as long as the machine is on.</p>
  68 +<p>Services are usually non-interactive console applications. User interaction, if required, is usually implemented in a separate, normal GUI application that communicates with the service through an IPC channel. For simple communication, <a href="qtservicecontroller.html#sendCommand">QtServiceController::sendCommand</a>() and <a href="qtservicebase.html#processCommand">QtService::processCommand</a>() may be used, possibly in combination with a shared settings file. For more complex, interactive communication, a custom IPC channel should be used, e.g&#x2e; based on Qt's networking classes. (In certain circumstances, a service may provide a GUI itself, ref. the &quot;interactive&quot; example documentation).</p>
  69 +<p>Typically, you will create a service by subclassing the <a href="qtservice.html">QtService</a> template class which inherits QtServiceBase and allows you to create a service for a particular application type.</p>
  70 +<p>The Windows implementation uses the NT Service Control Manager, and the application can be controlled through the system administration tools. Services are usually launched using the system account, which requires that all DLLs that the service executable depends on (i.e&#x2e; Qt), are located in the same directory as the service, or in a system path.</p>
  71 +<p>On Unix a service is implemented as a daemon.</p>
  72 +<p>You can retrieve the service's description, state, and startup type using the <a href="qtservicebase.html#serviceDescription">serviceDescription</a>(), <a href="qtservicebase.html#serviceFlags">serviceFlags</a>() and <a href="qtservicebase.html#startupType">startupType</a>() functions respectively. The service's state is decribed by the <a href="qtservicebase.html#ServiceFlag-enum">ServiceFlag</a> enum. The mentioned properites can also be set using the corresponding set functions. In addition you can retrieve the service's name using the <a href="qtservicebase.html#serviceName">serviceName</a>() function.</p>
  73 +<p>Several of QtServiceBase's protected functions are called on requests from the <a href="qtservicecontroller.html">QtServiceController</a> class:</p>
  74 +<ul>
  75 +<li><a href="qtservicebase.html#start">start</a>()</li>
  76 +<li><a href="qtservicebase.html#pause">pause</a>()</li>
  77 +<li><a href="qtservicebase.html#processCommand">processCommand</a>()</li>
  78 +<li><a href="qtservicebase.html#resume">resume</a>()</li>
  79 +<li><a href="qtservicebase.html#stop">stop</a>()</li>
  80 +</ul>
  81 +<p>You can control any given service using an instance of the <a href="qtservicecontroller.html">QtServiceController</a> class which also allows you to control services from separate applications. The mentioned functions are all virtual and won't do anything unless they are reimplemented. You can reimplement these functions to pause and resume the service's execution, as well as process user commands and perform additional clean-ups before shutting down.</p>
  82 +<p>QtServiceBase also provides the static <a href="qtservicebase.html#instance">instance</a>() function which returns a pointer to an application's QtServiceBase instance. In addition, a service can report events to the system's event log using the <a href="qtservicebase.html#logMessage">logMessage</a>() function. The <a href="qtservicebase.html#MessageType-enum">MessageType</a> enum describes the different types of messages a service reports.</p>
  83 +<p>The implementation of a service application's main function typically creates an service object derived by subclassing the <a href="qtservice.html">QtService</a> template class. Then the main function will call this service's <a href="qtservicebase.html#exec">exec</a>() function, and return the result of that call. For example:</p>
  84 +<pre> int main(int argc, char **argv)
  85 + {
  86 + MyService service(argc, argv);
  87 + return service.exec();
  88 + }</pre>
  89 +<p>When the <a href="qtservicebase.html#exec">exec</a>() function is called, it will parse the service specific arguments passed in <tt>argv</tt>, perform the required actions, and return.</p>
  90 +<a name="servicespecificarguments"></a><p>The following arguments are recognized as service specific:</p>
  91 +<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
  92 +<thead><tr valign="top" class="qt-style"><th>Short</th><th>Long</th><th>Explanation</th></tr></thead>
  93 +<tr valign="top" class="odd"><td>-i</td><td>-install</td><td>Install the service.</td></tr>
  94 +<tr valign="top" class="even"><td>-u</td><td>-uninstall</td><td>Uninstall the service.</td></tr>
  95 +<tr valign="top" class="odd"><td>-e</td><td>-exec</td><td>Execute the service as a standalone application (useful for debug purposes). This is a blocking call, the service will be executed like a normal application. In this mode you will not be able to communicate with the service from the contoller.</td></tr>
  96 +<tr valign="top" class="even"><td>-t</td><td>-terminate</td><td>Stop the service.</td></tr>
  97 +<tr valign="top" class="odd"><td>-p</td><td>-pause</td><td>Pause the service.</td></tr>
  98 +<tr valign="top" class="even"><td>-r</td><td>-resume</td><td>Resume a paused service.</td></tr>
  99 +<tr valign="top" class="odd"><td>-c <i>cmd</i></td><td>-command <i>cmd</i></td><td>Send the user defined command code <i>cmd</i> to the service application.</td></tr>
  100 +<tr valign="top" class="even"><td>-v</td><td>-version</td><td>Display version and status information.</td></tr>
  101 +</table></p>
  102 +<p>If <i>none</i> of the arguments is recognized as service specific, <a href="qtservicebase.html#exec">exec</a>() will first call the <a href="qtservicebase.html#createApplication">createApplication</a>() function, then <a href="qtservicebase.html#executeApplication">executeApplication</a>() and finally the <a href="qtservicebase.html#start">start</a>() function. In the end, <a href="qtservicebase.html#exec">exec</a>() returns while the service continues in its own process waiting for commands from the service controller.</p>
  103 +<p>See also <a href="qtservice.html">QtService</a> and <a href="qtservicecontroller.html">QtServiceController</a>.</p>
  104 +<hr />
  105 +<h2>Member Type Documentation</h2>
  106 +<h3 class="fn"><a name="MessageType-enum"></a>enum QtServiceBase::MessageType</h3>
  107 +<p>This enum describes the different types of messages a service reports to the system log.</p>
  108 +<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
  109 +<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
  110 +<tr><td valign="top"><tt>QtServiceBase::Success</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">An operation has succeeded, e.g&#x2e; the service is started.</td></tr>
  111 +<tr><td valign="top"><tt>QtServiceBase::Error</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">An operation failed, e.g&#x2e; the service failed to start.</td></tr>
  112 +<tr><td valign="top"><tt>QtServiceBase::Warning</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">An operation caused a warning that might require user interaction.</td></tr>
  113 +<tr><td valign="top"><tt>QtServiceBase::Information</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Any type of usually non-critical information.</td></tr>
  114 +</table></p>
  115 +<h3 class="flags"><a name="ServiceFlag-enum"></a>enum QtServiceBase::ServiceFlag<br />flags QtServiceBase::ServiceFlags</h3>
  116 +<p>This enum describes the different capabilities of a service.</p>
  117 +<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
  118 +<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
  119 +<tr><td valign="top"><tt>QtServiceBase::Default</tt></td><td align="center" valign="top"><tt>0x00</tt></td><td valign="top">The service can be stopped, but not suspended.</td></tr>
  120 +<tr><td valign="top"><tt>QtServiceBase::CanBeSuspended</tt></td><td align="center" valign="top"><tt>0x01</tt></td><td valign="top">The service can be suspended.</td></tr>
  121 +<tr><td valign="top"><tt>QtServiceBase::CannotBeStopped</tt></td><td align="center" valign="top"><tt>0x02</tt></td><td valign="top">The service cannot be stopped.</td></tr>
  122 +<tr><td valign="top"><tt>QtServiceBase::NeedsStopOnShutdown</tt></td><td align="center" valign="top"><tt>0x04</tt></td><td valign="top">(Windows only) The service will be stopped before the system shuts down. Note that Microsoft recommends this only for services that must absolutely clean up during shutdown, because there is a limited time available for shutdown of services.</td></tr>
  123 +</table></p>
  124 +<p>The ServiceFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;ServiceFlag&gt;. It stores an OR combination of ServiceFlag values.</p>
  125 +<hr />
  126 +<h2>Member Function Documentation</h2>
  127 +<h3 class="fn"><a name="QtServiceBase"></a>QtServiceBase::QtServiceBase ( int <i>argc</i>, char ** <i>argv</i>, const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>name</i> )</h3>
  128 +<p>Creates a service instance called <i>name</i>. The <i>argc</i> and <i>argv</i> parameters are parsed after the <a href="qtservicebase.html#exec">exec</a>() function has been called. Then they are passed to the application's constructor. The application type is determined by the <a href="qtservice.html">QtService</a> subclass.</p>
  129 +<p>The service is neither installed nor started. The name must not contain any backslashes or be longer than 255 characters. In addition, the name must be unique in the system's service database.</p>
  130 +<p>See also <a href="qtservicebase.html#exec">exec</a>(), <a href="qtservicebase.html#start">start</a>(), and <a href="qtservicecontroller.html#install">QtServiceController::install</a>().</p>
  131 +<h3 class="fn"><a name="dtor.QtServiceBase"></a>QtServiceBase::~QtServiceBase ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
  132 +<p>Destroys the service object. This neither stops nor uninstalls the service.</p>
  133 +<p>To stop a service the <a href="qtservicebase.html#stop">stop</a>() function must be called explicitly. To uninstall a service, you can use the <a href="qtservicecontroller.html#uninstall">QtServiceController::uninstall</a>() function.</p>
  134 +<p>See also <a href="qtservicebase.html#stop">stop</a>() and <a href="qtservicecontroller.html#uninstall">QtServiceController::uninstall</a>().</p>
  135 +<h3 class="fn"><a name="createApplication"></a>void QtServiceBase::createApplication ( int &amp; <i>argc</i>, char ** <i>argv</i> )&nbsp;&nbsp;<tt> [pure virtual protected]</tt></h3>
  136 +<p>Creates the application object using the <i>argc</i> and <i>argv</i> parameters.</p>
  137 +<p>This function is only called when no <a href="qtservicebase.html#servicespecificarguments">service specific arguments</a> were passed to the service constructor, and is called by <a href="qtservicebase.html#exec">exec</a>() before it calls the <a href="qtservicebase.html#executeApplication">executeApplication</a>() and <a href="qtservicebase.html#start">start</a>() functions.</p>
  138 +<p>The createApplication() function is implemented in <a href="qtservice.html">QtService</a>, but you might want to reimplement it, for example, if the chosen application type's constructor needs additional arguments.</p>
  139 +<p>See also <a href="qtservicebase.html#exec">exec</a>() and <a href="qtservice.html">QtService</a>.</p>
  140 +<h3 class="fn"><a name="exec"></a>int QtServiceBase::exec ()</h3>
  141 +<p>Executes the service.</p>
  142 +<p>When the exec() function is called, it will parse the <a href="qtservicebase.html#servicespecificarguments">service specific arguments</a> passed in <tt>argv</tt>, perform the required actions, and exit.</p>
  143 +<p>If none of the arguments is recognized as service specific, exec() will first call the <a href="qtservicebase.html#createApplication">createApplication</a>() function, then <a href="qtservicebase.html#executeApplication">executeApplication</a>() and finally the <a href="qtservicebase.html#start">start</a>() function. In the end, exec() returns while the service continues in its own process waiting for commands from the service controller.</p>
  144 +<p>See also <a href="qtservicecontroller.html">QtServiceController</a>.</p>
  145 +<h3 class="fn"><a name="executeApplication"></a>int QtServiceBase::executeApplication ()&nbsp;&nbsp;<tt> [pure virtual protected]</tt></h3>
  146 +<p>Executes the application previously created with the <a href="qtservicebase.html#createApplication">createApplication</a>() function.</p>
  147 +<p>This function is only called when no <a href="qtservicebase.html#servicespecificarguments">service specific arguments</a> were passed to the service constructor, and is called by <a href="qtservicebase.html#exec">exec</a>() after it has called the <a href="qtservicebase.html#createApplication">createApplication</a>() function and before <a href="qtservicebase.html#start">start</a>() function.</p>
  148 +<p>This function is implemented in <a href="qtservice.html">QtService</a>.</p>
  149 +<p>See also <a href="qtservicebase.html#exec">exec</a>() and <a href="qtservicebase.html#createApplication">createApplication</a>().</p>
  150 +<h3 class="fn"><a name="instance"></a>QtServiceBase * QtServiceBase::instance ()&nbsp;&nbsp;<tt> [static]</tt></h3>
  151 +<p>Returns a pointer to the current application's <a href="qtservicebase.html">QtServiceBase</a> instance.</p>
  152 +<h3 class="fn"><a name="logMessage"></a>void QtServiceBase::logMessage ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>message</i>, <a href="qtservicebase.html#MessageType-enum">MessageType</a> <i>type</i> = Success, int <i>id</i> = 0, <a href="http://qt.nokia.com/doc/4.6/qtglobal.html#uint-typedef">uint</a> <i>category</i> = 0, const <a href="http://qt.nokia.com/doc/4.6/qbytearray.html">QByteArray</a> &amp; <i>data</i> = QByteArray() )</h3>
  153 +<p>Reports a message of the given <i>type</i> with the given <i>message</i> to the local system event log. The message identifier <i>id</i> and the message <i>category</i> are user defined values. The <i>data</i> parameter can contain arbitrary binary data.</p>
  154 +<p>Message strings for <i>id</i> and <i>category</i> must be provided by a message file, which must be registered in the system registry. Refer to the MSDN for more information about how to do this on Windows.</p>
  155 +<p>See also <a href="qtservicebase.html#MessageType-enum">MessageType</a>.</p>
  156 +<h3 class="fn"><a name="pause"></a>void QtServiceBase::pause ()&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
  157 +<p>Reimplement this function to pause the service's execution (for example to stop a polling timer, or to ignore socket notifiers).</p>
  158 +<p>This function is called in reply to controller requests. The default implementation does nothing.</p>
  159 +<p>See also <a href="qtservicebase.html#resume">resume</a>() and <a href="qtservicecontroller.html#pause">QtServiceController::pause</a>().</p>
  160 +<h3 class="fn"><a name="processCommand"></a>void QtServiceBase::processCommand ( int <i>code</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
  161 +<p>Reimplement this function to process the user command <i>code</i>.</p>
  162 +<p>This function is called in reply to controller requests. The default implementation does nothing.</p>
  163 +<p>See also <a href="qtservicecontroller.html#sendCommand">QtServiceController::sendCommand</a>().</p>
  164 +<h3 class="fn"><a name="resume"></a>void QtServiceBase::resume ()&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
  165 +<p>Reimplement this function to continue the service after a call to <a href="qtservicebase.html#pause">pause</a>().</p>
  166 +<p>This function is called in reply to controller requests. The default implementation does nothing.</p>
  167 +<p>See also <a href="qtservicebase.html#pause">pause</a>() and <a href="qtservicecontroller.html#resume">QtServiceController::resume</a>().</p>
  168 +<h3 class="fn"><a name="serviceDescription"></a><a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> QtServiceBase::serviceDescription () const</h3>
  169 +<p>Returns the description of the service.</p>
  170 +<p>See also <a href="qtservicebase.html#setServiceDescription">setServiceDescription</a>() and <a href="qtservicebase.html#serviceName">serviceName</a>().</p>
  171 +<h3 class="fn"><a name="serviceFlags"></a><a href="qtservicebase.html#ServiceFlag-enum">ServiceFlags</a> QtServiceBase::serviceFlags () const</h3>
  172 +<p>Returns the service's state which is decribed using the <a href="qtservicebase.html#ServiceFlag-enum">ServiceFlag</a> enum.</p>
  173 +<p>See also <a href="qtservicebase.html#ServiceFlag-enum">ServiceFlags</a> and <a href="qtservicebase.html#setServiceFlags">setServiceFlags</a>().</p>
  174 +<h3 class="fn"><a name="serviceName"></a><a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> QtServiceBase::serviceName () const</h3>
  175 +<p>Returns the name of the service.</p>
  176 +<p>See also <a href="qtservicebase.html#QtServiceBase">QtServiceBase</a>() and <a href="qtservicebase.html#serviceDescription">serviceDescription</a>().</p>
  177 +<h3 class="fn"><a name="setServiceDescription"></a>void QtServiceBase::setServiceDescription ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>description</i> )</h3>
  178 +<p>Sets the description of the service to the given <i>description</i>.</p>
  179 +<p>See also <a href="qtservicebase.html#serviceDescription">serviceDescription</a>().</p>
  180 +<h3 class="fn"><a name="setServiceFlags"></a>void QtServiceBase::setServiceFlags ( <a href="qtservicebase.html#ServiceFlag-enum">ServiceFlags</a> <i>flags</i> )</h3>
  181 +<p>Sets the service's state to the state described by the given <i>flags</i>.</p>
  182 +<p>See also <a href="qtservicebase.html#ServiceFlag-enum">ServiceFlags</a> and <a href="qtservicebase.html#serviceFlags">serviceFlags</a>().</p>
  183 +<h3 class="fn"><a name="setStartupType"></a>void QtServiceBase::setStartupType ( <a href="qtservicecontroller.html#StartupType-enum">QtServiceController::StartupType</a> <i>type</i> )</h3>
  184 +<p>Sets the service's startup type to the given <i>type</i>.</p>
  185 +<p>See also <a href="qtservicecontroller.html#StartupType-enum">QtServiceController::StartupType</a> and <a href="qtservicebase.html#startupType">startupType</a>().</p>
  186 +<h3 class="fn"><a name="start"></a>void QtServiceBase::start ()&nbsp;&nbsp;<tt> [pure virtual protected]</tt></h3>
  187 +<p>This function must be implemented in <a href="qtservicebase.html">QtServiceBase</a> subclasses in order to perform the service's work. Usually you create some main object on the heap which is the heart of your service.</p>
  188 +<p>The function is only called when no service specific arguments were passed to the service constructor, and is called by <a href="qtservicebase.html#exec">exec</a>() after it has called the <a href="qtservicebase.html#executeApplication">executeApplication</a>() function.</p>
  189 +<p>Note that you <i>don't</i> need to create an application object or call its <a href="qtservicebase.html#exec">exec</a>() function explicitly.</p>
  190 +<p>See also <a href="qtservicebase.html#exec">exec</a>(), <a href="qtservicebase.html#stop">stop</a>(), and <a href="qtservicecontroller.html#start">QtServiceController::start</a>().</p>
  191 +<h3 class="fn"><a name="startupType"></a><a href="qtservicecontroller.html#StartupType-enum">QtServiceController::StartupType</a> QtServiceBase::startupType () const</h3>
  192 +<p>Returns the service's startup type.</p>
  193 +<p>See also <a href="qtservicecontroller.html#StartupType-enum">QtServiceController::StartupType</a> and <a href="qtservicebase.html#setStartupType">setStartupType</a>().</p>
  194 +<h3 class="fn"><a name="stop"></a>void QtServiceBase::stop ()&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
  195 +<p>Reimplement this function to perform additional cleanups before shutting down (for example deleting a main object if it was created in the <a href="qtservicebase.html#start">start</a>() function).</p>
  196 +<p>This function is called in reply to controller requests. The default implementation does nothing.</p>
  197 +<p>See also <a href="qtservicebase.html#start">start</a>() and <a href="qtservicecontroller.html#stop">QtServiceController::stop</a>().</p>
  198 +<p /><address><hr /><div align="center">
  199 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  200 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  201 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  202 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  203 +</tr></table></div></address></body>
  204 +</html>
... ...
src/qtservice/doc/html/qtservicecontroller-members.html 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- qtservice.cpp -->
  6 +<head>
  7 + <title>List of All Members for QtServiceController</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">List of All Members for QtServiceController</h1>
  16 +<p>This is the complete list of members for <a href="qtservicecontroller.html">QtServiceController</a>, including inherited members.</p>
  17 +<p><table class="propsummary" width="100%" border="0" cellpadding="0" cellspacing="0">
  18 +<tr><td width="45%" valign="top"><ul>
  19 +<li><div class="fn">enum <b><a href="qtservicecontroller.html#StartupType-enum">StartupType</a></b></div></li>
  20 +<li><div class="fn"><b><a href="qtservicecontroller.html#QtServiceController">QtServiceController</a></b> ( const QString &amp; )</div></li>
  21 +<li><div class="fn"><b><a href="qtservicecontroller.html#dtor.QtServiceController">~QtServiceController</a></b> ()</div></li>
  22 +<li><div class="fn"><b><a href="qtservicecontroller.html#install">install</a></b> ( const QString &amp;, const QString &amp;, const QString &amp; ) : bool</div></li>
  23 +<li><div class="fn"><b><a href="qtservicecontroller.html#isInstalled">isInstalled</a></b> () const : bool</div></li>
  24 +<li><div class="fn"><b><a href="qtservicecontroller.html#isRunning">isRunning</a></b> () const : bool</div></li>
  25 +<li><div class="fn"><b><a href="qtservicecontroller.html#pause">pause</a></b> () : bool</div></li>
  26 +<li><div class="fn"><b><a href="qtservicecontroller.html#resume">resume</a></b> () : bool</div></li>
  27 +<li><div class="fn"><b><a href="qtservicecontroller.html#sendCommand">sendCommand</a></b> ( int ) : bool</div></li>
  28 +</ul></td><td valign="top"><ul>
  29 +<li><div class="fn"><b><a href="qtservicecontroller.html#serviceDescription">serviceDescription</a></b> () const : QString</div></li>
  30 +<li><div class="fn"><b><a href="qtservicecontroller.html#serviceFilePath">serviceFilePath</a></b> () const : QString</div></li>
  31 +<li><div class="fn"><b><a href="qtservicecontroller.html#serviceName">serviceName</a></b> () const : QString</div></li>
  32 +<li><div class="fn"><b><a href="qtservicecontroller.html#start">start</a></b> ( const QStringList &amp; ) : bool</div></li>
  33 +<li><div class="fn"><b><a href="qtservicecontroller.html#start-2">start</a></b> () : bool</div></li>
  34 +<li><div class="fn"><b><a href="qtservicecontroller.html#startupType">startupType</a></b> () const : StartupType</div></li>
  35 +<li><div class="fn"><b><a href="qtservicecontroller.html#stop">stop</a></b> () : bool</div></li>
  36 +<li><div class="fn"><b><a href="qtservicecontroller.html#uninstall">uninstall</a></b> () : bool</div></li>
  37 +</ul>
  38 +</td></tr>
  39 +</table></p>
  40 +<p /><address><hr /><div align="center">
  41 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  42 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  43 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  44 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  45 +</tr></table></div></address></body>
  46 +</html>
... ...
src/qtservice/doc/html/qtservicecontroller.html 0 → 100644
... ... @@ -0,0 +1,158 @@
  1 +<?xml version="1.0" encoding="iso-8859-1"?>
  2 +<!DOCTYPE html
  3 + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  4 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 +<!-- qtservice.cpp -->
  6 +<head>
  7 + <title>QtServiceController Class Reference</title>
  8 + <link href="classic.css" rel="stylesheet" type="text/css" />
  9 +</head>
  10 +<body>
  11 +<table border="0" cellpadding="0" cellspacing="0" width="100%">
  12 +<tr>
  13 +<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="57" height="67" border="0" /></td>
  14 +<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a></td>
  15 +</tr></table><h1 class="title">QtServiceController Class Reference</h1>
  16 +<p>The QtServiceController class allows you to control services from separate applications. <a href="#details">More...</a></p>
  17 +<pre> #include &lt;QtServiceController&gt;</pre><ul>
  18 +<li><a href="qtservicecontroller-members.html">List of all members, including inherited members</a></li>
  19 +</ul>
  20 +<hr />
  21 +<a name="public-types"></a>
  22 +<h2>Public Types</h2>
  23 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  24 +<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#StartupType-enum">StartupType</a></b> { AutoStartup, ManualStartup }</td></tr>
  25 +</table>
  26 +<hr />
  27 +<a name="public-functions"></a>
  28 +<h2>Public Functions</h2>
  29 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  30 +<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#QtServiceController">QtServiceController</a></b> ( const QString &amp; <i>name</i> )</td></tr>
  31 +<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#dtor.QtServiceController">~QtServiceController</a></b> ()</td></tr>
  32 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#isInstalled">isInstalled</a></b> () const</td></tr>
  33 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#isRunning">isRunning</a></b> () const</td></tr>
  34 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#pause">pause</a></b> ()</td></tr>
  35 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#resume">resume</a></b> ()</td></tr>
  36 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#sendCommand">sendCommand</a></b> ( int <i>code</i> )</td></tr>
  37 +<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#serviceDescription">serviceDescription</a></b> () const</td></tr>
  38 +<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#serviceFilePath">serviceFilePath</a></b> () const</td></tr>
  39 +<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#serviceName">serviceName</a></b> () const</td></tr>
  40 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#start">start</a></b> ( const QStringList &amp; <i>arguments</i> )</td></tr>
  41 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#start-2">start</a></b> ()</td></tr>
  42 +<tr><td class="memItemLeft" align="right" valign="top">StartupType </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#startupType">startupType</a></b> () const</td></tr>
  43 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#stop">stop</a></b> ()</td></tr>
  44 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#uninstall">uninstall</a></b> ()</td></tr>
  45 +</table>
  46 +<hr />
  47 +<a name="static-public-members"></a>
  48 +<h2>Static Public Members</h2>
  49 +<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
  50 +<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtservicecontroller.html#install">install</a></b> ( const QString &amp; <i>serviceFilePath</i>, const QString &amp; <i>account</i> = QString(), const QString &amp; <i>password</i> = QString() )</td></tr>
  51 +</table>
  52 +<a name="details"></a>
  53 +<hr />
  54 +<h2>Detailed Description</h2>
  55 +<p>The QtServiceController class allows you to control services from separate applications.</p>
  56 +<p>QtServiceController provides a collection of functions that lets you install and run a service controlling its execution, as well as query its status.</p>
  57 +<p>In order to run a service, the service must be installed in the system's service database using the <a href="qtservicecontroller.html#install">install</a>() function. The system will start the service depending on the specified <a href="qtservicecontroller.html#StartupType-enum">StartupType</a>; it can either be started during system startup, or when a process starts it manually.</p>
  58 +<p>Once a service is installed, the service can be run and controlled manually using the <a href="qtservicecontroller.html#start">start</a>(), <a href="qtservicecontroller.html#stop">stop</a>(), <a href="qtservicecontroller.html#pause">pause</a>(), <a href="qtservicecontroller.html#resume">resume</a>() or <a href="qtservicecontroller.html#sendCommand">sendCommand</a>() functions. You can at any time query for the service's status using the <a href="qtservicecontroller.html#isInstalled">isInstalled</a>() and <a href="qtservicecontroller.html#isRunning">isRunning</a>() functions, or you can query its properties using the <a href="qtservicecontroller.html#serviceDescription">serviceDescription</a>(), <a href="qtservicecontroller.html#serviceFilePath">serviceFilePath</a>(), <a href="qtservicecontroller.html#serviceName">serviceName</a>() and <a href="qtservicecontroller.html#startupType">startupType</a>() functions. For example:</p>
  59 +<pre> MyService service; \\ which inherits QtService
  60 + QString serviceFilePath;
  61 +
  62 + QtServiceController controller(service.serviceName());
  63 +
  64 + if (controller.install(serviceFilePath))
  65 + controller.start()
  66 +
  67 + if (controller.isRunning())
  68 + QMessageBox::information(this, tr(&quot;Service Status&quot;),
  69 + tr(&quot;The %1 service is started&quot;).arg(controller.serviceName()));
  70 +
  71 + ...
  72 +
  73 + controller.stop();
  74 + controller.uninstall();
  75 + }</pre>
  76 +<p>An instance of the service controller can only control one single service. To control several services within one application, you must create en equal number of service controllers.</p>
  77 +<p>The QtServiceController destructor neither stops nor uninstalls the associated service. To stop a service the <a href="qtservicecontroller.html#stop">stop</a>() function must be called explicitly. To uninstall a service, you can use the <a href="qtservicecontroller.html#uninstall">uninstall</a>() function.</p>
  78 +<p>See also <a href="qtservicebase.html">QtServiceBase</a> and <a href="qtservice.html">QtService</a>.</p>
  79 +<hr />
  80 +<h2>Member Type Documentation</h2>
  81 +<h3 class="fn"><a name="StartupType-enum"></a>enum QtServiceController::StartupType</h3>
  82 +<p>This enum describes when a service should be started.</p>
  83 +<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
  84 +<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
  85 +<tr><td valign="top"><tt>QtServiceController::AutoStartup</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The service is started during system startup.</td></tr>
  86 +<tr><td valign="top"><tt>QtServiceController::ManualStartup</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The service must be started manually by a process.</td></tr>
  87 +</table></p>
  88 +<p><b>Warning:</b> The <i>StartupType</i> enum is ignored under UNIX-like systems. A service, or daemon, can only be started manually on such systems with current implementation.</p>
  89 +<p>See also <a href="qtservicecontroller.html#startupType">startupType</a>().</p>
  90 +<hr />
  91 +<h2>Member Function Documentation</h2>
  92 +<h3 class="fn"><a name="QtServiceController"></a>QtServiceController::QtServiceController ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>name</i> )</h3>
  93 +<p>Creates a controller object for the service with the given <i>name</i>.</p>
  94 +<h3 class="fn"><a name="dtor.QtServiceController"></a>QtServiceController::~QtServiceController ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
  95 +<p>Destroys the service controller. This neither stops nor uninstalls the controlled service.</p>
  96 +<p>To stop a service the <a href="qtservicecontroller.html#stop">stop</a>() function must be called explicitly. To uninstall a service, you can use the <a href="qtservicecontroller.html#uninstall">uninstall</a>() function.</p>
  97 +<p>See also <a href="qtservicecontroller.html#stop">stop</a>() and <a href="qtservicecontroller.html#uninstall">QtServiceController::uninstall</a>().</p>
  98 +<h3 class="fn"><a name="install"></a>bool QtServiceController::install ( const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>serviceFilePath</i>, const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>account</i> = QString(), const <a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> &amp; <i>password</i> = QString() )&nbsp;&nbsp;<tt> [static]</tt></h3>
  99 +<p>Installs the service with the given <i>serviceFilePath</i> and returns true if the service is installed successfully; otherwise returns false.</p>
  100 +<p>On Windows service is installed in the system's service control manager with the given <i>account</i> and <i>password</i>.</p>
  101 +<p>On Unix service configuration is written to <a href="http://qt.nokia.com/doc/4.6/qsettings.html#Scope-enum">QSettings::SystemScope</a> using &quot;QtSoftware&quot; as organization name. <i>account</i> and <i>password</i> arguments are ignored.</p>
  102 +<p><b>Warning:</b> Due to the different implementations of how services (daemons) are installed on various UNIX-like systems, this method doesn't integrate the service into the system's startup scripts.</p>
  103 +<p>See also <a href="qtservicecontroller.html#uninstall">uninstall</a>() and <a href="qtservicecontroller.html#start">start</a>().</p>
  104 +<h3 class="fn"><a name="isInstalled"></a>bool QtServiceController::isInstalled () const</h3>
  105 +<p>Returns true if the service is installed; otherwise returns false.</p>
  106 +<p>On Windows it uses the system's service control manager.</p>
  107 +<p>On Unix it checks configuration written to <a href="http://qt.nokia.com/doc/4.6/qsettings.html#Scope-enum">QSettings::SystemScope</a> using &quot;QtSoftware&quot; as organization name.</p>
  108 +<p>See also <a href="qtservicecontroller.html#install">install</a>().</p>
  109 +<h3 class="fn"><a name="isRunning"></a>bool QtServiceController::isRunning () const</h3>
  110 +<p>Returns true if the service is running; otherwise returns false. A service must be installed before it can be run using a controller.</p>
  111 +<p>See also <a href="qtservicecontroller.html#start">start</a>() and <a href="qtservicecontroller.html#isInstalled">isInstalled</a>().</p>
  112 +<h3 class="fn"><a name="pause"></a>bool QtServiceController::pause ()</h3>
  113 +<p>Requests the running service to pause. If the service's state is <a href="qtservicebase.html#ServiceFlag-enum">QtServiceBase::CanBeSuspended</a>, the service will call the <a href="qtservicebase.html#pause">QtServiceBase::pause</a>() implementation. The function does nothing if the service is not running.</p>
  114 +<p>Returns true if a running service was successfully paused; otherwise returns false.</p>
  115 +<p>See also <a href="qtservicecontroller.html#resume">resume</a>(), <a href="qtservicebase.html#pause">QtServiceBase::pause</a>(), and <a href="qtservicebase.html#ServiceFlag-enum">QtServiceBase::ServiceFlags</a>.</p>
  116 +<h3 class="fn"><a name="resume"></a>bool QtServiceController::resume ()</h3>
  117 +<p>Requests the running service to continue. If the service's state is <a href="qtservicebase.html#ServiceFlag-enum">QtServiceBase::CanBeSuspended</a>, the service will call the <a href="qtservicebase.html#resume">QtServiceBase::resume</a>() implementation. This function does nothing if the service is not running.</p>
  118 +<p>Returns true if a running service was successfully resumed; otherwise returns false.</p>
  119 +<p>See also <a href="qtservicecontroller.html#pause">pause</a>(), <a href="qtservicebase.html#resume">QtServiceBase::resume</a>(), and <a href="qtservicebase.html#ServiceFlag-enum">QtServiceBase::ServiceFlags</a>.</p>
  120 +<h3 class="fn"><a name="sendCommand"></a>bool QtServiceController::sendCommand ( int <i>code</i> )</h3>
  121 +<p>Sends the user command <i>code</i> to the service. The service will call the <a href="qtservicebase.html#processCommand">QtServiceBase::processCommand</a>() implementation. This function does nothing if the service is not running.</p>
  122 +<p>Returns true if the request was sent to a running service; otherwise returns false.</p>
  123 +<p>See also <a href="qtservicebase.html#processCommand">QtServiceBase::processCommand</a>().</p>
  124 +<h3 class="fn"><a name="serviceDescription"></a><a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> QtServiceController::serviceDescription () const</h3>
  125 +<p>Returns the description of the controlled service.</p>
  126 +<p>See also <a href="qtservicecontroller.html#install">install</a>() and <a href="qtservicecontroller.html#serviceName">serviceName</a>().</p>
  127 +<h3 class="fn"><a name="serviceFilePath"></a><a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> QtServiceController::serviceFilePath () const</h3>
  128 +<p>Returns the file path to the controlled service.</p>
  129 +<p>See also <a href="qtservicecontroller.html#install">install</a>() and <a href="qtservicecontroller.html#serviceName">serviceName</a>().</p>
  130 +<h3 class="fn"><a name="serviceName"></a><a href="http://qt.nokia.com/doc/4.6/qstring.html">QString</a> QtServiceController::serviceName () const</h3>
  131 +<p>Returns the name of the controlled service.</p>
  132 +<p>See also <a href="qtservicecontroller.html#QtServiceController">QtServiceController</a>() and <a href="qtservicecontroller.html#serviceDescription">serviceDescription</a>().</p>
  133 +<h3 class="fn"><a name="start"></a>bool QtServiceController::start ( const <a href="http://qt.nokia.com/doc/4.6/qstringlist.html">QStringList</a> &amp; <i>arguments</i> )</h3>
  134 +<p>Starts the installed service passing the given <i>arguments</i> to the service. A service must be installed before a controller can run it.</p>
  135 +<p>Returns true if the service could be started; otherwise returns false.</p>
  136 +<p>See also <a href="qtservicecontroller.html#install">install</a>() and <a href="qtservicecontroller.html#stop">stop</a>().</p>
  137 +<h3 class="fn"><a name="start-2"></a>bool QtServiceController::start ()</h3>
  138 +<p>This is an overloaded function.</p>
  139 +<p>Starts the installed service without passing any arguments to the service.</p>
  140 +<h3 class="fn"><a name="startupType"></a><a href="qtservicecontroller.html#StartupType-enum">StartupType</a> QtServiceController::startupType () const</h3>
  141 +<p>Returns the startup type of the controlled service.</p>
  142 +<p>See also <a href="qtservicecontroller.html#install">install</a>() and <a href="qtservicecontroller.html#serviceName">serviceName</a>().</p>
  143 +<h3 class="fn"><a name="stop"></a>bool QtServiceController::stop ()</h3>
  144 +<p>Requests the running service to stop. The service will call the <a href="qtservicebase.html#stop">QtServiceBase::stop</a>() implementation unless the service's state is <a href="qtservicebase.html#ServiceFlag-enum">QtServiceBase::CannotBeStopped</a>. This function does nothing if the service is not running.</p>
  145 +<p>Returns true if a running service was successfully stopped; otherwise false.</p>
  146 +<p>See also <a href="qtservicecontroller.html#start">start</a>(), <a href="qtservicebase.html#stop">QtServiceBase::stop</a>(), and <a href="qtservicebase.html#ServiceFlag-enum">QtServiceBase::ServiceFlags</a>.</p>
  147 +<h3 class="fn"><a name="uninstall"></a>bool QtServiceController::uninstall ()</h3>
  148 +<p>Uninstalls the service and returns true if successful; otherwise returns false.</p>
  149 +<p>On Windows service is uninstalled using the system's service control manager.</p>
  150 +<p>On Unix service configuration is cleared using <a href="http://qt.nokia.com/doc/4.6/qsettings.html#Scope-enum">QSettings::SystemScope</a> with &quot;QtSoftware&quot; as organization name.</p>
  151 +<p>See also <a href="qtservicecontroller.html#install">install</a>().</p>
  152 +<p /><address><hr /><div align="center">
  153 +<table width="100%" cellspacing="0" border="0"><tr class="address">
  154 +<td width="30%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
  155 +<td width="40%" align="center"><a href="http://qt.nokia.com/doc/trademarks.html">Trademarks</a></td>
  156 +<td width="30%" align="right"><div align="right">Qt Solutions</div></td>
  157 +</tr></table></div></address></body>
  158 +</html>
... ...
src/qtservice/doc/images/qt-logo.png 0 → 100644

3.98 KB

src/qtservice/doc/index.qdoc 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +/****************************************************************************
  2 +**
  3 +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
  4 +** Contact: http://www.qt-project.org/legal
  5 +**
  6 +** This file is part of the Qt Solutions component.
  7 +**
  8 +** $QT_BEGIN_LICENSE:BSD$
  9 +** You may use this file under the terms of the BSD license as follows:
  10 +**
  11 +** "Redistribution and use in source and binary forms, with or without
  12 +** modification, are permitted provided that the following conditions are
  13 +** met:
  14 +** * Redistributions of source code must retain the above copyright
  15 +** notice, this list of conditions and the following disclaimer.
  16 +** * Redistributions in binary form must reproduce the above copyright
  17 +** notice, this list of conditions and the following disclaimer in
  18 +** the documentation and/or other materials provided with the
  19 +** distribution.
  20 +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
  21 +** of its contributors may be used to endorse or promote products derived
  22 +** from this software without specific prior written permission.
  23 +**
  24 +**
  25 +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26 +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27 +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28 +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29 +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  30 +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31 +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32 +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33 +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34 +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35 +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
  36 +**
  37 +** $QT_END_LICENSE$
  38 +**
  39 +****************************************************************************/
  40 +
  41 +/*!
  42 + \page index.html
  43 + \title Service
  44 +
  45 + \section1 Description
  46 +
  47 + The QtService component is useful for developing Windows
  48 + services and Unix daemons.
  49 +
  50 +
  51 +
  52 + The project provides a QtService template class that can be used to
  53 + implement service applications, and a QtServiceController class
  54 + to control a service.
  55 +
  56 + On Windows systems the implementation uses the Service Control
  57 + Manager.
  58 +
  59 + On Unix systems services are implemented as daemons.
  60 +
  61 +
  62 +
  63 + \section1 Classes
  64 + \list
  65 + \i QtServiceController \i QtServiceBase \i QtService\endlist
  66 +
  67 + \section1 Examples
  68 + \list
  69 + \i \link qtservice-example-interactive.html An Interactive Service \endlink \i \link qtservice-example-server.html A simple HTTP Server \endlink \i \link qtservice-example-controller.html A simple Service Controller \endlink \endlist
  70 +
  71 +
  72 +
  73 +
  74 +
  75 +
  76 + \section1 Tested platforms
  77 + \list
  78 + \i Qt 4.4, 4.5 / Windows XP / MSVC.NET 2005
  79 + \i Qt 4.4, 4.5 / Linux / gcc
  80 + \i Qt 4.4, 4.5 / MacOS X 10.5 / gcc
  81 + \endlist
  82 +
  83 +
  84 +
  85 +
  86 +*/
... ...
src/qtservice/src/QtServiceBase 0 → 100644
... ... @@ -0,0 +1 @@
  1 +#include "qtservice.h"
... ...
src/qtservice/src/QtServiceController 0 → 100644
... ... @@ -0,0 +1 @@
  1 +#include "qtservice.h"
... ...
src/qtservice/src/qtservice.pri 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +include(../common.pri)
  2 +INCLUDEPATH += $$PWD
  3 +DEPENDPATH += $$PWD
  4 +!win32:QT += network
  5 +win32:LIBS += -luser32
  6 +
  7 +qtservice-uselib:!qtservice-buildlib {
  8 + LIBS += -L$$QTSERVICE_LIBDIR -l$$QTSERVICE_LIBNAME
  9 +} else {
  10 + HEADERS += $$PWD/qtservice.h \
  11 + $$PWD/qtservice_p.h
  12 + SOURCES += $$PWD/qtservice.cpp
  13 + win32:SOURCES += $$PWD/qtservice_win.cpp
  14 + unix:HEADERS += $$PWD/qtunixsocket.h $$PWD/qtunixserversocket.h
  15 + unix:SOURCES += $$PWD/qtservice_unix.cpp $$PWD/qtunixsocket.cpp $$PWD/qtunixserversocket.cpp
  16 +}
  17 +
  18 +win32 {
  19 + qtservice-buildlib:shared:DEFINES += QT_QTSERVICE_EXPORT
  20 + else:qtservice-uselib:DEFINES += QT_QTSERVICE_IMPORT
  21 +}
... ...