Valgrind: Use generic timed future for uncertain progress

Change-Id: Idb7f1b1e5a0fcd0351d6c30f5a6dadcbec191898
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
hjk
2014-05-05 14:23:37 +02:00
parent 9e457eefc8
commit 5ac261bff2
8 changed files with 74 additions and 33 deletions

View File

@@ -53,8 +53,6 @@ using namespace ProjectExplorer;
namespace Valgrind {
namespace Internal {
const int progressMaximum = 1000000;
ValgrindRunControl::ValgrindRunControl(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
: AnalyzerRunControl(sp, runConfiguration),
@@ -80,14 +78,11 @@ bool ValgrindRunControl::startEngine()
{
emit starting(this);
FutureProgress *fp = ProgressManager::addTask(m_progress->future(),
progressTitle(), "valgrind");
FutureProgress *fp = ProgressManager::addTimedTask(m_progress, progressTitle(), "valgrind", 100);
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
connect(fp, SIGNAL(canceled()), this, SLOT(handleProgressCanceled()));
connect(fp, SIGNAL(finished()), this, SLOT(handleProgressFinished()));
m_progress->setProgressRange(0, progressMaximum);
m_progress->reportStarted();
m_progress->setProgressValue(progressMaximum / 10);
const AnalyzerStartParameters &sp = startParameters();
#if VALGRIND_DEBUG_OUTPUT
@@ -183,12 +178,6 @@ void ValgrindRunControl::runnerFinished()
void ValgrindRunControl::receiveProcessOutput(const QString &output, OutputFormat format)
{
int progress = m_progress->progressValue();
if (progress < 5 * progressMaximum / 10)
progress += progress / 100;
else if (progress < 9 * progressMaximum / 10)
progress += progress / 1000;
m_progress->setProgressValue(progress);
appendMessage(output, format);
}