annotate ui/createinstallerdialog.cpp @ 375:9e38a4bcd44e

Move certificateitem role into the certificateitemdelagate where it belongs.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 12:06:03 +0200
parents b67dd46cd4a9
children 17e1c8f37d72
rev   line source
361
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 #include "createinstallerdialog.h"
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2 #include <QDebug>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 #include <QDir>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 #include <QPushButton>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 #include <QGroupBox>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 #include <QHBoxLayout>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 #include <QVBoxLayout>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include <QLabel>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #include <QFileDialog>
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 CreateInstallerDialog::CreateInstallerDialog(QMainWindow *parent) :
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 QDialog(parent)
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 setWindowTitle(tr("adminstrator - Create signed installer binary"));
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 setupGUI();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 }
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 void CreateInstallerDialog::setupGUI()
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 /* Top level layout / widgets */
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 QVBoxLayout *topLayout = new QVBoxLayout;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 QHBoxLayout *headerLayout = new QHBoxLayout;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 QVBoxLayout *centerLayout = new QVBoxLayout;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 QHBoxLayout *bottomLayout = new QHBoxLayout;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 QHBoxLayout *archiveLayout = new QHBoxLayout;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 QHBoxLayout *certLayout = new QHBoxLayout;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 QHBoxLayout *saveLayout = new QHBoxLayout;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 QString descString = tr("Create a new signed installer binary.\n");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 descString.append("Select the archive, certificate and destination directory.");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 QLabel *description = new QLabel(descString);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 headerLayout->addWidget(description);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 QLabel *archiveLabel = new QLabel("Select source archive:");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 archiveLabel->setFixedWidth(140);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 mArchiveFile = new QLineEdit();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 QPushButton *archiveSelect = new QPushButton("...");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 connect(archiveSelect, SIGNAL(clicked()), this, SLOT(openArchiveSelect()));
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 archiveSelect->setFixedWidth(30);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 archiveLayout->addWidget(archiveLabel);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 archiveLayout->addWidget(mArchiveFile);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 archiveLayout->addWidget(archiveSelect);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 QLabel *certLabel = new QLabel("Select certificate:");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 certLabel->setFixedWidth(140);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 mCertFile = new QLineEdit();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 QPushButton *certSelect = new QPushButton("...");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect()));
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 certSelect->setFixedWidth(30);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 certLayout->addWidget(certLabel);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 certLayout->addWidget(mCertFile);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 certLayout->addWidget(certSelect);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 QLabel *saveLabel = new QLabel("Select target location:");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 saveLabel->setFixedWidth(140);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 mSaveFile = new QLineEdit();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 QPushButton *saveSelect = new QPushButton("...");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation()));
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 saveSelect->setFixedWidth(30);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 saveLayout->addWidget(saveLabel);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 saveLayout->addWidget(mSaveFile);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 saveLayout->addWidget(saveSelect);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 centerLayout->addLayout(archiveLayout);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 centerLayout->addLayout(certLayout);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 centerLayout->addLayout(saveLayout);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 QPushButton *create = new QPushButton(tr("Create Installer"));
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 connect(create, SIGNAL(clicked()), this, SLOT(createInstaller()));
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 bottomLayout->insertStretch(0, 10);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 bottomLayout->addWidget(create);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 topLayout->addLayout(headerLayout);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 topLayout->addLayout(centerLayout);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 topLayout->insertStretch(2, 10);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 topLayout->addLayout(bottomLayout);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 setLayout(topLayout);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 return;
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 }
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 void CreateInstallerDialog::openCertificateSelect()
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 QString certFile = QFileDialog::getOpenFileName(
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 this, tr("Select certificate"), QDir::homePath(), "*.pem *.der *.crt");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 mCertFile->setText(certFile);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 }
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 void CreateInstallerDialog::openArchiveSelect()
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 QString archiveFile = QFileDialog::getOpenFileName(
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 this, tr("Select source archive"), QDir::homePath(), "*.zip *.tar.gz");
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 mArchiveFile->setText(archiveFile);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 }
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 void CreateInstallerDialog::openSaveLocation()
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 QString saveFile = QFileDialog::getExistingDirectory(
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 this, tr("Select target location"), QDir::homePath());
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 mSaveFile->setText(saveFile);
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 }
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 void CreateInstallerDialog::createInstaller()
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 {
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 qDebug() << "and now create the installer using:";
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 qDebug() << "source archive: " << mArchiveFile->text();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 qDebug() << "certificate: " << mCertFile->text();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 qDebug() << "target" << mSaveFile->text();
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 // TODO
b67dd46cd4a9 Added dialog to create a new, signed installer binary.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 }

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