forked from qt-creator/qt-creator
Locator: Reuse TaskTreeRunner for running locator filters
Change-Id: I4bbbab0905a235df5601064b115edaaa73da047e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <solutions/tasking/tasktreerunner.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/async.h>
|
#include <utils/async.h>
|
||||||
#include <utils/fuzzymatcher.h>
|
#include <utils/fuzzymatcher.h>
|
||||||
@@ -396,11 +398,12 @@ public:
|
|||||||
QString m_input;
|
QString m_input;
|
||||||
LocatorFilterEntries m_output;
|
LocatorFilterEntries m_output;
|
||||||
int m_parallelLimit = 0;
|
int m_parallelLimit = 0;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
TaskTreeRunner m_taskTreeRunner;
|
||||||
};
|
};
|
||||||
|
|
||||||
LocatorMatcher::LocatorMatcher()
|
LocatorMatcher::LocatorMatcher()
|
||||||
: d(new LocatorMatcherPrivate) {}
|
: d(new LocatorMatcherPrivate)
|
||||||
|
{}
|
||||||
|
|
||||||
LocatorMatcher::~LocatorMatcher() = default;
|
LocatorMatcher::~LocatorMatcher() = default;
|
||||||
|
|
||||||
@@ -423,7 +426,6 @@ void LocatorMatcher::start()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(!isRunning(), return);
|
QTC_ASSERT(!isRunning(), return);
|
||||||
d->m_output = {};
|
d->m_output = {};
|
||||||
d->m_taskTree.reset(new TaskTree);
|
|
||||||
|
|
||||||
struct CollectorStorage
|
struct CollectorStorage
|
||||||
{
|
{
|
||||||
@@ -479,27 +481,19 @@ void LocatorMatcher::start()
|
|||||||
parallelTasks
|
parallelTasks
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
d->m_taskTreeRunner.start(root, {}, [this](DoneWith result) {
|
||||||
d->m_taskTree->setRecipe(root);
|
|
||||||
connect(d->m_taskTree.get(), &TaskTree::done, this, [this](DoneWith result) {
|
|
||||||
emit done(result == DoneWith::Success);
|
emit done(result == DoneWith::Success);
|
||||||
d->m_taskTree.release()->deleteLater();
|
|
||||||
});
|
});
|
||||||
d->m_taskTree->start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocatorMatcher::stop()
|
void LocatorMatcher::stop()
|
||||||
{
|
{
|
||||||
if (!isRunning())
|
d->m_taskTreeRunner.stop();
|
||||||
return;
|
|
||||||
|
|
||||||
d->m_taskTree->stop();
|
|
||||||
d->m_taskTree.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocatorMatcher::isRunning() const
|
bool LocatorMatcher::isRunning() const
|
||||||
{
|
{
|
||||||
return d->m_taskTree.get() && d->m_taskTree->isRunning();
|
return d->m_taskTreeRunner.isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
LocatorFilterEntries LocatorMatcher::outputData() const
|
LocatorFilterEntries LocatorMatcher::outputData() const
|
||||||
|
Reference in New Issue
Block a user