Commit bf5c9902 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Move ProjectExplorer::Task into its own file

parent fef02649
......@@ -31,7 +31,7 @@
#define BUILDMANAGER_H
#include "projectexplorer_export.h"
#include "taskwindow.h"
#include "task.h"
#include <QtCore/QObject>
#include <QtCore/QStringList>
......@@ -50,6 +50,7 @@ class BuildStep;
class Project;
class ProjectExplorerPlugin;
class BuildConfiguration;
class TaskWindow;
class PROJECTEXPLORER_EXPORT BuildManager
: public QObject
......
......@@ -32,7 +32,7 @@
#include "projectconfiguration.h"
#include "projectexplorer_export.h"
#include "taskwindow.h"
#include "task.h"
#include <QtCore/QFutureInterface>
#include <QtGui/QWidget>
......
......@@ -31,7 +31,7 @@
#define IOUTPUTPARSER_H
#include "projectexplorer_export.h"
#include "taskwindow.h"
#include "task.h"
#include <QtCore/QObject>
#include <QtCore/QString>
......
......@@ -16,6 +16,7 @@ HEADERS += projectexplorer.h \
compileoutputwindow.h \
target.h \
targetsettingspanel.h \
task.h \
taskwindow.h \
outputwindow.h \
persistentsettings.h \
......@@ -93,6 +94,7 @@ SOURCES += projectexplorer.cpp \
ioutputparser.cpp \
projectconfiguration.cpp \
gnumakeparser.cpp \
task.cpp \
taskwindow.cpp \
outputwindow.cpp \
persistentsettings.cpp \
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "task.h"
namespace ProjectExplorer
{
//
// functions
//
bool operator==(const Task &t1, const Task &t2)
{
return t1.type == t2.type
&& t1.line == t2.line
&& t1.description == t2.description
&& t1.file == t2.file
&& t1.category == t2.category;
}
uint qHash(const Task &task)
{
return qHash(task.file) + task.line;
}
} // namespace ProjectExplorer
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef PROJECTEXPLORER_TASK_H
#define PROJECTEXPLORER_TASK_H
#include "projectexplorer_export.h"
#include <QtCore/QMetaType>
#include <QtGui/QTextLayout>
namespace ProjectExplorer {
// Build issue (warning or error).
struct PROJECTEXPLORER_EXPORT Task {
enum TaskType {
Unknown,
Error,
Warning
};
Task() : type(Unknown), line(-1)
{ }
Task(TaskType type_, const QString &description_,
const QString &file_, int line_, const QString &category_) :
type(type_), description(description_), file(file_), line(line_), category(category_)
{ }
Task(const Task &source) :
type(source.type), description(source.description), file(source.file),
line(source.line), category(source.category), formats(source.formats)
{ }
~Task()
{ }
TaskType type;
QString description;
QString file;
int line;
QString category;
// Having a QList<QTextLayout::FormatRange> in Task isn't that great
// It would be cleaner to split up the text into
// the logical hunks and then assemble them again
// (That is different consumers of tasks could show them in
// different ways!)
// But then again, the wording of the text most likely
// doesn't work if you split it up, nor are our parsers
// anywhere near being that good
QList<QTextLayout::FormatRange> formats;
};
bool operator==(const Task &t1, const Task &t2);
uint qHash(const Task &task);
} //namespace ProjectExplorer
Q_DECLARE_METATYPE(ProjectExplorer::Task)
Q_DECLARE_METATYPE(QList<ProjectExplorer::Task>)
#endif // PROJECTEXPLORER_TASK_H
......@@ -29,6 +29,8 @@
#include "taskwindow.h"
#include "task.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/vcsmanager.h>
......@@ -59,7 +61,6 @@ const int TASK_ICON_MARGIN = 2;
}
namespace ProjectExplorer {
namespace Internal {
class TaskView : public QListView
......@@ -818,9 +819,9 @@ void TaskWindow::updateActions()
d->m_copyAction->setEnabled(d->m_model->tasks().count() > 0);
}
QIcon TaskWindow::taskTypeIcon(Task::TaskType t) const
QIcon TaskWindow::taskTypeIcon(int t) const
{
return d->m_model->taskTypeIcon(t);
return d->m_model->taskTypeIcon(static_cast<Task::TaskType>(t));
}
namespace Internal {
......@@ -1016,23 +1017,6 @@ QWidget *TaskWindowContext::widget()
} // namespace Internal
//
// functions
//
bool operator==(const Task &t1, const Task &t2)
{
return t1.type == t2.type
&& t1.line == t2.line
&& t1.description == t2.description
&& t1.file == t2.file
&& t1.category == t2.category;
}
uint qHash(const Task &task)
{
return qHash(task.file) + task.line;
}
} // namespace ProjectExplorer
#include "taskwindow.moc"
......@@ -34,52 +34,17 @@
#include <coreplugin/ioutputpane.h>
#include <QtGui/QTextLayout>
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
class QAction;
class QModelIndex;
QT_END_NAMESPACE
namespace ProjectExplorer {
struct Task;
struct TaskWindowPrivate;
// Build issue (warning or error).
struct PROJECTEXPLORER_EXPORT Task {
enum TaskType {
Unknown,
Error,
Warning
};
Task() : type(Unknown), line(-1)
{ }
Task(TaskType type_, const QString &description_,
const QString &file_, int line_, const QString &category_) :
type(type_), description(description_), file(file_), line(line_), category(category_)
{ }
Task(const Task &source) :
type(source.type), description(source.description), file(source.file),
line(source.line), category(source.category), formats(source.formats)
{ }
~Task()
{ }
TaskType type;
QString description;
QString file;
int line;
QString category;
// Having a QList<QTextLayout::FormatRange> in Task isn't that great
// It would be cleaner to split up the text into
// the logical hunks and then assemble them again
// (That is different consumers of tasks could show them in
// different ways!)
// But then again, the wording of the text most likely
// doesn't work if you split it up, nor are our parsers
// anywhere near being that good
QList<QTextLayout::FormatRange> formats;
};
struct TaskWindowPrivate;
// Show build issues (warnings or errors) and open the editor on click.
......@@ -119,7 +84,7 @@ public:
void goToNext();
void goToPrev();
QIcon taskTypeIcon(Task::TaskType t) const;
QIcon taskTypeIcon(int t) const;
signals:
void tasksChanged();
......@@ -139,12 +104,6 @@ private:
TaskWindowPrivate *d;
};
bool operator==(const Task &t1, const Task &t2);
uint qHash(const Task &task);
} //namespace ProjectExplorer
Q_DECLARE_METATYPE(ProjectExplorer::Task)
Q_DECLARE_METATYPE(QList<ProjectExplorer::Task>)
#endif // TASKWINDOW_H
......@@ -31,6 +31,7 @@
#include "qmlprojectconstants.h"
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/taskwindow.h>
#include <QDebug>
......
......@@ -30,12 +30,17 @@
#ifndef QMLTASKMANAGER_H
#define QMLTASKMANAGER_H
#include <projectexplorer/taskwindow.h>
#include <projectexplorer/task.h>
#include <qmljs/qmljsdocument.h>
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtCore/QSet>
#include <QtCore/QMap>
#include <QtCore/QString>
namespace ProjectExplorer {
class TaskWindow;
} // namespace ProjectExplorer
namespace QmlProjectManager {
namespace Internal {
......
......@@ -35,8 +35,9 @@
#include "qt4projectmanagerconstants.h"
#include "qt4target.h"
#include <utils/qtcassert.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/task.h>
#include <utils/qtcassert.h>
#include <QtGui/QFileDialog>
#include <QtGui/QHeaderView>
......
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