Update my email address.
[kdbg.git] / kdbg / mainwndbase.h
blobb0f3041e5b702ba92692ef088daf0f33ddcceabe
1 // $Id$
3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
6 #ifndef MAINWNDBASE_H
7 #define MAINWNDBASE_H
9 #include <qlineedit.h>
10 #include <qlayout.h>
11 #include <qpushbutton.h>
12 #include <qcstring.h>
13 #include "exprwnd.h"
14 #include "sys/types.h" /* pid_t */
16 // forward declarations
17 class KDebugger;
18 class TTYWindow;
19 class UpdateUI;
20 class KToolBar;
21 class KStatusBar;
22 class KProcess;
23 class DebuggerDriver;
25 class WatchWindow : public QWidget
27 Q_OBJECT
28 public:
29 WatchWindow(QWidget* parent, const char* name, WFlags f = 0);
30 ~WatchWindow();
31 ExprWnd* watchVariables() { return &m_watchVariables; }
32 QString watchText() const { return m_watchEdit.text(); }
33 int columnWidth(int i) const { return m_watchVariables.columnWidth(i); }
34 void setColumnWidth(int i, int w) { m_watchVariables.setColumnWidth(i, w); }
36 protected:
37 QLineEdit m_watchEdit;
38 QPushButton m_watchAdd;
39 QPushButton m_watchDelete;
40 ExprWnd m_watchVariables;
41 QVBoxLayout m_watchV;
42 QHBoxLayout m_watchH;
44 virtual bool eventFilter(QObject* ob, QEvent* ev);
45 virtual void dragEnterEvent(QDragEnterEvent* event);
46 virtual void dropEvent(QDropEvent* event);
48 signals:
49 void addWatch();
50 void deleteWatch();
51 void textDropped(const QString& text);
53 protected slots:
54 void slotWatchHighlighted();
58 class DebuggerMainWndBase
60 public:
61 DebuggerMainWndBase();
62 virtual ~DebuggerMainWndBase();
64 /**
65 * Sets the command to invoke the terminal that displays the program
66 * output. If cmd is the empty string, the default is substituted.
68 void setTerminalCmd(const QString& cmd);
69 /**
70 * Sets the command to invoke the debugger.
72 void setDebuggerCmdStr(const QString& cmd);
73 /**
74 * Specifies the file where to write the transcript.
76 void setTranscript(const char* name);
77 /**
78 * Starts to debug the specified program using the specified language
79 * driver.
81 bool debugProgram(const QString& executable, QCString lang, QWidget* parent);
82 /**
83 * Specifies the process to attach to after the program is loaded.
85 void setAttachPid(const QString& pid);
87 // the following are needed to handle program arguments
88 void setCoreFile(const QString& corefile);
89 void setRemoteDevice(const QString &remoteDevice);
90 /** helper around KFileDialog */
91 static QString myGetFileName(QString caption,
92 QString dir, QString filter,
93 QWidget* parent);
94 /** invokes the global options dialog */
95 virtual void doGlobalOptions(QWidget* parent);
97 protected:
98 // settings
99 virtual void saveSettings(KConfig*);
100 virtual void restoreSettings(KConfig*);
102 // override must return the integrated output window
103 virtual TTYWindow* ttyWindow() = 0;
105 // statusbar texts
106 QString m_statusActive;
108 // output window
109 QString m_outputTermCmdStr;
110 QString m_outputTermKeepScript;
111 KProcess* m_outputTermProc;
112 int m_ttyLevel;
113 virtual QString createOutputWindow(); /* returns terminal name */
114 void shutdownTermWindow();
116 QString m_lastDirectory; /* the dir of the most recently opened file */
118 QString m_transcriptFile; /* where gdb dialog is logged */
120 bool m_popForeground; /* whether main wnd raises when prog stops */
121 int m_backTimeout; /* when wnd goes back */
122 int m_tabWidth; /* tab width in characters (can be 0) */
123 QString m_sourceFilter;
124 QString m_headerFilter;
126 // the debugger proper
127 QString m_debuggerCmdStr;
128 KDebugger* m_debugger;
129 void setupDebugger(QWidget* parent,
130 ExprWnd* localVars,
131 ExprWnd* watchVars,
132 QListBox* backtrace);
133 DebuggerDriver* driverFromLang(QCString lang);
135 * This function derives a driver name from the contents of the named
136 * file.
138 QCString driverNameFromFile(const QString& exe);
140 public:
142 * Important! The following functions must be overridden in derived
143 * classes and be declared as slots! Note: These must not be declared
144 * virtual here since Qt signal mechanism fails miserably (because this
145 * class will not be the left-most base class!).
147 void newStatusMsg(KStatusBar* statusbar);
148 void slotDebuggerStarting();
151 #endif // MAINWNDBASE_H