# HG changeset patch # User Raimund Renkert # Date 1397733803 -7200 # Node ID a5e76930b9a370685f01286adbbb285a5deb53e2 # Parent f07bc5de2a87c2ca8bebe5fea06401960b8e733e# Parent da3bebdd16ee0836bd4f81de37222430172fbb2e merged. diff -r da3bebdd16ee -r a5e76930b9a3 ui/CMakeLists.txt --- a/ui/CMakeLists.txt Thu Apr 17 12:35:51 2014 +0200 +++ b/ui/CMakeLists.txt Thu Apr 17 13:23:23 2014 +0200 @@ -42,6 +42,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/certificatetabledelegate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/createinstallerdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp ${CERTIFICATELIST_SOURCES} ) diff -r da3bebdd16ee -r a5e76930b9a3 ui/aboutdialog.cpp --- a/ui/aboutdialog.cpp Thu Apr 17 12:35:51 2014 +0200 +++ b/ui/aboutdialog.cpp Thu Apr 17 13:23:23 2014 +0200 @@ -6,30 +6,80 @@ * See LICENSE.txt for details. */ #include "aboutdialog.h" +#include #include #include -#include +#include #include +#include AboutDialog::AboutDialog(QMainWindow *parent) : QDialog(parent) { + setWindowTitle("About TrustBridge"); setupGUI(); } void AboutDialog::setupGUI() { QVBoxLayout *mainLayout = new QVBoxLayout(this); - QTextEdit *helpText = new QTextEdit; - helpText->setReadOnly(true); - helpText->setPlainText(tr("This dialog contains some text about the application")); + QHBoxLayout *headerLayout = new QHBoxLayout; + QVBoxLayout *headerTextLayout = new QVBoxLayout; + QVBoxLayout *centerLayout = new QVBoxLayout; + QHBoxLayout *bottomLayout = new QHBoxLayout; - QHBoxLayout *buttonLayout = new QHBoxLayout; + QImage *logoImage = new QImage(":/img/logo.png"); + QLabel *logo = new QLabel; + logo->setBackgroundRole(QPalette::Base); + logo->setPixmap(QPixmap::fromImage(*logoImage)); + QLabel *title = new QLabel("

" + tr("TrustBridge") + "

"); + QString version = tr("Version: "); + version.append(QApplication::applicationVersion()); + QLabel *appVersion = new QLabel(version); + + QFrame *headerSeparator = new QFrame(); + headerSeparator->setFrameShape(QFrame::HLine); + headerSeparator->setFrameShadow(QFrame::Sunken); + + headerTextLayout->addWidget(title); + headerTextLayout->addWidget(appVersion); + headerLayout->addWidget(logo); + headerLayout->addLayout(headerTextLayout); + headerLayout->insertStretch(2, 10); + + QLabel *textDesc = new QLabel(tr("TrustBridge is a secure root certificate" + " installer for Windows and Linux.")); + QLabel *textManage = new QLabel(tr("The root certificate lists are managed" + " by the German " + "Federal Office for Information Security (BSI).\n\n")); + QLabel *textDevel = new QLabel(tr("The software was developed by the companies" + " Intevation GmbH and " + " DN-Systems GmbH,
" + " contracted by the German Federal Office for Information Security (BSI).\n\n")); + QLabel *textLicense = new QLabel(tr("TrustBridge is Free Software licensed" + " under GNU GPL v2+.\n\nCopyright (C) 2014 by Bundesamt für Sicherheit" + " in der Informationstechnik")); + + centerLayout->addWidget(headerSeparator); + centerLayout->addWidget(textDesc); + centerLayout->addWidget(textManage); + centerLayout->addWidget(textDevel); + centerLayout->addWidget(textLicense); + centerLayout->insertSpacing(2, 10); + centerLayout->insertSpacing(4, 10); + centerLayout->insertSpacing(6, 10); + centerLayout->insertStretch(8, 10); + QPushButton *closeButton = new QPushButton(tr("Close")); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); - buttonLayout->insertStretch(0, 10); - buttonLayout->addWidget(closeButton); + bottomLayout->insertStretch(0, 10); + bottomLayout->addWidget(closeButton); - mainLayout->addWidget(helpText); - mainLayout->addLayout(buttonLayout); + QFrame *bottomSeparator = new QFrame(); + bottomSeparator->setFrameShape(QFrame::HLine); + bottomSeparator->setFrameShadow(QFrame::Sunken); + mainLayout->addLayout(headerLayout); + mainLayout->addLayout(centerLayout); + mainLayout->addWidget(bottomSeparator); + mainLayout->addLayout(bottomLayout); } diff -r da3bebdd16ee -r a5e76930b9a3 ui/administratorwindow.cpp --- a/ui/administratorwindow.cpp Thu Apr 17 12:35:51 2014 +0200 +++ b/ui/administratorwindow.cpp Thu Apr 17 13:23:23 2014 +0200 @@ -27,6 +27,7 @@ #include "certificatetabledelegate.h" #include "createinstallerdialog.h" #include "createcertlistdialog.h" +#include "aboutdialog.h" AdministratorWindow::AdministratorWindow() { setWindowTitle(tr("TrustBridge Administration")); @@ -73,7 +74,7 @@ // The certificate list QGroupBox *certBox = new QGroupBox( - tr("All managed root certificates of the certificate list:")); + tr("All managed root certificates of the certificate list: ")); certificateView = new QTableView; certificateModel = new CertificateTabelModel(); QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(this); @@ -81,6 +82,7 @@ CertificateTableDelegate *delegate = new CertificateTableDelegate(certificateView); certificateView->setModel(filterModel); certificateView->setItemDelegate(delegate); + certificateView->horizontalHeader()->setStretchLastSection(true); certificateView->resizeColumnsToContents(); certificateView->setColumnWidth(0, 60); certificateView->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -96,7 +98,7 @@ QLabel *logo = new QLabel; logo->setBackgroundRole(QPalette::Base); logo->setPixmap(QPixmap::fromImage(*logoImage)); - QLabel *title = new QLabel("

" + tr("TrustBridge Adminstration") + "

"); + QLabel *title = new QLabel("

" + tr("TrustBridge Administration") + "

"); QLabel *subTitle = new QLabel( tr("Management application of the BSI certificate installer")); headerTextLayout->addWidget(title); @@ -139,7 +141,7 @@ QString path = QStandardPaths::locate( QStandardPaths::DataLocation, QString("certlist_last.txt")); QString certFile = QFileDialog::getOpenFileName( - this, tr("Select certificate file"), path, "*.txt"); + this, tr("Select certificate list file"), path, "*.txt"); qDebug() << "selected: " + certFile; certList.readList(certFile.toLocal8Bit().constData()); if (!certList.isValid()) { @@ -159,10 +161,15 @@ void AdministratorWindow::addCertificates() { - QString certFile = QFileDialog::getOpenFileName( + QStringList certFiles = QFileDialog::getOpenFileNames( this, tr("Select certificate"), QDir::homePath(), "*.pem *.der"); - QList certs = Certificate::fromFileName(certFile); - addToCertificateTable(certs); + for (int i = 0; i < certFiles.size(); i++) { + QString certFile = certFiles.at(i); + QList certs = Certificate::fromFileName(certFile); + addToCertificateTable(certs); + } + certificateView->resizeColumnsToContents(); + certificateView->setColumnWidth(0, 60); } void AdministratorWindow::removeCertificates() @@ -188,19 +195,10 @@ } } -void AdministratorWindow::showSettings() -{ - qDebug() << "show settingsdialog"; -} - -void AdministratorWindow::showHelp() -{ - qDebug() << "show helpdialog"; -} - void AdministratorWindow::showAbout() { - qDebug() << "show aboutdialog"; + AboutDialog *dialog = new AboutDialog(this); + dialog->show(); } void AdministratorWindow::createInstaller() diff -r da3bebdd16ee -r a5e76930b9a3 ui/administratorwindow.h --- a/ui/administratorwindow.h Thu Apr 17 12:35:51 2014 +0200 +++ b/ui/administratorwindow.h Thu Apr 17 13:23:23 2014 +0200 @@ -34,8 +34,6 @@ private slots: void createInstaller(); - void showSettings(); - void showHelp(); void showAbout(); void loadCertificateFile(); void saveCertificateFile(); diff -r da3bebdd16ee -r a5e76930b9a3 ui/createcertlistdialog.cpp --- a/ui/createcertlistdialog.cpp Thu Apr 17 12:35:51 2014 +0200 +++ b/ui/createcertlistdialog.cpp Thu Apr 17 13:23:23 2014 +0200 @@ -30,14 +30,15 @@ QVBoxLayout *topLayout = new QVBoxLayout; QVBoxLayout *headerLayout = new QVBoxLayout; QHBoxLayout *headerSubLayout = new QHBoxLayout; - QVBoxLayout *centerLayout = new QVBoxLayout; + QHBoxLayout *centerLayout = new QHBoxLayout; QHBoxLayout *bottomLayout = new QHBoxLayout; - QHBoxLayout *certLayout = new QHBoxLayout; - QHBoxLayout *saveLayout = new QHBoxLayout; + QVBoxLayout *labelLayout = new QVBoxLayout; + QVBoxLayout *fieldLayout = new QVBoxLayout; + QVBoxLayout *buttonLayout = new QVBoxLayout; QLabel *header = new QLabel("

" + tr("Save certificate list") + "

"); QLabel *description = new QLabel( - tr("Save all managed root certificates in a new, signed certificate list")); + tr("Save all managed root certificates in a new, signed certificate list.")); headerSubLayout->insertSpacing(0, 40); headerSubLayout->addWidget(description); QFrame *headerSeparator = new QFrame(); @@ -46,39 +47,40 @@ headerLayout->addWidget(header); headerLayout->addLayout(headerSubLayout); headerLayout->addWidget(headerSeparator); + headerLayout->insertSpacing(3, 10); QLabel *certLabel = new QLabel("Select signature certificate (secret key):"); - certLabel->setFixedWidth(205); + QLabel *saveLabel = new QLabel("Select output folder:"); + labelLayout->addWidget(certLabel); + labelLayout->addWidget(saveLabel); + mCertFile = new QLineEdit(); + mSaveFile = new QLineEdit(); + fieldLayout->addWidget(mCertFile); + fieldLayout->addWidget(mSaveFile); + 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 output folder:"); - saveLabel->setFixedWidth(205); - mSaveFile = new QLineEdit(); + connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect())); QPushButton *saveSelect = new QPushButton("..."); connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation())); saveSelect->setFixedWidth(30); + buttonLayout->addWidget(certSelect); + buttonLayout->addWidget(saveSelect); - QString footerText = tr("In addition, each certificate list will be saved" + QString footerText = tr("In addition, each certificate list will be saved " "automatically in the archive directory:\n"); // TODO print out the path, not the displayName. - footerText.append(QStandardPaths::displayName(QStandardPaths::DataLocation)); + footerText.append(QStandardPaths::writableLocation( + QStandardPaths::DataLocation)); + //footerText.append(QStandardPaths::displayName(QStandardPaths::DataLocation)); QLabel *footer = new QLabel(footerText); - saveLayout->addWidget(saveLabel); - saveLayout->addWidget(mSaveFile); - saveLayout->addWidget(saveSelect); - centerLayout->insertSpacing(0, 10); - centerLayout->addLayout(certLayout); - centerLayout->addLayout(saveLayout); - centerLayout->insertSpacing(3, 10); + centerLayout->addLayout(labelLayout); + centerLayout->addLayout(fieldLayout); + centerLayout->addLayout(buttonLayout); - QPushButton *create = new QPushButton(tr("Sign list")); + QPushButton *create = new QPushButton(tr("Save list")); connect(create, SIGNAL(clicked()), this, SLOT(createList())); QPushButton *cancel = new QPushButton(tr("Cancel")); connect(cancel, SIGNAL(clicked()), this, SLOT(close())); @@ -94,6 +96,7 @@ topLayout->addLayout(centerLayout); topLayout->insertStretch(2, 10); topLayout->addWidget(footer); + topLayout->insertSpacing(4, 10); topLayout->addWidget(bottomSeparator); topLayout->addLayout(bottomLayout); diff -r da3bebdd16ee -r a5e76930b9a3 ui/createinstallerdialog.cpp --- a/ui/createinstallerdialog.cpp Thu Apr 17 12:35:51 2014 +0200 +++ b/ui/createinstallerdialog.cpp Thu Apr 17 13:23:23 2014 +0200 @@ -29,15 +29,15 @@ QVBoxLayout *topLayout = new QVBoxLayout; QVBoxLayout *headerLayout = new QVBoxLayout; QHBoxLayout *headerSubLayout = new QHBoxLayout; - QVBoxLayout *centerLayout = new QVBoxLayout; + QHBoxLayout *centerLayout = new QHBoxLayout; QHBoxLayout *bottomLayout = new QHBoxLayout; - QHBoxLayout *archiveLayout = new QHBoxLayout; - QHBoxLayout *certLayout = new QHBoxLayout; - QHBoxLayout *saveLayout = new QHBoxLayout; + QVBoxLayout *labelLayout = new QVBoxLayout; + QVBoxLayout *fieldLayout = new QVBoxLayout; + QVBoxLayout *buttonLayout = new QVBoxLayout; QLabel *header = new QLabel("

" + tr("Create binary installer") + "

"); QLabel *description = new QLabel( - tr("Create and signed a TrustBridge binary installer from source.")); + tr("Create and sign a TrustBridge binary installer from source.")); headerSubLayout->insertSpacing(0, 40); headerSubLayout->addWidget(description); QFrame *headerSeparator = new QFrame(); @@ -46,42 +46,38 @@ headerLayout->addWidget(header); headerLayout->addLayout(headerSubLayout); headerLayout->addWidget(headerSeparator); + headerLayout->insertSpacing(4, 10); QLabel *archiveLabel = new QLabel(tr("Select source archive:")); - archiveLabel->setFixedWidth(225); + QLabel *certLabel = new QLabel(tr("Select code signing certificate (secret key):")); + QLabel *saveLabel = new QLabel(tr("Select output folder:")); + labelLayout->addWidget(archiveLabel); + labelLayout->addWidget(certLabel); + labelLayout->addWidget(saveLabel); + mArchiveFile = new QLineEdit(); + mCertFile = new QLineEdit(); + mSaveFile = new QLineEdit(); + fieldLayout->addWidget(mArchiveFile); + fieldLayout->addWidget(mCertFile); + fieldLayout->addWidget(mSaveFile); + 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(tr("Select code signing certificate (secret key):")); - certLabel->setFixedWidth(225); - 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(tr("Select output folder:")); - saveLabel->setFixedWidth(225); - 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); + buttonLayout->addWidget(archiveSelect); + buttonLayout->addWidget(certSelect); + buttonLayout->addWidget(saveSelect); - centerLayout->insertSpacing(0, 10); - centerLayout->addLayout(archiveLayout); - centerLayout->addLayout(certLayout); - centerLayout->addLayout(saveLayout); - centerLayout->insertSpacing(4, 10); + centerLayout->addLayout(labelLayout); + centerLayout->addLayout(fieldLayout); + centerLayout->addLayout(buttonLayout); QPushButton *create = new QPushButton(tr("Create installer")); connect(create, SIGNAL(clicked()), this, SLOT(createInstaller())); @@ -98,6 +94,7 @@ topLayout->addLayout(headerLayout); topLayout->addLayout(centerLayout); topLayout->insertStretch(2, 10); + centerLayout->insertSpacing(3, 10); topLayout->addWidget(bottomSeparator); topLayout->addLayout(bottomLayout);