Convert KAboutData and KCmdLineOptions.
[kdbg.git] / kdbg / winstack.h
blob744e23bfe0cb3a618c69c2bd1df937b871154b34
1 /*
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.
5 */
7 #ifndef WINSTACK_H
8 #define WINSTACK_H
10 #include <qdialog.h>
11 #include <qlineedit.h>
12 #include <qlayout.h>
13 #include <qcheckbox.h>
14 #include <qpushbutton.h>
15 #include <qtooltip.h>
16 #include <Q3HBoxLayout>
17 #include <Q3VBoxLayout>
18 #include <QContextMenuEvent>
19 #include <QCloseEvent>
20 #include <ktabwidget.h>
21 #include <list>
23 // forward declarations
24 class KDebugger;
25 class WinStack;
26 class SourceWindow;
27 class DisassembledCode;
28 struct DbgAddr;
30 class FindDialog : public QDialog
32 Q_OBJECT
33 public:
34 FindDialog();
35 ~FindDialog();
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;
47 signals:
48 void closed();
50 protected:
51 virtual void closeEvent(QCloseEvent* ev);
52 Q3VBoxLayout m_layout;
53 Q3HBoxLayout m_buttons;
57 class ValueTip : public QToolTip
59 public:
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
69 Q_OBJECT
70 public:
71 WinStack(QWidget* parent);
72 virtual ~WinStack();
74 /**
75 * Slot activate also looks in this directory when the specified file is
76 * a relative path.
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;
90 signals:
91 void toggleBreak(const QString&, int, const DbgAddr&, bool);
92 void enadisBreak(const QString&, int, const DbgAddr&);
93 void newFileLoaded();
94 void initiateValuePopup(const QString&);
95 void disassemble(const QString&, int);
96 void setTabWidth(int numChars);
97 void moveProgramCounter(const QString&, int, const DbgAddr&);
99 public slots:
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();
109 void slotViewFind();
110 void slotBrkptSet();
111 void slotBrkptSetTemp();
112 void slotBrkptEnable();
113 void slotMoveProgramCounter();
114 void slotClose();
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);
126 protected:
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 */
135 // program counter
136 QString m_pcFile;
137 int m_pcLine; /* -1 if no PC */
138 QString m_pcAddress; /* exact address of PC */
139 int m_pcFrame;
141 ValueTip m_valueTip;
142 QRect m_tipLocation; /* where tip should appear */
144 int m_tabWidth; /* number of chars */
146 public:
147 // find dialog
148 FindDialog m_findDlg;
151 #endif // WINSTACK_H