Mercurial > trustbridge
changeset 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 | 3edbe1af2c85 |
children | bedeb38c244a |
files | ui/createinstallerdialog.cpp ui/createinstallerdialog.h |
diffstat | 2 files changed, 69 insertions(+), 1 deletions(-) [+] |
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); +} +
--- 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