comparison ui/mainwindow.cpp @ 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 fa0c99056208
children 60d3f59f0803 20ca94680003
comparison
equal deleted inserted replaced
753:7c1f34115ede 754:27043d74dc90
514 514
515 /* Header 1: Update date and search button */ 515 /* Header 1: Update date and search button */
516 mUpdatesHeader = 516 mUpdatesHeader =
517 new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>"); 517 new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>");
518 mLastCertUpdate = 518 mLastCertUpdate =
519 new QLabel(""); 519 new QLabel(tr("Installed certificates from:"));
520 mLastCertUpdateContents = new QLabel(QString());
520 mLastCertUpdate->hide(); 521 mLastCertUpdate->hide();
522 mLastCertUpdateContents->hide();
521 mSoftwareVersionLabel = 523 mSoftwareVersionLabel =
522 new QLabel(tr("TrustBridge Version: %1").arg(QApplication::applicationVersion())); 524 new QLabel(tr("TrustBridge Version:"));
525 mSoftwareVersionContents = new QLabel(QApplication::applicationVersion());
523 const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime().toLocalTime(); 526 const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime().toLocalTime();
524 if (lastCheck.isValid()) { 527 if (lastCheck.isValid()) {
525 const QString lastUpdateCheck = QLocale::system().toString(lastCheck, DATETIME_FORMAT); 528 const QString lastUpdateCheck = QLocale::system().toString(lastCheck, DATETIME_FORMAT);
526 mLastUpdateCheck = 529 mLastUpdateCheck =
527 new QLabel(tr("Last sucessful update check: %1").arg(lastUpdateCheck)); 530 new QLabel(tr("Last sucessful update check:"));
531 mLastUpdateCheckContents = new QLabel(lastUpdateCheck);
528 } else { 532 } else {
529 mLastUpdateCheck = new QLabel(""); 533 mLastUpdateCheck = new QLabel(tr("Last successful update check:"));
534 mLastUpdateCheckContents = new QLabel(QString());
530 mLastUpdateCheck->hide(); 535 mLastUpdateCheck->hide();
536 mLastUpdateCheckContents->hide();
531 } 537 }
532 QPushButton *searchUpdates = new QPushButton(" " + tr("Check for updates")); 538 QPushButton *searchUpdates = new QPushButton(" " + tr("Check for updates"));
533 searchUpdates->setIcon(QIcon(":/img/edit-find.png")); 539 searchUpdates->setIcon(QIcon(":/img/edit-find.png"));
534 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates())); 540 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
535 541
536 // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment]) 542 // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment])
537 updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2); 543 updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2);
538 updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 1, 0, 1, 1); 544 updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 1, 0, 1, 1);
545 updatesHeaderLayout->addWidget(mSoftwareVersionContents, 1, 1, 1, 1);
539 updatesHeaderLayout->addWidget(mLastUpdateCheck, 2, 0, 1, 1); 546 updatesHeaderLayout->addWidget(mLastUpdateCheck, 2, 0, 1, 1);
547 updatesHeaderLayout->addWidget(mLastUpdateCheckContents, 2, 1, 1, 1);
540 updatesHeaderLayout->addWidget(mLastCertUpdate, 3, 0, 1, 1); 548 updatesHeaderLayout->addWidget(mLastCertUpdate, 3, 0, 1, 1);
541 updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight); 549 updatesHeaderLayout->addWidget(mLastCertUpdateContents, 3, 1, 1, 1);
550 updatesHeaderLayout->setColumnStretch(3, 1);
551
552 updatesHeaderLayout->addWidget(searchUpdates, 1, 4, 1, 2, Qt::AlignRight);
542 updatesHeaderLayout->setRowMinimumHeight(4, 15); 553 updatesHeaderLayout->setRowMinimumHeight(4, 15);
543 554
544 /* Header 2: Action text and buttons */ 555 /* Header 2: Action text and buttons */
545 mUpdatesTip = 556 mUpdatesTip =
546 new QLabel(tr("There are currently no changes for your certificate stores.")); 557 new QLabel(tr("There are currently no changes for your certificate stores."));
562 #endif 573 #endif
563 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp())); 574 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
564 connect(mInstallButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); 575 connect(mInstallButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
565 576
566 // addWidget(*Widget, row, column, rowspan, colspan) 577 // addWidget(*Widget, row, column, rowspan, colspan)
567 updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 2); 578 updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 4);
568 updatesHeaderActionButtonLayout->addWidget(mInstallButton); 579 updatesHeaderActionButtonLayout->addWidget(mInstallButton);
569 updatesHeaderActionButtonLayout->addWidget(mQuitButton); 580 updatesHeaderActionButtonLayout->addWidget(mQuitButton);
570 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1); 581 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 3, Qt::AlignLeft);
571 updatesHeaderLayout->setRowMinimumHeight(7, 10); 582 updatesHeaderLayout->setRowMinimumHeight(7, 10);
572 583
573 /* The central panels. */ 584 /* The central panels. */
574 QScrollArea *centralScrollArea = new QScrollArea; 585 QScrollArea *centralScrollArea = new QScrollArea;
575 QVBoxLayout *updatesCenterLayout = new QVBoxLayout; 586 QVBoxLayout *updatesCenterLayout = new QVBoxLayout;
1002 } 1013 }
1003 } 1014 }
1004 } 1015 }
1005 1016
1006 if (mInstalledList.date().isValid()) { 1017 if (mInstalledList.date().isValid()) {
1007 mLastCertUpdate->setText(tr("Installed certificates from: %1") 1018 mLastCertUpdateContents->setText(QLocale::system().toString(mInstalledList.date().toLocalTime(),
1008 .arg(QLocale::system().toString(mInstalledList.date().toLocalTime(), 1019 DATETIME_FORMAT));
1009 DATETIME_FORMAT)));
1010 mLastCertUpdate->show(); 1020 mLastCertUpdate->show();
1021 mLastCertUpdateContents->show();
1011 } 1022 }
1012 mUpdatesManualCertificates->setText("<h3>" + 1023 mUpdatesManualCertificates->setText("<h3>" +
1013 tr("Manually changed certificates (%1)").arg(0) + 1024 tr("Manually changed certificates (%1)").arg(0) +
1014 "</h3>"); 1025 "</h3>");
1015 listChanged(0); 1026 listChanged(0);
1249 void MainWindow::updateCheckSuccess() 1260 void MainWindow::updateCheckSuccess()
1250 { 1261 {
1251 if (getState() != TransferError) { 1262 if (getState() != TransferError) {
1252 const QDateTime now = QDateTime::currentDateTime(); 1263 const QDateTime now = QDateTime::currentDateTime();
1253 mSettings.setValue("lastUpdateCheck", now); 1264 mSettings.setValue("lastUpdateCheck", now);
1254 mLastUpdateCheck->setText(tr("Last successful update check: %1").arg( 1265 mLastUpdateCheckContents->setText(QLocale::system().toString(now, DATETIME_FORMAT));
1255 QLocale::system().toString(now, DATETIME_FORMAT))); 1266 mLastUpdateCheckContents->show();
1256 mLastUpdateCheck->show(); 1267 mLastUpdateCheck->show();
1257 syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData()); 1268 syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData());
1258 } 1269 }
1259 } 1270 }
1260 1271

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