OSDN Git Service

658c7bf822d72b060a9797a0f54b82cb4865fbd4
[qt-creator-jp/qt-creator-jp.git] / src / plugins / memcheck / memchecktool.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
8 **
9 ** Contact: Nokia Corporation (qt-info@nokia.com)
10 **
11 ** No Commercial Usage
12 **
13 ** This file contains pre-release code and may not be distributed.
14 ** You may use this file in accordance with the terms and conditions
15 ** contained in the Technology Preview License Agreement accompanying
16 ** this package.
17 **
18 ** GNU Lesser General Public License Usage
19 **
20 ** Alternatively, this file may be used under the terms of the GNU Lesser
21 ** General Public License version 2.1 as published by the Free Software
22 ** Foundation and appearing in the file LICENSE.LGPL included in the
23 ** packaging of this file.  Please review the following information to
24 ** ensure the GNU Lesser General Public License version 2.1 requirements
25 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26 **
27 ** In addition, as a special exception, Nokia gives you certain additional
28 ** rights.  These rights are described in the Nokia Qt LGPL Exception
29 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30 **
31 ** If you have questions regarding the use of this file, please contact
32 ** Nokia at qt-info@nokia.com.
33 **
34 **************************************************************************/
35
36 #ifndef MEMCHECKTOOL_H
37 #define MEMCHECKTOOL_H
38
39 #include <analyzerbase/ianalyzertool.h>
40
41 #include <QtGui/QSortFilterProxyModel>
42 #include <QtCore/QSharedPointer>
43
44 QT_BEGIN_NAMESPACE
45 class QItemSelection;
46 class QTreeView;
47 class QModelIndex;
48 class QAction;
49 class QSpinBox;
50 class QCheckBox;
51 class QMenu;
52 QT_END_NAMESPACE
53
54 namespace Valgrind {
55 namespace XmlProtocol {
56 class ErrorListModel;
57 class Error;
58 }
59 }
60
61 namespace Analyzer {
62 class AnalyzerSettings;
63 namespace Internal {
64 class MemCheckOutputPaneAdapter;
65 class MemcheckErrorView;
66 class FrameFinder;
67
68 class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
69 {
70     Q_OBJECT
71 public:
72     MemcheckErrorFilterProxyModel(QObject *parent = 0);
73
74 public slots:
75     void setAcceptedKinds(const QList<int> &acceptedKinds);
76     void setFilterExternalIssues(bool filter);
77
78 protected:
79     bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
80 private:
81     QList<int> m_acceptedKinds;
82     bool m_filterExternalIssues;
83 };
84
85 class MemcheckTool : public IAnalyzerTool
86 {
87     Q_OBJECT
88 public:
89     explicit MemcheckTool(QObject *parent = 0);
90
91     QString id() const;
92     QString displayName() const;
93     ToolMode mode() const;
94
95     void initialize(ExtensionSystem::IPlugin *plugin);
96
97     virtual IAnalyzerOutputPaneAdapter *outputPaneAdapter();
98     IAnalyzerEngine *createEngine(ProjectExplorer::RunConfiguration *runConfiguration);
99
100     // For the output pane adapter.
101     MemcheckErrorView *ensurePaneErrorView();
102     QWidget *createPaneToolBarWidget();
103     void clearErrorView();
104
105 private slots:
106     void settingsDestroyed(QObject *settings);
107     void maybeActiveRunConfigurationChanged();
108
109     void engineStarting(const IAnalyzerEngine *engine);
110     void parserError(const Valgrind::XmlProtocol::Error &error);
111     void internalParserError(const QString &errorString);
112     void updateErrorFilter();
113     void suppressionActionTriggered();
114     void finished();
115     QMenu *filterMenu() const;
116
117 private:
118     AnalyzerSettings *m_settings;
119
120     FrameFinder *m_frameFinder;
121     Valgrind::XmlProtocol::ErrorListModel *m_errorModel;
122     MemcheckErrorFilterProxyModel *m_errorProxyModel;
123     MemcheckErrorView *m_errorView;
124
125     QList<QAction *> m_errorFilterActions;
126     QAction *m_filterProjectAction;
127     QList<QAction *> m_suppressionActions;
128     QAction *m_suppressionSeparator;
129     MemCheckOutputPaneAdapter *m_outputPaneAdapter;
130 };
131
132 } // namespace Internal
133 } // namespace Analyzer
134
135 #endif // MEMCHECKTOOL_H