view ui/certificateitemwidget.h @ 1275:be989e9d49a4

Translations updated.
author Emanuel Schuetze <emanuel@intevation.de>
date Mon, 29 Sep 2014 11:08:20 +0200
parents 2a1aa9df8f11
children 265583011f24
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 CERTIFICATELISTITEM_H
#define CERTIFICATELISTITEM_H
/**
 * @file certificateitemwidget.h
 * @brief Item delegate drawing custom certificate items in list views.
 *
 */
#include <QWidget>
#include <QLabel>
#include <QToolButton>

#include "certificate.h"

/** @brief A tool button that always looks as if it were unchecked. */
class CheckLessToolBtn : public QToolButton
{
    void paintEvent(QPaintEvent * pe);
};

/** @brief Item delegate drawing custom certificate items in list views.*/
class CertificateItemWidget : public QWidget
{
Q_OBJECT
public:
    /** @brief ctor of the widget
     *
     * @param [in] parent the parent of the widget
     * @param [in] cert the certificate to hold.
     * @param [in] state wether or not the action of the certificate should be done.
     * @param [in] btn the button used to manage the state of the cert.*/
    CertificateItemWidget(
        QWidget *parent = 0,
        const Certificate &cert = Certificate(),
        bool state = false,
        QToolButton * btn = NULL);

    bool state();
    /** @brief set the state of the certificate.
     *
     * A false state means that the certificate action (install or remove)
     * should not be executed.
     *
     * @param [in] state the state of the certificate
     **/
    void setState(bool state);

    /** @brief Obtain a copy of the certificate that is shown in the widget.
     *
     * @returns A copy of the hold certificate.
     **/
    Certificate certificate();

private:
    void setupGUI();

    Certificate mCertificate;
    bool mOriginalState;
    QLabel *mLabel;
    QToolButton *mButton;

private slots:
    void currentStateChanged(bool state);

signals:
    void stateChanged(bool state, const Certificate &cert);
};
#endif

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