TaskTree: Prepare for de-utils-ization - part 2

Move TaskTree into Tasking namespace.
Move Tasking namespace out of Utils namespace.

Change-Id: Ib4c1d7f54f1808517e54768dfa27209c33517b61
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-05-10 19:54:52 +02:00
parent 5a73d07c72
commit 97a66067bb
63 changed files with 142 additions and 160 deletions

View File

@@ -3,8 +3,6 @@
#include "async.h" #include "async.h"
#include <QCoreApplication>
namespace Utils { namespace Utils {
static int s_maxThreadCount = INT_MAX; static int s_maxThreadCount = INT_MAX;

View File

@@ -211,4 +211,4 @@ public:
} // namespace Utils } // namespace Utils
QTC_DECLARE_CUSTOM_TEMPLATE_TASK(AsyncTask, AsyncTaskAdapter); QTC_DECLARE_CUSTOM_TEMPLATE_TASK(AsyncTask, Utils::AsyncTaskAdapter);

View File

@@ -5,7 +5,7 @@
#include "qtcassert.h" #include "qtcassert.h"
namespace Utils { namespace Tasking {
void Barrier::setLimit(int value) void Barrier::setLimit(int value)
{ {
@@ -44,4 +44,4 @@ void Barrier::stopWithResult(bool success)
emit done(success); emit done(success);
} }
} // namespace Utils } // namespace Tasking

View File

@@ -7,7 +7,7 @@
#include "tasktree.h" #include "tasktree.h"
namespace Utils { namespace Tasking {
class QTCREATOR_UTILS_EXPORT Barrier final : public QObject class QTCREATOR_UTILS_EXPORT Barrier final : public QObject
{ {
@@ -41,11 +41,11 @@ public:
void start() final { task()->start(); } void start() final { task()->start(); }
}; };
} // namespace Utils } // namespace Tasking
QTC_DECLARE_CUSTOM_TASK(BarrierTask, Utils::BarrierTaskAdapter); QTC_DECLARE_CUSTOM_TASK(BarrierTask, Tasking::BarrierTaskAdapter);
namespace Utils::Tasking { namespace Tasking {
template <int Limit = 1> template <int Limit = 1>
class SharedBarrier class SharedBarrier
@@ -94,4 +94,4 @@ public:
}) {} }) {}
}; };
} // namespace Utils::Tasking } // namespace Tasking

View File

@@ -284,14 +284,14 @@ private:
WriteBuffer *m_writeBuffer = nullptr; WriteBuffer *m_writeBuffer = nullptr;
}; };
class FileStreamReaderAdapter : public Utils::Tasking::TaskAdapter<FileStreamReader> class FileStreamReaderAdapter : public TaskAdapter<FileStreamReader>
{ {
public: public:
FileStreamReaderAdapter() { connect(task(), &FileStreamBase::done, this, &TaskInterface::done); } FileStreamReaderAdapter() { connect(task(), &FileStreamBase::done, this, &TaskInterface::done); }
void start() override { task()->start(); } void start() override { task()->start(); }
}; };
class FileStreamWriterAdapter : public Utils::Tasking::TaskAdapter<FileStreamWriter> class FileStreamWriterAdapter : public TaskAdapter<FileStreamWriter>
{ {
public: public:
FileStreamWriterAdapter() { connect(task(), &FileStreamBase::done, this, &TaskInterface::done); } FileStreamWriterAdapter() { connect(task(), &FileStreamBase::done, this, &TaskInterface::done); }

View File

@@ -49,7 +49,7 @@ private:
class FileStreamerPrivate *d = nullptr; class FileStreamerPrivate *d = nullptr;
}; };
class FileStreamerTaskAdapter : public Utils::Tasking::TaskAdapter<FileStreamer> class FileStreamerTaskAdapter : public Tasking::TaskAdapter<FileStreamer>
{ {
public: public:
FileStreamerTaskAdapter() { connect(task(), &FileStreamer::done, this, FileStreamerTaskAdapter() { connect(task(), &FileStreamer::done, this,

View File

@@ -7,6 +7,8 @@
#include <QSet> #include <QSet>
namespace Tasking {
class Guard class Guard
{ {
Q_DISABLE_COPY(Guard) Q_DISABLE_COPY(Guard)
@@ -29,9 +31,6 @@ private:
Guard &m_guard; Guard &m_guard;
}; };
namespace Utils {
namespace Tasking {
static TaskAction toTaskAction(bool success) static TaskAction toTaskAction(bool success)
{ {
return success ? TaskAction::StopWithDone : TaskAction::StopWithError; return success ? TaskAction::StopWithDone : TaskAction::StopWithError;
@@ -191,10 +190,6 @@ void TaskItem::setTaskErrorHandler(const TaskEndHandler &handler)
m_taskHandler.m_errorHandler = handler; m_taskHandler.m_errorHandler = handler;
} }
} // namespace Tasking
using namespace Tasking;
class TaskTreePrivate; class TaskTreePrivate;
class TaskNode; class TaskNode;
@@ -686,8 +681,8 @@ void TaskNode::invokeEndHandler(bool success)
} }
/*! /*!
\class Utils::TaskTree \class TaskTree
\inheaderfile utils/tasktree.h \inheaderfile solutions/tasking/tasktree.h
\inmodule QtCreator \inmodule QtCreator
\ingroup mainclasses \ingroup mainclasses
\brief The TaskTree class runs an async task tree structure defined in a \brief The TaskTree class runs an async task tree structure defined in a
@@ -706,7 +701,6 @@ void TaskNode::invokeEndHandler(bool success)
or AsyncTask<ReturnType>: or AsyncTask<ReturnType>:
\code \code
using namespace Utils;
using namespace Tasking; using namespace Tasking;
const Group root { const Group root {
@@ -1285,7 +1279,7 @@ void TaskNode::invokeEndHandler(bool success)
recipe described by the Group root element. recipe described by the Group root element.
As TaskTree is also an asynchronous task, it can be a part of another TaskTree. As TaskTree is also an asynchronous task, it can be a part of another TaskTree.
To place a nested TaskTree inside another TaskTree, insert the Tasking::TaskTreeTask To place a nested TaskTree inside another TaskTree, insert the TaskTreeTask
element into other tree's Group element. element into other tree's Group element.
TaskTree reports progress of completed tasks when running. The progress value TaskTree reports progress of completed tasks when running. The progress value
@@ -1344,7 +1338,7 @@ void TaskNode::invokeEndHandler(bool success)
asynchronous task: asynchronous task:
\code \code
class TimeoutAdapter : public Utils::Tasking::TaskAdapter<QTimer> class TimeoutAdapter : public Tasking::TaskAdapter<QTimer>
{ {
public: public:
TimeoutAdapter() { TimeoutAdapter() {
@@ -1372,7 +1366,7 @@ void TaskNode::invokeEndHandler(bool success)
To make QTimer accessible inside TaskTree under the \e Timeout name, To make QTimer accessible inside TaskTree under the \e Timeout name,
register it with QTC_DECLARE_CUSTOM_TASK(Timeout, TimeoutAdapter). Timeout register it with QTC_DECLARE_CUSTOM_TASK(Timeout, TimeoutAdapter). Timeout
becomes a new task type inside Utils::Tasking namespace, using TimeoutAdapter. becomes a new task type inside Tasking namespace, using TimeoutAdapter.
The new task type is now registered, and you can use it in TaskTree: The new task type is now registered, and you can use it in TaskTree:
@@ -1416,7 +1410,7 @@ TaskTree::~TaskTree()
delete d; delete d;
} }
void TaskTree::setupRoot(const Tasking::Group &root) void TaskTree::setupRoot(const Group &root)
{ {
QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return); QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return);
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The setupRoot() is called from one of the" QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The setupRoot() is called from one of the"
@@ -1455,7 +1449,7 @@ int TaskTree::progressValue() const
return d->m_progressValue; return d->m_progressValue;
} }
void TaskTree::setupStorageHandler(const Tasking::TreeStorageBase &storage, void TaskTree::setupStorageHandler(const TreeStorageBase &storage,
StorageVoidHandler setupHandler, StorageVoidHandler setupHandler,
StorageVoidHandler doneHandler) StorageVoidHandler doneHandler)
{ {
@@ -1487,4 +1481,4 @@ void TaskTreeTaskAdapter::start()
task()->start(); task()->start();
} }
} // namespace Utils } // namespace Tasking

View File

@@ -9,15 +9,13 @@
#include <QObject> #include <QObject>
#include <QSharedPointer> #include <QSharedPointer>
namespace Utils { namespace Tasking {
class ExecutionContextActivator; class ExecutionContextActivator;
class TaskContainer; class TaskContainer;
class TaskNode; class TaskNode;
class TaskTreePrivate; class TaskTreePrivate;
namespace Tasking {
class QTCREATOR_UTILS_EXPORT TaskInterface : public QObject class QTCREATOR_UTILS_EXPORT TaskInterface : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -354,8 +352,6 @@ private:
}; };
}; };
} // namespace Tasking
class TaskTreePrivate; class TaskTreePrivate;
class QTCREATOR_UTILS_EXPORT TaskTree final : public QObject class QTCREATOR_UTILS_EXPORT TaskTree final : public QObject
@@ -364,10 +360,10 @@ class QTCREATOR_UTILS_EXPORT TaskTree final : public QObject
public: public:
TaskTree(); TaskTree();
TaskTree(const Tasking::Group &root); TaskTree(const Group &root);
~TaskTree(); ~TaskTree();
void setupRoot(const Tasking::Group &root); void setupRoot(const Group &root);
void start(); void start();
void stop(); void stop();
@@ -378,14 +374,12 @@ public:
int progressValue() const; // all finished / skipped / stopped tasks, groups itself excluded int progressValue() const; // all finished / skipped / stopped tasks, groups itself excluded
template <typename StorageStruct, typename StorageHandler> template <typename StorageStruct, typename StorageHandler>
void onStorageSetup(const Tasking::TreeStorage<StorageStruct> &storage, void onStorageSetup(const TreeStorage<StorageStruct> &storage, StorageHandler &&handler) {
StorageHandler &&handler) {
setupStorageHandler(storage, setupStorageHandler(storage,
wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler)), {}); wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler)), {});
} }
template <typename StorageStruct, typename StorageHandler> template <typename StorageStruct, typename StorageHandler>
void onStorageDone(const Tasking::TreeStorage<StorageStruct> &storage, void onStorageDone(const TreeStorage<StorageStruct> &storage, StorageHandler &&handler) {
StorageHandler &&handler) {
setupStorageHandler(storage, setupStorageHandler(storage,
{}, wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler))); {}, wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler)));
} }
@@ -398,7 +392,7 @@ signals:
private: private:
using StorageVoidHandler = std::function<void(void *)>; using StorageVoidHandler = std::function<void(void *)>;
void setupStorageHandler(const Tasking::TreeStorageBase &storage, void setupStorageHandler(const TreeStorageBase &storage,
StorageVoidHandler setupHandler, StorageVoidHandler setupHandler,
StorageVoidHandler doneHandler); StorageVoidHandler doneHandler);
template <typename StorageStruct, typename StorageHandler> template <typename StorageStruct, typename StorageHandler>
@@ -413,22 +407,22 @@ private:
TaskTreePrivate *d; TaskTreePrivate *d;
}; };
class QTCREATOR_UTILS_EXPORT TaskTreeTaskAdapter : public Tasking::TaskAdapter<TaskTree> class QTCREATOR_UTILS_EXPORT TaskTreeTaskAdapter : public TaskAdapter<TaskTree>
{ {
public: public:
TaskTreeTaskAdapter(); TaskTreeTaskAdapter();
void start() final; void start() final;
}; };
} // namespace Utils } // namespace Tasking
#define QTC_DECLARE_CUSTOM_TASK(CustomTaskName, TaskAdapterClass)\ #define QTC_DECLARE_CUSTOM_TASK(CustomTaskName, TaskAdapterClass)\
namespace Utils::Tasking { using CustomTaskName = CustomTask<TaskAdapterClass>; } namespace Tasking { using CustomTaskName = CustomTask<TaskAdapterClass>; }
#define QTC_DECLARE_CUSTOM_TEMPLATE_TASK(CustomTaskName, TaskAdapterClass)\ #define QTC_DECLARE_CUSTOM_TEMPLATE_TASK(CustomTaskName, TaskAdapterClass)\
namespace Utils::Tasking {\ namespace Tasking {\
template <typename ...Args>\ template <typename ...Args>\
using CustomTaskName = CustomTask<TaskAdapterClass<Args...>>;\ using CustomTaskName = CustomTask<TaskAdapterClass<Args...>>;\
} // namespace Utils::Tasking } // namespace Tasking
QTC_DECLARE_CUSTOM_TASK(TaskTreeTask, Utils::TaskTreeTaskAdapter); QTC_DECLARE_CUSTOM_TASK(TaskTreeTask, TaskTreeTaskAdapter);

View File

@@ -18,7 +18,7 @@ class QThreadPool;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace ProjectExplorer { class Project; } namespace ProjectExplorer { class Project; }
namespace Utils { class TaskTree; } namespace Tasking { class TaskTree; }
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
@@ -95,7 +95,7 @@ private:
QTimer m_reparseTimer; QTimer m_reparseTimer;
QSet<ITestParser *> m_updateParsers; QSet<ITestParser *> m_updateParsers;
Utils::FutureSynchronizer m_futureSynchronizer; Utils::FutureSynchronizer m_futureSynchronizer;
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
QHash<Utils::FilePath, int> m_qmlEditorRev; QHash<Utils::FilePath, int> m_qmlEditorRev;
}; };

View File

@@ -46,6 +46,7 @@
using namespace Core; using namespace Core;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace Autotest { namespace Autotest {
@@ -346,7 +347,6 @@ void TestRunner::runTestsHelper()
std::unique_ptr<TestOutputReader> m_outputReader; std::unique_ptr<TestOutputReader> m_outputReader;
}; };
using namespace Tasking;
QList<TaskItem> tasks{optional}; QList<TaskItem> tasks{optional};
for (ITestConfiguration *config : m_selectedTests) { for (ITestConfiguration *config : m_selectedTests) {

View File

@@ -19,7 +19,7 @@ class QLabel;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace ProjectExplorer { class Project; } namespace ProjectExplorer { class Project; }
namespace Utils { class TaskTree; } namespace Tasking { class TaskTree; }
namespace Autotest { namespace Autotest {
@@ -70,7 +70,7 @@ private:
bool postponeTestRunWithEmptyExecutable(ProjectExplorer::Project *project); bool postponeTestRunWithEmptyExecutable(ProjectExplorer::Project *project);
void onBuildSystemUpdated(); void onBuildSystemUpdated();
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
QList<ITestConfiguration *> m_selectedTests; QList<ITestConfiguration *> m_selectedTests;
TestRunMode m_runMode = TestRunMode::None; TestRunMode m_runMode = TestRunMode::None;

View File

@@ -17,8 +17,8 @@
#include <utils/process.h> #include <utils/process.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace Qdb::Internal { namespace Qdb::Internal {

View File

@@ -16,8 +16,8 @@
#include <utils/process.h> #include <utils/process.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace Qdb::Internal { namespace Qdb::Internal {

View File

@@ -29,6 +29,7 @@
using namespace CppEditor; using namespace CppEditor;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runcontrol", QtWarningMsg) static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runcontrol", QtWarningMsg)
@@ -183,7 +184,6 @@ void ClangToolRunWorker::start()
m_filesAnalyzed.clear(); m_filesAnalyzed.clear();
m_filesNotAnalyzed.clear(); m_filesNotAnalyzed.clear();
using namespace Tasking;
QList<TaskItem> tasks{ParallelLimit(qMax(1, m_runSettings.parallelJobs()))}; QList<TaskItem> tasks{ParallelLimit(qMax(1, m_runSettings.parallelJobs()))};
for (const AnalyzeUnit &unit : std::as_const(unitsToProcess)) { for (const AnalyzeUnit &unit : std::as_const(unitsToProcess)) {
if (!m_diagnosticConfig.isEnabled(tool) if (!m_diagnosticConfig.isEnabled(tool)

View File

@@ -15,7 +15,7 @@
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QSet> #include <QSet>
namespace Utils { class TaskTree; } namespace Tasking { class TaskTree; }
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -67,7 +67,7 @@ private:
QString m_targetTriple; QString m_targetTriple;
Utils::Id m_toolChainType; Utils::Id m_toolChainType;
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
QSet<Utils::FilePath> m_projectFiles; QSet<Utils::FilePath> m_projectFiles;
QSet<Utils::FilePath> m_filesAnalyzed; QSet<Utils::FilePath> m_filesAnalyzed;
QSet<Utils::FilePath> m_filesNotAnalyzed; QSet<Utils::FilePath> m_filesNotAnalyzed;

View File

@@ -10,7 +10,7 @@
#include <utils/environment.h> #include <utils/environment.h>
namespace Utils::Tasking { class TaskItem; } namespace Tasking { class TaskItem; }
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -50,9 +50,9 @@ struct AnalyzeOutputData
using AnalyzeSetupHandler = std::function<bool()>; using AnalyzeSetupHandler = std::function<bool()>;
using AnalyzeOutputHandler = std::function<void(const AnalyzeOutputData &)>; using AnalyzeOutputHandler = std::function<void(const AnalyzeOutputData &)>;
Utils::Tasking::TaskItem clangToolTask(const AnalyzeInputData &input, Tasking::TaskItem clangToolTask(const AnalyzeInputData &input,
const AnalyzeSetupHandler &setupHandler, const AnalyzeSetupHandler &setupHandler,
const AnalyzeOutputHandler &outputHandler); const AnalyzeOutputHandler &outputHandler);
} // namespace Internal } // namespace Internal
} // namespace ClangTools } // namespace ClangTools

View File

@@ -35,6 +35,7 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.cftr", QtWarningMsg)
using namespace Core; using namespace Core;
using namespace CppEditor; using namespace CppEditor;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace ClangTools { namespace ClangTools {
@@ -188,7 +189,6 @@ void DocumentClangToolRunner::run()
vfso().update(); vfso().update();
const ClangDiagnosticConfig config = diagnosticConfig(runSettings.diagnosticConfigId()); const ClangDiagnosticConfig config = diagnosticConfig(runSettings.diagnosticConfigId());
const Environment env = projectBuildEnvironment(project); const Environment env = projectBuildEnvironment(project);
using namespace Tasking;
QList<TaskItem> tasks{parallel}; QList<TaskItem> tasks{parallel};
const auto addClangTool = [this, &runSettings, &config, &env, &tasks](ClangToolType tool) { const auto addClangTool = [this, &runSettings, &config, &env, &tasks](ClangToolType tool) {
if (!toolEnabled(tool, config, runSettings)) if (!toolEnabled(tool, config, runSettings))

View File

@@ -14,8 +14,8 @@
#include <QTimer> #include <QTimer>
namespace Core { class IDocument; } namespace Core { class IDocument; }
namespace Tasking { class TaskTree; }
namespace TextEditor { class TextEditorWidget; } namespace TextEditor { class TextEditorWidget; }
namespace Utils { class TaskTree; }
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
@@ -51,7 +51,7 @@ private:
QList<QPointer<TextEditor::TextEditorWidget>> m_editorsWithMarkers; QList<QPointer<TextEditor::TextEditorWidget>> m_editorsWithMarkers;
SuppressedDiagnosticsList m_suppressed; SuppressedDiagnosticsList m_suppressed;
Utils::FilePath m_lastProjectDirectory; Utils::FilePath m_lastProjectDirectory;
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -27,7 +27,7 @@ ExternalToolsFilter::ExternalToolsFilter()
LocatorMatcherTasks ExternalToolsFilter::matchers() LocatorMatcherTasks ExternalToolsFilter::matchers()
{ {
using namespace Utils::Tasking; using namespace Tasking;
TreeStorage<LocatorStorage> storage; TreeStorage<LocatorStorage> storage;

View File

@@ -25,6 +25,7 @@
#include <unordered_set> #include <unordered_set>
using namespace Tasking;
using namespace Utils; using namespace Utils;
/*! /*!
@@ -243,7 +244,7 @@ private:
// When all the results are reported (the expected number of reports is set with setFilterCount()), // When all the results are reported (the expected number of reports is set with setFilterCount()),
// the ResultsCollector finishes. The intermediate results are reported with // the ResultsCollector finishes. The intermediate results are reported with
// serialOutputDataReady() signal. // serialOutputDataReady() signal.
// The object of ResultsCollector is registered in Tasking namespace with Tasking::Collector name. // The object of ResultsCollector is registered in Tasking namespace under the Collector name.
class ResultsCollector : public QObject class ResultsCollector : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -316,7 +317,7 @@ void ResultsCollector::start()
m_watcher->setFuture(Utils::asyncRun(deduplicate, m_deduplicator)); m_watcher->setFuture(Utils::asyncRun(deduplicate, m_deduplicator));
} }
class ResultsCollectorAdapter : public Tasking::TaskAdapter<ResultsCollector> class ResultsCollectorAdapter : public TaskAdapter<ResultsCollector>
{ {
public: public:
ResultsCollectorAdapter() { ResultsCollectorAdapter() {
@@ -427,8 +428,6 @@ void LocatorMatcher::start()
d->m_output = {}; d->m_output = {};
d->m_taskTree.reset(new TaskTree); d->m_taskTree.reset(new TaskTree);
using namespace Tasking;
struct CollectorStorage struct CollectorStorage
{ {
ResultsCollector *m_collector = nullptr; ResultsCollector *m_collector = nullptr;
@@ -613,7 +612,7 @@ void ILocatorFilter::prepareSearch(const QString &entry)
/*! /*!
Sets the refresh recipe for refreshing cached data. Sets the refresh recipe for refreshing cached data.
*/ */
void ILocatorFilter::setRefreshRecipe(const std::optional<Tasking::TaskItem> &recipe) void ILocatorFilter::setRefreshRecipe(const std::optional<TaskItem> &recipe)
{ {
m_refreshRecipe = recipe; m_refreshRecipe = recipe;
} }
@@ -622,7 +621,7 @@ void ILocatorFilter::setRefreshRecipe(const std::optional<Tasking::TaskItem> &re
Returns the refresh recipe for refreshing cached data. By default, the locator filter has Returns the refresh recipe for refreshing cached data. By default, the locator filter has
no recipe set, so that it won't be refreshed. no recipe set, so that it won't be refreshed.
*/ */
std::optional<Tasking::TaskItem> ILocatorFilter::refreshRecipe() const std::optional<TaskItem> ILocatorFilter::refreshRecipe() const
{ {
return m_refreshRecipe; return m_refreshRecipe;
} }
@@ -1524,8 +1523,6 @@ static void filter(QPromise<LocatorFileCachePrivate> &promise, const LocatorStor
*/ */
LocatorMatcherTask LocatorFileCache::matcher() const LocatorMatcherTask LocatorFileCache::matcher() const
{ {
using namespace Tasking;
TreeStorage<LocatorStorage> storage; TreeStorage<LocatorStorage> storage;
std::weak_ptr<LocatorFileCachePrivate> weak = d; std::weak_ptr<LocatorFileCachePrivate> weak = d;

View File

@@ -139,10 +139,10 @@ class CORE_EXPORT LocatorMatcherTask final
public: public:
// The main task. Initial data (searchTerm) should be taken from storage.input(). // The main task. Initial data (searchTerm) should be taken from storage.input().
// Results reporting is done via the storage.reportOutput(). // Results reporting is done via the storage.reportOutput().
Utils::Tasking::TaskItem task = Utils::Tasking::Group{}; Tasking::TaskItem task = Tasking::Group{};
// When constructing the task, don't place the storage inside the task above. // When constructing the task, don't place the storage inside the task above.
Utils::Tasking::TreeStorage<LocatorStorage> storage; Tasking::TreeStorage<LocatorStorage> storage;
}; };
using LocatorMatcherTasks = QList<LocatorMatcherTask>; using LocatorMatcherTasks = QList<LocatorMatcherTask>;
@@ -275,8 +275,8 @@ protected:
virtual void saveState(QJsonObject &object) const; virtual void saveState(QJsonObject &object) const;
virtual void restoreState(const QJsonObject &object); virtual void restoreState(const QJsonObject &object);
void setRefreshRecipe(const std::optional<Utils::Tasking::TaskItem> &recipe); void setRefreshRecipe(const std::optional<Tasking::TaskItem> &recipe);
std::optional<Utils::Tasking::TaskItem> refreshRecipe() const; std::optional<Tasking::TaskItem> refreshRecipe() const;
static bool isOldSetting(const QByteArray &state); static bool isOldSetting(const QByteArray &state);
@@ -295,7 +295,7 @@ private:
QString m_description; QString m_description;
QString m_defaultShortcut; QString m_defaultShortcut;
std::optional<QString> m_defaultSearchText; std::optional<QString> m_defaultSearchText;
std::optional<Utils::Tasking::TaskItem> m_refreshRecipe; std::optional<Tasking::TaskItem> m_refreshRecipe;
QKeySequence m_defaultKeySequence; QKeySequence m_defaultKeySequence;
bool m_defaultIncludedByDefault = false; bool m_defaultIncludedByDefault = false;
bool m_includedByDefault = m_defaultIncludedByDefault; bool m_includedByDefault = m_defaultIncludedByDefault;

View File

@@ -21,6 +21,7 @@
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace std::chrono_literals; using namespace std::chrono_literals;
@@ -341,7 +342,7 @@ private:
JavaScriptOutput m_output; JavaScriptOutput m_output;
}; };
class JavaScriptRequestAdapter : public Tasking::TaskAdapter<JavaScriptRequest> class JavaScriptRequestAdapter : public TaskAdapter<JavaScriptRequest>
{ {
public: public:
JavaScriptRequestAdapter() { connect(task(), &JavaScriptRequest::done, JavaScriptRequestAdapter() { connect(task(), &JavaScriptRequest::done,
@@ -366,8 +367,6 @@ JavaScriptFilter::~JavaScriptFilter() = default;
LocatorMatcherTasks JavaScriptFilter::matchers() LocatorMatcherTasks JavaScriptFilter::matchers()
{ {
using namespace Tasking;
TreeStorage<LocatorStorage> storage; TreeStorage<LocatorStorage> storage;
if (!m_javaScriptEngine) if (!m_javaScriptEngine)
m_javaScriptEngine.reset(new JavaScriptEngine); m_javaScriptEngine.reset(new JavaScriptEngine);

View File

@@ -13,7 +13,7 @@
#include <functional> #include <functional>
namespace Utils { class TaskTree; } namespace Tasking { class TaskTree; }
namespace Core { namespace Core {
namespace Internal { namespace Internal {
@@ -74,7 +74,7 @@ private:
QList<ILocatorFilter *> m_customFilters; QList<ILocatorFilter *> m_customFilters;
QMap<Utils::Id, QAction *> m_filterActionMap; QMap<Utils::Id, QAction *> m_filterActionMap;
QTimer m_refreshTimer; QTimer m_refreshTimer;
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
QList<ILocatorFilter *> m_refreshingFilters; QList<ILocatorFilter *> m_refreshingFilters;
}; };

View File

@@ -16,6 +16,7 @@
#include <QMutexLocker> #include <QMutexLocker>
#include <QRegularExpression> #include <QRegularExpression>
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace Core::Internal { namespace Core::Internal {
@@ -29,7 +30,7 @@ OpenDocumentsFilter::OpenDocumentsFilter()
setPriority(High); setPriority(High);
setDefaultIncludedByDefault(true); setDefaultIncludedByDefault(true);
// TODO: Remove the refresh recipe // TODO: Remove the refresh recipe
setRefreshRecipe(Tasking::Sync([this] { refreshInternally(); })); setRefreshRecipe(Sync([this] { refreshInternally(); }));
connect(DocumentModel::model(), &QAbstractItemModel::dataChanged, connect(DocumentModel::model(), &QAbstractItemModel::dataChanged,
this, &OpenDocumentsFilter::slotDataChanged); this, &OpenDocumentsFilter::slotDataChanged);
@@ -75,8 +76,6 @@ static void matchEditors(QPromise<void> &promise, const LocatorStorage &storage,
LocatorMatcherTasks OpenDocumentsFilter::matchers() LocatorMatcherTasks OpenDocumentsFilter::matchers()
{ {
using namespace Tasking;
TreeStorage<LocatorStorage> storage; TreeStorage<LocatorStorage> storage;
const auto onSetup = [storage](Async<void> &async) { const auto onSetup = [storage](Async<void> &async) {

View File

@@ -14,6 +14,7 @@
#include <QTimer> #include <QTimer>
using namespace Utils; using namespace Utils;
using namespace Tasking;
namespace Core { namespace Core {

View File

@@ -9,7 +9,7 @@
#include <QObject> #include <QObject>
namespace Utils { class TaskTree; } namespace Tasking { class TaskTree; }
namespace Core { namespace Core {
@@ -20,7 +20,7 @@ class CORE_EXPORT TaskProgress : public QObject
Q_OBJECT Q_OBJECT
public: public:
TaskProgress(Utils::TaskTree *taskTree); // Makes TaskProgress a child of task tree TaskProgress(Tasking::TaskTree *taskTree); // Makes TaskProgress a child of task tree
~TaskProgress() override; ~TaskProgress() override;
void setId(Utils::Id id); void setId(Utils::Id id);

View File

@@ -10,7 +10,7 @@
#include <utils/futuresynchronizer.h> #include <utils/futuresynchronizer.h>
namespace ProjectExplorer { class ExtraCompiler; } namespace ProjectExplorer { class ExtraCompiler; }
namespace Utils { class TaskTree; } namespace Tasking { class TaskTree; }
namespace CppEditor { namespace CppEditor {
@@ -44,7 +44,7 @@ public:
private: private:
Utils::FutureSynchronizer m_futureSynchronizer; Utils::FutureSynchronizer m_futureSynchronizer;
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
}; };
} // namespace CppEditor } // namespace CppEditor

View File

@@ -34,6 +34,7 @@
using namespace Core; using namespace Core;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace Debugger::Internal { namespace Debugger::Internal {
@@ -217,8 +218,6 @@ void AttachCoreDialog::accepted()
const DebuggerItem *debuggerItem = Debugger::DebuggerKitAspect::debugger(kit()); const DebuggerItem *debuggerItem = Debugger::DebuggerKitAspect::debugger(kit());
const FilePath debuggerCommand = debuggerItem->command(); const FilePath debuggerCommand = debuggerItem->command();
using namespace Tasking;
const auto copyFile = [debuggerCommand](const FilePath &srcPath) -> expected_str<FilePath> { const auto copyFile = [debuggerCommand](const FilePath &srcPath) -> expected_str<FilePath> {
if (!srcPath.isSameDevice(debuggerCommand)) { if (!srcPath.isSameDevice(debuggerCommand)) {
const expected_str<FilePath> tmpPath = debuggerCommand.tmpDir(); const expected_str<FilePath> tmpPath = debuggerCommand.tmpDir();

View File

@@ -12,6 +12,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace Core; using namespace Core;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace DiffEditor { namespace DiffEditor {

View File

@@ -61,7 +61,7 @@ signals:
protected: protected:
// Core functions: // Core functions:
void setReloadRecipe(const Utils::Tasking::Group &recipe) { m_reloadRecipe = recipe; } void setReloadRecipe(const Tasking::Group &recipe) { m_reloadRecipe = recipe; }
void setDiffFiles(const QList<FileData> &diffFileList); void setDiffFiles(const QList<FileData> &diffFileList);
// Optional: // Optional:
void setDisplayName(const QString &name) { m_displayName = name; } void setDisplayName(const QString &name) { m_displayName = name; }
@@ -74,8 +74,8 @@ private:
Internal::DiffEditorDocument *const m_document; Internal::DiffEditorDocument *const m_document;
QString m_displayName; QString m_displayName;
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
Utils::Tasking::Group m_reloadRecipe; Tasking::Group m_reloadRecipe;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(DiffEditorController::PatchOptions) Q_DECLARE_OPERATORS_FOR_FLAGS(DiffEditorController::PatchOptions)

View File

@@ -20,6 +20,7 @@
#include <set> #include <set>
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace VcsBase; using namespace VcsBase;
@@ -413,7 +414,6 @@ void BranchModel::refresh(const FilePath &workingDirectory, ShowError showError)
return; return;
} }
using namespace Tasking;
const ProcessTask topRevisionProc = const ProcessTask topRevisionProc =
d->client->topRevision(workingDirectory, d->client->topRevision(workingDirectory,
[=](const QString &ref, const QDateTime &dateTime) { [=](const QString &ref, const QDateTime &dateTime) {

View File

@@ -37,6 +37,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
using namespace Core; using namespace Core;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace VcsBase; using namespace VcsBase;
@@ -527,8 +528,6 @@ bool BranchView::reset(const QByteArray &resetType)
TaskTree *BranchView::onFastForwardMerge(const std::function<void()> &callback) TaskTree *BranchView::onFastForwardMerge(const std::function<void()> &callback)
{ {
using namespace Tasking;
const QModelIndex selected = selectedIndex(); const QModelIndex selected = selectedIndex();
QTC_CHECK(selected != m_model->currentBranch()); QTC_CHECK(selected != m_model->currentBranch());

View File

@@ -17,10 +17,11 @@ class QToolButton;
class QTreeView; class QTreeView;
QT_END_NAMESPACE; QT_END_NAMESPACE;
namespace Tasking { class TaskTree; }
namespace Utils { namespace Utils {
class ElidingLabel; class ElidingLabel;
class NavigationTreeView; class NavigationTreeView;
class TaskTree;
} // Utils } // Utils
namespace Git::Internal { namespace Git::Internal {
@@ -55,7 +56,7 @@ private:
bool remove(); bool remove();
bool rename(); bool rename();
bool reset(const QByteArray &resetType); bool reset(const QByteArray &resetType);
Utils::TaskTree *onFastForwardMerge(const std::function<void()> &callback); Tasking::TaskTree *onFastForwardMerge(const std::function<void()> &callback);
bool merge(bool allowFastForward); bool merge(bool allowFastForward);
void rebase(); void rebase();
bool cherryPick(); bool cherryPick();

View File

@@ -76,6 +76,7 @@ const char showFormatC[] =
using namespace Core; using namespace Core;
using namespace DiffEditor; using namespace DiffEditor;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace VcsBase; using namespace VcsBase;
@@ -1730,12 +1731,9 @@ bool GitClient::synchronousRevParseCmd(const FilePath &workingDirectory, const Q
} }
// Retrieve head revision // Retrieve head revision
Utils::Tasking::ProcessTask GitClient::topRevision( ProcessTask GitClient::topRevision(const FilePath &workingDirectory,
const FilePath &workingDirectory,
const std::function<void(const QString &, const QDateTime &)> &callback) const std::function<void(const QString &, const QDateTime &)> &callback)
{ {
using namespace Tasking;
const auto setupProcess = [=](Process &process) { const auto setupProcess = [=](Process &process) {
setupCommand(process, workingDirectory, {"show", "-s", "--pretty=format:%H:%ct", HEAD}); setupCommand(process, workingDirectory, {"show", "-s", "--pretty=format:%H:%ct", HEAD});
}; };

View File

@@ -242,8 +242,7 @@ public:
QString synchronousTopic(const Utils::FilePath &workingDirectory) const; QString synchronousTopic(const Utils::FilePath &workingDirectory) const;
bool synchronousRevParseCmd(const Utils::FilePath &workingDirectory, const QString &ref, bool synchronousRevParseCmd(const Utils::FilePath &workingDirectory, const QString &ref,
QString *output, QString *errorMessage = nullptr) const; QString *output, QString *errorMessage = nullptr) const;
Utils::Tasking::ProcessTask topRevision( Tasking::ProcessTask topRevision(const Utils::FilePath &workingDirectory,
const Utils::FilePath &workingDirectory,
const std::function<void(const QString &, const QDateTime &)> &callback); const std::function<void(const QString &, const QDateTime &)> &callback);
bool isRemoteCommit(const Utils::FilePath &workingDirectory, const QString &commit); bool isRemoteCommit(const Utils::FilePath &workingDirectory, const QString &commit);

View File

@@ -21,6 +21,7 @@
using namespace Core; using namespace Core;
using namespace Help; using namespace Help;
using namespace Help::Internal; using namespace Help::Internal;
using namespace Tasking;
using namespace Utils; using namespace Utils;
HelpIndexFilter::HelpIndexFilter() HelpIndexFilter::HelpIndexFilter()
@@ -30,7 +31,7 @@ HelpIndexFilter::HelpIndexFilter()
setDescription(Tr::tr("Locates help topics, for example in the Qt documentation.")); setDescription(Tr::tr("Locates help topics, for example in the Qt documentation."));
setDefaultIncludedByDefault(false); setDefaultIncludedByDefault(false);
setDefaultShortcutString("?"); setDefaultShortcutString("?");
setRefreshRecipe(Utils::Tasking::Sync([this] { invalidateCache(); })); setRefreshRecipe(Sync([this] { invalidateCache(); }));
m_icon = Utils::Icons::BOOKMARK.icon(); m_icon = Utils::Icons::BOOKMARK.icon();
connect(Core::HelpManager::Signals::instance(), &Core::HelpManager::Signals::setupFinished, connect(Core::HelpManager::Signals::instance(), &Core::HelpManager::Signals::setupFinished,
@@ -83,8 +84,6 @@ static void matches(QPromise<QStringList> &promise, const LocatorStorage &storag
LocatorMatcherTasks HelpIndexFilter::matchers() LocatorMatcherTasks HelpIndexFilter::matchers()
{ {
using namespace Tasking;
TreeStorage<LocatorStorage> storage; TreeStorage<LocatorStorage> storage;
const auto onSetup = [this, storage](Async<QStringList> &async) { const auto onSetup = [this, storage](Async<QStringList> &async) {

View File

@@ -67,7 +67,7 @@ public:
}; };
class LANGUAGECLIENT_EXPORT WorkspaceSymbolRequestTaskAdapter class LANGUAGECLIENT_EXPORT WorkspaceSymbolRequestTaskAdapter
: public Utils::Tasking::TaskAdapter<WorkspaceSymbolRequestTask> : public Tasking::TaskAdapter<WorkspaceSymbolRequestTask>
{ {
public: public:
WorkspaceSymbolRequestTaskAdapter(); WorkspaceSymbolRequestTaskAdapter();

View File

@@ -39,7 +39,7 @@ private:
}; };
class LANGUAGECLIENT_EXPORT CurrentDocumentSymbolsRequestTaskAdapter class LANGUAGECLIENT_EXPORT CurrentDocumentSymbolsRequestTaskAdapter
: public Utils::Tasking::TaskAdapter<CurrentDocumentSymbolsRequest> : public Tasking::TaskAdapter<CurrentDocumentSymbolsRequest>
{ {
public: public:
CurrentDocumentSymbolsRequestTaskAdapter(); CurrentDocumentSymbolsRequestTaskAdapter();

View File

@@ -20,6 +20,7 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -240,7 +241,7 @@ void AbstractProcessStep::setupProcess(Process *process)
}); });
} }
void AbstractProcessStep::runTaskTree(const Tasking::Group &recipe) void AbstractProcessStep::runTaskTree(const Group &recipe)
{ {
setupStreams(); setupStreams();

View File

@@ -11,9 +11,10 @@ namespace Utils {
class CommandLine; class CommandLine;
enum class ProcessResult; enum class ProcessResult;
class Process; class Process;
namespace Tasking { class Group; }
} }
namespace Tasking { class Group; }
namespace ProjectExplorer { namespace ProjectExplorer {
class ProcessParameters; class ProcessParameters;
@@ -52,7 +53,7 @@ protected:
bool checkWorkingDirectory(); bool checkWorkingDirectory();
void setupProcess(Utils::Process *process); void setupProcess(Utils::Process *process);
void runTaskTree(const Utils::Tasking::Group &recipe); void runTaskTree(const Tasking::Group &recipe);
ProcessParameters *displayedParameters() const; ProcessParameters *displayedParameters() const;
private: private:

View File

@@ -44,7 +44,7 @@ private:
}; };
class PROJECTEXPLORER_EXPORT DeviceUsedPortsGathererAdapter class PROJECTEXPLORER_EXPORT DeviceUsedPortsGathererAdapter
: public Utils::Tasking::TaskAdapter<DeviceUsedPortsGatherer> : public Tasking::TaskAdapter<DeviceUsedPortsGatherer>
{ {
public: public:
DeviceUsedPortsGathererAdapter(); DeviceUsedPortsGathererAdapter();

View File

@@ -46,7 +46,7 @@ private:
FileTransferPrivate *d; FileTransferPrivate *d;
}; };
class PROJECTEXPLORER_EXPORT FileTransferTaskAdapter : public Utils::Tasking::TaskAdapter<FileTransfer> class PROJECTEXPLORER_EXPORT FileTransferTaskAdapter : public Tasking::TaskAdapter<FileTransfer>
{ {
public: public:
FileTransferTaskAdapter(); FileTransferTaskAdapter();

View File

@@ -276,7 +276,7 @@ private:
QString m_errorString; QString m_errorString;
}; };
class PROJECTEXPLORER_EXPORT KillerAdapter : public Utils::Tasking::TaskAdapter<DeviceProcessKiller> class PROJECTEXPLORER_EXPORT KillerAdapter : public Tasking::TaskAdapter<DeviceProcessKiller>
{ {
public: public:
KillerAdapter(); KillerAdapter();

View File

@@ -24,6 +24,7 @@
#include <QTimer> #include <QTimer>
using namespace Core; using namespace Core;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -136,7 +137,7 @@ QThreadPool *ExtraCompiler::extraCompilerThreadPool()
return s_extraCompilerThreadPool(); return s_extraCompilerThreadPool();
} }
Tasking::TaskItem ExtraCompiler::compileFileItem() TaskItem ExtraCompiler::compileFileItem()
{ {
return taskItemImpl(fromFileProvider()); return taskItemImpl(fromFileProvider());
} }
@@ -325,7 +326,7 @@ ProcessExtraCompiler::ProcessExtraCompiler(const Project *project, const FilePat
ExtraCompiler(project, source, targets, parent) ExtraCompiler(project, source, targets, parent)
{ } { }
Tasking::TaskItem ProcessExtraCompiler::taskItemImpl(const ContentProvider &provider) TaskItem ProcessExtraCompiler::taskItemImpl(const ContentProvider &provider)
{ {
const auto setupTask = [=](Async<FileNameToContentsHash> &async) { const auto setupTask = [=](Async<FileNameToContentsHash> &async) {
async.setThreadPool(extraCompilerThreadPool()); async.setThreadPool(extraCompilerThreadPool());
@@ -344,7 +345,7 @@ Tasking::TaskItem ProcessExtraCompiler::taskItemImpl(const ContentProvider &prov
setContent(it.key(), it.value()); setContent(it.key(), it.value());
updateCompileTime(); updateCompileTime();
}; };
return Tasking::AsyncTask<FileNameToContentsHash>(setupTask, taskDone); return AsyncTask<FileNameToContentsHash>(setupTask, taskDone);
} }
FilePath ProcessExtraCompiler::workingDirectory() const FilePath ProcessExtraCompiler::workingDirectory() const

View File

@@ -49,7 +49,7 @@ public:
Utils::FilePaths targets() const; Utils::FilePaths targets() const;
void forEachTarget(std::function<void(const Utils::FilePath &)> func) const; void forEachTarget(std::function<void(const Utils::FilePath &)> func) const;
Utils::Tasking::TaskItem compileFileItem(); Tasking::TaskItem compileFileItem();
void compileFile(); void compileFile();
bool isDirty() const; bool isDirty() const;
void block(); void block();
@@ -75,7 +75,7 @@ private:
void compileContent(const QByteArray &content); void compileContent(const QByteArray &content);
void compileImpl(const ContentProvider &provider); void compileImpl(const ContentProvider &provider);
void compileIfDirty(); void compileIfDirty();
virtual Utils::Tasking::TaskItem taskItemImpl(const ContentProvider &provider) = 0; virtual Tasking::TaskItem taskItemImpl(const ContentProvider &provider) = 0;
const std::unique_ptr<ExtraCompilerPrivate> d; const std::unique_ptr<ExtraCompilerPrivate> d;
}; };
@@ -101,7 +101,7 @@ protected:
virtual Tasks parseIssues(const QByteArray &stdErr); virtual Tasks parseIssues(const QByteArray &stdErr);
private: private:
Utils::Tasking::TaskItem taskItemImpl(const ContentProvider &provider) final; Tasking::TaskItem taskItemImpl(const ContentProvider &provider) final;
void runInThread(QPromise<FileNameToContentsHash> &promise, void runInThread(QPromise<FileNameToContentsHash> &promise,
const Utils::FilePath &cmd, const Utils::FilePath &workDir, const Utils::FilePath &cmd, const Utils::FilePath &workDir,
const QStringList &args, const ContentProvider &provider, const QStringList &args, const ContentProvider &provider,

View File

@@ -31,8 +31,8 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace QtSupport; using namespace QtSupport;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace Qnx::Internal { namespace Qnx::Internal {

View File

@@ -31,7 +31,7 @@ Slog2InfoRunner::Slog2InfoRunner(RunControl *runControl)
void Slog2InfoRunner::start() void Slog2InfoRunner::start()
{ {
using namespace Utils::Tasking; using namespace Tasking;
QTC_CHECK(!m_taskTree); QTC_CHECK(!m_taskTree);
const auto testStartHandler = [this](Process &process) { const auto testStartHandler = [this](Process &process) {
@@ -68,7 +68,7 @@ void Slog2InfoRunner::start()
StdErrFormat); StdErrFormat);
}; };
const Tasking::Group root { const Group root {
ProcessTask(testStartHandler, testDoneHandler, testErrorHandler), ProcessTask(testStartHandler, testDoneHandler, testErrorHandler),
ProcessTask(launchTimeStartHandler, launchTimeDoneHandler), ProcessTask(launchTimeStartHandler, launchTimeDoneHandler),
ProcessTask(logStartHandler, {}, logErrorHandler) ProcessTask(logStartHandler, {}, logErrorHandler)

View File

@@ -7,7 +7,7 @@
#include <QDateTime> #include <QDateTime>
namespace Utils { class TaskTree; } namespace Tasking { class TaskTree; }
namespace Qnx::Internal { namespace Qnx::Internal {
@@ -33,7 +33,7 @@ private:
bool m_currentLogs = false; bool m_currentLogs = false;
QString m_remainingData; QString m_remainingData;
std::unique_ptr<Utils::TaskTree> m_taskTree; std::unique_ptr<Tasking::TaskTree> m_taskTree;
}; };
} // Qnx::Internal } // Qnx::Internal

View File

@@ -19,6 +19,7 @@
#include <QPointer> #include <QPointer>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
@@ -204,7 +205,7 @@ bool AbstractRemoteLinuxDeployStep::isDeploymentNecessary() const
return true; return true;
} }
Tasking::Group AbstractRemoteLinuxDeployStep::deployRecipe() Group AbstractRemoteLinuxDeployStep::deployRecipe()
{ {
return {}; return {};
} }

View File

@@ -11,8 +11,7 @@
#include <QObject> #include <QObject>
namespace ProjectExplorer { class DeployableFile; } namespace ProjectExplorer { class DeployableFile; }
namespace Tasking { class Group; }
namespace Utils::Tasking { class Group; }
namespace RemoteLinux { namespace RemoteLinux {
@@ -71,7 +70,7 @@ protected:
private: private:
virtual bool isDeploymentNecessary() const; virtual bool isDeploymentNecessary() const;
virtual Utils::Tasking::Group deployRecipe(); virtual Tasking::Group deployRecipe();
Internal::AbstractRemoteLinuxDeployStepPrivate *d; Internal::AbstractRemoteLinuxDeployStepPrivate *d;
}; };

View File

@@ -14,8 +14,8 @@
#include <utils/process.h> #include <utils/process.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace RemoteLinux::Internal { namespace RemoteLinux::Internal {

View File

@@ -22,8 +22,8 @@
#include <QDateTime> #include <QDateTime>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace RemoteLinux::Internal { namespace RemoteLinux::Internal {
@@ -68,7 +68,7 @@ public:
} }
bool isDeploymentNecessary() const final; bool isDeploymentNecessary() const final;
Utils::Tasking::Group deployRecipe() final; Group deployRecipe() final;
QDateTime timestampFromStat(const DeployableFile &file, Process *statProc); QDateTime timestampFromStat(const DeployableFile &file, Process *statProc);

View File

@@ -15,8 +15,8 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace RemoteLinux::Internal { namespace RemoteLinux::Internal {

View File

@@ -16,8 +16,8 @@
#include <utils/stringutils.h> #include <utils/stringutils.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
@@ -130,7 +130,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::unameTask() const
else else
emit q->errorMessage(Tr::tr("uname failed.") + '\n'); emit q->errorMessage(Tr::tr("uname failed.") + '\n');
}; };
return Tasking::Group { return Group {
optional, optional,
ProcessTask(setup, done, error) ProcessTask(setup, done, error)
}; };
@@ -219,7 +219,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::transferTask(FileTransferMethod method
TaskItem GenericLinuxDeviceTesterPrivate::transferTasks() const TaskItem GenericLinuxDeviceTesterPrivate::transferTasks() const
{ {
TreeStorage<TransferStorage> storage; TreeStorage<TransferStorage> storage;
return Tasking::Group { return Group {
continueOnDone, continueOnDone,
Storage(storage), Storage(storage),
transferTask(FileTransferMethod::GenericCopy, storage), transferTask(FileTransferMethod::GenericCopy, storage),
@@ -260,7 +260,7 @@ TaskItem GenericLinuxDeviceTesterPrivate::commandTasks() const
})); }));
for (const QString &commandName : commandsToTest()) for (const QString &commandName : commandsToTest())
tasks.append(commandTask(commandName)); tasks.append(commandTask(commandName));
return Tasking::Group {tasks}; return Group {tasks};
} }
} // namespace Internal } // namespace Internal

View File

@@ -7,7 +7,7 @@
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
namespace Utils::Tasking { class TaskItem; } namespace Tasking { class TaskItem; }
namespace RemoteLinux { namespace RemoteLinux {
@@ -22,7 +22,7 @@ public:
~GenericLinuxDeviceTester() override; ~GenericLinuxDeviceTester() override;
void setExtraCommandsToTest(const QStringList &extraCommands); void setExtraCommandsToTest(const QStringList &extraCommands);
void setExtraTests(const QList<Utils::Tasking::TaskItem> &extraTests); void setExtraTests(const QList<Tasking::TaskItem> &extraTests);
void testDevice(const ProjectExplorer::IDevice::Ptr &deviceConfiguration) override; void testDevice(const ProjectExplorer::IDevice::Ptr &deviceConfiguration) override;
void stopTest() override; void stopTest() override;

View File

@@ -21,8 +21,8 @@
#include <utils/tasktree.h> #include <utils/tasktree.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace RemoteLinux { namespace RemoteLinux {
@@ -35,9 +35,9 @@ public:
private: private:
bool isDeploymentNecessary() const final; bool isDeploymentNecessary() const final;
Tasking::Group deployRecipe() final; Group deployRecipe() final;
Tasking::TaskItem mkdirTask(); TaskItem mkdirTask();
Tasking::TaskItem transferTask(); TaskItem transferTask();
mutable FilesToTransfer m_files; mutable FilesToTransfer m_files;
bool m_ignoreMissingFiles = false; bool m_ignoreMissingFiles = false;

View File

@@ -16,8 +16,8 @@
#include <utils/processinterface.h> #include <utils/processinterface.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking;
namespace RemoteLinux::Internal { namespace RemoteLinux::Internal {

View File

@@ -43,6 +43,7 @@ const char InstallQtUpdates[] = "UpdateInfo.InstallQtUpdates";
const char M_MAINTENANCE_TOOL[] = "QtCreator.Menu.Tools.MaintenanceTool"; const char M_MAINTENANCE_TOOL[] = "QtCreator.Menu.Tools.MaintenanceTool";
using namespace Core; using namespace Core;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace UpdateInfo { namespace UpdateInfo {

View File

@@ -12,6 +12,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace DiffEditor; using namespace DiffEditor;
using namespace Tasking;
using namespace Utils; using namespace Utils;
namespace VcsBase { namespace VcsBase {
@@ -24,7 +25,7 @@ public:
VcsBaseDiffEditorController *q; VcsBaseDiffEditorController *q;
Environment m_processEnvironment; Environment m_processEnvironment;
FilePath m_vcsBinary; FilePath m_vcsBinary;
const Tasking::TreeStorage<QString> m_inputStorage; const TreeStorage<QString> m_inputStorage;
}; };
///////////////////// /////////////////////
@@ -39,15 +40,13 @@ VcsBaseDiffEditorController::~VcsBaseDiffEditorController()
delete d; delete d;
} }
Tasking::TreeStorage<QString> VcsBaseDiffEditorController::inputStorage() const TreeStorage<QString> VcsBaseDiffEditorController::inputStorage() const
{ {
return d->m_inputStorage; return d->m_inputStorage;
} }
Tasking::TaskItem VcsBaseDiffEditorController::postProcessTask() TaskItem VcsBaseDiffEditorController::postProcessTask()
{ {
using namespace Tasking;
const auto setupDiffProcessor = [this](Async<QList<FileData>> &async) { const auto setupDiffProcessor = [this](Async<QList<FileData>> &async) {
const QString *storage = inputStorage().activeStorage(); const QString *storage = inputStorage().activeStorage();
QTC_ASSERT(storage, qWarning("Using postProcessTask() requires putting inputStorage() " QTC_ASSERT(storage, qWarning("Using postProcessTask() requires putting inputStorage() "

View File

@@ -28,8 +28,8 @@ public:
void setVcsBinary(const Utils::FilePath &path); void setVcsBinary(const Utils::FilePath &path);
protected: protected:
Utils::Tasking::TreeStorage<QString> inputStorage() const; Tasking::TreeStorage<QString> inputStorage() const;
Utils::Tasking::TaskItem postProcessTask(); Tasking::TaskItem postProcessTask();
void setupCommand(Utils::Process &process, const QStringList &args) const; void setupCommand(Utils::Process &process, const QStringList &args) const;

View File

@@ -11,7 +11,7 @@
using namespace std::literals::chrono_literals; using namespace std::literals::chrono_literals;
using namespace Utils; using namespace Utils;
using namespace Utils::Tasking; using namespace Tasking;
using TestTask = Async<void>; using TestTask = Async<void>;
using Test = AsyncTask<void>; using Test = AsyncTask<void>;

View File

@@ -146,11 +146,12 @@ int main(int argc, char *argv[])
// Task tree creator (takes configuation from GUI) // Task tree creator (takes configuation from GUI)
using namespace Tasking;
std::unique_ptr<TaskTree> taskTree; std::unique_ptr<TaskTree> taskTree;
FutureSynchronizer synchronizer; FutureSynchronizer synchronizer;
auto treeRoot = [&] { auto treeRoot = [&] {
using namespace Tasking;
auto taskItem = [sync = &synchronizer, synchronizerCheckBox](TaskWidget *widget) { auto taskItem = [sync = &synchronizer, synchronizerCheckBox](TaskWidget *widget) {
const auto setupHandler = [=](Async<void> &task) { const auto setupHandler = [=](Async<void> &task) {

View File

@@ -60,10 +60,10 @@ public:
GroupWidget(); GroupWidget();
void setExecuteMode(ExecuteMode mode); void setExecuteMode(ExecuteMode mode);
Utils::Tasking::ParallelLimit executeMode() const; Tasking::ParallelLimit executeMode() const;
void setWorkflowPolicy(Utils::Tasking::WorkflowPolicy policy); void setWorkflowPolicy(Tasking::WorkflowPolicy policy);
Utils::Tasking::WorkflowPolicy workflowPolicy() const; Tasking::WorkflowPolicy workflowPolicy() const;
private: private:
void updateExecuteMode(); void updateExecuteMode();
@@ -73,7 +73,7 @@ private:
QComboBox *m_workflowCombo = nullptr; QComboBox *m_workflowCombo = nullptr;
ExecuteMode m_executeMode = ExecuteMode::Sequential; ExecuteMode m_executeMode = ExecuteMode::Sequential;
Utils::Tasking::WorkflowPolicy m_workflowPolicy = Utils::Tasking::WorkflowPolicy::StopOnError; Tasking::WorkflowPolicy m_workflowPolicy = Tasking::WorkflowPolicy::StopOnError;
}; };
class TaskGroup class TaskGroup