• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • server
processcontrol.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2006 by Tobias Koenig <tokoe@kde.org> *
3  * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU Library General Public License as *
7  * published by the Free Software Foundation; either version 2 of the *
8  * License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU Library General Public *
16  * License along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef _PROCESSCONTROL_H
22 #define _PROCESSCONTROL_H
23 
24 #include <QtCore/QObject>
25 #include <QtCore/QProcess>
26 
27 
32 class ProcessControl : public QObject
33 {
34  Q_OBJECT
35 
36 public:
44  enum CrashPolicy
45  {
46  StopOnCrash,
47  RestartOnCrash
48  };
49 
55  ProcessControl( QObject *parent = 0 );
56 
60  ~ProcessControl();
61 
65  void start( const QString &application, const QStringList &arguments = QStringList(),
66  CrashPolicy policy = RestartOnCrash, int maxCrashes = 5 );
67 
74  void terminate( bool waitAndKill = false );
75 
79  void setCrashPolicy( CrashPolicy policy );
80 
81  bool isRunning() const;
82 
83  bool waitForStarted();
84 
85 Q_SIGNALS:
92  void processErrorMessages( const QString &errorMsg );
93 
94  void finished( bool clean );
95 
96 private Q_SLOTS:
97  void slotError( QProcess::ProcessError );
98  void slotFinished( int, QProcess::ExitStatus );
99 
100 private:
101  void start();
102 
103  QString commandLine() const;
104 
105  QProcess mProcess;
106  QString mApplication;
107  QStringList mArguments;
108  CrashPolicy mPolicy;
109  bool mFailedToStart;
110  int mCrashCount;
111 };
112 
113 #endif
ProcessControl::StopOnCrash
Definition: processcontrol.h:46
ProcessControl::terminate
void terminate(bool waitAndKill=false)
Sends the term signal to the process.
Definition: processcontrol.cpp:126
ProcessControl::ProcessControl
ProcessControl(QObject *parent=0)
Creates a new process control.
Definition: processcontrol.cpp:29
ProcessControl::isRunning
bool isRunning() const
Definition: processcontrol.cpp:116
QObject
ProcessControl::RestartOnCrash
Definition: processcontrol.h:47
ProcessControl::setCrashPolicy
void setCrashPolicy(CrashPolicy policy)
Sets the crash policy.
Definition: processcontrol.cpp:57
ProcessControl::~ProcessControl
~ProcessControl()
Destroys the process control.
Definition: processcontrol.cpp:39
ProcessControl::finished
void finished(bool clean)
ProcessControl
This class starts and observes a process.
Definition: processcontrol.h:32
ProcessControl::CrashPolicy
CrashPolicy
Theses enums describe the behaviour when the observed application crashed.
Definition: processcontrol.h:44
ProcessControl::waitForStarted
bool waitForStarted()
Definition: processcontrol.cpp:143
ProcessControl::processErrorMessages
void processErrorMessages(const QString &errorMsg)
This signal is emitted whenever the observed application writes something to stderr.
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal