Remember the width of column 1 of Locals and Watch window across sessions.
[kdbg.git] / kdbg / mainwndbase.h
blobec508923769af1bdd40e4bfde30100deccf2dc14
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);
46 signals:
47 void addWatch();
48 void deleteWatch();
50 protected slots:
51 void slotWatchHighlighted();
55 class DebuggerMainWndBase
57 public:
58 DebuggerMainWndBase();
59 virtual ~DebuggerMainWndBase();
61 /**
62 * Sets the command to invoke the terminal that displays the program
63 * output. If cmd is the empty string, the default is substituted.
65 void setTerminalCmd(const QString& cmd);
66 /**
67 * Sets the command to invoke the debugger.
69 void setDebuggerCmdStr(const QString& cmd);
70 /**
71 * Specifies the file where to write the transcript.
73 void setTranscript(const char* name);
74 /**
75 * Starts to debug the specified program using the specified language
76 * driver.
78 bool debugProgram(const QString& executable, QCString lang, QWidget* parent);
79 /**
80 * Specifies the process to attach to after the program is loaded.
82 void setAttachPid(const QString& pid);
84 // the following are needed to handle program arguments
85 void setCoreFile(const QString& corefile);
86 void setRemoteDevice(const QString &remoteDevice);
87 /** helper around KFileDialog */
88 static QString myGetFileName(QString caption,
89 QString dir, QString filter,
90 QWidget* parent);
91 /** invokes the global options dialog */
92 virtual void doGlobalOptions(QWidget* parent);
94 protected:
95 // settings
96 virtual void saveSettings(KConfig*);
97 virtual void restoreSettings(KConfig*);
99 // override must return the integrated output window
100 virtual TTYWindow* ttyWindow() = 0;
102 // statusbar texts
103 QString m_statusActive;
105 // output window
106 QString m_outputTermCmdStr;
107 QString m_outputTermKeepScript;
108 KProcess* m_outputTermProc;
109 int m_ttyLevel;
110 virtual QString createOutputWindow(); /* returns terminal name */
111 void shutdownTermWindow();
113 QString m_lastDirectory; /* the dir of the most recently opened file */
115 QString m_transcriptFile; /* where gdb dialog is logged */
117 bool m_popForeground; /* whether main wnd raises when prog stops */
118 int m_backTimeout; /* when wnd goes back */
119 int m_tabWidth; /* tab width in characters (can be 0) */
120 QString m_sourceFilter;
121 QString m_headerFilter;
123 // the debugger proper
124 QString m_debuggerCmdStr;
125 KDebugger* m_debugger;
126 void setupDebugger(QWidget* parent,
127 ExprWnd* localVars,
128 ExprWnd* watchVars,
129 QListBox* backtrace);
130 DebuggerDriver* driverFromLang(QCString lang);
132 * This function derives a driver name from the contents of the named
133 * file.
135 QCString driverNameFromFile(const QString& exe);
137 public:
139 * Important! The following functions must be overridden in derived
140 * classes and be declared as slots! Note: These must not be declared
141 * virtual here since Qt signal mechanism fails miserably (because this
142 * class will not be the left-most base class!).
144 void newStatusMsg(KStatusBar* statusbar);
145 void slotDebuggerStarting();
148 #endif // MAINWNDBASE_H