view ui/administratorwindow.h @ 754:27043d74dc90

(Issue25) Align header contents in their own column. We now also stretch column 3 so that the contents are aligned with the descriptive labels without a space in between. Sadly this causes the quit button to be resized to it's minimum instead of sharing the space with the installation button as the installation button is so large that it squeezes the push button.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 07 Jul 2014 12:38:33 +0200
parents 75cd2fbf9ac6
children 0b7bb4f68f5a
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.
 */
#ifndef ADMINSTRATORWINDOW_H
#define ADMINSTRATORWINDOW_H

/**
 * @file administratorwindow.h
 * @brief Administrator UI controller
 */

#include <QMainWindow>
#include <QSettings>
#include <QMenuBar>
#include <QTableView>
#include <QPushButton>

#include "certificatelist.h"
#include "certificatetablemodel.h"

class QMenu;
class QAction;

class AdministratorWindow : public QMainWindow
{
    Q_OBJECT

public:
    AdministratorWindow();

    /** @brief obtain a reference to the certificates currently in the model
     * @returns the currently shown certificates
     */
    const QList<Certificate>& certificates() const {
        return certificateModel->certificates();
    }

    /** @brief get the settings for this application
     * @returns a reference the applications settings object
     */
    QSettings* settings() {return &mSettings;}

    /** @brief log the diff between the initial certificate list and the list
     * saved as current.
     *
     * @param currentCerts  Path to the current certificate list file.
     * @param certFingerprint The fingerprint of the signing key used.
     */
    void logChanges(const QString &currentCerts, const QString &keyFingerprint);

    /** @brief get the currently changed certificates.
     * @return a list of certificates.
     */
    QList<Certificate> currentChanges();

private slots:
    void createInstaller();
    void showAbout();
    void loadCertificateFile();
    void saveCertificateFile();
    void addCertificates();
    void removeCertificates();
    void clickedCertificate(const QModelIndex&);

private:
    void createActions();
    void createMenuBar();
    void createContent();
    void loadCertificateTable();
    void addToCertificateTable(const QList<Certificate> &certs);
    QByteArray createLogEntries(const CertificateList &list, const QString &keyFingerprint);

    QSettings mSettings;

    QMenuBar *menuBar;

    QTableView *certificateView;
    CertificateList mCertList;
    CertificateTabelModel *certificateModel;
    QPushButton *saveButton;
    QPushButton *loadButton;
    QPushButton *addButton;
    QPushButton *removeButton;
};

#endif // ADMINSTRATORWINDOW_H

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