KStdAccel is now a namespace, not an object.
[kdbg.git] / kdbg / mainwndbase.h
blobd15fbe82f694894aa884ab7e86c0f07855497e15
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 "exprwnd.h"
13 #include "sys/types.h" /* pid_t */
15 // forward declarations
16 class KDebugger;
17 class TTYWindow;
18 class UpdateUI;
19 class KToolBar;
20 class KStatusBar;
21 class KProcess;
23 class WatchWindow : public QWidget
25 Q_OBJECT
26 public:
27 WatchWindow(QWidget* parent, const char* name, WFlags f = 0);
28 ~WatchWindow();
29 ExprWnd* watchVariables() { return &m_watchVariables; }
30 QString watchText() const { return m_watchEdit.text(); }
32 protected:
33 QLineEdit m_watchEdit;
34 QPushButton m_watchAdd;
35 QPushButton m_watchDelete;
36 ExprWnd m_watchVariables;
37 QVBoxLayout m_watchV;
38 QHBoxLayout m_watchH;
40 virtual bool eventFilter(QObject* ob, QEvent* ev);
42 signals:
43 void addWatch();
44 void deleteWatch();
46 protected slots:
47 void slotWatchHighlighted(int);
51 class DebuggerMainWndBase
53 public:
54 DebuggerMainWndBase();
55 virtual ~DebuggerMainWndBase();
57 /**
58 * Sets the command to invoke the terminal that displays the program
59 * output. If cmd is the empty string, the default is substituted.
61 void setTerminalCmd(const QString& cmd);
62 /**
63 * Sets the command to invoke the debugger.
65 void setDebuggerCmdStr(const QString& cmd);
66 /**
67 * Specifies the file where to write the transcript.
69 void setTranscript(const char* name);
71 // the following are needed to handle program arguments
72 bool debugProgram(const QString& executable);
73 void setCoreFile(const QString& corefile);
74 void setRemoteDevice(const QString &remoteDevice);
75 /** helper around KFileDialog */
76 static QString myGetFileName(QString caption,
77 QString dir, QString filter,
78 QWidget* parent);
79 /** invokes the global options dialog */
80 virtual void doGlobalOptions(QWidget* parent);
81 /** add recent executable; moves it to top of list if present */
82 void addRecentExec(const QString& executable);
83 /** remove recent executable */
84 void removeRecentExec(const QString& executable);
85 /** start a new session; error popups appear on errors */
86 bool debugProgramInteractive(const QString& executable, QWidget* parent);
88 protected:
89 // settings
90 virtual void saveSettings(KConfig*);
91 virtual void restoreSettings(KConfig*);
93 // override must return the toolbar containing the animation and
94 // buttons to update
95 virtual KToolBar* dbgToolBar() = 0;
96 // override must return the statusbar
97 virtual KStatusBar* dbgStatusBar() = 0;
98 // override must return the integrated output window
99 virtual TTYWindow* ttyWindow() = 0;
101 // statusbar texts
102 QString m_statusActive;
104 // animated button
105 QList<QPixmap> m_animation;
106 uint m_animationCounter;
107 void initAnimation();
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 // recent execs in File menu
128 QStrList m_recentExecList;
130 // the debugger proper
131 QString m_debuggerCmdStr;
132 KDebugger* m_debugger;
133 void setupDebugger(QWidget* parent,
134 ExprWnd* localVars,
135 ExprWnd* watchVars,
136 QListBox* backtrace);
138 public:
140 * Important! The following functions must be overridden in derived
141 * classes and be declared as slots! Note: These must not be declared
142 * virtual here since Qt signal mechanism fails miserably (because this
143 * class will not be the left-most base class!).
145 void updateUIItem(UpdateUI* item);
146 void updateLineItems();
147 void slotNewStatusMsg();
148 void slotAnimationTimeout();
149 void slotDebuggerStarting();
152 #endif // MAINWNDBASE_H