-rw-r--r-- | core/launcher/applauncher.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/core/launcher/applauncher.h b/core/launcher/applauncher.h new file mode 100644 index 0000000..6a1e416 --- a/dev/null +++ b/core/launcher/applauncher.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #ifndef APP_LAUNCHER_H | ||
22 | #define APP_LAUNCHER_H | ||
23 | |||
24 | #include <qtopia/qpeglobal.h> | ||
25 | #include <qobject.h> | ||
26 | #include <qmap.h> | ||
27 | #ifdef Q_OS_WIN32 | ||
28 | #include <qtopia/qprocess.h> | ||
29 | #include <qlist.h> | ||
30 | #endif | ||
31 | |||
32 | class QMessageBox; | ||
33 | |||
34 | class AppLauncher : public QObject | ||
35 | { | ||
36 | Q_OBJECT | ||
37 | public: | ||
38 | AppLauncher(QObject *parent = 0, const char *name = 0); | ||
39 | ~AppLauncher(); | ||
40 | |||
41 | bool isRunning(const QString &app); | ||
42 | |||
43 | static const int RAISE_TIMEOUT_MS; | ||
44 | |||
45 | signals: | ||
46 | void launched(int pid, const QString &app); | ||
47 | void terminated(int pid, const QString &app); | ||
48 | void connected(const QString &app); | ||
49 | |||
50 | protected slots: | ||
51 | void sigStopped(int sigPid, int sigStatus); | ||
52 | void received(const QCString& msg, const QByteArray& data); | ||
53 | void newQcopChannel(const QString& channel); | ||
54 | void removedQcopChannel(const QString& channel); | ||
55 | void createQuickLauncher(); | ||
56 | void processExited(); | ||
57 | |||
58 | protected: | ||
59 | bool event(QEvent *); | ||
60 | void timerEvent( QTimerEvent * ); | ||
61 | |||
62 | private: | ||
63 | static void signalHandler(int sig); | ||
64 | bool executeBuiltin(const QString &c, const QString &document); | ||
65 | bool execute(const QString &c, const QString &document, bool noRaise = FALSE); | ||
66 | void kill( int pid ); | ||
67 | int pidForName( const QString & ); | ||
68 | |||
69 | private: | ||
70 | QMap<int,QString> runningApps; | ||
71 | QMap<QString,int> waitingHeartbeat; | ||
72 | #ifdef Q_OS_WIN32 | ||
73 | QList<QProcess> runningAppsProc; | ||
74 | #endif | ||
75 | int qlPid; | ||
76 | bool qlReady; | ||
77 | QMessageBox *appKillerBox; | ||
78 | QString appKillerName; | ||
79 | }; | ||
80 | |||
81 | #endif | ||
82 | |||