Mercurial > trustbridge
changeset 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 | 7c1f34115ede |
children | 01a10d6a0af1 |
files | ui/mainwindow.cpp ui/mainwindow.h |
diffstat | 2 files changed, 26 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Fri Jul 04 18:00:11 2014 +0200 +++ b/ui/mainwindow.cpp Mon Jul 07 12:38:33 2014 +0200 @@ -516,18 +516,24 @@ mUpdatesHeader = new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>"); mLastCertUpdate = - new QLabel(""); + new QLabel(tr("Installed certificates from:")); + mLastCertUpdateContents = new QLabel(QString()); mLastCertUpdate->hide(); + mLastCertUpdateContents->hide(); mSoftwareVersionLabel = - new QLabel(tr("TrustBridge Version: %1").arg(QApplication::applicationVersion())); + new QLabel(tr("TrustBridge Version:")); + mSoftwareVersionContents = new QLabel(QApplication::applicationVersion()); const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime().toLocalTime(); if (lastCheck.isValid()) { const QString lastUpdateCheck = QLocale::system().toString(lastCheck, DATETIME_FORMAT); mLastUpdateCheck = - new QLabel(tr("Last sucessful update check: %1").arg(lastUpdateCheck)); + new QLabel(tr("Last sucessful update check:")); + mLastUpdateCheckContents = new QLabel(lastUpdateCheck); } else { - mLastUpdateCheck = new QLabel(""); + mLastUpdateCheck = new QLabel(tr("Last successful update check:")); + mLastUpdateCheckContents = new QLabel(QString()); mLastUpdateCheck->hide(); + mLastUpdateCheckContents->hide(); } QPushButton *searchUpdates = new QPushButton(" " + tr("Check for updates")); searchUpdates->setIcon(QIcon(":/img/edit-find.png")); @@ -536,9 +542,14 @@ // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment]) updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2); updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 1, 0, 1, 1); + updatesHeaderLayout->addWidget(mSoftwareVersionContents, 1, 1, 1, 1); updatesHeaderLayout->addWidget(mLastUpdateCheck, 2, 0, 1, 1); + updatesHeaderLayout->addWidget(mLastUpdateCheckContents, 2, 1, 1, 1); updatesHeaderLayout->addWidget(mLastCertUpdate, 3, 0, 1, 1); - updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight); + updatesHeaderLayout->addWidget(mLastCertUpdateContents, 3, 1, 1, 1); + updatesHeaderLayout->setColumnStretch(3, 1); + + updatesHeaderLayout->addWidget(searchUpdates, 1, 4, 1, 2, Qt::AlignRight); updatesHeaderLayout->setRowMinimumHeight(4, 15); /* Header 2: Action text and buttons */ @@ -564,10 +575,10 @@ connect(mInstallButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); // addWidget(*Widget, row, column, rowspan, colspan) - updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 2); + updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 4); updatesHeaderActionButtonLayout->addWidget(mInstallButton); updatesHeaderActionButtonLayout->addWidget(mQuitButton); - updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1); + updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 3, Qt::AlignLeft); updatesHeaderLayout->setRowMinimumHeight(7, 10); /* The central panels. */ @@ -1004,10 +1015,10 @@ } if (mInstalledList.date().isValid()) { - mLastCertUpdate->setText(tr("Installed certificates from: %1") - .arg(QLocale::system().toString(mInstalledList.date().toLocalTime(), - DATETIME_FORMAT))); + mLastCertUpdateContents->setText(QLocale::system().toString(mInstalledList.date().toLocalTime(), + DATETIME_FORMAT)); mLastCertUpdate->show(); + mLastCertUpdateContents->show(); } mUpdatesManualCertificates->setText("<h3>" + tr("Manually changed certificates (%1)").arg(0) + @@ -1251,8 +1262,8 @@ if (getState() != TransferError) { const QDateTime now = QDateTime::currentDateTime(); mSettings.setValue("lastUpdateCheck", now); - mLastUpdateCheck->setText(tr("Last successful update check: %1").arg( - QLocale::system().toString(now, DATETIME_FORMAT))); + mLastUpdateCheckContents->setText(QLocale::system().toString(now, DATETIME_FORMAT)); + mLastUpdateCheckContents->show(); mLastUpdateCheck->show(); syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData()); }
--- a/ui/mainwindow.h Fri Jul 04 18:00:11 2014 +0200 +++ b/ui/mainwindow.h Mon Jul 07 12:38:33 2014 +0200 @@ -247,8 +247,11 @@ QLabel *mUpdatesHeader; QLabel *mLastCertUpdate; + QLabel *mLastCertUpdateContents; QLabel *mSoftwareVersionLabel; + QLabel *mSoftwareVersionContents; QLabel *mLastUpdateCheck; + QLabel *mLastUpdateCheckContents; QLabel *mUpdatesNewCertificates; QLabel *mUpdatesRemoveCertificates; QLabel *mUpdatesManualCertificates;