Changeset View
Changeset View
Standalone View
Standalone View
addons/gdbplugin/plugin_kategdb.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 74 | { | |||
---|---|---|---|---|---|
105 | m_outputArea->setTextBackgroundColor(schemeView.foreground().color()); | 105 | m_outputArea->setTextBackgroundColor(schemeView.foreground().color()); | ||
106 | m_outputArea->setTextColor(schemeView.background().color()); | 106 | m_outputArea->setTextColor(schemeView.background().color()); | ||
107 | QPalette p = m_outputArea->palette (); | 107 | QPalette p = m_outputArea->palette (); | ||
108 | p.setColor(QPalette::Base, schemeView.foreground().color()); | 108 | p.setColor(QPalette::Base, schemeView.foreground().color()); | ||
109 | m_outputArea->setPalette(p); | 109 | m_outputArea->setPalette(p); | ||
110 | 110 | | |||
111 | // input | 111 | // input | ||
112 | m_inputArea = new KHistoryComboBox(true); | 112 | m_inputArea = new KHistoryComboBox(true); | ||
113 | connect(m_inputArea, SIGNAL(returnPressed()), this, SLOT(slotSendCommand())); | 113 | connect(m_inputArea, static_cast<void (KHistoryComboBox::*)()>(&KHistoryComboBox::returnPressed), this, &KatePluginGDBView::slotSendCommand); | ||
114 | QHBoxLayout *inputLayout = new QHBoxLayout(); | 114 | QHBoxLayout *inputLayout = new QHBoxLayout(); | ||
115 | inputLayout->addWidget(m_inputArea, 10); | 115 | inputLayout->addWidget(m_inputArea, 10); | ||
116 | inputLayout->setContentsMargins(0,0,0,0); | 116 | inputLayout->setContentsMargins(0,0,0,0); | ||
117 | m_outputArea->setFocusProxy(m_inputArea); // take the focus from the outputArea | 117 | m_outputArea->setFocusProxy(m_inputArea); // take the focus from the outputArea | ||
118 | 118 | | |||
119 | m_gdbPage = new QWidget(); | 119 | m_gdbPage = new QWidget(); | ||
120 | QVBoxLayout *layout = new QVBoxLayout(m_gdbPage); | 120 | QVBoxLayout *layout = new QVBoxLayout(m_gdbPage); | ||
121 | layout->addWidget(m_outputArea); | 121 | layout->addWidget(m_outputArea); | ||
Show All 13 Lines | |||||
135 | stackLayout->setContentsMargins(0,0,0,0); | 135 | stackLayout->setContentsMargins(0,0,0,0); | ||
136 | stackLayout->setSpacing(0); | 136 | stackLayout->setSpacing(0); | ||
137 | QStringList headers; | 137 | QStringList headers; | ||
138 | headers << QStringLiteral(" ") << i18nc("Column label (frame number)", "Nr") << i18nc("Column label", "Frame"); | 138 | headers << QStringLiteral(" ") << i18nc("Column label (frame number)", "Nr") << i18nc("Column label", "Frame"); | ||
139 | m_stackTree->setHeaderLabels(headers); | 139 | m_stackTree->setHeaderLabels(headers); | ||
140 | m_stackTree->setRootIsDecorated(false); | 140 | m_stackTree->setRootIsDecorated(false); | ||
141 | m_stackTree->resizeColumnToContents(0); | 141 | m_stackTree->resizeColumnToContents(0); | ||
142 | m_stackTree->resizeColumnToContents(1); | 142 | m_stackTree->resizeColumnToContents(1); | ||
143 | m_stackTree->setAutoScroll(false); | 143 | m_stackTree->setAutoScroll(false);/* | ||
144 | connect(m_stackTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), | 144 | connect(m_stackTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), | ||
145 | this, SLOT(stackFrameSelected())); | 145 | this, SLOT(stackFrameSelected()));*/ | ||
dhaumann: Remove this comment? | |||||
146 | connect(m_stackTree, &QTreeWidget::itemActivated, this, &KatePluginGDBView::stackFrameSelected); | ||||
146 | 147 | | |||
147 | connect(m_threadCombo, SIGNAL(currentIndexChanged(int)), | 148 | connect(m_threadCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &KatePluginGDBView::threadSelected); | ||
148 | this, SLOT(threadSelected(int))); | | |||
149 | 149 | | |||
150 | 150 | | |||
151 | m_localsView = new LocalsView(); | 151 | m_localsView = new LocalsView(); | ||
152 | 152 | | |||
153 | QSplitter *locStackSplitter = new QSplitter(m_localsStackToolView); | 153 | QSplitter *locStackSplitter = new QSplitter(m_localsStackToolView); | ||
154 | locStackSplitter->addWidget(m_localsView); | 154 | locStackSplitter->addWidget(m_localsView); | ||
155 | locStackSplitter->addWidget(stackContainer); | 155 | locStackSplitter->addWidget(stackContainer); | ||
156 | locStackSplitter->setOrientation(Qt::Vertical); | 156 | locStackSplitter->setOrientation(Qt::Vertical); | ||
157 | 157 | | |||
158 | // config page | 158 | // config page | ||
159 | m_configView = new ConfigView(nullptr, mainWin); | 159 | m_configView = new ConfigView(nullptr, mainWin); | ||
160 | 160 | | |||
161 | m_ioView = new IOView(); | 161 | m_ioView = new IOView(); | ||
162 | connect(m_configView, SIGNAL(showIO(bool)), | 162 | connect(m_configView, &ConfigView::showIO, this, &KatePluginGDBView::showIO); | ||
163 | this, SLOT(showIO(bool))); | | |||
164 | 163 | | |||
165 | m_tabWidget->addTab(m_gdbPage, i18nc("Tab label", "GDB Output")); | 164 | m_tabWidget->addTab(m_gdbPage, i18nc("Tab label", "GDB Output")); | ||
166 | m_tabWidget->addTab(m_configView, i18nc("Tab label", "Settings")); | 165 | m_tabWidget->addTab(m_configView, i18nc("Tab label", "Settings")); | ||
167 | 166 | | |||
168 | m_debugView = new DebugView(this); | 167 | m_debugView = new DebugView(this); | ||
169 | connect(m_debugView, SIGNAL(readyForInput(bool)), | 168 | connect(m_debugView, &DebugView::readyForInput, this, &KatePluginGDBView::enableDebugActions); | ||
170 | this, SLOT(enableDebugActions(bool))); | | |||
171 | 169 | | |||
172 | connect(m_debugView, SIGNAL(outputText(QString)), | 170 | connect(m_debugView, &DebugView::outputText, this, &KatePluginGDBView::addOutputText); | ||
173 | this, SLOT(addOutputText(QString))); | | |||
174 | 171 | | |||
175 | connect(m_debugView, SIGNAL(outputError(QString)), | 172 | connect(m_debugView, &DebugView::outputError, this, &KatePluginGDBView::addErrorText); | ||
176 | this, SLOT(addErrorText(QString))); | | |||
177 | 173 | | |||
178 | connect(m_debugView, SIGNAL(debugLocationChanged(QUrl,int)), | 174 | connect(m_debugView, &DebugView::debugLocationChanged, this, &KatePluginGDBView::slotGoTo); | ||
179 | this, SLOT(slotGoTo(QUrl,int))); | | |||
180 | 175 | | |||
181 | connect(m_debugView, SIGNAL(breakPointSet(QUrl,int)), | 176 | connect(m_debugView, &DebugView::breakPointSet, this, &KatePluginGDBView::slotBreakpointSet); | ||
182 | this, SLOT(slotBreakpointSet(QUrl,int))); | | |||
183 | 177 | | |||
184 | connect(m_debugView, SIGNAL(breakPointCleared(QUrl,int)), | 178 | connect(m_debugView, &DebugView::breakPointCleared, this, &KatePluginGDBView::slotBreakpointCleared); | ||
185 | this, SLOT(slotBreakpointCleared(QUrl,int))); | | |||
186 | 179 | | |||
187 | connect(m_debugView, SIGNAL(clearBreakpointMarks()), | 180 | connect(m_debugView, &DebugView::clearBreakpointMarks, this, &KatePluginGDBView::clearMarks); | ||
188 | this, SLOT(clearMarks())); | | |||
189 | 181 | | |||
190 | connect(m_debugView, SIGNAL(programEnded()), | 182 | connect(m_debugView, &DebugView::programEnded, this, &KatePluginGDBView::programEnded); | ||
191 | this, SLOT(programEnded())); | | |||
192 | 183 | | |||
193 | connect(m_debugView, SIGNAL(gdbEnded()), | 184 | connect(m_debugView, &DebugView::gdbEnded, this, &KatePluginGDBView::programEnded); | ||
194 | this, SLOT(programEnded())); | | |||
195 | 185 | | |||
196 | connect(m_debugView, SIGNAL(gdbEnded()), | 186 | connect(m_debugView, &DebugView::gdbEnded, this, &KatePluginGDBView::gdbEnded); | ||
197 | this, SLOT(gdbEnded())); | | |||
198 | 187 | | |||
199 | connect(m_debugView, SIGNAL(stackFrameInfo(QString,QString)), | 188 | connect(m_debugView, &DebugView::stackFrameInfo, this, &KatePluginGDBView::insertStackFrame); | ||
200 | this, SLOT(insertStackFrame(QString,QString))); | | |||
201 | 189 | | |||
202 | connect(m_debugView, SIGNAL(stackFrameChanged(int)), | 190 | connect(m_debugView, &DebugView::stackFrameChanged, this, &KatePluginGDBView::stackFrameChanged); | ||
203 | this, SLOT(stackFrameChanged(int))); | | |||
204 | 191 | | |||
205 | connect(m_debugView, SIGNAL(infoLocal(QString)), | 192 | connect(m_debugView, &DebugView::infoLocal, m_localsView, &LocalsView::addLocal); | ||
206 | m_localsView, SLOT(addLocal(QString))); | | |||
207 | 193 | | |||
208 | connect(m_debugView, SIGNAL(threadInfo(int,bool)), | 194 | connect(m_debugView, &DebugView::threadInfo, this, &KatePluginGDBView::insertThread); | ||
209 | this, SLOT(insertThread(int,bool))); | | |||
210 | 195 | | |||
211 | connect(m_localsView, SIGNAL(localsVisible(bool)), | 196 | connect(m_localsView, &LocalsView::localsVisible, m_debugView, &DebugView::slotQueryLocals); | ||
212 | m_debugView, SLOT(slotQueryLocals(bool))); | | |||
213 | 197 | | |||
214 | // Actions | 198 | // Actions | ||
215 | m_configView->registerActions(actionCollection()); | 199 | m_configView->registerActions(actionCollection()); | ||
216 | 200 | | |||
217 | QAction* a = actionCollection()->addAction(QStringLiteral("debug")); | 201 | QAction* a = actionCollection()->addAction(QStringLiteral("debug")); | ||
218 | a->setText(i18n("Start Debugging")); | 202 | a->setText(i18n("Start Debugging")); | ||
219 | a->setIcon(QIcon(QStringLiteral(":/kategdb/22-actions-debug-kategdb.png"))); | 203 | a->setIcon(QIcon(QStringLiteral(":/kategdb/22-actions-debug-kategdb.png"))); | ||
220 | connect( a, SIGNAL(triggered(bool)), | 204 | connect(a, &QAction::triggered, this, &KatePluginGDBView::slotDebug); | ||
221 | this, SLOT(slotDebug())); | | |||
222 | 205 | | |||
223 | a = actionCollection()->addAction(QStringLiteral("kill")); | 206 | a = actionCollection()->addAction(QStringLiteral("kill")); | ||
224 | a->setText(i18n("Kill / Stop Debugging")); | 207 | a->setText(i18n("Kill / Stop Debugging")); | ||
225 | a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-stop"))); | 208 | a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-stop"))); | ||
226 | connect( a, SIGNAL(triggered(bool)), | 209 | connect(a, &QAction::triggered, m_debugView, &DebugView::slotKill); | ||
227 | m_debugView, SLOT(slotKill())); | | |||
228 | 210 | | |||
229 | a = actionCollection()->addAction(QStringLiteral("rerun")); | 211 | a = actionCollection()->addAction(QStringLiteral("rerun")); | ||
230 | a->setText(i18n("Restart Debugging")); | 212 | a->setText(i18n("Restart Debugging")); | ||
231 | a->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | 213 | a->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); | ||
232 | connect( a, SIGNAL(triggered(bool)), | 214 | connect(a, &QAction::triggered,this, &KatePluginGDBView::slotRestart); | ||
233 | this, SLOT(slotRestart())); | | |||
234 | 215 | | |||
235 | a = actionCollection()->addAction(QStringLiteral("toggle_breakpoint")); | 216 | a = actionCollection()->addAction(QStringLiteral("toggle_breakpoint")); | ||
236 | a->setText(i18n("Toggle Breakpoint / Break")); | 217 | a->setText(i18n("Toggle Breakpoint / Break")); | ||
237 | a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause"))); | 218 | a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause"))); | ||
238 | connect( a, SIGNAL(triggered(bool)), | 219 | connect(a, &QAction::triggered,this, &KatePluginGDBView::slotToggleBreakpoint); | ||
239 | this, SLOT(slotToggleBreakpoint())); | | |||
240 | 220 | | |||
241 | a = actionCollection()->addAction(QStringLiteral("step_in")); | 221 | a = actionCollection()->addAction(QStringLiteral("step_in")); | ||
242 | a->setText(i18n("Step In")); | 222 | a->setText(i18n("Step In")); | ||
243 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-into"))); | 223 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-into"))); | ||
244 | connect( a, SIGNAL(triggered(bool)), | 224 | connect(a, &QAction::triggered, m_debugView, &DebugView::slotStepInto); | ||
245 | m_debugView, SLOT(slotStepInto())); | | |||
246 | 225 | | |||
247 | a = actionCollection()->addAction(QStringLiteral("step_over")); | 226 | a = actionCollection()->addAction(QStringLiteral("step_over")); | ||
248 | a->setText(i18n("Step Over")); | 227 | a->setText(i18n("Step Over")); | ||
249 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-over"))); | 228 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-over"))); | ||
250 | connect( a, SIGNAL(triggered(bool)), | 229 | connect(a, &QAction::triggered, m_debugView, &DebugView::slotStepOver); | ||
251 | m_debugView, SLOT(slotStepOver())); | 230 | | ||
252 | 231 | | |||
253 | a = actionCollection()->addAction(QStringLiteral("step_out")); | 232 | a = actionCollection()->addAction(QStringLiteral("step_out")); | ||
254 | a->setText(i18n("Step Out")); | 233 | a->setText(i18n("Step Out")); | ||
255 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-out"))); | 234 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-step-out"))); | ||
256 | connect( a, SIGNAL(triggered(bool)), | 235 | connect(a, &QAction::triggered, m_debugView, &DebugView::slotStepOut); | ||
257 | m_debugView, SLOT(slotStepOut())); | | |||
258 | 236 | | |||
259 | a = actionCollection()->addAction(QStringLiteral("move_pc")); | 237 | a = actionCollection()->addAction(QStringLiteral("move_pc")); | ||
260 | a->setText(i18nc("Move Program Counter (next execution)", "Move PC")); | 238 | a->setText(i18nc("Move Program Counter (next execution)", "Move PC")); | ||
261 | connect( a, SIGNAL(triggered(bool)), | 239 | connect(a, &QAction::triggered, this, &KatePluginGDBView::slotMovePC); | ||
262 | this, SLOT(slotMovePC())); | | |||
263 | 240 | | |||
264 | a = actionCollection()->addAction(QStringLiteral("run_to_cursor")); | 241 | a = actionCollection()->addAction(QStringLiteral("run_to_cursor")); | ||
265 | a->setText(i18n("Run To Cursor")); | 242 | a->setText(i18n("Run To Cursor")); | ||
266 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-run-cursor"))); | 243 | a->setIcon(QIcon::fromTheme(QStringLiteral("debug-run-cursor"))); | ||
267 | connect( a, SIGNAL(triggered(bool)), | 244 | connect(a, &QAction::triggered, this, &KatePluginGDBView::slotRunToCursor); | ||
268 | this, SLOT(slotRunToCursor())); | | |||
269 | 245 | | |||
270 | a = actionCollection()->addAction(QStringLiteral("continue")); | 246 | a = actionCollection()->addAction(QStringLiteral("continue")); | ||
271 | a->setText(i18n("Continue")); | 247 | a->setText(i18n("Continue")); | ||
272 | a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start"))); | 248 | a->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start"))); | ||
273 | connect( a, SIGNAL(triggered(bool)), | 249 | connect(a, &QAction::triggered, m_debugView, &DebugView::slotContinue); | ||
274 | m_debugView, SLOT(slotContinue())); | | |||
275 | 250 | | |||
276 | a = actionCollection()->addAction(QStringLiteral("print_value")); | 251 | a = actionCollection()->addAction(QStringLiteral("print_value")); | ||
277 | a->setText(i18n("Print Value")); | 252 | a->setText(i18n("Print Value")); | ||
278 | a->setIcon(QIcon::fromTheme(QStringLiteral("document-preview"))); | 253 | a->setIcon(QIcon::fromTheme(QStringLiteral("document-preview"))); | ||
279 | connect( a, SIGNAL(triggered(bool)), | 254 | connect(a, &QAction::triggered, this, &KatePluginGDBView::slotValue); | ||
280 | this, SLOT(slotValue())); | | |||
281 | 255 | | |||
282 | // popup context m_menu | 256 | // popup context m_menu | ||
283 | m_menu = new KActionMenu(i18n("Debug"), this); | 257 | m_menu = new KActionMenu(i18n("Debug"), this); | ||
284 | actionCollection()->addAction(QStringLiteral("popup_gdb"), m_menu); | 258 | actionCollection()->addAction(QStringLiteral("popup_gdb"), m_menu); | ||
285 | connect(m_menu->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu())); | 259 | connect(m_menu->menu(), &QMenu::aboutToShow, this, &KatePluginGDBView::aboutToShowMenu); | ||
286 | 260 | | |||
287 | m_breakpoint = m_menu->menu()->addAction(i18n("popup_breakpoint"), | 261 | m_breakpoint = m_menu->menu()->addAction(i18n("popup_breakpoint"), | ||
288 | this, SLOT(slotToggleBreakpoint())); | 262 | this, SLOT(slotToggleBreakpoint())); | ||
289 | 263 | | |||
290 | QAction* popupAction = m_menu->menu()->addAction(i18n("popup_run_to_cursor"), | 264 | QAction* popupAction = m_menu->menu()->addAction(i18n("popup_run_to_cursor"), | ||
291 | this, SLOT(slotRunToCursor())); | 265 | this, SLOT(slotRunToCursor())); | ||
292 | popupAction->setText(i18n("Run To Cursor")); | 266 | popupAction->setText(i18n("Run To Cursor")); | ||
293 | popupAction = m_menu->menu()->addAction(QStringLiteral("move_pc"), | 267 | popupAction = m_menu->menu()->addAction(QStringLiteral("move_pc"), | ||
294 | this, SLOT(slotMovePC())); | 268 | this, SLOT(slotMovePC())); | ||
295 | popupAction->setText(i18nc("Move Program Counter (next execution)", "Move PC")); | 269 | popupAction->setText(i18nc("Move Program Counter (next execution)", "Move PC")); | ||
296 | 270 | | |||
297 | enableDebugActions(false); | 271 | enableDebugActions(false); | ||
298 | 272 | | |||
299 | connect(m_mainWin, SIGNAL(unhandledShortcutOverride(QEvent*)), | 273 | connect(m_mainWin, &KTextEditor::MainWindow::unhandledShortcutOverride, | ||
300 | this, SLOT(handleEsc(QEvent*))); | 274 | this, &KatePluginGDBView::handleEsc); | ||
301 | 275 | | |||
302 | m_toolView->installEventFilter(this); | 276 | m_toolView->installEventFilter(this); | ||
303 | 277 | | |||
304 | m_mainWin->guiFactory()->addClient(this); | 278 | m_mainWin->guiFactory()->addClient(this); | ||
305 | } | 279 | } | ||
306 | 280 | | |||
307 | KatePluginGDBView::~KatePluginGDBView() | 281 | KatePluginGDBView::~KatePluginGDBView() | ||
308 | { | 282 | { | ||
Show All 9 Lines | |||||
318 | 292 | | |||
319 | void KatePluginGDBView::writeSessionConfig(KConfigGroup& config) | 293 | void KatePluginGDBView::writeSessionConfig(KConfigGroup& config) | ||
320 | { | 294 | { | ||
321 | m_configView->writeConfig(config); | 295 | m_configView->writeConfig(config); | ||
322 | } | 296 | } | ||
323 | 297 | | |||
324 | void KatePluginGDBView::slotDebug() | 298 | void KatePluginGDBView::slotDebug() | ||
325 | { | 299 | { | ||
326 | disconnect(m_ioView, SIGNAL(stdOutText(QString)), nullptr, nullptr); | 300 | disconnect(m_ioView, &IOView::stdOutText, nullptr, nullptr); | ||
327 | disconnect(m_ioView, SIGNAL(stdErrText(QString)), nullptr, nullptr); | 301 | disconnect(m_ioView, &IOView::stdErrText, nullptr, nullptr); | ||
328 | if (m_configView->showIOTab()) { | 302 | if (m_configView->showIOTab()) { | ||
329 | connect(m_ioView, SIGNAL(stdOutText(QString)), m_ioView, SLOT(addStdOutText(QString))); | 303 | connect(m_ioView, &IOView::stdOutText, m_ioView, &IOView::addStdOutText); | ||
330 | connect(m_ioView, SIGNAL(stdErrText(QString)), m_ioView, SLOT(addStdErrText(QString))); | 304 | connect(m_ioView, &IOView::stdErrText, m_ioView, &IOView::addStdErrText); | ||
331 | } | 305 | } | ||
332 | else { | 306 | else { | ||
333 | connect(m_ioView, SIGNAL(stdOutText(QString)), this, SLOT(addOutputText(QString))); | 307 | connect(m_ioView, &IOView::stdOutText, this, &KatePluginGDBView::addOutputText); | ||
334 | connect(m_ioView, SIGNAL(stdErrText(QString)), this, SLOT(addErrorText(QString))); | 308 | connect(m_ioView, &IOView::stdErrText, this, &KatePluginGDBView::addErrorText); | ||
335 | } | 309 | } | ||
336 | QStringList ioFifos; | 310 | QStringList ioFifos; | ||
337 | ioFifos << m_ioView->stdinFifo(); | 311 | ioFifos << m_ioView->stdinFifo(); | ||
338 | ioFifos << m_ioView->stdoutFifo(); | 312 | ioFifos << m_ioView->stdoutFifo(); | ||
339 | ioFifos << m_ioView->stderrFifo(); | 313 | ioFifos << m_ioView->stderrFifo(); | ||
340 | 314 | | |||
341 | enableDebugActions(true); | 315 | enableDebugActions(true); | ||
342 | m_mainWin->showToolView(m_toolView); | 316 | m_mainWin->showToolView(m_toolView); | ||
▲ Show 20 Lines • Show All 433 Lines • Show Last 20 Lines |
Remove this comment?