From 60554bdb9f3326efbf7a473a5d10ac1157c85fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 13 Dec 2010 18:22:52 +0100 Subject: [PATCH 1/2] createrelease: Added comment to test 'cppcheck --errorlist'. Ticket: #2292 --- createrelease | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/createrelease b/createrelease index 804b54c77..663d8563b 100755 --- a/createrelease +++ b/createrelease @@ -37,6 +37,10 @@ # # Upload manual.pdf and version.txt... # sftp hyd_danmar,cppcheck@web.sourceforge.net +# +# Make sure "cppcheck --errorlist" works +# +# save "cppcheck --doc" output on wiki # Tag to use tag=$1 From 05ebf120c3fd254ea1c896e48017f3202d6ddcfb Mon Sep 17 00:00:00 2001 From: Zachary Blair Date: Tue, 14 Dec 2010 00:16:26 -0800 Subject: [PATCH 2/2] Fixed #2266 (GUI: Better check duration display format) --- gui/statsdialog.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/gui/statsdialog.cpp b/gui/statsdialog.cpp index 766627579..5f910e2c0 100644 --- a/gui/statsdialog.cpp +++ b/gui/statsdialog.cpp @@ -66,7 +66,31 @@ void StatsDialog::setNumberOfFilesScanned(int num) void StatsDialog::setScanDuration(double seconds) { - mUI.mScanDuration->setText(tr("%1 secs").arg(seconds)); + // Factor the duration into units (days/hours/minutes/seconds) + int secs = seconds; + int days = secs / (24 * 60 * 60); + secs -= days * (24 * 60 * 60); + int hours = secs / (60 * 60); + secs -= hours * (60 * 60); + int mins = secs / 60; + secs -= mins * 60; + + // Concatenate the two most significant units (e.g. "1 day and 3 hours") + QStringList parts; + if (days) + parts << ((days == 1) ? tr("1 day") : tr("%1 days").arg(days)); + if (hours) + parts << ((hours == 1) ? tr("1 hour") : tr("%1 hours").arg(hours)); + if (mins && parts.size() < 2) + parts << ((mins == 1) ? tr("1 minute") : tr("%1 minutes").arg(mins)); + if (secs && parts.size() < 2) + parts << ((secs == 1) ? tr("1 second") : tr("%1 seconds").arg(secs)); + + // For durations < 1s, show the fraction of a second (e.g. "0.7 seconds") + if (parts.isEmpty()) + parts << tr("0.%1 seconds").arg(int(10.0 *(seconds - secs))); + + mUI.mScanDuration->setText(parts.join(tr(" and "))); } void StatsDialog::copyToClipboard() @@ -152,4 +176,4 @@ void StatsDialog::setStatistics(const CheckStatistics *stats) mUI.mLblWarnings->setText(QString("%1").arg(stats->GetCount(SHOW_WARNINGS))); mUI.mLblStyle->setText(QString("%1").arg(stats->GetCount(SHOW_STYLE))); mUI.mLblPerformance->setText(QString("%1").arg(stats->GetCount(SHOW_PERFORMANCE))); -} \ No newline at end of file +}