Documented XSLT debugging.
[kdbg.git] / kdbg / mainwndbase.h
blob2bcae258ba3607cd01c70f4421d3c9c8c1328f3a
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(); }
34 protected:
35 QLineEdit m_watchEdit;
36 QPushButton m_watchAdd;
37 QPushButton m_watchDelete;
38 ExprWnd m_watchVariables;
39 QVBoxLayout m_watchV;
40 QHBoxLayout m_watchH;
42 virtual bool eventFilter(QObject* ob, QEvent* ev);
44 signals:
45 void addWatch();
46 void deleteWatch();
48 protected slots:
49 void slotWatchHighlighted(int);
53 class DebuggerMainWndBase
55 public:
56 DebuggerMainWndBase();
57 virtual ~DebuggerMainWndBase();
59 /**
60 * Sets the command to invoke the terminal that displays the program
61 * output. If cmd is the empty string, the default is substituted.
63 void setTerminalCmd(const QString& cmd);
64 /**
65 * Sets the command to invoke the debugger.
67 void setDebuggerCmdStr(const QString& cmd);
68 /**
69 * Specifies the file where to write the transcript.
71 void setTranscript(const char* name);
72 /**
73 * Starts to debug the specified program using the specified language
74 * driver.
76 bool debugProgram(const QString& executable, QCString lang, QWidget* parent);
77 /**
78 * Specifies the process to attach to after the program is loaded.
80 void setAttachPid(const QString& pid);
82 // the following are needed to handle program arguments
83 void setCoreFile(const QString& corefile);
84 void setRemoteDevice(const QString &remoteDevice);
85 /** helper around KFileDialog */
86 static QString myGetFileName(QString caption,
87 QString dir, QString filter,
88 QWidget* parent);
89 /** invokes the global options dialog */
90 virtual void doGlobalOptions(QWidget* parent);
92 protected:
93 // settings
94 virtual void saveSettings(KConfig*);
95 virtual void restoreSettings(KConfig*);
97 // override must return the integrated output window
98 virtual TTYWindow* ttyWindow() = 0;
100 // statusbar texts
101 QString m_statusActive;
103 // animated button
104 QList<QPixmap> m_animation;
105 uint m_animationCounter;
106 void initAnimation(KToolBar* toolbar);
107 void nextAnimationFrame(KToolBar* toolbar);
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