Address status bar text boxes by pointer instead of "command IDs".
[kdbg.git] / kdbg / dbgmainwnd.h
blobf85e3a66ce556b80fd9c5112fa7b8b78a5e0f9a0
1 /*
2 * Copyright Johannes Sixt
3 * This file is licensed under the GNU General Public License Version 2.
4 * See the file COPYING in the toplevel directory of the source directory.
5 */
7 #ifndef DBGMAINWND_H
8 #define DBGMAINWND_H
10 #include <QPointer>
11 #include <QTimer>
12 #include <kxmlguiwindow.h>
13 #include "regwnd.h"
15 class QDockWidget;
16 class QProcess;
17 class KAnimatedButton;
18 class KRecentFilesAction;
19 class KSqueezedTextLabel;
20 class KUrl;
21 class WinStack;
22 class QListWidget;
23 class ExprWnd;
24 class BreakpointTable;
25 class ThreadList;
26 class MemoryWindow;
27 class TTYWindow;
28 class WatchWindow;
29 class KDebugger;
30 class DebuggerDriver;
31 struct DbgAddr;
33 class DebuggerMainWnd : public KXmlGuiWindow
35 Q_OBJECT
36 public:
37 DebuggerMainWnd();
38 ~DebuggerMainWnd();
40 bool debugProgram(const QString& exe, const QString& lang);
42 /**
43 * Specifies the file where to write the transcript.
45 void setTranscript(const QString& name);
46 /**
47 * Specifies the process to attach to after the program is loaded.
49 void setAttachPid(const QString& pid);
51 // the following are needed to handle program arguments
52 void setCoreFile(const QString& corefile);
53 void setRemoteDevice(const QString &remoteDevice);
54 void overrideProgramArguments(const QString& args);
56 protected:
57 // session properties
58 virtual void saveProperties(KConfigGroup& cg);
59 virtual void readProperties(const KConfigGroup& cg);
60 // settings
61 void saveSettings(KSharedConfigPtr);
62 void restoreSettings(KSharedConfigPtr);
64 void initAnimation();
65 void initStatusBar();
66 void initKAction();
68 // view windows
69 WinStack* m_filesWindow;
70 QListWidget* m_btWindow;
71 ExprWnd* m_localVariables;
72 WatchWindow* m_watches;
73 RegisterView* m_registers;
74 BreakpointTable* m_bpTable;
75 TTYWindow* m_ttyWindow;
76 ThreadList* m_threads;
77 MemoryWindow* m_memoryWindow;
79 QTimer m_backTimer;
81 // recent execs in File menu
82 QAction* m_closeAction;
83 QAction* m_reloadAction;
84 QAction* m_fileExecAction;
85 KRecentFilesAction* m_recentExecAction;
86 QAction* m_coreDumpAction;
87 QAction* m_settingsAction;
88 QAction* m_findAction;
89 QAction* m_btWindowAction;
90 QAction* m_localVariablesAction;
91 QAction* m_watchesAction;
92 QAction* m_registersAction;
93 QAction* m_bpTableAction;
94 QAction* m_ttyWindowAction;
95 QAction* m_threadsAction;
96 QAction* m_memoryWindowAction;
97 QAction* m_runAction;
98 QAction* m_stepIntoAction;
99 QAction* m_stepOverAction;
100 QAction* m_stepOutAction;
101 QAction* m_toCursorAction;
102 QAction* m_stepIntoIAction;
103 QAction* m_stepOverIAction;
104 QAction* m_execMovePCAction;
105 QAction* m_breakAction;
106 QAction* m_killAction;
107 QAction* m_restartAction;
108 QAction* m_attachAction;
109 QAction* m_detachAction;
110 QAction* m_argumentsAction;
111 QAction* m_bpSetAction;
112 QAction* m_bpSetTempAction;
113 QAction* m_bpEnableAction;
114 QAction* m_editValueAction;
115 QString m_lastDirectory; /* the dir of the most recently opened file */
117 protected:
118 virtual bool queryClose();
119 QAction* createAction(const QString& text, const char* icon,
120 int shortcut, const QObject* receiver,
121 const char* slot, const char* name);
122 QAction* createAction(const QString& text,
123 int shortcut, const QObject* receiver,
124 const char* slot, const char* name);
126 // the debugger proper
127 QString m_debuggerCmdStr;
128 KDebugger* m_debugger;
129 QString m_transcriptFile; /* where gdb dialog is logged */
132 * Starts to debug the specified program using the specified language
133 * driver.
135 bool startDriver(const QString& executable, QString lang);
136 DebuggerDriver* driverFromLang(QString lang);
138 * Derives a driver name from the contents of the named file.
140 QString driverNameFromFile(const QString& exe);
142 // output window
143 QString m_outputTermCmdStr;
144 QString m_outputTermKeepScript;
145 QProcess* m_outputTermProc;
146 int m_ttyLevel;
148 QString createOutputWindow();
150 bool m_popForeground; /* whether main wnd raises when prog stops */
151 int m_backTimeout; /* when wnd goes back */
152 int m_tabWidth; /* tab width in characters (can be 0) */
153 QString m_sourceFilter;
154 QString m_headerFilter;
155 void setTerminalCmd(const QString& cmd);
156 void setDebuggerCmdStr(const QString& cmd);
158 QDockWidget* createDockWidget(const char* name, const QString& title);
159 QDockWidget* dockParent(QWidget* w);
160 bool isDockVisible(QWidget* w);
161 void makeDefaultLayout();
163 QString makeSourceFilter();
165 // to avoid flicker when the status bar is updated,
166 // we store the last string that we put there
167 QPointer<KAnimatedButton> m_animation;
168 QString m_lastActiveStatusText;
169 bool m_animRunning;
171 // statusbar texts
172 KSqueezedTextLabel* m_statusActiveLabel;
173 QString m_statusActive;
174 KSqueezedTextLabel* m_statusMsgLabel;
176 signals:
177 void setTabWidth(int tabWidth);
179 public slots:
180 virtual void updateUI();
181 virtual void updateLineItems();
182 void slotAddWatch();
183 void slotAddWatch(const QString& text);
184 void slotNewFileLoaded();
185 void slotNewStatusMsg();
186 void slotDebuggerStarting();
187 void slotToggleBreak(const QString&, int, const DbgAddr&, bool);
188 void slotEnaDisBreak(const QString&, int, const DbgAddr&);
189 void slotProgramStopped();
190 void slotBackTimer();
191 void slotRecentExec(const KUrl& url);
192 void slotLocalsPopup(const QPoint& pt);
193 void slotLocalsToWatch();
194 void slotEditValue();
196 void slotFileOpen();
197 void slotFileExe();
198 void slotFileCore();
199 void slotFileGlobalSettings();
200 void slotFileProgSettings();
201 void slotViewStatusbar();
202 void slotExecUntil();
203 void slotExecAttach();
204 void slotExecArgs();
205 void intoBackground();
206 void slotConfigureKeys();
209 #endif // DBGMAINWND_H