Mercurial > trustbridge
comparison ui/mainwindow.cpp @ 432:16b5cd858571
Updated layout and certificate details in trustbridge installer.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 22 Apr 2014 11:20:13 +0200 |
parents | 09bb19e5e369 |
children | dbcc7740b9d8 |
comparison
equal
deleted
inserted
replaced
431:280f2556a48b | 432:16b5cd858571 |
---|---|
280 | 280 |
281 // Layouts and Container | 281 // Layouts and Container |
282 QHBoxLayout *mainLayout = new QHBoxLayout; | 282 QHBoxLayout *mainLayout = new QHBoxLayout; |
283 QVBoxLayout *infoLayout = new QVBoxLayout; | 283 QVBoxLayout *infoLayout = new QVBoxLayout; |
284 QVBoxLayout *certLayout = new QVBoxLayout; | 284 QVBoxLayout *certLayout = new QVBoxLayout; |
285 QVBoxLayout *detailLayout = new QVBoxLayout; | 285 QHBoxLayout *detailLayout = new QHBoxLayout; |
286 QVBoxLayout *detailLabelLayout = new QVBoxLayout; | |
287 QVBoxLayout *detailContentLayout = new QVBoxLayout; | |
286 QHBoxLayout *headerLayout = new QHBoxLayout; | 288 QHBoxLayout *headerLayout = new QHBoxLayout; |
287 QVBoxLayout *headerTextLayout = new QVBoxLayout; | 289 QVBoxLayout *headerTextLayout = new QVBoxLayout; |
288 QVBoxLayout *toolLayout = new QVBoxLayout; | |
289 QHBoxLayout *bottomLayout = new QHBoxLayout; | 290 QHBoxLayout *bottomLayout = new QHBoxLayout; |
291 QVBoxLayout *settingsLayout = new QVBoxLayout; | |
290 | 292 |
291 // The certificate list | 293 // The certificate list |
292 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); | 294 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); |
293 mCertListWidget = new QListWidget; | 295 mCertListWidget = new QListWidget; |
294 mCertListWidget->setItemDelegate(new CertificateItemDelegate); | 296 mCertListWidget->setItemDelegate(new CertificateItemDelegate); |
310 headerLayout->addLayout(headerTextLayout); | 312 headerLayout->addLayout(headerTextLayout); |
311 headerLayout->setStretch(0, 0); | 313 headerLayout->setStretch(0, 0); |
312 headerLayout->setStretch(1, 10); | 314 headerLayout->setStretch(1, 10); |
313 | 315 |
314 // The settings. | 316 // The settings. |
315 QCheckBox *autoUpdateOption = new QCheckBox(tr("autoupdate")); | 317 QGroupBox *settingsBox = new QGroupBox(tr("Settings")); |
316 toolLayout->addWidget(autoUpdateOption); | 318 mAutoUpdateOption = new QCheckBox(tr("Autoupdate")); |
319 mAutoStartOption = new QCheckBox(tr("Autostart")); | |
320 settingsLayout->addWidget(mAutoUpdateOption); | |
321 settingsLayout->addWidget(mAutoStartOption); | |
322 settingsBox->setLayout(settingsLayout); | |
317 // connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate())); | 323 // connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate())); |
318 | 324 |
319 // The buttons. | 325 // The buttons. |
320 bottomLayout->setAlignment(Qt::AlignBottom); | 326 bottomLayout->setAlignment(Qt::AlignBottom); |
321 installButton = new QPushButton(tr("Install selected")); | 327 installButton = new QPushButton(tr("Install selected")); |
331 bottomLayout->addWidget(quitButton); | 337 bottomLayout->addWidget(quitButton); |
332 bottomLayout->setAlignment(quitButton, Qt::AlignBottom); | 338 bottomLayout->setAlignment(quitButton, Qt::AlignBottom); |
333 | 339 |
334 // The certificate details | 340 // The certificate details |
335 QGroupBox *detailBox = new QGroupBox(tr("Details")); | 341 QGroupBox *detailBox = new QGroupBox(tr("Details")); |
336 certificateDetails = new QTextEdit; | 342 QLabel *subjectCN = new QLabel(tr("Subject Common Name:")); |
337 certificateDetails->setReadOnly(true); | 343 QLabel *subjectOU = new QLabel(tr("Subject Organisation:")); |
338 detailLayout->addWidget(certificateDetails); | 344 QLabel *issuerCN = new QLabel(tr("Issuer Common Name:")); |
345 QLabel *issuerOU = new QLabel(tr("Issuer Organisation:")); | |
346 QLabel *validFrom = new QLabel(tr("Valid from:")); | |
347 QLabel *validTo = new QLabel(tr("Valid to:")); | |
348 QLabel *fingerprint = new QLabel(tr("Fingerprint:")); | |
349 detailLabelLayout->addWidget(subjectCN); | |
350 detailLabelLayout->addWidget(subjectOU); | |
351 detailLabelLayout->addWidget(issuerCN); | |
352 detailLabelLayout->addWidget(issuerOU); | |
353 detailLabelLayout->addWidget(validFrom); | |
354 detailLabelLayout->addWidget(validTo); | |
355 detailLabelLayout->addWidget(fingerprint); | |
356 mSubjectCN = new QLabel(tr("")); | |
357 mSubjectOU = new QLabel(tr("")); | |
358 mIssuerCN = new QLabel(tr("")); | |
359 mIssuerOU = new QLabel(tr("")); | |
360 mValidFrom = new QLabel(tr("")); | |
361 mValidTo = new QLabel(tr("")); | |
362 mFingerprint = new QLabel(tr("")); | |
363 detailContentLayout->addWidget(mSubjectCN); | |
364 detailContentLayout->addWidget(mSubjectOU); | |
365 detailContentLayout->addWidget(mIssuerCN); | |
366 detailContentLayout->addWidget(mIssuerOU); | |
367 detailContentLayout->addWidget(mValidFrom); | |
368 detailContentLayout->addWidget(mValidTo); | |
369 detailContentLayout->addWidget(mFingerprint); | |
370 detailLayout->addLayout(detailLabelLayout); | |
371 detailLayout->addLayout(detailContentLayout); | |
339 detailBox->setLayout(detailLayout); | 372 detailBox->setLayout(detailLayout); |
340 | 373 |
341 infoLayout->addSpacing(20); | 374 infoLayout->addSpacing(20); |
342 infoLayout->addLayout(headerLayout); | 375 infoLayout->addLayout(headerLayout); |
343 infoLayout->addLayout(toolLayout); | |
344 infoLayout->addWidget(detailBox); | 376 infoLayout->addWidget(detailBox); |
377 infoLayout->addWidget(settingsBox); | |
345 infoLayout->addLayout(bottomLayout); | 378 infoLayout->addLayout(bottomLayout); |
346 | 379 |
347 mainLayout->addWidget(certBox); | 380 mainLayout->addWidget(certBox); |
348 mainLayout->addLayout(infoLayout); | 381 mainLayout->addLayout(infoLayout); |
349 | 382 |
369 qWarning() << "Invalid certificate in list"; | 402 qWarning() << "Invalid certificate in list"; |
370 continue; | 403 continue; |
371 } | 404 } |
372 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); | 405 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); |
373 SeparatorItemDelegate *separator = new SeparatorItemDelegate(); | 406 SeparatorItemDelegate *separator = new SeparatorItemDelegate(); |
374 item->setData(CertificateItemDelegate::DetailsRole, cert.details()); | 407 item->setData(CertificateItemDelegate::DetailsRole, QVariant::fromValue(cert)); |
375 item->setData(CertificateItemDelegate::B64LineRole, cert.base64Line()); | |
376 Qt::CheckState checkedState = mPreviouslyUnselected.contains(cert.base64Line()) ? | 408 Qt::CheckState checkedState = mPreviouslyUnselected.contains(cert.base64Line()) ? |
377 Qt::Unchecked : Qt::Checked; | 409 Qt::Unchecked : Qt::Checked; |
378 | 410 |
379 bool isOld = mInstalledList.getCertificates().contains(cert); | 411 bool isOld = mInstalledList.getCertificates().contains(cert); |
380 qDebug() << "Found old certificate."; | 412 qDebug() << "Found old certificate."; |
441 about->show(); | 473 about->show(); |
442 } | 474 } |
443 | 475 |
444 void MainWindow::showDetails(QListWidgetItem *item) | 476 void MainWindow::showDetails(QListWidgetItem *item) |
445 { | 477 { |
446 QString details = item->data(CertificateItemDelegate::DetailsRole).toString(); | 478 Certificate cert = item->data(CertificateItemDelegate::DetailsRole).value<Certificate>(); |
447 certificateDetails->setPlainText(details); | 479 mSubjectCN->setText(cert.subjectCN()); |
480 mSubjectOU->setText(cert.subjectOU()); | |
481 mIssuerCN->setText(cert.issuerCN()); | |
482 mIssuerOU->setText(cert.issuerO()); | |
483 mValidFrom->setText(cert.validFrom().toString()); | |
484 mValidTo->setText(cert.validTo().toString()); | |
485 mFingerprint->setText(cert.fingerprint()); | |
448 } | 486 } |
449 | 487 |
450 void MainWindow::resizeButtons() | 488 void MainWindow::resizeButtons() |
451 { | 489 { |
452 installButton->setFixedHeight(20); | 490 installButton->setFixedHeight(20); |