Exemplo n.º 1
0
void FsRadProgressDlg::setCurrentStatus(const TCHAR* text)
{
	if (!stopRequested())
	{
		currentTaskText.SetWindowText(text);
	}

	allowBackgroundProcessing();
}
void	ProgressDlg::setCurrentStatus(const fstl::string & text)
{
	if (!stopRequested())
	{
		currentTaskText.SetWindowText(text.asArray());
	}

	allowBackgroundProcessing();
}
void	ProgressDlg::setCurrentPercent(const float percent)
{
	if (!stopRequested())
	{
		static	float	lastPercent = 23456.0f;
		if (percent != lastPercent)
		{
			lastPercent = percent;
			char	dsp[20];
			sprintf(dsp, "%.3f%%", percent);
			currentTaskPercent.SetWindowText(dsp);
			currentTaskProgress.SetPos(static_cast<int>(percent * 10.0f));
		}

		{
			char	disp[90];
			memset(disp, 0, sizeof(disp));
			currentTaskText.GetWindowText(disp, sizeof(disp));

			char	disp2[90];
#ifdef	_DEBUG
			sprintf(disp2, "%.2f%% - %s (DEBUG)", percent, disp);
#else
			sprintf(disp2, "%.2f%% - %s", percent, disp);
#endif
			SetWindowText(disp2);
		}
	}

	// Update the timer, if it has changed

	int	thisTime = time(NULL);
	if (thisTime != lastTime() && !paused())
	{
		lastTime() = thisTime;
		int	seconds = lastTime() - runtimeStart();
		int	minutes = seconds / 60; seconds -= minutes * 60;
		int	hours = minutes / 60; minutes -= hours * 60;
		char	dsp[90];
		sprintf(dsp, "%02d:%02d:%02d", hours, minutes, seconds);
		runtimeText.SetWindowText(dsp);
	}

	allowBackgroundProcessing();
}
Exemplo n.º 4
0
void FsRadProgressDlg::setCurrentPercent(const float percent)
{
	if (!stopRequested())
	{
		static	float	lastPercent = 23456.0f;
		if (percent != lastPercent)
		{
			lastPercent = percent;
			CString str;
			str.Format(L"%.3f%%", percent);
			currentTaskPercent.SetWindowText(str);
			currentTaskProgress.SetPos(static_cast<int>(percent * 10.0f));
		}

		{
			CString disp;
			currentTaskText.GetWindowText(disp);

			CString disp2;
			disp2.Format(L"%.2f%% - %s", percent, (LPCWSTR)disp);
			SetWindowText(disp2);
		}
	}

	// Update the timer, if it has changed

	auto	thisTime = time(NULL);
	if (thisTime != lastTime() && !paused())
	{
		lastTime() = thisTime;
		auto seconds = lastTime() - runtimeStart();
		auto minutes = seconds / 60; seconds -= minutes * 60;
		auto hours = minutes / 60; minutes -= hours * 60;
		CString dsp;
		dsp.Format(L"%02d:%02d:%02d", hours, minutes, seconds);
		runtimeText.SetWindowText(dsp);
	}

	allowBackgroundProcessing();
}