forked from qt-creator/qt-creator
Tasks: Create a container class for category data
Reduce the number of arguments that need to be passed around. Change-Id: I9fbfdcdf7b20f8f26e35f435bf8d65ba483e4114 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -77,7 +77,7 @@ ClangCodeModelPlugin::~ClangCodeModelPlugin()
|
|||||||
|
|
||||||
void ClangCodeModelPlugin::initialize()
|
void ClangCodeModelPlugin::initialize()
|
||||||
{
|
{
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_DIAGNOSTICS, Tr::tr("Clang Code Model"));
|
TaskHub::addCategory({Constants::TASK_CATEGORY_DIAGNOSTICS, Tr::tr("Clang Code Model")});
|
||||||
CppEditor::CppModelManager::instance()->activateClangCodeModel(
|
CppEditor::CppModelManager::instance()->activateClangCodeModel(
|
||||||
std::make_unique<ClangModelManagerSupport>());
|
std::make_unique<ClangModelManagerSupport>());
|
||||||
createCompilationDBAction();
|
createCompilationDBAction();
|
||||||
|
@@ -89,7 +89,7 @@ ClangToolsPlugin::~ClangToolsPlugin()
|
|||||||
|
|
||||||
void ClangToolsPlugin::initialize()
|
void ClangToolsPlugin::initialize()
|
||||||
{
|
{
|
||||||
TaskHub::addCategory(taskCategory(), Tr::tr("Clang Tools"));
|
TaskHub::addCategory({taskCategory(), Tr::tr("Clang Tools")});
|
||||||
|
|
||||||
// Import tidy/clazy diagnostic configs from CppEditor now
|
// Import tidy/clazy diagnostic configs from CppEditor now
|
||||||
// instead of at opening time of the settings page
|
// instead of at opening time of the settings page
|
||||||
|
@@ -723,7 +723,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
|
|||||||
|
|
||||||
// Task integration.
|
// Task integration.
|
||||||
//: Category under which Analyzer tasks are listed in Issues view
|
//: Category under which Analyzer tasks are listed in Issues view
|
||||||
TaskHub::addCategory(ANALYZERTASK_ID, Tr::tr("Debugger"));
|
TaskHub::addCategory({ANALYZERTASK_ID, Tr::tr("Debugger")});
|
||||||
|
|
||||||
const Context debuggerNotRunning(C_DEBUGGER_NOTRUNNING);
|
const Context debuggerNotRunning(C_DEBUGGER_NOTRUNNING);
|
||||||
ICore::addAdditionalContext(debuggerNotRunning);
|
ICore::addAdditionalContext(debuggerNotRunning);
|
||||||
@@ -765,8 +765,8 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
|
|||||||
act->setEnabled(false);
|
act->setEnabled(false);
|
||||||
Command *cmd = ActionManager::registerAction(act, Constants::OPEN_MEMORY_EDITOR);
|
Command *cmd = ActionManager::registerAction(act, Constants::OPEN_MEMORY_EDITOR);
|
||||||
|
|
||||||
TaskHub::addCategory(TASK_CATEGORY_DEBUGGER_DEBUGINFO, Tr::tr("Debug Information"));
|
TaskHub::addCategory({TASK_CATEGORY_DEBUGGER_DEBUGINFO, Tr::tr("Debug Information")});
|
||||||
TaskHub::addCategory(TASK_CATEGORY_DEBUGGER_RUNTIME, Tr::tr("Debugger Runtime"));
|
TaskHub::addCategory({TASK_CATEGORY_DEBUGGER_RUNTIME, Tr::tr("Debugger Runtime")});
|
||||||
|
|
||||||
m_debuggerSettings.readSettings();
|
m_debuggerSettings.readSettings();
|
||||||
|
|
||||||
|
@@ -97,7 +97,7 @@ void NimPlugin::extensionsInitialized()
|
|||||||
FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_SCRIPT_MIMETYPE);
|
FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIM_SCRIPT_MIMETYPE);
|
||||||
FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIMBLE_MIMETYPE);
|
FileIconProvider::registerIconOverlayForMimeType(icon, Constants::C_NIMBLE_MIMETYPE);
|
||||||
}
|
}
|
||||||
TaskHub::addCategory(Constants::C_NIMPARSE_ID, "Nim");
|
TaskHub::addCategory({Constants::C_NIMPARSE_ID, "Nim"});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Nim
|
} // namespace Nim
|
||||||
|
@@ -291,18 +291,18 @@ BuildManager *BuildManager::instance()
|
|||||||
|
|
||||||
void BuildManager::extensionsInitialized()
|
void BuildManager::extensionsInitialized()
|
||||||
{
|
{
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_COMPILE,
|
TaskHub::addCategory({Constants::TASK_CATEGORY_COMPILE,
|
||||||
Tr::tr("Compile", "Category for compiler issues listed under 'Issues'"),
|
Tr::tr("Compile", "Category for compiler issues listed under 'Issues'"),
|
||||||
true, 100);
|
true, 100});
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_BUILDSYSTEM,
|
TaskHub::addCategory({Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||||
Tr::tr("Build System", "Category for build system issues listed under 'Issues'"),
|
Tr::tr("Build System", "Category for build system issues listed under 'Issues'"),
|
||||||
true, 100);
|
true, 100});
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_DEPLOYMENT,
|
TaskHub::addCategory({Constants::TASK_CATEGORY_DEPLOYMENT,
|
||||||
Tr::tr("Deployment", "Category for deployment issues listed under 'Issues'"),
|
Tr::tr("Deployment", "Category for deployment issues listed under 'Issues'"),
|
||||||
true, 100);
|
true, 100});
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_AUTOTEST,
|
TaskHub::addCategory({Constants::TASK_CATEGORY_AUTOTEST,
|
||||||
Tr::tr("Autotests", "Category for autotest issues listed under 'Issues'"),
|
Tr::tr("Autotests", "Category for autotest issues listed under 'Issues'"),
|
||||||
true, 100);
|
true, 100});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildManager::buildProjectWithoutDependencies(Project *project)
|
void BuildManager::buildProjectWithoutDependencies(Project *project)
|
||||||
|
@@ -2074,9 +2074,9 @@ void ProjectExplorerPlugin::extensionsInitialized()
|
|||||||
dd->m_projectFilterString = filterStrings.join(filterSeparator);
|
dd->m_projectFilterString = filterStrings.join(filterSeparator);
|
||||||
|
|
||||||
BuildManager::extensionsInitialized();
|
BuildManager::extensionsInitialized();
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_SANITIZER,
|
TaskHub::addCategory({Constants::TASK_CATEGORY_SANITIZER,
|
||||||
Tr::tr("Sanitizer", "Category for sanitizer issues listed under 'Issues'"));
|
Tr::tr("Sanitizer", "Category for sanitizer issues listed under 'Issues'")});
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_TASKLIST_ID, Tr::tr("My Tasks"));
|
TaskHub::addCategory({Constants::TASK_CATEGORY_TASKLIST_ID, Tr::tr("My Tasks")});
|
||||||
|
|
||||||
SshSettings::loadSettings(ICore::settings());
|
SshSettings::loadSettings(ICore::settings());
|
||||||
const auto searchPathRetriever = [] {
|
const auto searchPathRetriever = [] {
|
||||||
|
@@ -107,13 +107,12 @@ TaskHub::~TaskHub()
|
|||||||
m_instance = nullptr;
|
m_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskHub::addCategory(Utils::Id categoryId, const QString &displayName, bool visible,
|
void TaskHub::addCategory(const TaskCategory &category)
|
||||||
int priority)
|
|
||||||
{
|
{
|
||||||
QTC_CHECK(!displayName.isEmpty());
|
QTC_CHECK(!category.displayName.isEmpty());
|
||||||
QTC_ASSERT(!m_registeredCategories.contains(categoryId), return);
|
QTC_ASSERT(!m_registeredCategories.contains(category.id), return);
|
||||||
m_registeredCategories.push_back(categoryId);
|
m_registeredCategories.push_back(category.id);
|
||||||
emit m_instance->categoryAdded(categoryId, displayName, visible, priority);
|
emit m_instance->categoryAdded(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskHub *TaskHub::instance()
|
TaskHub *TaskHub::instance()
|
||||||
|
@@ -12,6 +12,15 @@ namespace ProjectExplorer {
|
|||||||
|
|
||||||
class ProjectExplorerPlugin;
|
class ProjectExplorerPlugin;
|
||||||
|
|
||||||
|
class PROJECTEXPLORER_EXPORT TaskCategory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Utils::Id id;
|
||||||
|
QString displayName;
|
||||||
|
bool visible = true;
|
||||||
|
int priority = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT TaskHub : public QObject
|
class PROJECTEXPLORER_EXPORT TaskHub : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -28,8 +37,7 @@ public slots:
|
|||||||
static void removeTask(const ProjectExplorer::Task &task);
|
static void removeTask(const ProjectExplorer::Task &task);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void addCategory(Utils::Id categoryId, const QString &displayName, bool visible = true,
|
static void addCategory(const TaskCategory &category);
|
||||||
int priority = 0);
|
|
||||||
static void updateTaskFileName(const Task &task, const QString &fileName);
|
static void updateTaskFileName(const Task &task, const QString &fileName);
|
||||||
static void updateTaskLineNumber(const Task &task, int line);
|
static void updateTaskLineNumber(const Task &task, int line);
|
||||||
static void taskMarkClicked(const Task &task);
|
static void taskMarkClicked(const Task &task);
|
||||||
@@ -39,8 +47,7 @@ public:
|
|||||||
static void requestPopup();
|
static void requestPopup();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void categoryAdded(Utils::Id categoryId, const QString &displayName, bool visible,
|
void categoryAdded(const TaskCategory &category);
|
||||||
int priority);
|
|
||||||
void taskAdded(const ProjectExplorer::Task &task);
|
void taskAdded(const ProjectExplorer::Task &task);
|
||||||
void taskRemoved(const ProjectExplorer::Task &task);
|
void taskRemoved(const ProjectExplorer::Task &task);
|
||||||
void tasksCleared(Utils::Id categoryId);
|
void tasksCleared(Utils::Id categoryId);
|
||||||
|
@@ -60,13 +60,13 @@ bool TaskModel::hasFile(const QModelIndex &index) const
|
|||||||
return !m_tasks.at(row).file.isEmpty();
|
return !m_tasks.at(row).file.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskModel::addCategory(Utils::Id categoryId, const QString &categoryName, int priority)
|
void TaskModel::addCategory(const TaskCategory &category)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(categoryId.isValid(), return);
|
QTC_ASSERT(category.id.isValid(), return);
|
||||||
CategoryData data;
|
CategoryData data;
|
||||||
data.displayName = categoryName;
|
data.displayName = category.displayName;
|
||||||
data.priority = priority;
|
data.priority = category.priority;
|
||||||
m_categories.insert(categoryId, data);
|
m_categories.insert(category.id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tasks TaskModel::tasks(Utils::Id categoryId) const
|
Tasks TaskModel::tasks(Utils::Id categoryId) const
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
class TaskCategory;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class TaskModel : public QAbstractItemModel
|
class TaskModel : public QAbstractItemModel
|
||||||
@@ -31,7 +33,7 @@ public:
|
|||||||
|
|
||||||
QList<Utils::Id> categoryIds() const;
|
QList<Utils::Id> categoryIds() const;
|
||||||
QString categoryDisplayName(Utils::Id categoryId) const;
|
QString categoryDisplayName(Utils::Id categoryId) const;
|
||||||
void addCategory(Utils::Id categoryId, const QString &categoryName, int priority);
|
void addCategory(const TaskCategory &category);
|
||||||
|
|
||||||
Tasks tasks(Utils::Id categoryId = Utils::Id()) const;
|
Tasks tasks(Utils::Id categoryId = Utils::Id()) const;
|
||||||
void addTask(const Task &t);
|
void addTask(const Task &t);
|
||||||
|
@@ -365,12 +365,12 @@ void TaskWindow::visibilityChanged(bool visible)
|
|||||||
delayedInitialization();
|
delayedInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskWindow::addCategory(Id categoryId, const QString &displayName, bool visible, int priority)
|
void TaskWindow::addCategory(const TaskCategory &category)
|
||||||
{
|
{
|
||||||
d->m_model->addCategory(categoryId, displayName, priority);
|
d->m_model->addCategory(category);
|
||||||
if (!visible) {
|
if (!category.visible) {
|
||||||
QList<Id> filters = d->m_filter->filteredCategories();
|
QList<Id> filters = d->m_filter->filteredCategories();
|
||||||
filters += categoryId;
|
filters += category.id;
|
||||||
d->m_filter->setFilteredCategories(filters);
|
d->m_filter->setFilteredCategories(filters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,7 @@ class QPoint;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
class TaskCategory;
|
||||||
class TaskHub;
|
class TaskHub;
|
||||||
class Task;
|
class Task;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void updateFilter() override;
|
void updateFilter() override;
|
||||||
|
|
||||||
void addCategory(Utils::Id categoryId, const QString &displayName, bool visible, int priority);
|
void addCategory(const TaskCategory &category);
|
||||||
void addTask(const ProjectExplorer::Task &task);
|
void addTask(const ProjectExplorer::Task &task);
|
||||||
void removeTask(const ProjectExplorer::Task &task);
|
void removeTask(const ProjectExplorer::Task &task);
|
||||||
void updatedTaskFileName(const Task &task, const QString &fileName);
|
void updatedTaskFileName(const Task &task, const QString &fileName);
|
||||||
|
@@ -70,7 +70,7 @@ void PythonPlugin::extensionsInitialized()
|
|||||||
::Constants::FILEOVERLAY_PY);
|
::Constants::FILEOVERLAY_PY);
|
||||||
FileIconProvider::registerIconOverlayForSuffix(imageFile, "py");
|
FileIconProvider::registerIconOverlayForSuffix(imageFile, "py");
|
||||||
|
|
||||||
TaskHub::addCategory(PythonErrorTaskCategory, "Python", true);
|
TaskHub::addCategory({PythonErrorTaskCategory, "Python", true});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Python::Internal
|
} // Python::Internal
|
||||||
|
@@ -38,8 +38,8 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
AssetExporterPlugin::AssetExporterPlugin()
|
AssetExporterPlugin::AssetExporterPlugin()
|
||||||
{
|
{
|
||||||
ProjectExplorer::TaskHub::addCategory( Constants::TASK_CATEGORY_ASSET_EXPORT,
|
ProjectExplorer::TaskHub::addCategory({Constants::TASK_CATEGORY_ASSET_EXPORT,
|
||||||
tr("Asset Export"), false);
|
tr("Asset Export"), false});
|
||||||
|
|
||||||
auto *designerPlugin = QmlDesigner::QmlDesignerPlugin::instance();
|
auto *designerPlugin = QmlDesigner::QmlDesignerPlugin::instance();
|
||||||
auto &viewManager = designerPlugin->viewManager();
|
auto &viewManager = designerPlugin->viewManager();
|
||||||
|
@@ -205,8 +205,8 @@ void QmlJSEditorPlugin::extensionsInitialized()
|
|||||||
FileIconProvider::registerIconOverlayForMimeType(ProjectExplorer::Constants::FILEOVERLAY_UI,
|
FileIconProvider::registerIconOverlayForMimeType(ProjectExplorer::Constants::FILEOVERLAY_UI,
|
||||||
"application/x-qt.ui+qml");
|
"application/x-qt.ui+qml");
|
||||||
|
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_QML, Tr::tr("QML"));
|
TaskHub::addCategory({Constants::TASK_CATEGORY_QML, Tr::tr("QML")});
|
||||||
TaskHub::addCategory(Constants::TASK_CATEGORY_QML_ANALYSIS, Tr::tr("QML Analysis"), false);
|
TaskHub::addCategory({Constants::TASK_CATEGORY_QML_ANALYSIS, Tr::tr("QML Analysis"), false});
|
||||||
QmllsSettingsManager::instance()->setupAutoupdate();
|
QmllsSettingsManager::instance()->setupAutoupdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user