forked from qt-creator/qt-creator
ProjectExplorer: Rename Task::addMark to setMark and make it private
Make TaskHub a friend of Task so that it can still use the method. This should stop anyone from accidentally calling that. Change-Id: I36974d0ba874f0cac59b7c57ed667ce2e75e1d4c Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -83,10 +83,10 @@ Task Task::buildConfigurationMissingTask()
|
||||
Constants::TASK_CATEGORY_BUILDSYSTEM);
|
||||
}
|
||||
|
||||
void Task::addMark(TextEditor::TextMark *mark)
|
||||
void Task::setMark(TextEditor::TextMark *mark)
|
||||
{
|
||||
QTC_ASSERT(mark, return);
|
||||
QTC_ASSERT(m_mark.isNull(), return);
|
||||
|
||||
m_mark = QSharedPointer<TextEditor::TextMark>(mark);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class TaskHub;
|
||||
|
||||
// Documentation inside.
|
||||
class PROJECTEXPLORER_EXPORT Task
|
||||
{
|
||||
@@ -66,7 +68,6 @@ public:
|
||||
int movedLine = -1; // contains a line number if the line was moved in the editor
|
||||
Core::Id category;
|
||||
QIcon icon;
|
||||
void addMark(TextEditor::TextMark *mark);
|
||||
|
||||
// Having a QList<QTextLayout::FormatRange> in Task isn't that great
|
||||
// It would be cleaner to split up the text into
|
||||
@@ -79,8 +80,12 @@ public:
|
||||
QList<QTextLayout::FormatRange> formats;
|
||||
|
||||
private:
|
||||
void setMark(TextEditor::TextMark *mark);
|
||||
|
||||
QSharedPointer<TextEditor::TextMark> m_mark;
|
||||
static unsigned int s_nextId;
|
||||
|
||||
friend class TaskHub;
|
||||
};
|
||||
|
||||
bool PROJECTEXPLORER_EXPORT operator==(const Task &t1, const Task &t2);
|
||||
|
||||
@@ -134,6 +134,8 @@ void TaskHub::addTask(Task task)
|
||||
{
|
||||
QTC_ASSERT(m_registeredCategories.contains(task.category), return);
|
||||
QTC_ASSERT(!task.description.isEmpty(), return);
|
||||
QTC_ASSERT(!task.isNull(), return);
|
||||
QTC_ASSERT(task.m_mark.isNull(), return);
|
||||
|
||||
if (task.file.isEmpty())
|
||||
task.line = -1;
|
||||
@@ -146,7 +148,7 @@ void TaskHub::addTask(Task task)
|
||||
auto mark = new TaskMark(task.taskId, task.file.toString(), task.line, task.type, !task.icon.isNull());
|
||||
mark->setIcon(task.icon);
|
||||
mark->setPriority(TextEditor::TextMark::LowPriority);
|
||||
task.addMark(mark);
|
||||
task.setMark(mark);
|
||||
}
|
||||
emit m_instance->taskAdded(task);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user