Solaris' ln needs -s -f instead of -sf.
[kdbg.git] / kdbg / mainwndbase.h
blobe516ff4d74f69103fa090fd4c631dc21bdb5d4db
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 KStdAccel;
20 class KToolBar;
21 class KStatusBar;
22 class KProcess;
24 extern KStdAccel* keys;
27 class WatchWindow : public QWidget
29 Q_OBJECT
30 public:
31 WatchWindow(QWidget* parent, const char* name, WFlags f = 0);
32 ~WatchWindow();
33 ExprWnd* watchVariables() { return &m_watchVariables; }
34 QString watchText() const { return m_watchEdit.text(); }
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(int);
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);
75 // the following are needed to handle program arguments
76 bool debugProgram(const QString& executable);
77 void setCoreFile(const QString& corefile);
78 void setRemoteDevice(const QString &remoteDevice);
79 /** returns true if the command was handled */
80 bool handleCommand(int item);
81 /** helper around KFileDialog */
82 static QString myGetFileName(QString caption,
83 QString dir, QString filter,
84 QWidget* parent);
85 /** invokes the global options dialog */
86 virtual void doGlobalOptions();
87 /** add recent executable; moves it to top of list if present */
88 void addRecentExec(const QString& executable);
89 /** remove recent executable */
90 void removeRecentExec(const QString& executable);
91 /** start a new session; error popups appear on errors */
92 bool debugProgramInteractive(const QString& executable);
94 protected:
95 // settings
96 virtual void saveSettings(KConfig*);
97 virtual void restoreSettings(KConfig*);
99 // override must return the toolbar containing the animation and
100 // buttons to update
101 virtual KToolBar* dbgToolBar() = 0;
102 // override must return the statusbar
103 virtual KStatusBar* dbgStatusBar() = 0;
104 // override must return the main window (usually this)
105 virtual QWidget* dbgMainWnd() = 0;
106 // override must return the integrated output window
107 virtual TTYWindow* ttyWindow() = 0;
109 // statusbar texts
110 QString m_statusActive;
112 // animated button
113 QList<QPixmap> m_animation;
114 uint m_animationCounter;
115 void initAnimation();
117 // output window
118 QString m_outputTermCmdStr;
119 QString m_outputTermKeepScript;
120 KProcess* m_outputTermProc;
121 int m_ttyLevel;
122 virtual QString createOutputWindow(); /* returns terminal name */
123 void shutdownTermWindow();
125 QString m_lastDirectory; /* the dir of the most recently opened file */
127 QString m_transcriptFile; /* where gdb dialog is logged */
129 bool m_popForeground; /* whether main wnd raises when prog stops */
130 int m_backTimeout; /* when wnd goes back */
131 int m_tabWidth; /* tab width in characters (can be 0) */
132 QString m_sourceFilter;
133 QString m_headerFilter;
135 // recent execs in File menu
136 QStrList m_recentExecList;
138 // the debugger proper
139 QString m_debuggerCmdStr;
140 KDebugger* m_debugger;
141 void setupDebugger(ExprWnd* localVars,
142 ExprWnd* watchVars,
143 QListBox* backtrace);
145 public:
147 * Important! The following functions must be overridden in derived
148 * classes and be declared as slots! Note: These must not be declared
149 * virtual here since Qt signal mechanism fails miserably (because this
150 * class will not be the left-most base class!).
152 void updateUIItem(UpdateUI* item);
153 void updateLineItems();
154 void slotNewStatusMsg();
155 void slotAnimationTimeout();
156 void slotDebuggerStarting();
159 #endif // MAINWNDBASE_H