Commit a9f163a4 authored by Andre Hartmann's avatar Andre Hartmann

BuildManager: Simplify "Display elapsed time after build"

Reducing line noise and improving readability.
Also rounding up to full seconds to avoid "00:00" for a build that lasts
800ms.

Change-Id: I88471ec39d233e5f67821381769550eb8c4c5dd5
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent dc2b0c49
......@@ -247,17 +247,11 @@ void BuildManager::updateTaskCount()
void BuildManager::finish()
{
const int seconds = d->m_elapsed.elapsed() / 1000;
const int minutes = seconds / 60;
const int hours = minutes / 60;
QString maybeHours;
if (hours) {
maybeHours.setNum(hours);
maybeHours.append(QLatin1Char(':'));
}
addToOutputWindow(tr("Elapsed time: %1%2:%3.") .arg(maybeHours)
.arg(minutes % 60, 2, 10, QLatin1Char('0'))
.arg(seconds % 60, 2, 10, QLatin1Char('0')), BuildStep::MessageOutput);
const QTime format = QTime(0, 0, 0, 0).addMSecs(d->m_elapsed.elapsed() + 500);
QString time = format.toString(QLatin1String("h:mm:ss"));
if (time.startsWith(QLatin1String("0:")))
time.remove(0, 2); // Don't display zero hours
addToOutputWindow(tr("Elapsed time: %1.") .arg(time), BuildStep::MessageOutput);
QApplication::alert(Core::ICore::mainWindow(), 3000);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment