annotate ui/installwrapper.h @ 370:8b9ba61add57

Also add the testkey for the release build mode
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 10:49:41 +0200
parents dc4efb0a70cb
children a507e5f1b999
rev   line source
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
1 #ifndef UI_INSTALLWRAPPER_H
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
2 #define UI_INSTALLWRAPPER_H
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
3
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
4 #include <QFileInfo>
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
5 #include <QString>
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
6 #include <QStringList>
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
7 #include <QTemporaryFile>
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 #include <QThread>
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10 #include "certificate.h"
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
11 /** @file installwrapper.h
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
12 * @brief Wrapper around the call to the updated process */
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
13
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
14 /** @brief Get the FileInfo for the installation process.
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
15 *
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
16 * This points to the file where the installation process is
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
17 * supposed to be.
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
18 *
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
19 * @returns A FileInfo with the path of the installation process.*/
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
20 QFileInfo getCinstProcInfo();
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
21
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
22 /** @brief wrapper around installer process
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
23 *
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
24 * This wrapper is mostly needed because QProcess executes
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
25 * a process on Windows directly with CreateProcess and
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
26 * thus can not be used to elevate the Process.
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
27 *
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
28 * On Windows this class uses ShellExecuteExW to control
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
29 * the child process. On Linux systems QProcess is used.
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
30 *
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
31 * It subclasses QThread so the installation can be done
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
32 * asynchronusly. */
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
33 class InstallWrapper : public QThread
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
34 {
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
35 Q_OBJECT
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
36
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
37 public:
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
38 /**
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
39 * @brief Construct an installwrapper for a certificateList
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
40 *
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
41 * The install wrapper will start the cinst process to execute
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
42 * the specified instructions with the provided certificatelist.
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
43 *
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
44 * The cinst executable is expected to be in the same directory
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
45 * as the current application.
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
46 *
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
47 * @param[in] parent the parent object.
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
48 * @param[in] listFileName the absolute path to the certificatelist.
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
49 * @param[in] choices a list of R: / I: <cert> lines to execute.
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
50 */
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
51 InstallWrapper(QObject* parent, const QString& path,
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
52 const QStringList& instructions);
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
53
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
54 private:
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
55 /**@brief write the choices made into a temporary file
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
56 *
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
57 * @param[in] choicesFile the temporary file to write.
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
58 *
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
59 * @returns true on success. false on error.
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
60 */
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
61 bool writeChoices(QTemporaryFile* choicesFile) const;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
62
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
63 const QString mCertListFile;
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
64 const QStringList mChoices;
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
65
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
66 protected:
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
67 void run();
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
68
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
69 Q_SIGNALS:
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
70 /**
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
71 * @brief An error happened
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
72 *
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
73 * @param[out] message: A localized message to show. Can be empty.
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
74 */
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
75 void error(const QString &message);
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
76 };
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
77
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
78 #endif // UI_INSTALLWRAPPER_H

http://wald.intevation.org/projects/trustbridge/