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.
12 #include <qlineedit.h>
14 #include <qcheckbox.h>
15 #include <qpushbutton.h>
16 #include <qpopupmenu.h>
20 // forward declarations
24 class DisassembledCode
;
27 class FindDialog
: public QDialog
34 bool caseSensitive() const { return m_caseCheck
.isChecked(); }
35 QString
searchText() const { return m_searchText
.text(); }
36 virtual void done(int result
);
38 QLineEdit m_searchText
;
39 QCheckBox m_caseCheck
;
40 QPushButton m_buttonForward
;
41 QPushButton m_buttonBackward
;
42 QPushButton m_buttonClose
;
48 virtual void closeEvent(QCloseEvent
* ev
);
50 QHBoxLayout m_buttons
;
54 class ValueTip
: public QToolTip
57 ValueTip(WinStack
* parent
);
58 virtual ~ValueTip() {} // Qt3's QToolTip lacks virtual dtor!
59 virtual void maybeTip(const QPoint
& p
);
60 void tip(const QRect
& r
, const QString
& s
) { QToolTip::tip(r
, s
); }
64 class WinStack
: public QWidget
68 WinStack(QWidget
* parent
, const char* name
);
71 enum { WindowMore
=0x100, WindowMask
=0xf };
74 * The menu set with setWindowMenu will be modified by this widget to
75 * list the available windows. The specified popup menu must be set up
76 * to contain an entry with ID WindowMore. The windows will be inserted
79 void setWindowMenu(QPopupMenu
* menu
);
81 * Slot activate also looks in this directory when the specified file is
84 void setExtraDirectory(const QString
& dir
) { m_lastOpenDir
= dir
; }
85 void activateFile(const QString
& fileName
);
86 bool activeLine(QString
& filename
, int& lineNo
);
87 bool activeLine(QString
& filename
, int& lineNo
, DbgAddr
& address
);
88 void maybeTip(const QPoint
& p
);
89 bool hasWindows() const { return m_fileList
.size() > 0; }
90 QString
activeFileName() const;
92 virtual QSize
sizeHint() const;
93 virtual void resizeEvent(QResizeEvent
*);
98 void toggleBreak(const QString
&, int, const DbgAddr
&, bool);
99 void enadisBreak(const QString
&, int, const DbgAddr
&);
100 void newFileLoaded();
101 void initiateValuePopup(const QString
&);
102 void disassemble(const QString
&, int);
103 void setTabWidth(int numChars
);
104 void moveProgramCounter(const QString
&, int, const DbgAddr
&);
107 void selectWindow(int id
); /* 1-based index, 0 means dialog More... */
108 virtual void slotFindForward();
109 virtual void slotFindBackward();
110 virtual void activate(const QString
& filename
, int lineNo
, const DbgAddr
& address
);
111 void updatePC(const QString
& filename
, int lineNo
, const DbgAddr
& address
, int frameNo
);
112 void reloadAllFiles();
113 void updateLineItems(const KDebugger
* deb
);
114 void slotSetTabWidth(int numChars
);
116 void slotFileReload();
119 void slotBrkptSetTemp();
120 void slotBrkptEnable();
121 void slotMoveProgramCounter();
123 // Displays the value tip at m_tipLocation
124 void slotShowValueTip(const QString
& tipText
);
126 // Shows the disassembled code at the location given by file and lineNo
127 void slotDisassembled(const QString
& fileName
, int lineNo
,
128 const QList
<DisassembledCode
>& disass
);
130 // Updates line items after expanding/collapsing disassembled code
131 void slotExpandCollapse(int lineNo
);
134 bool activatePath(QString pathname
, int lineNo
, const DbgAddr
& address
);
135 virtual bool activateWindow(SourceWindow
* fw
, int lineNo
, const DbgAddr
& address
); /* -1 doesnt change line */
136 virtual void changeWindowMenu();
137 virtual void contextMenuEvent(QContextMenuEvent
* e
);
138 void setPC(bool set
, const QString
& fileName
, int lineNo
,
139 const DbgAddr
& address
, int frameNo
);
140 ValArray
<SourceWindow
*> m_fileList
;
141 SourceWindow
* m_activeWindow
;
142 QString m_lastOpenDir
; /* where user opened last file */
143 QPopupMenu
* m_windowMenu
;
147 int m_pcLine
; /* -1 if no PC */
148 QString m_pcAddress
; /* exact address of PC */
152 QRect m_tipLocation
; /* where tip should appear */
154 int m_tabWidth
; /* number of chars */
158 FindDialog m_findDlg
;