Commit 0332a8c1 authored by David Schulz's avatar David Schulz
Browse files

ProjectExplorer: Simplify TaskMark constructor



Change-Id: I8ba0e8451772eff605961e0d9aff15f535c12566
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 8db91e82
......@@ -59,18 +59,19 @@ static Core::Id categoryForType(Task::TaskType type)
class TaskMark : public TextEditor::TextMark
{
public:
TaskMark(unsigned int id, const QString &fileName, int lineNumber,
Task::TaskType type, bool visible) :
TextMark(fileName, lineNumber, categoryForType(type)),
m_id(id)
TaskMark(const Task &task) :
TextMark(task.file.toString(), task.line, categoryForType(task.type)),
m_id(task.taskId)
{
setColor(type == Task::Error ? Utils::Theme::ProjectExplorer_TaskError_TextMarkColor
setColor(task.type == Task::Error ? Utils::Theme::ProjectExplorer_TaskError_TextMarkColor
: Utils::Theme::ProjectExplorer_TaskWarn_TextMarkColor);
setDefaultToolTip(type == Task::Error ? QApplication::translate("TaskHub", "Error")
setDefaultToolTip(task.type == Task::Error ? QApplication::translate("TaskHub", "Error")
: QApplication::translate("TaskHub", "Warning"));
setPriority(type == Task::Error ? TextEditor::TextMark::NormalPriority
setPriority(task.type == Task::Error ? TextEditor::TextMark::NormalPriority
: TextEditor::TextMark::LowPriority);
setVisible(visible);
setToolTip(task.description);
setIcon(task.icon);
setVisible(!task.icon.isNull());
}
bool isClickable() const;
......@@ -151,12 +152,8 @@ void TaskHub::addTask(Task task)
task.line = -1;
task.movedLine = task.line;
if (task.line != -1) {
auto mark = new TaskMark(task.taskId, task.file.toString(), task.line, task.type, !task.icon.isNull());
mark->setToolTip(task.description);
mark->setIcon(task.icon);
task.setMark(mark);
}
if (task.line != -1)
task.setMark(new TaskMark(task));
emit m_instance->taskAdded(task);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment