~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to languages/cpp/debugger/gdbbreakpointwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
    begin                : Tue May 13 2003
3
 
    copyright            : (C) 2003 by John Birch
4
 
    email                : jbb@kdevelop.org
5
 
 ***************************************************************************/
6
 
 
7
 
/***************************************************************************
8
 
 *                                                                         *
9
 
 *   This program is free software; you can redistribute it and/or modify  *
10
 
 *   it under the terms of the GNU General Public License as published by  *
11
 
 *   the Free Software Foundation; either version 2 of the License, or     *
12
 
 *   (at your option) any later version.                                   *
13
 
 *                                                                         *
14
 
 ***************************************************************************/
15
 
 
16
 
#ifndef _GDBBreakpointWidget_H_
17
 
#define _GDBBreakpointWidget_H_
18
 
 
19
 
#include <qhbox.h>
20
 
#include <qpopupmenu.h>
21
 
#include <qtable.h>
22
 
#include <qguardedptr.h>
23
 
#include <qvaluevector.h>
24
 
 
25
 
#include "mi/gdbmi.h"
26
 
#include "gdbcontroller.h"
27
 
 
28
 
class QDomElement;
29
 
class QToolButton;
30
 
class QLabel;
31
 
class KURL;
32
 
 
33
 
/***************************************************************************/
34
 
/***************************************************************************/
35
 
/***************************************************************************/
36
 
 
37
 
namespace GDBDebugger
38
 
{
39
 
class Breakpoint;
40
 
class BreakpointTableRow;
41
 
class GDBTable;
42
 
class GDBController;
43
 
 
44
 
class GDBBreakpointWidget : public QHBox
45
 
{
46
 
    Q_OBJECT
47
 
 
48
 
public:
49
 
    GDBBreakpointWidget( GDBController* controller,
50
 
                         QWidget* parent=0, const char* name=0 );
51
 
    virtual ~GDBBreakpointWidget();
52
 
 
53
 
    void reset();
54
 
 
55
 
    void savePartialProjectSession(QDomElement* el);
56
 
    void restorePartialProjectSession(const QDomElement* el);
57
 
 
58
 
    bool hasWatchpointForAddress(unsigned long long address) const;
59
 
 
60
 
 
61
 
public slots:
62
 
    // Connected to from the editor widget:
63
 
    void slotToggleBreakpoint(const QString &filename, int lineNum);
64
 
    void slotToggleBreakpointEnabled(const QString &fileName, int lineNum);
65
 
 
66
 
    // Connected to from the variable widget:
67
 
    void slotToggleWatchpoint(const QString &varName);
68
 
 
69
 
    void slotBreakpointSet(Breakpoint*);
70
 
 
71
 
    void slotRefreshBP(const KURL &filename);
72
 
 
73
 
    void slotBreakpointHit(int id);
74
 
 
75
 
    
76
 
protected:
77
 
    virtual void focusInEvent(QFocusEvent *e);
78
 
 
79
 
 
80
 
    friend class BreakpointActionCell; // for access to slotNewValue
81
 
private slots:
82
 
    void slotRemoveBreakpoint();
83
 
    void slotRemoveAllBreakpoints();
84
 
    void slotEditBreakpoint(const QString &fileName, int lineNum);
85
 
    void slotEditBreakpoint();
86
 
    void slotAddBlankBreakpoint(int idx);
87
 
    void slotRowDoubleClicked(int row, int col, int button, const QPoint & mousePos);
88
 
    void slotContextMenuShow( int row, int col, const QPoint &mousePos );
89
 
    void slotContextMenuSelect( int item );
90
 
    void slotEditRow(int row, int col, const QPoint & mousePos);
91
 
    void slotNewValue(int row, int col);
92
 
    void editTracing(QTableItem* item);
93
 
    void slotBreakpointModified(Breakpoint*);
94
 
 
95
 
    void slotEvent(GDBController::event_t);
96
 
    void slotWatchpointHit(int id,
97
 
                           const QString& oldValue,
98
 
                           const QString& newValue);
99
 
 
100
 
signals:
101
 
    void publishBPState(const Breakpoint& brkpt);
102
 
    void refreshBPState(const Breakpoint& brkpt);
103
 
    void gotoSourcePosition(const QString &fileName, int lineNum);
104
 
    // Emitted when output from yet another passed tracepoint is available.
105
 
    void tracingOutput(const char*);
106
 
 
107
 
private:
108
 
    BreakpointTableRow* find(Breakpoint *bp);
109
 
    BreakpointTableRow* findId(int id);
110
 
    BreakpointTableRow* findKey(int BPKey);
111
 
 
112
 
    void setActive();
113
 
    BreakpointTableRow* addBreakpoint(Breakpoint *bp);
114
 
    void removeBreakpoint(BreakpointTableRow* btr);
115
 
 
116
 
    void sendToGdb(Breakpoint &);
117
 
 
118
 
    void handleBreakpointList(const GDBMI::ResultRecord&);
119
 
    void handleTracingPrintf(const QValueVector<QString>& s);
120
 
 
121
 
private:
122
 
    GDBController*  controller_;
123
 
 
124
 
    GDBTable*       m_table;
125
 
    QPopupMenu*     m_ctxMenu;
126
 
};
127
 
 
128
 
class BreakpointTableRow;
129
 
 
130
 
/** Custom table cell class for cells that require complex editing.
131
 
    When current, the cell shows a "..." on the right. When clicked,
132
 
    the 'edit' signal is emitted that can be be used to pop-up
133
 
    a dialog box. 
134
 
 
135
 
    When editing is done, the receiver of 'edit' should change the
136
 
    value in the table, and then call the 'updateValue' method.    
137
 
 */
138
 
class ComplexEditCell : public QObject, public QTableItem
139
 
{
140
 
    Q_OBJECT
141
 
public:
142
 
 
143
 
    ComplexEditCell(QTable* table);
144
 
 
145
 
    /** Called by Qt when the current cell should become editable.
146
 
        In our case, when the item becomes current. Creates a widget
147
 
        that will be shown in the cell and should be able to edit cell
148
 
        content. In our case -- text plus "..." button that invokes 
149
 
        action dialog.        
150
 
    */
151
 
    QWidget* createEditor() const;    
152
 
 
153
 
    void updateValue();
154
 
 
155
 
private slots:
156
 
 
157
 
    /** Called when the "..." button is clicked. */
158
 
    void slotEdit();
159
 
 
160
 
signals:
161
 
    void edit(QTableItem*);
162
 
 
163
 
private:
164
 
    mutable QGuardedPtr<QLabel> label_;
165
 
};
166
 
 
167
 
 
168
 
/***************************************************************************/
169
 
/***************************************************************************/
170
 
/***************************************************************************/
171
 
 
172
 
}
173
 
 
174
 
#endif