comparison ui/certificateitemwidget.cpp @ 842:bd33c6585cd0

UI improvements (issue18, 60)
author Emanuel Schuetze <emanuel@intevation.de>
date Wed, 30 Jul 2014 09:58:20 +0200
parents b108510bac5a
children 9c4543128666
comparison
equal deleted inserted replaced
841:216a65d7fc4b 842:bd33c6585cd0
40 qDebug() << "Failed to create fusion style"; 40 qDebug() << "Failed to create fusion style";
41 } else { 41 } else {
42 mComboBox->setStyle(fusionStyle); 42 mComboBox->setStyle(fusionStyle);
43 } 43 }
44 44
45 mComboBox->setIconSize(QSize(48, 48)); 45 mComboBox->setIconSize(QSize(32, 32));
46 mComboBox->setFixedWidth(68); 46 mComboBox->setFixedWidth(64);
47 47
48 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); 48 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
49 49
50 const QString validity = tr("Valid: %1 until %2").arg( 50 const QString validity = tr("Validity: %1 until %2").arg(
51 QLocale::system().toString(mCertificate.validFrom().date(), QLocale::ShortFormat)).arg( 51 QLocale::system().toString(mCertificate.validFrom().date(), QLocale::ShortFormat)).arg(
52 QLocale::system().toString(mCertificate.validTo().date(), QLocale::ShortFormat)); 52 QLocale::system().toString(mCertificate.validTo().date(), QLocale::ShortFormat));
53 const QString fpstring = tr("Fingerprint (SHA1): &lt;%1&gt;").arg(mCertificate.fingerprint()); 53 const QString fpstring = tr("Fingerprint (SHA1): <code>%1</code>").arg(mCertificate.fingerprint());
54 mLabel->setText(QString::fromLatin1("<big><b>%1</b><br/>%2<br/>%3<br/>%4</big>").arg 54 mLabel->setText(QString::fromLatin1("<big><b>%1</b></big><br/>%2<br/>%3<br/>%4").arg
55 (mCertificate.subjectCN()).arg(mCertificate.subjectO()).arg(validity).arg 55 (mCertificate.subjectCN()).arg(mCertificate.subjectO()).arg(validity).arg
56 (fpstring)); 56 (fpstring));
57 mLabel->setTextFormat(Qt::RichText); 57 mLabel->setTextFormat(Qt::RichText);
58 58
59 mLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); 59 mLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
60 60
61 mLabel->setTextInteractionFlags( 61 mLabel->setTextInteractionFlags(
62 Qt::TextSelectableByMouse | 62 Qt::TextSelectableByMouse |
63 Qt::TextSelectableByKeyboard); 63 Qt::TextSelectableByKeyboard);
64 mComboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); 64 mComboBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
67 67
68 QHBoxLayout *layout = new QHBoxLayout; 68 QHBoxLayout *layout = new QHBoxLayout;
69 if (mCertificate.isInstallCert()) { 69 if (mCertificate.isInstallCert()) {
70 mComboBox->addItem(QIcon(":/img/security-high.png"), QString(), mInstallLabel); 70 mComboBox->addItem(QIcon(":/img/security-high.png"), QString(), mInstallLabel);
71 mComboBox->addItem(QIcon(":/img/security-low.png"), QString(), mRemoveLabel); 71 mComboBox->addItem(QIcon(":/img/security-low.png"), QString(), mRemoveLabel);
72 if (mState) 72 if (mState) {
73 mComboBox->setCurrentIndex(0); 73 mComboBox->setCurrentIndex(0);
74 mComboBox->setToolTip(tr("This certificate is currently installed."));
75 }
74 else { 76 else {
75 mComboBox->setCurrentIndex(1); 77 mComboBox->setCurrentIndex(1);
78 mComboBox->setToolTip(tr("This certificate is currently not installed."));
76 } 79 }
77 layout->addWidget(mComboBox); 80 layout->addWidget(mComboBox);
78 } 81 }
79 else if (!mCertificate.isInstallCert() && !mEditable){ 82 else if (!mCertificate.isInstallCert() && !mEditable){
80 QImage *img = new QImage(":/img/trash-empty.png"); 83 QImage *img = new QImage(":/img/trash-empty.png");
81 QLabel *imgLabel = new QLabel; 84 QLabel *imgLabel = new QLabel;
82 imgLabel->setPixmap(QPixmap::fromImage(*img)); 85 imgLabel->setPixmap(QPixmap::fromImage(*img));
83 imgLabel->setFixedSize(48, 48); 86 imgLabel->setFixedSize(64, 64);
84 imgLabel->setMargin(2); 87 imgLabel->setMargin(8);
88 imgLabel->setToolTip(tr("This certificate was uninstalled."));
85 layout->addWidget(imgLabel); 89 layout->addWidget(imgLabel);
86 } 90 }
87 else { 91 else {
88 mComboBox->addItem(QIcon(":/img/trash-empty.png"), QString(), tr("uninstall")); 92 mComboBox->addItem(QIcon(":/img/trash-empty.png"), QString(), tr("uninstall"));
89 mComboBox->addItem(QIcon(":/img/security-medium.png"), QString(), tr("keep")); 93 mComboBox->addItem(QIcon(":/img/security-medium.png"), QString(), tr("keep"));
94 mComboBox->setToolTip(tr("This certificate is currently installed."));
90 if (mState) 95 if (mState)
91 mComboBox->setCurrentIndex(0); 96 mComboBox->setCurrentIndex(0);
92 else { 97 else {
93 mComboBox->setCurrentIndex(1); 98 mComboBox->setCurrentIndex(1);
94 } 99 }

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