Mercurial > trustbridge
comparison ui/createinstallerdialog.cpp @ 526:f6371e9c959a
Add a dialog when installer creation is done
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 29 Apr 2014 13:29:57 +0000 |
parents | 31e0a86f5a35 |
children | 522b4e28c073 |
comparison
equal
deleted
inserted
replaced
525:3edbe1af2c85 | 526:f6371e9c959a |
---|---|
5 * and comes with ABSOLUTELY NO WARRANTY! | 5 * and comes with ABSOLUTELY NO WARRANTY! |
6 * See LICENSE.txt for details. | 6 * See LICENSE.txt for details. |
7 */ | 7 */ |
8 #include "createinstallerdialog.h" | 8 #include "createinstallerdialog.h" |
9 #include <QDebug> | 9 #include <QDebug> |
10 #include <QTextEdit> | |
10 #include <QDir> | 11 #include <QDir> |
11 #include <QPushButton> | 12 #include <QPushButton> |
12 #include <QGroupBox> | 13 #include <QGroupBox> |
13 #include <QHBoxLayout> | 14 #include <QHBoxLayout> |
14 #include <QVBoxLayout> | 15 #include <QVBoxLayout> |
15 #include <QLabel> | 16 #include <QLabel> |
16 #include <QFileDialog> | 17 #include <QFileDialog> |
17 #include <QSettings> | 18 #include <QSettings> |
19 #include <QStyle> | |
20 #include <QApplication> | |
18 #include <QMessageBox> | 21 #include <QMessageBox> |
19 | 22 |
20 CreateInstallerDialog::CreateInstallerDialog(QMainWindow *parent) : | 23 CreateInstallerDialog::CreateInstallerDialog(QMainWindow *parent) : |
21 QDialog(parent), | 24 QDialog(parent), |
22 mProgress(this) | 25 mProgress(this) |
157 QMessageBox::warning(this, tr("Error!"), msg); | 160 QMessageBox::warning(this, tr("Error!"), msg); |
158 } | 161 } |
159 | 162 |
160 void CreateInstallerDialog::processFinished(int exitCode, QProcess::ExitStatus exitStatus) | 163 void CreateInstallerDialog::processFinished(int exitCode, QProcess::ExitStatus exitStatus) |
161 { | 164 { |
165 FinishedDialog *fin = new FinishedDialog(0, tr("Created installer in %1.") | |
166 .arg(mBinaryFolder->text()), mNSISProc.readAll(), false); | |
162 qDebug() << "Finished: " << mNSISProc.readAll(); | 167 qDebug() << "Finished: " << mNSISProc.readAll(); |
163 mProgress.cancel(); | 168 mProgress.cancel(); |
169 fin->show(); | |
170 close(); | |
164 } | 171 } |
165 | 172 |
166 void CreateInstallerDialog::processError(QProcess::ProcessError error) | 173 void CreateInstallerDialog::processError(QProcess::ProcessError error) |
167 { | 174 { |
168 qDebug() << "Error: " << mNSISProc.readAll(); | 175 qDebug() << "Error: " << mNSISProc.readAll(); |
216 mNSISProc.state() == QProcess::NotRunning) { | 223 mNSISProc.state() == QProcess::NotRunning) { |
217 showErrorMessage(tr("Failed to start makensis.\n" | 224 showErrorMessage(tr("Failed to start makensis.\n" |
218 "Please ensure that makensis is installed and in your PATH variable.")); | 225 "Please ensure that makensis is installed and in your PATH variable.")); |
219 } | 226 } |
220 } | 227 } |
228 | |
229 FinishedDialog::FinishedDialog(QDialog *parent, | |
230 QString msg, QString details, bool isErr): | |
231 QDialog(parent) | |
232 { | |
233 QVBoxLayout *topLayout = new QVBoxLayout; | |
234 QHBoxLayout *buttonLayout = new QHBoxLayout; | |
235 QLabel *msgLabel = new QLabel; | |
236 QTextEdit *detailsWindow = new QTextEdit; | |
237 | |
238 detailsWindow->insertPlainText(details); | |
239 detailsWindow->setReadOnly(true); | |
240 detailsWindow->hide(); | |
241 | |
242 if (!isErr) { | |
243 setWindowTitle(tr("Success!")); | |
244 msgLabel->setPixmap(QApplication::style()->standardIcon( | |
245 QStyle::SP_MessageBoxInformation).pixmap(16, 16)); | |
246 } else { | |
247 setWindowTitle(tr("Error!")); | |
248 msgLabel->setPixmap(QApplication::style()->standardIcon( | |
249 QStyle::SP_MessageBoxCritical).pixmap(16, 16)); | |
250 } | |
251 msgLabel->setText(msg); | |
252 | |
253 topLayout->addWidget(msgLabel); | |
254 topLayout->addWidget(detailsWindow); | |
255 QPushButton *detailsBtn = new QPushButton(tr("Details")); | |
256 connect(detailsBtn, SIGNAL(clicked()), detailsWindow, SLOT(show())); | |
257 buttonLayout->addWidget(detailsBtn); | |
258 | |
259 QPushButton *okBtn = new QPushButton(tr("OK")); | |
260 okBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); | |
261 connect(okBtn, SIGNAL(clicked()), this, SLOT(close())); | |
262 buttonLayout->insertStretch(0, 100); | |
263 buttonLayout->addWidget(okBtn); | |
264 | |
265 topLayout->addLayout(buttonLayout); | |
266 setLayout(topLayout); | |
267 } | |
268 |