annotate ui/createinstallerdialog.h @ 1321:0dd2a739906f

(Auto) Update translations
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 13 Oct 2014 18:06:13 +0200
parents 2a1aa9df8f11
children
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 361
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 361
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 361
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 361
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 361
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 361
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 361
diff changeset
7 */
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #ifndef CREATEINSTALLERDIALOG_H
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #define CREATEINSTALLERDIALOG_H
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QDialog>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QMainWindow>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 #include <QLineEdit>
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
14 #include <QProcess>
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
15 #include <QProgressDialog>
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
16 #include <QDir>
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 /**
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 * @file createinstallerdialog.h
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
19 * @brief The dialog to select the input and create an installer.
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 */
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 class QListWidget;
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
23 class QTemporaryDir;
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
25 /** @brief The dialog to select the input and create an installer. */
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 class CreateInstallerDialog : public QDialog
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 Q_OBJECT
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 public:
526
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
30 /** @brief Create a dialog showing settings for the create installer
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 * process
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 * */
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 CreateInstallerDialog(QMainWindow *parent);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 private:
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 void setupGUI();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 QLineEdit *mCertFile;
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
39 QLineEdit *mBinaryFolder;
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 QLineEdit *mSaveFile;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
42 QProcess mNSISProc;
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
43 QProgressDialog mProgress;
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
44 QString mInstallerPath;
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
45 QTemporaryDir *mCurrentWorkingDir;
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
46
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
47 /** @brief show an error message with QMessageBox
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
48 *
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
49 * @param [in] msg The message to show
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
50 */
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
51 void showErrorMessage(const QString &msg);
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
52
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 private slots:
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 void openCertificateSelect();
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
55 void openFolderSelect();
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 void openSaveLocation();
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
57
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
58 /**@brief entry point for installer creation
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
59 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
60 * check the selected parameters (certificate / folder etc.) and
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
61 * create the nsis installer. This also creates the signatures. */
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 void createInstaller();
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
63
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
64 /**@brief Create tempoary dir with signed binaries from sourcedir
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
65 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
66 * Copies all files from the sourceDir to a temporary directory
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
67 * and signs all .exe files in that directory.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
68 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
69 * The caller needs to delete the temporary directory. If an error
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
70 * occurs NULL is returned.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
71 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
72 * @param[in] sourceDir the directory with the binaries to sign
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
73 * @returns a pointer to a temporary dir containing the signed binaries
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
74 * or NULL.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
75 */
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
76 QTemporaryDir *codesignBinaries(const QDir& sourceDir);
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
77
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
78 /**@brief Sign a file with the codesigning certificate from mCertFile
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
79 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
80 * Calls osslsigncode to sign the file pointed to in filePath.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
81 * The signing operation is logged.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
82 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
83 * Sign information (hash algo / publisher / url) can be set at
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
84 * build time or in the settings with the variables:
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
85 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
86 * sign_hash # the hash algorithm to use. Values are the same as in singtool
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
87 * sign_publisher # the publisher information
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
88 * sign_url # the product url to use in the signature
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
89 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
90 * @param[in] filePath the absolute path to the file.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
91 * @returns true on success, false on error
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
92 */
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
93 bool signFile(QString filePath);
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
94
868
ae571e7ecdc9 Make appendTextSignature public for better testability
Andre Heinecke <andre.heinecke@intevation.de>
parents: 761
diff changeset
95 /* Slots for the creator process */
ae571e7ecdc9 Make appendTextSignature public for better testability
Andre Heinecke <andre.heinecke@intevation.de>
parents: 761
diff changeset
96 void processError(QProcess::ProcessError error);
ae571e7ecdc9 Make appendTextSignature public for better testability
Andre Heinecke <andre.heinecke@intevation.de>
parents: 761
diff changeset
97 void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
ae571e7ecdc9 Make appendTextSignature public for better testability
Andre Heinecke <andre.heinecke@intevation.de>
parents: 761
diff changeset
98
ae571e7ecdc9 Make appendTextSignature public for better testability
Andre Heinecke <andre.heinecke@intevation.de>
parents: 761
diff changeset
99 public slots:
761
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
100 /**@brief Append a base64 encoded sha256 RSA signature to a file.
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
101 *
1053
78798d3af8f0 Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 868
diff changeset
102 * The format of the added signature line will be:<BR>
78798d3af8f0 Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 868
diff changeset
103 * S:\<signature\>\\r\\n<BR>
761
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
104 * For the signature the key in mCertFile is used.
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
105 *
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
106 * @param[in] input The absolute path of the file to sign
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
107 * @param[out] output The absolute path of the file to write
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
108 *
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
109 * @returns true on success, false on failure
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
110 */
49168bcb02e2 (Issue55) Sign a linux installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 571
diff changeset
111 bool appendTextSignatureToFile(const QString& input, const QString& output);
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 };
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113
526
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
114 /** @brief The dialog shown after the installer was created. */
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
115 class FinishedDialog : public QDialog
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
116 {
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
117 Q_OBJECT
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
118
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
119 public:
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
120 /** @brief constructor for the dialog
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
121 *
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
122 * @param [in] parent the parent window
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
123 * @param [in] msg the message to show
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
124 * @param [in] details verbose information
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
125 * @param [in] isErr if the dialog should be shown as an error*/
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
126 FinishedDialog(QDialog *parent,
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
127 QString msg,
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
128 QString details,
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
129 bool isErr);
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
130
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
131 };
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
132
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
133
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 #endif // CREATEINSTALLERDIALOG_H

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