• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevelop/kdevplatform/debugger

  • extragear
  • kdevelop
  • kdevelop
  • kdevplatform
  • debugger
  • breakpoint
breakpointmodel.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2002 Matthias Hoelzer-Kluepfel <[email protected]>
3  Copyright (C) 2002 John Firebaugh <[email protected]>
4  Copyright (C) 2007 Hamish Rodda <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB.
18  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef KDEVPLATFORM_BREAKPOINTMODEL_H
23 #define KDEVPLATFORM_BREAKPOINTMODEL_H
24 
25 #include <QAbstractTableModel>
26 
27 #include <KTextEditor/MarkInterface>
28 #include "breakpoint.h"
29 
30 class QUrl;
31 
32 namespace KParts { class Part; }
33 namespace KTextEditor {
34 class Cursor;
35 }
36 
37 namespace KDevelop
38 {
39 class IDocument;
40 class Breakpoint;
41 class BreakpointModelPrivate;
42 
43 class KDEVPLATFORMDEBUGGER_EXPORT BreakpointModel : public QAbstractTableModel
44 {
45  Q_OBJECT
46 
47 public:
48  enum Column {
53  EnableColumn,
54 
59  StateColumn,
60 
65  KindColumn,
66 
72  LocationColumn,
73 
77  ConditionColumn,
78 
82  HitCountColumn,
83 
88  IgnoreHitsColumn,
89 
90  NumColumns
91  };
92 
93  enum ColumnFlag {
94  EnableColumnFlag = 1 << EnableColumn,
95  StateColumnFlag = 1 << StateColumn,
96  KindColumnFlag = 1 << KindColumn,
97  LocationColumnFlag = 1 << LocationColumn,
98  ConditionColumnFlag = 1 << ConditionColumn,
99  HitCountColumnFlag = 1 << HitCountColumn,
100  IgnoreHitsColumnFlag = 1 << IgnoreHitsColumn
101  };
102  Q_DECLARE_FLAGS(ColumnFlags, ColumnFlag)
103 
104  explicit BreakpointModel(QObject* parent);
105  ~BreakpointModel() override;
106 
107  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
108  Qt::ItemFlags flags(const QModelIndex &index) const override;
109  QModelIndex breakpointIndex(Breakpoint *b, int column);
110  bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
111  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
112  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
113 
115  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
116  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
117 
118  void toggleBreakpoint(const QUrl &url, const KTextEditor::Cursor& cursor);
119 
120 
121  KDevelop::Breakpoint* addCodeBreakpoint();
122  KDevelop::Breakpoint* addCodeBreakpoint(const QUrl& location, int line);
123  KDevelop::Breakpoint* addCodeBreakpoint(const QString& expression);
124  KDevelop::Breakpoint* addWatchpoint();
125  KDevelop::Breakpoint* addWatchpoint(const QString& expression);
126  KDevelop::Breakpoint* addReadWatchpoint();
127  KDevelop::Breakpoint* addReadWatchpoint(const QString& expression);
128  KDevelop::Breakpoint* addAccessWatchpoint();
129  KDevelop::Breakpoint* addAccessWatchpoint(const QString& expression);
130 
131  Breakpoint* breakpoint(int row) const;
132  QList<Breakpoint*> breakpoints() const;
133 
134 Q_SIGNALS:
135  void error(int row, const QString& errorText);
136  void hit(int row);
137 
138 public Q_SLOTS:
139  void save();
140  void load();
141 
142 private:
143  enum MarkType {
144  BreakpointMark = KTextEditor::MarkInterface::BreakpointActive,
145  ReachedBreakpointMark = KTextEditor::MarkInterface::BreakpointReached,
146  DisabledBreakpointMark = KTextEditor::MarkInterface::BreakpointDisabled,
147  PendingBreakpointMark = KTextEditor::MarkInterface::markType08,
148 
149  AllBreakpointMarks = BreakpointMark | ReachedBreakpointMark | DisabledBreakpointMark | PendingBreakpointMark
150  };
151 
152 private Q_SLOTS:
153 
154  void updateMarks();
155 
156  void slotPartAdded(KParts::Part* part);
157 
164  void markChanged(KTextEditor::Document *document, KTextEditor::Mark mark, KTextEditor::MarkInterface::MarkChangeAction action);
165  void textDocumentCreated(KDevelop::IDocument*);
166  void documentSaved(KDevelop::IDocument*);
167  void aboutToDeleteMovingInterfaceContent(KTextEditor::Document *document);
168 
169  void markContextMenuRequested( KTextEditor::Document* document, KTextEditor::Mark mark,
170  const QPoint &pos, bool& handled );
171 
172 private:
173  static const QPixmap* breakpointPixmap();
174  static const QPixmap* pendingBreakpointPixmap();
175  static const QPixmap* reachedBreakpointPixmap();
176  static const QPixmap* disabledBreakpointPixmap();
177 
178 private:
179  friend class Breakpoint;
180  friend class IBreakpointController;
181 
182  void updateState(int row, Breakpoint::BreakpointState state);
183  void updateHitCount(int row, int hitCount);
184  void updateErrorText(int row, const QString& errorText);
185  void notifyHit(int row);
186 
187  void registerBreakpoint(Breakpoint* breakpoint);
188  void scheduleSave();
189 
190  void reportChange(Breakpoint *breakpoint, Breakpoint::Column column);
191  uint breakpointType(Breakpoint *breakpoint) const;
192  Breakpoint *breakpoint(const QUrl& url, int line) const;
193 
194 private:
195  const QScopedPointer<class BreakpointModelPrivate> d_ptr;
196  Q_DECLARE_PRIVATE(BreakpointModel)
197 };
198 
199 }
200 
201 Q_DECLARE_OPERATORS_FOR_FLAGS(KDevelop::BreakpointModel::ColumnFlags)
202 
203 #endif
QModelIndex
KDevelop::Breakpoint
Definition: breakpoint.h:38
QAbstractTableModel
KDevelop::BreakpointModel::IgnoreHitsColumn
How many hits of the breakpoint will be ignored before the breakpoint actually stops the program (can...
Definition: breakpointmodel.h:88
KDevelop::BreakpointModel
Definition: breakpointmodel.h:43
QPoint
KDevelop::Breakpoint::Column
Column
Definition: breakpoint.h:71
KDevelop::BreakpointModel::ConditionColumn
Condition for conditional breakpoints (modifiable by user).
Definition: breakpointmodel.h:77
KDevelop::BreakpointModel::EnableColumn
Whether the breakpoint is active or not (settable by user): value is Qt::Checked or Qt::Unchecked...
Definition: breakpointmodel.h:53
KDevelop::BreakpointModel::HitCountColumn
The number of times this breakpoint has been hit (cannot be modified by the user).
Definition: breakpointmodel.h:82
KDevelop::BreakpointModel::StateColumn
Synchronization state of the breakpoint (not settable by user): value is one of the BreakpointState e...
Definition: breakpointmodel.h:59
QObject
QScopedPointer< class BreakpointModelPrivate >
KDevelop::BreakpointModel::LocationColumn
Location of the breakpoint (modifiable by user); value is a string describing the location; note that...
Definition: breakpointmodel.h:72
QString
QList
breakpoint.h
QPixmap
KDevelop::BreakpointModel::Column
Column
Definition: breakpointmodel.h:48
KDevelop::Breakpoint::BreakpointState
BreakpointState
Definition: breakpoint.h:48
QUrl
KDevelop::BreakpointModel::KindColumn
Kind/type of breakpoint (never changes): value is one of the BreakpointKind enum values.
Definition: breakpointmodel.h:65
KDevelop::BreakpointModel::ColumnFlag
ColumnFlag
Definition: breakpointmodel.h:93
KDevelop::IBreakpointController
Definition: ibreakpointcontroller.h:39
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Fri Dec 6 2019 04:49:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevelop/kdevplatform/debugger

Skip menu "kdevelop/kdevplatform/debugger"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  •   kdevplatform
  •     debugger
  •     documentation
  •     interfaces
  •     language
  •       assistant
  •       backgroundparser
  •       checks
  •       classmodel
  •       codecompletion
  •       codegen
  •       duchain
  •       editor
  •       highlighting
  •       interfaces
  •       util
  •     outputview
  •     project
  •     serialization
  •     shell
  •     sublime
  •     tests
  •     util
  •     vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal