[PATCH 2 of 3] Add a dialog when installer creation is done

Wald Commits scm-commit at wald.intevation.org
Tue Apr 29 15:37:21 CEST 2014


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1398778197 0
# Node ID f6371e9c959af50868dbb99372b69ab044cf996b
# Parent  3edbe1af2c85d58ea80b25c54415aff4c6e6aecb
Add a dialog when installer creation is done

diff -r 3edbe1af2c85 -r f6371e9c959a ui/createinstallerdialog.cpp
--- 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);
+}
+
diff -r 3edbe1af2c85 -r f6371e9c959a ui/createinstallerdialog.h
--- a/ui/createinstallerdialog.h	Tue Apr 29 13:29:28 2014 +0000
+++ b/ui/createinstallerdialog.h	Tue Apr 29 13:29:57 2014 +0000
@@ -24,7 +24,7 @@
 {
     Q_OBJECT
 public:
-    /** @brief Create a dialog showing settings for the create installer#
+    /** @brief Create a dialog showing settings for the create installer
      * process
      * */
     CreateInstallerDialog(QMainWindow *parent);
@@ -56,4 +56,24 @@
     void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
 };
 
+/** @brief The dialog shown after the installer was created. */
+class FinishedDialog : public QDialog
+{
+    Q_OBJECT
+
+    public:
+        /** @brief constructor for the dialog
+         *
+         * @param [in] parent the parent window
+         * @param [in] msg the message to show
+         * @param [in] details verbose information
+         * @param [in] isErr if the dialog should be shown as an error*/
+        FinishedDialog(QDialog *parent,
+                       QString msg,
+                       QString details,
+                       bool isErr);
+
+};
+
+
 #endif // CREATEINSTALLERDIALOG_H


More information about the Trustbridge-commits mailing list