KVIrc  4.9.2
DeveloperAPIs
KviKvsProcessManager.h
Go to the documentation of this file.
1 #ifndef _KVI_KVS_PROCESSMANAGER_H_
2 #define _KVI_KVS_PROCESSMANAGER_H_
3 //=============================================================================
4 //
5 // File : KviKvsProcessManager.h
6 // Creation date : Wed 07 Apr 2004 03:03:52 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net>
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "kvi_settings.h"
28 #include "KviKvsAsyncOperation.h"
29 #include "KviQString.h"
30 #include "KviWindow.h"
31 #include "KviKvsVariant.h"
32 #include "KviKvsRunTimeContext.h"
33 
34 #include "KviPointerHashTable.h"
35 
36 #ifdef Unsorted
37 #undef Unsorted
38 #endif
39 
40 #include "QProcess"
41 
42 #include <QTimer>
43 
44 #define KVI_KVS_PROCESSDESCRIPTOR_TRIGGERSTDOUT 1
45 #define KVI_KVS_PROCESSDESCRIPTOR_TRIGGERSTDERR 2
46 #define KVI_KVS_PROCESSDESCRIPTOR_TRIGGERTERMINATED 4
47 #define KVI_KVS_PROCESSDESCRIPTOR_OUTPUTBYBLOCKS 8
48 #define KVI_KVS_PROCESSDESCRIPTOR_TRIGGERSTARTED 16
49 #define KVI_KVS_PROCESSDESCRIPTOR_NOSHELL 32
50 #define KVI_KVS_PROCESSDESCRIPTOR_KILLIFNOWINDOW 64
51 
52 class KviWindow;
53 class KviKvsScript;
54 class KviKvsVariant;
55 
57 {
58  QString szShell;
59  QString szCommandline;
63  int iFlags;
64  int iMaxRunTime; // 0 for no timeout
65  int iPingTimeout; // 0 for no ping timeout
67 
68 class KviKvsProcessManager;
69 
71 {
72  friend class KviKvsProcessManager;
73  Q_OBJECT
74 public:
77 
78 protected:
80  {
85  EventPing
86  };
87 
88 private:
89  QProcess * m_pProcess;
94  QTimer * m_pPingTimer;
95  QTimer * m_pRunTimeTimer;
97 
98 public:
99  bool start();
100 private slots:
101  void maxRunTimeExpired();
102  void ping();
103  void readStdout();
104  void readStderr();
105  void processExited(int exitCode);
106  void processStarted();
107  void selfDelete();
108 
109 private:
110  bool trigger(CallbackEvent e, const QString & szData);
111  void triggerSelfDelete();
112 };
113 
114 #endif
Definition: KviKvsProcessManager.h:70
struct _KviKvsProcessDescriptorData KviKvsProcessDescriptorData
KviKvsProcessDescriptorData * m_pData
Definition: KviKvsProcessManager.h:93
This class defines a new data type which contains variant data.
Definition: KviKvsVariant.h:351
#define KVIRC_API
Definition: kvi_settings.h:128
CallbackEvent
Definition: KviKvsProcessManager.h:79
int iFlags
Definition: KviKvsProcessManager.h:63
KviKvsVariant * pMagic
Definition: KviKvsProcessManager.h:61
The KVIrc Script class.
Definition: KviKvsScript.h:59
QTimer * m_pPingTimer
Definition: KviKvsProcessManager.h:94
QString m_szStdoutBuffer
Definition: KviKvsProcessManager.h:91
QProcess * m_pProcess
Definition: KviKvsProcessManager.h:89
bool m_bDeletePending
Definition: KviKvsProcessManager.h:96
int iMaxRunTime
Definition: KviKvsProcessManager.h:64
Definition: KviKvsRunTimeContext.h:43
#define e
Definition: detector.cpp:69
QTimer * m_pRunTimeTimer
Definition: KviKvsProcessManager.h:95
Pointer Hash Table.
Definition: KviKvsAsyncOperation.h:34
char s d
Definition: KviIrcNumericCodes.h:391
QString szShell
Definition: KviKvsProcessManager.h:58
QString m_szStderrBuffer
Definition: KviKvsProcessManager.h:92
KviWindow * pWnd
Definition: KviKvsProcessManager.h:62
Definition: KviKvsProcessManager.h:84
int iPingTimeout
Definition: KviKvsProcessManager.h:65
Definition: KviKvsProcessManager.h:56
QString szCommandline
Definition: KviKvsProcessManager.h:59
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
KviKvsScript * pCallback
Definition: KviKvsProcessManager.h:60
Definition: KviKvsProcessManager.h:83
Contains the KviWindow class.
Definition: KviKvsProcessManager.h:82
Handling of variant data type in KVS.
Definition: KviKvsProcessManager.h:81
This file contains compile time settings.
Helper functions for the QString class.
KviKvsExtendedRunTimeData * m_pExtendedRunTimeData
Definition: KviKvsProcessManager.h:90