2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-06-16 14:12:30 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2010-06-16 14:12:30 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-06-16 14:12:30 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2010-06-16 14:12:30 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-06-16 14:12:30 +02:00
|
|
|
|
|
|
|
|
#include "task.h"
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer
|
|
|
|
|
{
|
|
|
|
|
|
2010-08-04 14:56:32 +02:00
|
|
|
unsigned int Task::s_nextId = 1;
|
2010-06-30 16:37:07 +02:00
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::Task
|
|
|
|
|
\brief Build issue (warning or error).
|
|
|
|
|
\sa ProjectExplorer::TaskHub
|
|
|
|
|
*/
|
|
|
|
|
|
2010-08-04 14:56:32 +02:00
|
|
|
Task::Task() : taskId(0), type(Unknown), line(-1)
|
|
|
|
|
{ }
|
2010-06-24 16:17:11 +02:00
|
|
|
|
|
|
|
|
Task::Task(TaskType type_, const QString &description_,
|
2012-01-26 13:38:25 +01:00
|
|
|
const Utils::FileName &file_, int line_, const Core::Id &category_) :
|
|
|
|
|
taskId(s_nextId), type(type_), description(description_),
|
2012-02-03 16:07:13 +01:00
|
|
|
file(file_), line(line_), movedLine(line_), category(category_)
|
2010-06-24 16:14:29 +02:00
|
|
|
{
|
2010-06-30 16:37:07 +02:00
|
|
|
++s_nextId;
|
2010-06-24 16:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-03 16:07:13 +01:00
|
|
|
void Task::addMark(TextEditor::BaseTextMark *mark)
|
|
|
|
|
{
|
|
|
|
|
m_mark = QSharedPointer<TextEditor::BaseTextMark>(mark);
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-04 14:56:32 +02:00
|
|
|
bool Task::isNull() const
|
|
|
|
|
{ return taskId == 0; }
|
|
|
|
|
|
2013-05-03 15:58:01 +02:00
|
|
|
void Task::clear()
|
|
|
|
|
{
|
|
|
|
|
taskId = 0;
|
|
|
|
|
description.clear();
|
|
|
|
|
file = Utils::FileName();
|
|
|
|
|
line = -1;
|
|
|
|
|
movedLine = -1;
|
|
|
|
|
category = Core::Id();
|
|
|
|
|
type = Task::Unknown;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 14:12:30 +02:00
|
|
|
//
|
|
|
|
|
// functions
|
|
|
|
|
//
|
|
|
|
|
bool operator==(const Task &t1, const Task &t2)
|
|
|
|
|
{
|
2010-06-30 16:37:07 +02:00
|
|
|
return t1.taskId == t2.taskId;
|
2010-06-16 14:12:30 +02:00
|
|
|
}
|
|
|
|
|
|
2011-05-12 11:51:17 +02:00
|
|
|
bool operator<(const Task &a, const Task &b)
|
|
|
|
|
{
|
|
|
|
|
if (a.type != b.type) {
|
|
|
|
|
if (a.type == ProjectExplorer::Task::Error)
|
|
|
|
|
return true;
|
|
|
|
|
if (b.type == ProjectExplorer::Task::Error)
|
|
|
|
|
return false;
|
|
|
|
|
if (a.type == ProjectExplorer::Task::Warning)
|
|
|
|
|
return true;
|
|
|
|
|
if (b.type == ProjectExplorer::Task::Warning)
|
|
|
|
|
return false;
|
|
|
|
|
// Can't happen
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
2012-01-26 13:38:25 +01:00
|
|
|
if (a.category.uniqueIdentifier() < b.category.uniqueIdentifier())
|
2011-05-12 11:51:17 +02:00
|
|
|
return true;
|
2012-01-26 13:38:25 +01:00
|
|
|
if (b.category.uniqueIdentifier() < a.category.uniqueIdentifier())
|
2011-05-12 11:51:17 +02:00
|
|
|
return false;
|
|
|
|
|
return a.taskId < b.taskId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-06-16 14:12:30 +02:00
|
|
|
uint qHash(const Task &task)
|
|
|
|
|
{
|
2010-06-30 16:37:07 +02:00
|
|
|
return task.taskId;
|
2010-06-16 14:12:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace ProjectExplorer
|