changeset 427:d08e39b913ee

Added about dialog content and open the dialog via administration app.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 17 Apr 2014 12:56:23 +0200
parents d7cda835abd6
children d1819cd56dee
files ui/CMakeLists.txt ui/aboutdialog.cpp ui/administratorwindow.cpp ui/administratorwindow.h
diffstat 4 files changed, 65 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/ui/CMakeLists.txt	Thu Apr 17 12:06:57 2014 +0200
+++ b/ui/CMakeLists.txt	Thu Apr 17 12:56: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}
 )
 
--- a/ui/aboutdialog.cpp	Thu Apr 17 12:06:57 2014 +0200
+++ b/ui/aboutdialog.cpp	Thu Apr 17 12:56:23 2014 +0200
@@ -6,30 +6,79 @@
  * See LICENSE.txt for details.
  */
 #include "aboutdialog.h"
+#include <QApplication>
 #include <QDebug>
 #include <QVBoxLayout>
-#include <QTextEdit>
+#include <QHBoxLayout>
 #include <QPushButton>
+#include <QLabel>
 
 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("<h2>" + tr("TrustBridge") + "</h2>");
+    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 <a href=\"https://www.bsi.bund.de\">"
+        "Federal Office for Information Security (BSI)</a>.\n\n"));
+    QLabel *textDevel = new QLabel(tr("The software was developed by the companies"
+        " <a href=\"http://www.intevation.de\">Intevation GmbH</a> and "
+        " <a href=\"http://www.dn-systems.de\">DN-Systems GmbH</a>, <br>"
+        " 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);
+
     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);
 }
--- a/ui/administratorwindow.cpp	Thu Apr 17 12:06:57 2014 +0200
+++ b/ui/administratorwindow.cpp	Thu Apr 17 12:56: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"));
@@ -97,7 +98,7 @@
     QLabel *logo = new QLabel;
     logo->setBackgroundRole(QPalette::Base);
     logo->setPixmap(QPixmap::fromImage(*logoImage));
-    QLabel *title = new QLabel("<h2>" + tr("TrustBridge Adminstration") + "</h2>");
+    QLabel *title = new QLabel("<h2>" + tr("TrustBridge Administration") + "</h2>");
     QLabel *subTitle = new QLabel(
         tr("Management application of the BSI certificate installer"));
     headerTextLayout->addWidget(title);
@@ -164,6 +165,8 @@
         this, tr("Select certificate"), QDir::homePath(), "*.pem *.der");
     QList<Certificate> certs = Certificate::fromFileName(certFile);
     addToCertificateTable(certs);
+    certificateView->resizeColumnsToContents();
+    certificateView->setColumnWidth(0, 60);
 }
 
 void AdministratorWindow::removeCertificates()
@@ -189,19 +192,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()
--- a/ui/administratorwindow.h	Thu Apr 17 12:06:57 2014 +0200
+++ b/ui/administratorwindow.h	Thu Apr 17 12:56:23 2014 +0200
@@ -34,8 +34,6 @@
 
 private slots:
     void createInstaller();
-    void showSettings();
-    void showHelp();
     void showAbout();
     void loadCertificateFile();
     void saveCertificateFile();

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