diff 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
line wrap: on
line diff
--- a/ui/createinstallerdialog.cpp	Tue Apr 29 13:29:28 2014 +0000
+++ b/ui/createinstallerdialog.cpp	Tue Apr 29 13:29:57 2014 +0000
@@ -7,6 +7,7 @@
  */
 #include "createinstallerdialog.h"
 #include <QDebug>
+#include <QTextEdit>
 #include <QDir>
 #include <QPushButton>
 #include <QGroupBox>
@@ -15,6 +16,8 @@
 #include <QLabel>
 #include <QFileDialog>
 #include <QSettings>
+#include <QStyle>
+#include <QApplication>
 #include <QMessageBox>
 
 CreateInstallerDialog::CreateInstallerDialog(QMainWindow *parent) :
@@ -159,8 +162,12 @@
 
 void CreateInstallerDialog::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
 {
+    FinishedDialog *fin = new FinishedDialog(0, tr("Created installer in %1.")
+            .arg(mBinaryFolder->text()), mNSISProc.readAll(), false);
     qDebug() << "Finished: " << mNSISProc.readAll();
     mProgress.cancel();
+    fin->show();
+    close();
 }
 
 void CreateInstallerDialog::processError(QProcess::ProcessError error)
@@ -218,3 +225,44 @@
             "Please ensure that makensis is installed and in your PATH variable."));
     }
 }
+
+FinishedDialog::FinishedDialog(QDialog *parent,
+        QString msg, QString details, bool isErr):
+    QDialog(parent)
+{
+    QVBoxLayout *topLayout = new QVBoxLayout;
+    QHBoxLayout *buttonLayout = new QHBoxLayout;
+    QLabel *msgLabel = new QLabel;
+    QTextEdit *detailsWindow = new QTextEdit;
+
+    detailsWindow->insertPlainText(details);
+    detailsWindow->setReadOnly(true);
+    detailsWindow->hide();
+
+    if (!isErr) {
+        setWindowTitle(tr("Success!"));
+        msgLabel->setPixmap(QApplication::style()->standardIcon(
+                    QStyle::SP_MessageBoxInformation).pixmap(16, 16));
+    } else {
+        setWindowTitle(tr("Error!"));
+        msgLabel->setPixmap(QApplication::style()->standardIcon(
+                    QStyle::SP_MessageBoxCritical).pixmap(16, 16));
+    }
+    msgLabel->setText(msg);
+
+    topLayout->addWidget(msgLabel);
+    topLayout->addWidget(detailsWindow);
+    QPushButton *detailsBtn = new QPushButton(tr("Details"));
+    connect(detailsBtn, SIGNAL(clicked()), detailsWindow, SLOT(show()));
+    buttonLayout->addWidget(detailsBtn);
+
+    QPushButton *okBtn = new QPushButton(tr("OK"));
+    okBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton));
+    connect(okBtn, SIGNAL(clicked()), this, SLOT(close()));
+    buttonLayout->insertStretch(0, 100);
+    buttonLayout->addWidget(okBtn);
+
+    topLayout->addLayout(buttonLayout);
+    setLayout(topLayout);
+}
+

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