comparison ui/mainwindow.cpp @ 714:57bd73145e48

(Issue25) Fix typos change order and add better date formating
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 16:05:57 +0200
parents cdf8a924e480
children 929c3db85eb7
comparison
equal deleted inserted replaced
713:cdf8a924e480 714:57bd73145e48
45 45
46 // The amount of time in minutes stay silent if we have 46 // The amount of time in minutes stay silent if we have
47 // something to say 47 // something to say
48 #define NAG_INTERVAL_MINUTES 70 48 #define NAG_INTERVAL_MINUTES 70
49 49
50 #define DATETIME_FORMAT "dddd, d.MMMM yyyy HH:mm:ss"
51
50 #ifndef APPNAME 52 #ifndef APPNAME
51 #define APPNAME "TrustBridge" 53 #define APPNAME "TrustBridge"
52 #endif 54 #endif
53 55
54 #define SERVER_URL "https://files.intevation.de:443" 56 #define SERVER_URL "https://files.intevation.de:443"
539 mLastCertUpdate = 541 mLastCertUpdate =
540 new QLabel(""); 542 new QLabel("");
541 mLastCertUpdate->hide(); 543 mLastCertUpdate->hide();
542 mSoftwareVersionLabel = 544 mSoftwareVersionLabel =
543 new QLabel(tr("TrustBridge Version: %1").arg(QApplication::applicationVersion())); 545 new QLabel(tr("TrustBridge Version: %1").arg(QApplication::applicationVersion()));
544 const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime(); 546 const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime().toLocalTime();
545 if (lastCheck.isValid()) { 547 if (lastCheck.isValid()) {
546 const QString lastUpdateCheck = QLocale::system().toString(lastCheck); 548 const QString lastUpdateCheck = QLocale::system().toString(lastCheck, DATETIME_FORMAT);
547 mLastUpdateCheck = 549 mLastUpdateCheck =
548 new QLabel(tr("Last sucessful update check: %1").arg(lastUpdateCheck)); 550 new QLabel(tr("Last sucessful update check: %1").arg(lastUpdateCheck));
549 } else { 551 } else {
550 mLastUpdateCheck = new QLabel(""); 552 mLastUpdateCheck = new QLabel("");
551 mLastUpdateCheck->hide(); 553 mLastUpdateCheck->hide();
554 searchUpdates->setIcon(QIcon(":/img/edit-find.png")); 556 searchUpdates->setIcon(QIcon(":/img/edit-find.png"));
555 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates())); 557 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
556 558
557 // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment]) 559 // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment])
558 updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2); 560 updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2);
559 updatesHeaderLayout->addWidget(mLastCertUpdate, 1, 0, 1, 1); 561 updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 1, 0, 1, 1);
560 updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 2, 0, 1, 1); 562 updatesHeaderLayout->addWidget(mLastUpdateCheck, 2, 0, 1, 1);
561 updatesHeaderLayout->addWidget(mLastUpdateCheck, 3, 0, 1, 1); 563 updatesHeaderLayout->addWidget(mLastCertUpdate, 3, 0, 1, 1);
562 updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight); 564 updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight);
563 updatesHeaderLayout->setRowMinimumHeight(4, 15); 565 updatesHeaderLayout->setRowMinimumHeight(4, 15);
564 566
565 /* Header 2: Action text and buttons */ 567 /* Header 2: Action text and buttons */
566 QLabel *updatesTip = 568 QLabel *updatesTip =
925 } 927 }
926 } 928 }
927 929
928 if (mInstalledList.date().isValid()) { 930 if (mInstalledList.date().isValid()) {
929 mLastCertUpdate->setText(tr("Installed certificates from: %1") 931 mLastCertUpdate->setText(tr("Installed certificates from: %1")
930 .arg(QLocale::system().toString(mInstalledList.date()))); 932 .arg(QLocale::system().toString(mInstalledList.date().toLocalTime(),
933 DATETIME_FORMAT)));
931 mLastCertUpdate->show(); 934 mLastCertUpdate->show();
932 } 935 }
933 mUpdatesManualCertificates->setText("<h3>" + 936 mUpdatesManualCertificates->setText("<h3>" +
934 tr("Manually changed certificates (%1)").arg(0) + 937 tr("Manually changed certificates (%1)").arg(0) +
935 "</h3>"); 938 "</h3>");
1179 void MainWindow::updateCheckSuccess() 1182 void MainWindow::updateCheckSuccess()
1180 { 1183 {
1181 if (getState() != TransferError) { 1184 if (getState() != TransferError) {
1182 const QDateTime now = QDateTime::currentDateTime(); 1185 const QDateTime now = QDateTime::currentDateTime();
1183 mSettings.setValue("lastUpdateCheck", now); 1186 mSettings.setValue("lastUpdateCheck", now);
1184 mLastUpdateCheck->setText(tr("Last sucessful update check: %1").arg( 1187 mLastUpdateCheck->setText(tr("Last successful update check: %1").arg(
1185 QLocale::system().toString(now))); 1188 QLocale::system().toString(now, DATETIME_FORMAT)));
1186 mLastUpdateCheck->show(); 1189 mLastUpdateCheck->show();
1187 syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData()); 1190 syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData());
1188 } 1191 }
1189 } 1192 }

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