Mercurial > trustbridge
annotate ui/createinstallerdialog.cpp @ 518:31e0a86f5a35
Actually set the arguments for makensis process. Fix escaping
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 29 Apr 2014 09:25:51 +0000 |
parents | 3332db04c77d |
children | f6371e9c959a |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 #include "createinstallerdialog.h" |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 #include <QDebug> |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 #include <QDir> |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 #include <QPushButton> |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 #include <QGroupBox> |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 #include <QHBoxLayout> |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 #include <QVBoxLayout> |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 #include <QLabel> |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 #include <QFileDialog> |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
17 #include <QSettings> |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
18 #include <QMessageBox> |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 CreateInstallerDialog::CreateInstallerDialog(QMainWindow *parent) : |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
21 QDialog(parent), |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
22 mProgress(this) |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 { |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
24 QSettings settings; |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
25 setWindowTitle(tr("Create binary installer")); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 setupGUI(); |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
27 resize(500, 250); |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
28 mCertFile->setText(settings.value("CodeSignCert", QString()).toString()); |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
29 mBinaryFolder->setText(settings.value("LastBinaryFolder", QString()).toString()); |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
30 mSaveFile->setText(settings.value("LastBinOutputFolder", QString()).toString()); |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
31 |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
32 connect(&mNSISProc, SIGNAL(finished(int, QProcess::ExitStatus)), |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
33 this, SLOT(processFinished(int, QProcess::ExitStatus))); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
34 connect(&mNSISProc, SIGNAL(error(QProcess::ProcessError)), |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
35 this, SLOT(processError(QProcess::ProcessError))); |
361
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 |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 void CreateInstallerDialog::setupGUI() |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 { |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 /* Top level layout / widgets */ |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 QVBoxLayout *topLayout = new QVBoxLayout; |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
42 QVBoxLayout *headerLayout = new QVBoxLayout; |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
43 QHBoxLayout *headerSubLayout = new QHBoxLayout; |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
44 QHBoxLayout *centerLayout = new QHBoxLayout; |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 QHBoxLayout *bottomLayout = new QHBoxLayout; |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
46 QVBoxLayout *labelLayout = new QVBoxLayout; |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
47 QVBoxLayout *fieldLayout = new QVBoxLayout; |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
48 QVBoxLayout *buttonLayout = new QVBoxLayout; |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
50 QLabel *header = new QLabel("<h3>" + tr("Create binary installer") + "</h3>"); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
51 QLabel *description = new QLabel( |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
52 tr("Create and sign a TrustBridge binary installer.")); |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
53 headerSubLayout->insertSpacing(0, 40); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
54 headerSubLayout->addWidget(description); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
55 QFrame *headerSeparator = new QFrame(); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
56 headerSeparator->setFrameShape(QFrame::HLine); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
57 headerSeparator->setFrameShadow(QFrame::Sunken); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
58 headerLayout->addWidget(header); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
59 headerLayout->addLayout(headerSubLayout); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
60 headerLayout->addWidget(headerSeparator); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
61 headerLayout->insertSpacing(4, 10); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
63 QLabel *archiveLabel = new QLabel(tr("Select binary folder:")); |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
64 QLabel *certLabel = new QLabel(tr("Select code signing certificate:")); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
65 QLabel *saveLabel = new QLabel(tr("Select output folder:")); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
66 labelLayout->addWidget(archiveLabel); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
67 labelLayout->addWidget(certLabel); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
68 labelLayout->addWidget(saveLabel); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
69 |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
70 mBinaryFolder = new QLineEdit(); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
71 mCertFile = new QLineEdit(); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
72 mSaveFile = new QLineEdit(); |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
73 fieldLayout->addWidget(mBinaryFolder); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
74 fieldLayout->addWidget(mCertFile); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
75 fieldLayout->addWidget(mSaveFile); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
76 |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 QPushButton *archiveSelect = new QPushButton("..."); |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
78 connect(archiveSelect, SIGNAL(clicked()), this, SLOT(openFolderSelect())); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 archiveSelect->setFixedWidth(30); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 QPushButton *certSelect = new QPushButton("..."); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect())); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 certSelect->setFixedWidth(30); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
83 QPushButton *saveSelect = new QPushButton("..."); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation())); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 saveSelect->setFixedWidth(30); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
86 buttonLayout->addWidget(archiveSelect); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
87 buttonLayout->addWidget(certSelect); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
88 buttonLayout->addWidget(saveSelect); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
90 centerLayout->addLayout(labelLayout); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
91 centerLayout->addLayout(fieldLayout); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
92 centerLayout->addLayout(buttonLayout); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
93 |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
94 QPushButton *create = new QPushButton(tr("Create installer")); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 connect(create, SIGNAL(clicked()), this, SLOT(createInstaller())); |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
96 QPushButton *cancel = new QPushButton(tr("Cancel")); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
97 connect(cancel, SIGNAL(clicked()), this, SLOT(close())); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
98 bottomLayout->insertStretch(0, 10); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
99 bottomLayout->addWidget(create); |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
100 bottomLayout->addWidget(cancel); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
101 |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
102 QFrame *bottomSeparator = new QFrame(); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
103 bottomSeparator->setFrameShape(QFrame::HLine); |
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
104 bottomSeparator->setFrameShadow(QFrame::Sunken); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
105 |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
106 topLayout->addLayout(headerLayout); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
107 topLayout->addLayout(centerLayout); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
108 topLayout->insertStretch(2, 10); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
109 centerLayout->insertSpacing(3, 10); |
414
3d803d383b41
Wording and layout in TrustBridge administration create binary dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
110 topLayout->addWidget(bottomSeparator); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
111 topLayout->addLayout(bottomLayout); |
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 setLayout(topLayout); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
114 |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
115 mProgress.setWindowModality(Qt::WindowModal); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
116 mProgress.setLabelText(tr("Creating installer package...")); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
117 mProgress.setCancelButton(0); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
118 mProgress.setRange(0,0); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
119 mProgress.setMinimumDuration(0); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
120 |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
121 return; |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 } |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
123 |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
124 void CreateInstallerDialog::openCertificateSelect() |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
125 { |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
126 QSettings settings; |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
127 QString certFile = QFileDialog::getOpenFileName( |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
128 this, tr("Select certificate"), |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
129 mCertFile->text().isEmpty() ? QDir::homePath() : mCertFile->text(), |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
130 "*.pem *.der *.crt"); |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
131 settings.setValue("CodeSignCert", certFile); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
132 mCertFile->setText(certFile); |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
133 } |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
134 |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
135 void CreateInstallerDialog::openFolderSelect() |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 { |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
137 QSettings settings; |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
138 QString archiveFolder = QFileDialog::getExistingDirectory( |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
139 this, tr("Select binary folder"), |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
140 mBinaryFolder->text().isEmpty() ? QDir::homePath() : mBinaryFolder->text()); |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
141 mBinaryFolder->setText(archiveFolder); |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
142 settings.setValue("LastBinaryFolder", archiveFolder); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
143 } |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
144 |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
145 void CreateInstallerDialog::openSaveLocation() |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
146 { |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
147 QSettings settings; |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
148 QString saveFile = QFileDialog::getExistingDirectory( |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
149 this, tr("Select target location"), |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
150 mSaveFile->text().isEmpty() ? QDir::homePath() : mSaveFile->text()); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
151 mSaveFile->setText(saveFile); |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
152 settings.setValue("LastBinOutputFolder", saveFile); |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
153 } |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
154 |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
155 void CreateInstallerDialog::showErrorMessage(const QString &msg) |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
156 { |
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
157 QMessageBox::warning(this, tr("Error!"), msg); |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
158 } |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
159 |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
160 void CreateInstallerDialog::processFinished(int exitCode, QProcess::ExitStatus exitStatus) |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
161 { |
518
31e0a86f5a35
Actually set the arguments for makensis process. Fix escaping
Andre Heinecke <aheinecke@intevation.de>
parents:
516
diff
changeset
|
162 qDebug() << "Finished: " << mNSISProc.readAll(); |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
163 mProgress.cancel(); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
164 } |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
165 |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
166 void CreateInstallerDialog::processError(QProcess::ProcessError error) |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
167 { |
518
31e0a86f5a35
Actually set the arguments for makensis process. Fix escaping
Andre Heinecke <aheinecke@intevation.de>
parents:
516
diff
changeset
|
168 qDebug() << "Error: " << mNSISProc.readAll(); |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
169 mProgress.cancel(); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
170 } |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
171 |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
172 void CreateInstallerDialog::createInstaller() |
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
173 { |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
174 QDir binDir(mBinaryFolder->text()); |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
175 QDir outDir(mSaveFile->text()); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
176 if (mBinaryFolder->text().isEmpty() || !binDir.exists()) { |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
177 showErrorMessage(tr("Please select an existing input folder.")); |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
178 return; |
515
9d3880db6ba7
Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
179 } |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
180 if (mCertFile->text().isEmpty()) { |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
181 showErrorMessage(tr("Please select a codesigning certificate.")); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
182 return; |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
183 } |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
184 if (mSaveFile->text().isEmpty() || !outDir.exists()) { |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
185 showErrorMessage(tr("Please select a output folder.")); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
186 return; |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
187 } |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
188 QSettings options(binDir.filePath("meta.ini"), QSettings::IniFormat); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
189 options.sync(); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
190 QStringList keys = options.allKeys(); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
191 if (options.status() != QSettings::NoError || keys.size() < 1) { |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
192 showErrorMessage(tr("Folder %1 does not appear to contain a meta.ini") |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
193 .arg(binDir.path())); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
194 return; |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
195 } |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
196 |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
197 /* Copy windows directory contents to tmpdir */ |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
198 QStringList arguments; |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
199 mNSISProc.setProgram("makensis"); |
518
31e0a86f5a35
Actually set the arguments for makensis process. Fix escaping
Andre Heinecke <aheinecke@intevation.de>
parents:
516
diff
changeset
|
200 mNSISProc.setProcessChannelMode(QProcess::MergedChannels); |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
201 mNSISProc.setWorkingDirectory(outDir.path()); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
202 arguments << QString::fromLatin1("-Dfiles_dir=") + binDir.path() + "/windows"; |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
203 foreach (const QString &key, keys) { |
518
31e0a86f5a35
Actually set the arguments for makensis process. Fix escaping
Andre Heinecke <aheinecke@intevation.de>
parents:
516
diff
changeset
|
204 arguments << QString::fromLatin1("-D%1=%2").arg(key, |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
205 options.value(key, QString()).toString()); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
206 } |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
207 |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
208 arguments << binDir.path() + "/trustbridge.nsi"; |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
209 |
518
31e0a86f5a35
Actually set the arguments for makensis process. Fix escaping
Andre Heinecke <aheinecke@intevation.de>
parents:
516
diff
changeset
|
210 qDebug() << "Starting makensis with arguments: " << arguments; |
31e0a86f5a35
Actually set the arguments for makensis process. Fix escaping
Andre Heinecke <aheinecke@intevation.de>
parents:
516
diff
changeset
|
211 mNSISProc.setArguments(arguments); |
516
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
212 mNSISProc.start(); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
213 mProgress.show(); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
214 |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
215 if (!mNSISProc.waitForStarted() || |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
216 mNSISProc.state() == QProcess::NotRunning) { |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
217 showErrorMessage(tr("Failed to start makensis.\n" |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
218 "Please ensure that makensis is installed and in your PATH variable.")); |
3332db04c77d
Call makensis in create installer dialog
Andre Heinecke <aheinecke@intevation.de>
parents:
515
diff
changeset
|
219 } |
361
b67dd46cd4a9
Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
220 } |