view ui/aboutdialog.cpp @ 633:6c090638b2b4

Use static buffer for module file name. According to the msdn examle the return value of getmodulefilename should be used to indicate success and not the size. And according to comments on that function on Windows 8.1 it does not return the needed size. So better be more robust and just use max_path as a limit.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 23 Jun 2014 15:29:48 +0200
parents 8dbfd0cb534b
children 1e18d4c1932a
line wrap: on
line source
/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */
#include "aboutdialog.h"
#include <QApplication>
#include <QDebug>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QLabel>

AboutDialog::AboutDialog(QMainWindow *parent) :
    QDialog(parent)
{
    setWindowTitle("About TrustBridge");
    setupGUI();
}

void AboutDialog::setupGUI()
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    QHBoxLayout *headerLayout = new QHBoxLayout;
    QVBoxLayout *headerTextLayout = new QVBoxLayout;
    QVBoxLayout *centerLayout = new QVBoxLayout;
    QHBoxLayout *bottomLayout = 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);
    appVersion->setTextInteractionFlags(
        Qt::TextSelectableByMouse |
        Qt::TextSelectableByKeyboard);

    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 root certificate"
        " installer for Windows and Linux."));
    textDesc->setTextInteractionFlags(
        Qt::TextSelectableByMouse |
        Qt::TextSelectableByKeyboard);
    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"));
    textManage->setTextInteractionFlags(
        Qt::TextBrowserInteraction |
        Qt::TextSelectableByKeyboard);
    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"));
    textDevel->setTextInteractionFlags(
        Qt::TextBrowserInteraction |
        Qt::TextSelectableByKeyboard);
    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"));
    textLicense->setTextInteractionFlags(
        Qt::TextSelectableByMouse |
        Qt::TextSelectableByKeyboard);

    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()));
    bottomLayout->insertStretch(0, 10);
    bottomLayout->addWidget(closeButton);

    QFrame *bottomSeparator = new QFrame();
    bottomSeparator->setFrameShape(QFrame::HLine);
    bottomSeparator->setFrameShadow(QFrame::Sunken);
    mainLayout->addLayout(headerLayout);
    mainLayout->addLayout(centerLayout);
    mainLayout->addWidget(bottomSeparator);
    mainLayout->addLayout(bottomLayout);
}

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