Insert a license note at the top of source files.
[kdbg.git] / kdbg / mainwndbase.h
blob0a579428e1baaebc1d6c01a3aeebd6bf9dcf8167
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 MAINWNDBASE_H
8 #define MAINWNDBASE_H
10 #include <qlineedit.h>
11 #include <qlayout.h>
12 #include <qpushbutton.h>
13 #include <qcstring.h>
14 #include "exprwnd.h"
15 #include "sys/types.h" /* pid_t */
17 // forward declarations
18 class KDebugger;
19 class TTYWindow;
20 class UpdateUI;
21 class KToolBar;
22 class KStatusBar;
23 class KProcess;
24 class DebuggerDriver;
26 class WatchWindow : public QWidget
28 Q_OBJECT
29 public:
30 WatchWindow(QWidget* parent, const char* name, WFlags f = 0);
31 ~WatchWindow();
32 ExprWnd* watchVariables() { return &m_watchVariables; }
33 QString watchText() const { return m_watchEdit.text(); }
34 int columnWidth(int i) const { return m_watchVariables.columnWidth(i); }
35 void setColumnWidth(int i, int w) { m_watchVariables.setColumnWidth(i, w); }
37 protected:
38 QLineEdit m_watchEdit;
39 QPushButton m_watchAdd;
40 QPushButton m_watchDelete;
41 ExprWnd m_watchVariables;
42 QVBoxLayout m_watchV;
43 QHBoxLayout m_watchH;
45 virtual bool eventFilter(QObject* ob, QEvent* ev);
46 virtual void dragEnterEvent(QDragEnterEvent* event);
47 virtual void dropEvent(QDropEvent* event);
49 signals:
50 void addWatch();
51 void deleteWatch();
52 void textDropped(const QString& text);
54 protected slots:
55 void slotWatchHighlighted();
59 class DebuggerMainWndBase
61 public:
62 DebuggerMainWndBase();
63 virtual ~DebuggerMainWndBase();
65 /**
66 * Sets the command to invoke the terminal that displays the program
67 * output. If cmd is the empty string, the default is substituted.
69 void setTerminalCmd(const QString& cmd);
70 /**
71 * Sets the command to invoke the debugger.
73 void setDebuggerCmdStr(const QString& cmd);
74 /**
75 * Specifies the file where to write the transcript.
77 void setTranscript(const char* name);
78 /**
79 * Starts to debug the specified program using the specified language
80 * driver.
82 bool debugProgram(const QString& executable, QCString lang, QWidget* parent);
83 /**
84 * Specifies the process to attach to after the program is loaded.
86 void setAttachPid(const QString& pid);
88 // the following are needed to handle program arguments
89 void setCoreFile(const QString& corefile);
90 void setRemoteDevice(const QString &remoteDevice);
91 /** helper around KFileDialog */
92 static QString myGetFileName(QString caption,
93 QString dir, QString filter,
94 QWidget* parent);
95 /** invokes the global options dialog */
96 virtual void doGlobalOptions(QWidget* parent);
98 protected:
99 // settings
100 virtual void saveSettings(KConfig*);
101 virtual void restoreSettings(KConfig*);
103 // override must return the integrated output window
104 virtual TTYWindow* ttyWindow() = 0;
106 // statusbar texts
107 QString m_statusActive;
109 // output window
110 QString m_outputTermCmdStr;
111 QString m_outputTermKeepScript;
112 KProcess* m_outputTermProc;
113 int m_ttyLevel;
114 virtual QString createOutputWindow(); /* returns terminal name */
115 void shutdownTermWindow();
117 QString m_lastDirectory; /* the dir of the most recently opened file */
119 QString m_transcriptFile; /* where gdb dialog is logged */
121 bool m_popForeground; /* whether main wnd raises when prog stops */
122 int m_backTimeout; /* when wnd goes back */
123 int m_tabWidth; /* tab width in characters (can be 0) */
124 QString m_sourceFilter;
125 QString m_headerFilter;
127 // the debugger proper
128 QString m_debuggerCmdStr;
129 KDebugger* m_debugger;
130 void setupDebugger(QWidget* parent,
131 ExprWnd* localVars,
132 ExprWnd* watchVars,
133 QListBox* backtrace);
134 DebuggerDriver* driverFromLang(QCString lang);
136 * This function derives a driver name from the contents of the named
137 * file.
139 QCString driverNameFromFile(const QString& exe);
141 public:
143 * Important! The following functions must be overridden in derived
144 * classes and be declared as slots! Note: These must not be declared
145 * virtual here since Qt signal mechanism fails miserably (because this
146 * class will not be the left-most base class!).
148 void newStatusMsg(KStatusBar* statusbar);
149 void slotDebuggerStarting();
152 #endif // MAINWNDBASE_H