Extend copyright to 2018.
[kdbg.git] / kdbg / winstack.h
blob02ff334487c7f3fa8ff954f96aba4454b6f73627
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>
11 #include <QLineEdit>
12 #include <QCheckBox>
13 #include <QPushButton>
14 #include <QHBoxLayout>
15 #include <QVBoxLayout>
16 #include <QTabWidget>
17 #include <list>
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 WinStack : public QTabWidget
55 Q_OBJECT
56 public:
57 WinStack(QWidget* parent);
58 virtual ~WinStack();
60 /**
61 * Slot activate also looks in this directory when the specified file is
62 * a relative path.
64 void setExtraDirectory(const QString& dir) { m_lastOpenDir = dir; }
65 void activateFile(const QString& fileName);
66 bool activeLine(QString& filename, int& lineNo);
67 bool activeLine(QString& filename, int& lineNo, DbgAddr& address);
68 bool hasWindows() const { return count() > 0; }
69 QString activeFileName() const;
70 SourceWindow* activeWindow() const;
71 SourceWindow* windowAt(int i) const;
73 virtual QSize sizeHint() const;
75 signals:
76 void toggleBreak(const QString&, int, const DbgAddr&, bool);
77 void enadisBreak(const QString&, int, const DbgAddr&);
78 void newFileLoaded();
79 void initiateValuePopup(const QString&);
80 void disassemble(const QString&, int);
81 void setTabWidth(int numChars);
82 void moveProgramCounter(const QString&, int, const DbgAddr&);
84 public slots:
85 virtual void slotFindForward();
86 virtual void slotFindBackward();
87 virtual void activate(const QString& filename, int lineNo, const DbgAddr& address);
88 void updatePC(const QString& filename, int lineNo, const DbgAddr& address, int frameNo);
89 void reloadAllFiles();
90 void updateLineItems(const KDebugger* deb);
91 void slotSetTabWidth(int numChars);
93 void slotFileReload();
94 void slotViewFind();
95 void slotBrkptSet();
96 void slotBrkptSetTemp();
97 void slotBrkptEnable();
98 void slotMoveProgramCounter();
99 void slotClose();
100 void slotCloseTab(int tab);
102 // Displays the value tip at m_tipLocation
103 void slotShowValueTip(const QString& tipText);
105 // Shows the disassembled code at the location given by file and lineNo
106 void slotDisassembled(const QString& fileName, int lineNo,
107 const std::list<DisassembledCode>& disass);
109 // Updates line items after expanding/collapsing disassembled code
110 void slotExpandCollapse(int lineNo);
112 protected:
113 bool activatePath(QString pathname, int lineNo, const DbgAddr& address);
114 virtual bool activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& address); /* -1 doesnt change line */
115 virtual void contextMenuEvent(QContextMenuEvent* e);
116 virtual bool event(QEvent* event);
117 void setPC(bool set, const QString& fileName, int lineNo,
118 const DbgAddr& address, int frameNo);
119 SourceWindow* findByFileName(const QString& fileName) const;
120 QString m_lastOpenDir; /* where user opened last file */
122 // program counter
123 QString m_pcFile;
124 int m_pcLine; /* -1 if no PC */
125 QString m_pcAddress; /* exact address of PC */
126 int m_pcFrame;
128 QPoint m_tipLocation; /* where tip should appear */
129 QRect m_tipRegion; /* where tip should remain */
131 int m_tabWidth; /* number of chars */
133 public:
134 // find dialog
135 FindDialog m_findDlg;
138 #endif // WINSTACK_H