# HG changeset patch # User Raimund Renkert # Date 1397315978 -7200 # Node ID b67dd46cd4a951aa55339acc1469a4bae373dffc # Parent c0eac5c8c24545f510125afa26b8881123345dc9 Added dialog to create a new, signed installer binary. diff -r c0eac5c8c245 -r b67dd46cd4a9 ui/createinstallerdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/createinstallerdialog.cpp Sat Apr 12 17:19:38 2014 +0200 @@ -0,0 +1,111 @@ +#include "createinstallerdialog.h" +#include +#include +#include +#include +#include +#include +#include +#include + +CreateInstallerDialog::CreateInstallerDialog(QMainWindow *parent) : + QDialog(parent) +{ + setWindowTitle(tr("adminstrator - Create signed installer binary")); + setupGUI(); +} + +void CreateInstallerDialog::setupGUI() +{ + /* Top level layout / widgets */ + QVBoxLayout *topLayout = new QVBoxLayout; + QHBoxLayout *headerLayout = new QHBoxLayout; + QVBoxLayout *centerLayout = new QVBoxLayout; + QHBoxLayout *bottomLayout = new QHBoxLayout; + QHBoxLayout *archiveLayout = new QHBoxLayout; + QHBoxLayout *certLayout = new QHBoxLayout; + QHBoxLayout *saveLayout = new QHBoxLayout; + + QString descString = tr("Create a new signed installer binary.\n"); + descString.append("Select the archive, certificate and destination directory."); + QLabel *description = new QLabel(descString); + headerLayout->addWidget(description); + + QLabel *archiveLabel = new QLabel("Select source archive:"); + archiveLabel->setFixedWidth(140); + mArchiveFile = new QLineEdit(); + QPushButton *archiveSelect = new QPushButton("..."); + connect(archiveSelect, SIGNAL(clicked()), this, SLOT(openArchiveSelect())); + archiveSelect->setFixedWidth(30); + archiveLayout->addWidget(archiveLabel); + archiveLayout->addWidget(mArchiveFile); + archiveLayout->addWidget(archiveSelect); + + QLabel *certLabel = new QLabel("Select certificate:"); + certLabel->setFixedWidth(140); + mCertFile = new QLineEdit(); + QPushButton *certSelect = new QPushButton("..."); + connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect())); + certSelect->setFixedWidth(30); + certLayout->addWidget(certLabel); + certLayout->addWidget(mCertFile); + certLayout->addWidget(certSelect); + + QLabel *saveLabel = new QLabel("Select target location:"); + saveLabel->setFixedWidth(140); + mSaveFile = new QLineEdit(); + QPushButton *saveSelect = new QPushButton("..."); + connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation())); + saveSelect->setFixedWidth(30); + saveLayout->addWidget(saveLabel); + saveLayout->addWidget(mSaveFile); + saveLayout->addWidget(saveSelect); + + centerLayout->addLayout(archiveLayout); + centerLayout->addLayout(certLayout); + centerLayout->addLayout(saveLayout); + + QPushButton *create = new QPushButton(tr("Create Installer")); + connect(create, SIGNAL(clicked()), this, SLOT(createInstaller())); + bottomLayout->insertStretch(0, 10); + bottomLayout->addWidget(create); + + topLayout->addLayout(headerLayout); + topLayout->addLayout(centerLayout); + topLayout->insertStretch(2, 10); + topLayout->addLayout(bottomLayout); + + setLayout(topLayout); + + return; +} + +void CreateInstallerDialog::openCertificateSelect() +{ + QString certFile = QFileDialog::getOpenFileName( + this, tr("Select certificate"), QDir::homePath(), "*.pem *.der *.crt"); + mCertFile->setText(certFile); +} + +void CreateInstallerDialog::openArchiveSelect() +{ + QString archiveFile = QFileDialog::getOpenFileName( + this, tr("Select source archive"), QDir::homePath(), "*.zip *.tar.gz"); + mArchiveFile->setText(archiveFile); +} + +void CreateInstallerDialog::openSaveLocation() +{ + QString saveFile = QFileDialog::getExistingDirectory( + this, tr("Select target location"), QDir::homePath()); + mSaveFile->setText(saveFile); +} + +void CreateInstallerDialog::createInstaller() +{ + qDebug() << "and now create the installer using:"; + qDebug() << "source archive: " << mArchiveFile->text(); + qDebug() << "certificate: " << mCertFile->text(); + qDebug() << "target" << mSaveFile->text(); + // TODO +} diff -r c0eac5c8c245 -r b67dd46cd4a9 ui/createinstallerdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/createinstallerdialog.h Sat Apr 12 17:19:38 2014 +0200 @@ -0,0 +1,37 @@ +#ifndef CREATEINSTALLERDIALOG_H +#define CREATEINSTALLERDIALOG_H + +#include +#include +#include +/** + * @file createinstallerdialog.h + * @brief The dialog to show settings and create an installer. + */ + +class QListWidget; + +class CreateInstallerDialog : public QDialog +{ + Q_OBJECT +public: + /** @brief Create a dialog showing settings for the create installer# + * process + * */ + CreateInstallerDialog(QMainWindow *parent); + +private: + void setupGUI(); + + QLineEdit *mCertFile; + QLineEdit *mArchiveFile; + QLineEdit *mSaveFile; + +private slots: + void openCertificateSelect(); + void openArchiveSelect(); + void openSaveLocation(); + void createInstaller(); +}; + +#endif // CREATEINSTALLERDIALOG_H