annotate ui/createinstallerdialog.h @ 580:cf7e82e91875

Do not fail when creating the link fails. Just warn.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 27 May 2014 10:29:05 +0000
parents 6c4fff146999
children 49168bcb02e2
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
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * @brief The dialog to show settings and create an installer.
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
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 class CreateInstallerDialog : public QDialog
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 Q_OBJECT
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 public:
526
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
29 /** @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
30 * process
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 * */
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 CreateInstallerDialog(QMainWindow *parent);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 private:
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 void setupGUI();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 QLineEdit *mCertFile;
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
38 QLineEdit *mBinaryFolder;
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 QLineEdit *mSaveFile;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
41 QProcess mNSISProc;
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
42 QProgressDialog mProgress;
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
43 QString mInstallerPath;
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
44 QTemporaryDir *mCurrentWorkingDir;
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
45
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
46 /** @brief show an error message with QMessageBox
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
47 *
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
48 * @param [in] msg The message to show
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
49 */
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
50 void showErrorMessage(const QString &msg);
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
51
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 private slots:
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 void openCertificateSelect();
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
54 void openFolderSelect();
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 void openSaveLocation();
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
56
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
57 /**@brief entry point for installer creation
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
58 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
59 * check the selected parameters (certificate / folder etc.) and
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
60 * 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
61 void createInstaller();
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
62
571
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
63 /**@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
64 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
65 * 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
66 * and signs all .exe files in that directory.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
67 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
68 * 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
69 * occurs NULL is returned.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
70 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
71 * @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
72 * @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
73 * or NULL.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
74 */
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
75 QTemporaryDir *codesignBinaries(const QDir& sourceDir);
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
76
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
77 /**@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
78 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
79 * 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
80 * The signing operation is logged.
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
81 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
82 * 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
83 * 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
84 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
85 * 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
86 * sign_publisher # the publisher information
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
87 * 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
88 *
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
89 * @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
90 * @returns true on success, false on error
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
91 */
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
92 bool signFile(QString filePath);
6c4fff146999 Implement codesigning in the administrator tool
Andre Heinecke <aheinecke@intevation.de>
parents: 526
diff changeset
93
516
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
94 /* Slots for the creator process */
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
95 void processError(QProcess::ProcessError error);
3332db04c77d Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
96 void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 };
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98
526
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
99 /** @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
100 class FinishedDialog : public QDialog
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
101 {
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
102 Q_OBJECT
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
103
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
104 public:
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
105 /** @brief constructor for the dialog
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
106 *
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
107 * @param [in] parent the parent window
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
108 * @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
109 * @param [in] details verbose information
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
110 * @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
111 FinishedDialog(QDialog *parent,
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
112 QString msg,
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
113 QString details,
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
114 bool isErr);
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
115
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
f6371e9c959a Add a dialog when installer creation is done
Andre Heinecke <aheinecke@intevation.de>
parents: 516
diff changeset
118
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 #endif // CREATEINSTALLERDIALOG_H

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