ui: changed the display format of the parse duration to "hh:mm:ss"

This commit is contained in:
malte_langkabel
2016-03-24 10:44:09 +01:00
parent 82db193c78
commit 880a199540
2 changed files with 21 additions and 3 deletions
@@ -29,7 +29,7 @@ void StatusBarController::handleMessage(MessageFinishedParsing* message)
getView()->setErrorCount(errorCount);
std::string status = message->getStatusStr();
status += " " + std::to_string(errorCount.total) + " error" + (errorCount.total > 1 ? "s" : "");
status += " " + std::to_string(errorCount.total) + " error" + (errorCount.total != 1 ? "s" : "");
if (errorCount.fatal > 0)
{
status += " (" + std::to_string(errorCount.fatal) + " fatal)";
@@ -33,8 +33,26 @@ public:
{
std::stringstream ss;
ss << "Finished analysis: ";
ss << fileCount << "/" << totalFileCount << " files, ";
ss << std::setprecision(2) << std::fixed << parseTime << " seconds.";
ss << fileCount << "/" << totalFileCount << " files; ";
float secondsLeft = parseTime;
int hours = int(secondsLeft / 3600);
secondsLeft -= hours * 3600;
int minutes = int(secondsLeft / 60);
secondsLeft -= minutes * 60;
int seconds = int(secondsLeft);
if (hours > 9)
{
ss << hours;
}
else
{
ss << std::setw(2) << std::setfill('0') << hours;
}
ss << ":" << std::setw(2) << std::setfill('0') << minutes;
ss << ":" << std::setw(2) << std::setfill('0') << seconds << ". ";
return ss.str();
}