Mercurial > trustbridge
comparison ui/installwrapper.h @ 256:84ae353688e0
Add installwrapper class to handle process communication
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 01 Apr 2014 10:52:06 +0000 |
parents | |
children | f23e0ccd5d14 |
comparison
equal
deleted
inserted
replaced
255:c82dab1824be | 256:84ae353688e0 |
---|---|
1 #ifndef UI_INSTALLWRAPPER_H | |
2 #define UI_INSTALLWRAPPER_H | |
3 | |
4 #include <QString> | |
5 #include <QStringList> | |
6 #include <QProcess> | |
7 #include <QThread> | |
8 | |
9 #include "certificate.h" | |
10 /** @file installwrapper.h | |
11 * @brief Wrapper around the call to the updated process */ | |
12 | |
13 /** @brief wrapper around installer process | |
14 * | |
15 * This wrapper is mostly needed because QProcess executes | |
16 * a process on Windows directly with CreateProcess and | |
17 * thus can not be used to elevate the Process. | |
18 * | |
19 * On Windows this class uses ShellExecuteExW to control | |
20 * the child process. On Linux systems QProcess is used. | |
21 * | |
22 * It subclasses QThread so the installation can be done | |
23 * asynchronusly. */ | |
24 class InstallWrapper : public QThread | |
25 { | |
26 Q_OBJECT | |
27 | |
28 public: | |
29 /** | |
30 * @brief Construct an installwrapper for a certificateList | |
31 * | |
32 * The install wrapper will start the cinst process to execute | |
33 * the specified instructions with the provided certificatelist. | |
34 * | |
35 * The cinst executable is expected to be in the same directory | |
36 * as the current application. | |
37 * | |
38 * @param[in] parent the parent object. | |
39 * @param[in] listFileName the absolute path to the certificatelist. | |
40 * @param[in] instructions a list of instructions to execute. | |
41 */ | |
42 InstallWrapper(QObject* parent, const QString& path, | |
43 const QStringList& instructions); | |
44 | |
45 private: | |
46 const QString mCertListFile; | |
47 const QStringList mInstructions; | |
48 #ifdef WIN32 | |
49 SHELLEXECUTEINFOW mExecInfo; | |
50 #else | |
51 QProcess cinstProc; | |
52 #endif | |
53 | |
54 protected: | |
55 void run(); | |
56 | |
57 Q_SIGNALS: | |
58 /** | |
59 * @brief An error happened | |
60 * | |
61 * @param[out] message: A localized message to show. Can be empty. | |
62 */ | |
63 void error(const QString &message); | |
64 }; | |
65 | |
66 #endif // UI_INSTALLWRAPPER_H |