1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2015 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include <QPixmap>
#include "XcaDialog.h"
#include "MainWindow.h"
#include "Help.h"
// index = enum pki_type
static const char * const PixmapMap[] = {
"", ":keyImg", ":csrImg", ":certImg", ":revImg", ":tempImg", "", ":scardImg",
};
XcaDialog::XcaDialog(QWidget *parent, enum pki_type type, QWidget *w,
const QString &t, const QString &desc,
const QString &help_ctx)
: QDialog(parent ? parent : mainwin)
{
setupUi(this);
setWindowTitle(XCA_TITLE);
image->setPixmap(QPixmap(PixmapMap[type]));
content->addWidget(w);
mainwin->helpdlg->register_ctxhelp_button(this, help_ctx);
widg = w;
title->setText(t);
if (desc.isEmpty()) {
verticalLayout->removeWidget(description);
delete description;
} else {
description->setText(desc);
}
}
void XcaDialog::noSpacer()
{
verticalLayout->removeItem(topSpacer);
verticalLayout->removeItem(bottomSpacer);
delete topSpacer;
delete bottomSpacer;
if (widg)
widg->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
}
void XcaDialog::aboutDialog(const QPixmap &left)
{
title->setPixmap(left.scaledToHeight(title->height()));
noSpacer();
resize(560, 400);
buttonBox->setStandardButtons(QDialogButtonBox::Ok);
buttonBox->centerButtons();
}
|