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) ...@@ -59,18 +59,19 @@ static Core::Id categoryForType(Task::TaskType type)
class TaskMark : public TextEditor::TextMark class TaskMark : public TextEditor::TextMark
{ {
public: public:
TaskMark(unsigned int id, const QString &fileName, int lineNumber, TaskMark(const Task &task) :
Task::TaskType type, bool visible) : TextMark(task.file.toString(), task.line, categoryForType(task.type)),
TextMark(fileName, lineNumber, categoryForType(type)), m_id(task.taskId)
m_id(id)
{ {
setColor(type == Task::Error ? Utils::Theme::ProjectExplorer_TaskError_TextMarkColor setColor(task.type == Task::Error ? Utils::Theme::ProjectExplorer_TaskError_TextMarkColor
: Utils::Theme::ProjectExplorer_TaskWarn_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")); : QApplication::translate("TaskHub", "Warning"));
setPriority(type == Task::Error ? TextEditor::TextMark::NormalPriority setPriority(task.type == Task::Error ? TextEditor::TextMark::NormalPriority
: TextEditor::TextMark::LowPriority); : TextEditor::TextMark::LowPriority);
setVisible(visible); setToolTip(task.description);
setIcon(task.icon);
setVisible(!task.icon.isNull());
} }
bool isClickable() const; bool isClickable() const;
...@@ -151,12 +152,8 @@ void TaskHub::addTask(Task task) ...@@ -151,12 +152,8 @@ void TaskHub::addTask(Task task)
task.line = -1; task.line = -1;
task.movedLine = task.line; task.movedLine = task.line;
if (task.line != -1) { if (task.line != -1)
auto mark = new TaskMark(task.taskId, task.file.toString(), task.line, task.type, !task.icon.isNull()); task.setMark(new TaskMark(task));
mark->setToolTip(task.description);
mark->setIcon(task.icon);
task.setMark(mark);
}
emit m_instance->taskAdded(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