diff options
author | hjk <hjk@qt.io> | 2020-01-15 08:56:11 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-01-20 10:11:59 +0000 |
commit | 0334b6e491a3688f2455e075595afde87b8f76af (patch) | |
tree | cc63a1fae976a46ea6ddc5d2cb956d1d7ac37516 /src/plugins/projectexplorer/task.cpp | |
parent | 7e19d1af7c356dae703e110f9d24b75429ef8fb5 (diff) | |
download | qt-creator-0334b6e491a3688f2455e075595afde87b8f76af.tar.gz |
ProjectManager: Add convenience Task subclasses
For Compile, BuildSystem and Deployment. Unclutters user code and reduces
binary size.
Change-Id: Ia18e917bb411754162e9f4ec6056d752a020bb50
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/task.cpp')
-rw-r--r-- | src/plugins/projectexplorer/task.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp index d6c7ef8a1b..136d4db09a 100644 --- a/src/plugins/projectexplorer/task.cpp +++ b/src/plugins/projectexplorer/task.cpp @@ -38,8 +38,9 @@ #include <QFileInfo> #include <QTextStream> -namespace ProjectExplorer -{ +using namespace Utils; + +namespace ProjectExplorer { static QIcon taskTypeIcon(Task::TaskType t) { @@ -74,24 +75,18 @@ Task::Task(TaskType type_, const QString &description_, Task Task::compilerMissingTask() { - return Task(Task::Error, - QCoreApplication::translate("ProjectExplorer::Task", - "%1 needs a compiler set up to build. " - "Configure a compiler in the kit options.") - .arg(Core::Constants::IDE_DISPLAY_NAME), - Utils::FilePath(), -1, - Constants::TASK_CATEGORY_BUILDSYSTEM); + return BuildSystemTask(Task::Error, + tr("%1 needs a compiler set up to build. " + "Configure a compiler in the kit options.") + .arg(Core::Constants::IDE_DISPLAY_NAME)); } Task Task::buildConfigurationMissingTask() { - return Task(Task::Error, - QCoreApplication::translate("ProjectExplorer::Task", - "%1 needs a build configuration set up to build. " - "Configure a build configuration in the project settings.") - .arg(Core::Constants::IDE_DISPLAY_NAME), - Utils::FilePath(), -1, - Constants::TASK_CATEGORY_BUILDSYSTEM); + return BuildSystemTask(Task::Error, + tr("%1 needs a build configuration set up to build. " + "Configure a build configuration in the project settings.") + .arg(Core::Constants::IDE_DISPLAY_NAME)); } void Task::setMark(TextEditor::TextMark *mark) @@ -196,4 +191,22 @@ bool containsType(const Tasks &issues, Task::TaskType type) return Utils::contains(issues, [type](const Task &t) { return t.type == type; }); } +// CompilerTask + +CompileTask::CompileTask(TaskType type, const QString &desc, const FilePath &file, int line) + : Task(type, desc, file, line, ProjectExplorer::Constants::TASK_CATEGORY_COMPILE) +{} + +// BuildSystemTask + +BuildSystemTask::BuildSystemTask(Task::TaskType type, const QString &desc, const FilePath &file, int line) + : Task(type, desc, file, line, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM) +{} + +// DeploymentTask + +DeploymentTask::DeploymentTask(Task::TaskType type, const QString &desc) + : Task(type, desc, {}, -1, ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT) +{} + } // namespace ProjectExplorer |