1
/**************************************************************************
3
** This file is part of Qt Creator
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7
** Contact: Nokia Corporation (info@qt.nokia.com)
10
** GNU Lesser General Public License Usage
12
** This file may be used under the terms of the GNU Lesser General Public
13
** License version 2.1 as published by the Free Software Foundation and
14
** appearing in the file LICENSE.LGPL included in the packaging of this file.
15
** Please review the following information to ensure the GNU Lesser General
16
** Public License version 2.1 requirements will be met:
17
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19
** In addition, as a special exception, Nokia gives you certain additional
20
** rights. These rights are described in the Nokia Qt LGPL Exception
21
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25
** Alternatively, this file may be used in accordance with the terms and
26
** conditions contained in a signed written agreement between you and Nokia.
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at info@qt.nokia.com.
31
**************************************************************************/
33
#ifndef QTESTLIBPLUGIN_H
34
#define QTESTLIBPLUGIN_H
36
#include <coreplugin/ioutputpane.h>
37
#include <extensionsystem/pluginmanager.h>
38
#include <projectexplorer/projectexplorer.h>
40
#include <QtGui/QPixmap>
41
#include <QtGui/QSortFilterProxyModel>
42
#include <QtGui/QStandardItem>
43
#include <QtGui/QWidget>
47
class QStandardItemModel;
56
class QTestOutputWidget;
64
class QTestFunction : public QStandardItem
84
inline QTestFunction(const QString &name)
85
: QStandardItem(name) {
87
// ### hardcoding colors sucks...
88
setForeground(Qt::darkBlue);
91
void addIncident(IncidentType type,
92
const QString &file = QString(),
93
const QString &line = QString(),
94
const QString &details = QString());
96
void addMessage(MessageType type, const QString &text);
98
static bool indexHasIncidents(const QModelIndex &function, IncidentType type);
101
class QTestOutputPane : public Core::IOutputPane
106
QTestOutputPane(QTestLibPlugin *plugin);
108
void addFunction(QTestFunction *function);
110
virtual QWidget *outputWidget(QWidget *parent);
111
QList<QWidget*> toolBarWidgets(void) const { return QList<QWidget *>(); }
112
virtual QString name() const;
114
virtual void clearContents();
115
virtual void visibilityChanged(bool visible);
120
virtual int priorityInStatusBar() const { return 0;}
121
virtual void setFocus() {}
122
virtual bool hasFocus() { return false;}
123
virtual bool canFocus() { return false;}
129
QTestLibPlugin *m_plugin;
130
QTestOutputWidget *m_widget;
131
QStandardItemModel *m_model;
134
class QTestOutputFilter : public QSortFilterProxyModel
137
inline QTestOutputFilter(QObject *parent)
138
: QSortFilterProxyModel(parent), m_filter(QTestFunction::Fail)
141
inline void setIncidentFilter(QTestFunction::IncidentType incident) {
147
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
150
QTestFunction::IncidentType m_filter;
153
class QTestOutputWidget : public QWidget
158
QTestOutputWidget(QStandardItemModel *model, QWidget *parent);
163
void activateComboFilter(int index);
164
void gotoLocation(QModelIndex index);
167
QStandardItemModel *m_model;
168
QTreeView *m_resultsView;
169
QComboBox *m_filterCombo;
170
QTestOutputFilter *m_filterModel;
173
class QTestLibPlugin : public QObject
179
virtual ~QTestLibPlugin();
181
bool init(const QStringList &args, QString *errorMessage);
182
void extensionsInitialized();
184
// IApplicationOutput
185
virtual void clear();
186
virtual void appendOutput(const QString &out);
187
virtual void processExited(int exitCode);
190
void projectRunHook(ProjectExplorer::Project *project);
193
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
194
QString m_outputFile;
195
QString m_projectDirectory;
196
QTestOutputPane *m_outputPane;
199
} // namespace Internal
200
} // namespace QTestLibPlugin
202
Q_DECLARE_METATYPE(QTestLib::Internal::QTestLocation)
203
Q_DECLARE_METATYPE(QTestLib::Internal::QTestFunction::IncidentType)
204
Q_DECLARE_METATYPE(QTestLib::Internal::QTestFunction::MessageType)
206
#endif // QTESTLIBPLUGIN_H