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 <QCoreApplication>
namespace Utils {
static int s_maxThreadCount = INT_MAX;

View File

@@ -211,4 +211,4 @@ public:
} // 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"
namespace Utils {
namespace Tasking {
void Barrier::setLimit(int value)
{
@@ -44,4 +44,4 @@ void Barrier::stopWithResult(bool success)
emit done(success);
}
} // namespace Utils
} // namespace Tasking

View File

@@ -7,7 +7,7 @@
#include "tasktree.h"
namespace Utils {
namespace Tasking {
class QTCREATOR_UTILS_EXPORT Barrier final : public QObject
{
@@ -41,11 +41,11 @@ public:
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>
class SharedBarrier
@@ -94,4 +94,4 @@ public:
}) {}
};
} // namespace Utils::Tasking
} // namespace Tasking

View File

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

View File

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

View File

@@ -7,6 +7,8 @@
#include <QSet>
namespace Tasking {
class Guard
{
Q_DISABLE_COPY(Guard)
@@ -29,9 +31,6 @@ private:
Guard &m_guard;
};
namespace Utils {
namespace Tasking {
static TaskAction toTaskAction(bool success)
{
return success ? TaskAction::StopWithDone : TaskAction::StopWithError;
@@ -191,10 +190,6 @@ void TaskItem::setTaskErrorHandler(const TaskEndHandler &handler)
m_taskHandler.m_errorHandler = handler;
}
} // namespace Tasking
using namespace Tasking;
class TaskTreePrivate;
class TaskNode;
@@ -686,8 +681,8 @@ void TaskNode::invokeEndHandler(bool success)
}
/*!
\class Utils::TaskTree
\inheaderfile utils/tasktree.h
\class TaskTree
\inheaderfile solutions/tasking/tasktree.h
\inmodule QtCreator
\ingroup mainclasses
\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>:
\code
using namespace Utils;
using namespace Tasking;
const Group root {
@@ -1285,7 +1279,7 @@ void TaskNode::invokeEndHandler(bool success)
recipe described by the Group root element.
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.
TaskTree reports progress of completed tasks when running. The progress value
@@ -1344,7 +1338,7 @@ void TaskNode::invokeEndHandler(bool success)
asynchronous task:
\code
class TimeoutAdapter : public Utils::Tasking::TaskAdapter<QTimer>
class TimeoutAdapter : public Tasking::TaskAdapter<QTimer>
{
public:
TimeoutAdapter() {
@@ -1372,7 +1366,7 @@ void TaskNode::invokeEndHandler(bool success)
To make QTimer accessible inside TaskTree under the \e Timeout name,
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:
@@ -1416,7 +1410,7 @@ TaskTree::~TaskTree()
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(!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;
}
void TaskTree::setupStorageHandler(const Tasking::TreeStorageBase &storage,
void TaskTree::setupStorageHandler(const TreeStorageBase &storage,
StorageVoidHandler setupHandler,
StorageVoidHandler doneHandler)
{
@@ -1487,4 +1481,4 @@ void TaskTreeTaskAdapter::start()
task()->start();
}
} // namespace Utils
} // namespace Tasking

View File

@@ -9,15 +9,13 @@
#include <QObject>
#include <QSharedPointer>
namespace Utils {
namespace Tasking {
class ExecutionContextActivator;
class TaskContainer;
class TaskNode;
class TaskTreePrivate;
namespace Tasking {
class QTCREATOR_UTILS_EXPORT TaskInterface : public QObject
{
Q_OBJECT
@@ -354,8 +352,6 @@ private:
};
};
} // namespace Tasking
class TaskTreePrivate;
class QTCREATOR_UTILS_EXPORT TaskTree final : public QObject
@@ -364,10 +360,10 @@ class QTCREATOR_UTILS_EXPORT TaskTree final : public QObject
public:
TaskTree();
TaskTree(const Tasking::Group &root);
TaskTree(const Group &root);
~TaskTree();
void setupRoot(const Tasking::Group &root);
void setupRoot(const Group &root);
void start();
void stop();
@@ -378,14 +374,12 @@ public:
int progressValue() const; // all finished / skipped / stopped tasks, groups itself excluded
template <typename StorageStruct, typename StorageHandler>
void onStorageSetup(const Tasking::TreeStorage<StorageStruct> &storage,
StorageHandler &&handler) {
void onStorageSetup(const TreeStorage<StorageStruct> &storage, StorageHandler &&handler) {
setupStorageHandler(storage,
wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler)), {});
}
template <typename StorageStruct, typename StorageHandler>
void onStorageDone(const Tasking::TreeStorage<StorageStruct> &storage,
StorageHandler &&handler) {
void onStorageDone(const TreeStorage<StorageStruct> &storage, StorageHandler &&handler) {
setupStorageHandler(storage,
{}, wrapHandler<StorageStruct>(std::forward<StorageHandler>(handler)));
}
@@ -398,7 +392,7 @@ signals:
private:
using StorageVoidHandler = std::function<void(void *)>;
void setupStorageHandler(const Tasking::TreeStorageBase &storage,
void setupStorageHandler(const TreeStorageBase &storage,
StorageVoidHandler setupHandler,
StorageVoidHandler doneHandler);
template <typename StorageStruct, typename StorageHandler>
@@ -413,22 +407,22 @@ private:
TaskTreePrivate *d;
};
class QTCREATOR_UTILS_EXPORT TaskTreeTaskAdapter : public Tasking::TaskAdapter<TaskTree>
class QTCREATOR_UTILS_EXPORT TaskTreeTaskAdapter : public TaskAdapter<TaskTree>
{
public:
TaskTreeTaskAdapter();
void start() final;
};
} // namespace Utils
} // namespace Tasking
#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)\
namespace Utils::Tasking {\
namespace Tasking {\
template <typename ...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
namespace ProjectExplorer { class Project; }
namespace Utils { class TaskTree; }
namespace Tasking { class TaskTree; }
namespace Autotest {
namespace Internal {
@@ -95,7 +95,7 @@ private:
QTimer m_reparseTimer;
QSet<ITestParser *> m_updateParsers;
Utils::FutureSynchronizer m_futureSynchronizer;
std::unique_ptr<Utils::TaskTree> m_taskTree;
std::unique_ptr<Tasking::TaskTree> m_taskTree;
QHash<Utils::FilePath, int> m_qmlEditorRev;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -15,7 +15,7 @@
#include <QElapsedTimer>
#include <QSet>
namespace Utils { class TaskTree; }
namespace Tasking { class TaskTree; }
namespace ClangTools {
namespace Internal {
@@ -67,7 +67,7 @@ private:
QString m_targetTriple;
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_filesAnalyzed;
QSet<Utils::FilePath> m_filesNotAnalyzed;

View File

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

View File

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

View File

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

View File

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

View File

@@ -25,6 +25,7 @@
#include <unordered_set>
using namespace Tasking;
using namespace Utils;
/*!
@@ -243,7 +244,7 @@ private:
// When all the results are reported (the expected number of reports is set with setFilterCount()),
// the ResultsCollector finishes. The intermediate results are reported with
// 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
{
Q_OBJECT
@@ -316,7 +317,7 @@ void ResultsCollector::start()
m_watcher->setFuture(Utils::asyncRun(deduplicate, m_deduplicator));
}
class ResultsCollectorAdapter : public Tasking::TaskAdapter<ResultsCollector>
class ResultsCollectorAdapter : public TaskAdapter<ResultsCollector>
{
public:
ResultsCollectorAdapter() {
@@ -427,8 +428,6 @@ void LocatorMatcher::start()
d->m_output = {};
d->m_taskTree.reset(new TaskTree);
using namespace Tasking;
struct CollectorStorage
{
ResultsCollector *m_collector = nullptr;
@@ -613,7 +612,7 @@ void ILocatorFilter::prepareSearch(const QString &entry)
/*!
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;
}
@@ -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
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;
}
@@ -1524,8 +1523,6 @@ static void filter(QPromise<LocatorFileCachePrivate> &promise, const LocatorStor
*/
LocatorMatcherTask LocatorFileCache::matcher() const
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
std::weak_ptr<LocatorFileCachePrivate> weak = d;

View File

@@ -139,10 +139,10 @@ class CORE_EXPORT LocatorMatcherTask final
public:
// The main task. Initial data (searchTerm) should be taken from storage.input().
// 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.
Utils::Tasking::TreeStorage<LocatorStorage> storage;
Tasking::TreeStorage<LocatorStorage> storage;
};
using LocatorMatcherTasks = QList<LocatorMatcherTask>;
@@ -275,8 +275,8 @@ protected:
virtual void saveState(QJsonObject &object) const;
virtual void restoreState(const QJsonObject &object);
void setRefreshRecipe(const std::optional<Utils::Tasking::TaskItem> &recipe);
std::optional<Utils::Tasking::TaskItem> refreshRecipe() const;
void setRefreshRecipe(const std::optional<Tasking::TaskItem> &recipe);
std::optional<Tasking::TaskItem> refreshRecipe() const;
static bool isOldSetting(const QByteArray &state);
@@ -295,7 +295,7 @@ private:
QString m_description;
QString m_defaultShortcut;
std::optional<QString> m_defaultSearchText;
std::optional<Utils::Tasking::TaskItem> m_refreshRecipe;
std::optional<Tasking::TaskItem> m_refreshRecipe;
QKeySequence m_defaultKeySequence;
bool m_defaultIncludedByDefault = false;
bool m_includedByDefault = m_defaultIncludedByDefault;

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,7 @@
#include <QObject>
namespace Utils { class TaskTree; }
namespace Tasking { class TaskTree; }
namespace Core {
@@ -20,7 +20,7 @@ class CORE_EXPORT TaskProgress : public QObject
Q_OBJECT
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;
void setId(Utils::Id id);

View File

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

View File

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

View File

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

View File

@@ -61,7 +61,7 @@ signals:
protected:
// 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);
// Optional:
void setDisplayName(const QString &name) { m_displayName = name; }
@@ -74,8 +74,8 @@ private:
Internal::DiffEditorDocument *const m_document;
QString m_displayName;
std::unique_ptr<Utils::TaskTree> m_taskTree;
Utils::Tasking::Group m_reloadRecipe;
std::unique_ptr<Tasking::TaskTree> m_taskTree;
Tasking::Group m_reloadRecipe;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(DiffEditorController::PatchOptions)

View File

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

View File

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

View File

@@ -17,10 +17,11 @@ class QToolButton;
class QTreeView;
QT_END_NAMESPACE;
namespace Tasking { class TaskTree; }
namespace Utils {
class ElidingLabel;
class NavigationTreeView;
class TaskTree;
} // Utils
namespace Git::Internal {
@@ -55,7 +56,7 @@ private:
bool remove();
bool rename();
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);
void rebase();
bool cherryPick();

View File

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

View File

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

View File

@@ -21,6 +21,7 @@
using namespace Core;
using namespace Help;
using namespace Help::Internal;
using namespace Tasking;
using namespace Utils;
HelpIndexFilter::HelpIndexFilter()
@@ -30,7 +31,7 @@ HelpIndexFilter::HelpIndexFilter()
setDescription(Tr::tr("Locates help topics, for example in the Qt documentation."));
setDefaultIncludedByDefault(false);
setDefaultShortcutString("?");
setRefreshRecipe(Utils::Tasking::Sync([this] { invalidateCache(); }));
setRefreshRecipe(Sync([this] { invalidateCache(); }));
m_icon = Utils::Icons::BOOKMARK.icon();
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()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
const auto onSetup = [this, storage](Async<QStringList> &async) {

View File

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

View File

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

View File

@@ -20,6 +20,7 @@
#include <algorithm>
#include <memory>
using namespace Tasking;
using namespace Utils;
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();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
#include <projectexplorer/devicesupport/idevice.h>
namespace Utils::Tasking { class TaskItem; }
namespace Tasking { class TaskItem; }
namespace RemoteLinux {
@@ -22,7 +22,7 @@ public:
~GenericLinuxDeviceTester() override;
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 stopTest() override;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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