2 * Copyright Johannes Sixt
3 * This file is licensed under the GNU General Public License Version 2.
4 * See the file COPYING in the toplevel directory of the source directory.
11 #include <qlineedit.h>
13 #include <qcheckbox.h>
14 #include <qpushbutton.h>
16 #include <Q3HBoxLayout>
17 #include <Q3VBoxLayout>
18 #include <QContextMenuEvent>
19 #include <QCloseEvent>
20 #include <ktabwidget.h>
23 // forward declarations
27 class DisassembledCode
;
30 class FindDialog
: public QDialog
37 bool caseSensitive() const { return m_caseCheck
.isChecked(); }
38 QString
searchText() const { return m_searchText
.text(); }
39 virtual void done(int result
);
41 QLineEdit m_searchText
;
42 QCheckBox m_caseCheck
;
43 QPushButton m_buttonForward
;
44 QPushButton m_buttonBackward
;
45 QPushButton m_buttonClose
;
51 virtual void closeEvent(QCloseEvent
* ev
);
52 Q3VBoxLayout m_layout
;
53 Q3HBoxLayout m_buttons
;
57 class ValueTip
: public QToolTip
60 ValueTip(WinStack
* parent
);
61 virtual ~ValueTip() {} // Qt3's QToolTip lacks virtual dtor!
62 virtual void maybeTip(const QPoint
& p
);
63 void tip(const QRect
& r
, const QString
& s
) { QToolTip::tip(r
, s
); }
67 class WinStack
: public KTabWidget
71 WinStack(QWidget
* parent
);
75 * Slot activate also looks in this directory when the specified file is
78 void setExtraDirectory(const QString
& dir
) { m_lastOpenDir
= dir
; }
79 void activateFile(const QString
& fileName
);
80 bool activeLine(QString
& filename
, int& lineNo
);
81 bool activeLine(QString
& filename
, int& lineNo
, DbgAddr
& address
);
82 void maybeTip(const QPoint
& p
);
83 bool hasWindows() const { return count() > 0; }
84 QString
activeFileName() const;
85 SourceWindow
* activeWindow() const;
86 SourceWindow
* windowAt(int i
) const;
88 virtual QSize
sizeHint() const;
91 void toggleBreak(const QString
&, int, const DbgAddr
&, bool);
92 void enadisBreak(const QString
&, int, const DbgAddr
&);
94 void initiateValuePopup(const QString
&);
95 void disassemble(const QString
&, int);
96 void setTabWidth(int numChars
);
97 void moveProgramCounter(const QString
&, int, const DbgAddr
&);
100 virtual void slotFindForward();
101 virtual void slotFindBackward();
102 virtual void activate(const QString
& filename
, int lineNo
, const DbgAddr
& address
);
103 void updatePC(const QString
& filename
, int lineNo
, const DbgAddr
& address
, int frameNo
);
104 void reloadAllFiles();
105 void updateLineItems(const KDebugger
* deb
);
106 void slotSetTabWidth(int numChars
);
108 void slotFileReload();
111 void slotBrkptSetTemp();
112 void slotBrkptEnable();
113 void slotMoveProgramCounter();
116 // Displays the value tip at m_tipLocation
117 void slotShowValueTip(const QString
& tipText
);
119 // Shows the disassembled code at the location given by file and lineNo
120 void slotDisassembled(const QString
& fileName
, int lineNo
,
121 const std::list
<DisassembledCode
>& disass
);
123 // Updates line items after expanding/collapsing disassembled code
124 void slotExpandCollapse(int lineNo
);
127 bool activatePath(QString pathname
, int lineNo
, const DbgAddr
& address
);
128 virtual bool activateWindow(SourceWindow
* fw
, int lineNo
, const DbgAddr
& address
); /* -1 doesnt change line */
129 virtual void contextMenuEvent(QContextMenuEvent
* e
);
130 void setPC(bool set
, const QString
& fileName
, int lineNo
,
131 const DbgAddr
& address
, int frameNo
);
132 SourceWindow
* findByFileName(const QString
& fileName
) const;
133 QString m_lastOpenDir
; /* where user opened last file */
137 int m_pcLine
; /* -1 if no PC */
138 QString m_pcAddress
; /* exact address of PC */
142 QRect m_tipLocation
; /* where tip should appear */
144 int m_tabWidth
; /* number of chars */
148 FindDialog m_findDlg
;