commit de44823156ba70b0ab520d97d15e522758365c8e
parent bc7c511cb7b937089fd52fa90778f8c76175b3a1
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 19 Nov 2017 17:31:06 -0800
progress: use thousands separator in status text
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/progress.cpp b/src/progress.cpp
@@ -21,6 +21,8 @@
#include "resource.hpp"
#include "win32.hpp"
+#include <sstream>
+
using namespace std;
Progress::Progress(ThreadPool *pool)
@@ -81,12 +83,12 @@ void Progress::addTask(ThreadTask *task)
void Progress::updateProgress()
{
- char position[32];
- snprintf(position, sizeof(position), "%d of %d",
- min(m_done + 1, m_total), m_total);
+ ostringstream position;
+ String::imbueStream(position);
+ position << min(m_done + 1, m_total) << " of " << m_total;
char label[1024];
- snprintf(label, sizeof(label), m_current.c_str(), position);
+ snprintf(label, sizeof(label), m_current.c_str(), position.str().c_str());
Win32::setWindowText(m_label, label);