Fixed printing of QString values for some at least gdb 5.2.1.
[kdbg.git] / kdbg / winstack.h
blob8398ab2c80cffd9b55c1a3f08e7164ed700117ff
1 // $Id$
3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
6 #ifndef WINSTACK_H
7 #define WINSTACK_H
9 #include <qlist.h>
10 #include <qdialog.h>
11 #include <qlineedit.h>
12 #include <qlayout.h>
13 #include <qcheckbox.h>
14 #include <qpushbutton.h>
15 #include <qpopupmenu.h>
16 #include <qtooltip.h>
17 #include "valarray.h"
19 // forward declarations
20 class KDebugger;
21 class WinStack;
22 class SourceWindow;
23 class DisassembledCode;
24 struct DbgAddr;
26 class FindDialog : public QDialog
28 Q_OBJECT
29 public:
30 FindDialog();
31 ~FindDialog();
33 bool caseSensitive() const { return m_caseCheck.isChecked(); }
34 QString searchText() const { return m_searchText.text(); }
35 virtual void done(int result);
37 QLineEdit m_searchText;
38 QCheckBox m_caseCheck;
39 QPushButton m_buttonForward;
40 QPushButton m_buttonBackward;
41 QPushButton m_buttonClose;
43 signals:
44 void closed();
46 protected:
47 virtual void closeEvent(QCloseEvent* ev);
48 QVBoxLayout m_layout;
49 QHBoxLayout m_buttons;
53 class ValueTip : public QToolTip
55 public:
56 ValueTip(WinStack* parent);
57 virtual void maybeTip(const QPoint& p);
58 void tip(const QRect& r, const QString& s) { QToolTip::tip(r, s); }
62 class WinStack : public QWidget
64 Q_OBJECT
65 public:
66 WinStack(QWidget* parent, const char* name);
67 virtual ~WinStack();
69 enum { WindowMore=0x100, WindowMask=0xf };
71 /**
72 * The menu set with setWindowMenu will be modified by this widget to
73 * list the available windows. The specified popup menu must be set up
74 * to contain an entry with ID WindowMore. The windows will be inserted
75 * before this entry.
77 void setWindowMenu(QPopupMenu* menu);
78 /**
79 * Slot activate also looks in this directory when the specified file is
80 * a relative path.
82 void setExtraDirectory(const QString& dir) { m_lastOpenDir = dir; }
83 void activateFile(const QString& fileName);
84 bool activeLine(QString& filename, int& lineNo);
85 bool activeLine(QString& filename, int& lineNo, DbgAddr& address);
86 void maybeTip(const QPoint& p);
87 bool hasWindows() const { return m_fileList.size() > 0; }
89 virtual void resizeEvent(QResizeEvent*);
91 signals:
92 void fileChanged();
93 void lineChanged();
94 void toggleBreak(const QString&, int, const DbgAddr&, bool);
95 void enadisBreak(const QString&, int, const DbgAddr&);
96 void clickedRight(const QPoint&);
97 void filesRightClick(const QPoint&);
98 void newFileLoaded();
99 void initiateValuePopup(const QString&);
100 void disassemble(const QString&, int);
101 void setTabWidth(int numChars);
103 public slots:
104 void selectWindow(int id); /* 1-based index, 0 means dialog More... */
105 virtual void slotFindForward();
106 virtual void slotFindBackward();
107 virtual void activate(const QString& filename, int lineNo, const DbgAddr& address);
108 void updatePC(const QString& filename, int lineNo, const DbgAddr& address, int frameNo);
109 void reloadAllFiles();
110 void updateLineItems(const KDebugger* deb);
111 void slotSetTabWidth(int numChars);
113 void slotFileReload();
114 void slotViewFind();
115 void slotBrkptSet();
116 void slotBrkptSetTemp();
117 void slotBrkptEnable();
119 // Displays the value tip at m_tipLocation
120 void slotShowValueTip(const QString& tipText);
122 // Shows the disassembled code at the location given by file and lineNo
123 void slotDisassembled(const QString& fileName, int lineNo,
124 const QList<DisassembledCode>& disass);
126 // Updates line items after expanding/collapsing disassembled code
127 void slotExpandCollapse(int lineNo);
129 protected:
130 bool activatePath(QString pathname, int lineNo, const DbgAddr& address);
131 virtual bool activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& address); /* -1 doesnt change line */
132 virtual void changeWindowMenu();
133 virtual void mousePressEvent(QMouseEvent*);
134 void setPC(bool set, const QString& fileName, int lineNo,
135 const DbgAddr& address, int frameNo);
136 ValArray<SourceWindow*> m_fileList;
137 SourceWindow* m_activeWindow;
138 QString m_lastOpenDir; /* where user opened last file */
139 QPopupMenu* m_windowMenu;
141 // program counter
142 QString m_pcFile;
143 int m_pcLine; /* -1 if no PC */
144 QString m_pcAddress; /* exact address of PC */
145 int m_pcFrame;
147 ValueTip m_valueTip;
148 QRect m_tipLocation; /* where tip should appear */
150 int m_tabWidth; /* number of chars */
152 public:
153 // find dialog
154 FindDialog m_findDlg;
157 #endif // WINSTACK_H