| 411 | } |
| 412 | |
| 413 | void TextEditorPrivate::showMarginMenu() |
| 414 | { |
| 415 | QMenu menu; |
| 416 | int line = 0, index = 0; |
| 417 | q->getCursorPosition(&line, &index); |
| 418 | |
| 419 | if (q->hasBreakpoint(line)) { |
| 420 | menu.addAction(tr("Remove Breakpoint"), q, [this, line] { q->removeBreakpoint(line); }); |
| 421 | if (q->breakpointEnabled(line)) |
| 422 | menu.addAction(tr("Disable Breakpoint"), q, [this, line] { q->setBreakpointEnabled(line, false); }); |
| 423 | else |
| 424 | menu.addAction(tr("Enable Breakpoint"), q, [this, line] { q->setBreakpointEnabled(line, true); }); |
| 425 | menu.addAction(tr("Add Condition"), q, [this, line] { q->setBreakpointCondition(line); }); |
| 426 | } else { |
| 427 | static QString text(tr("Add a breakpoint on line %1")); |
| 428 | menu.addAction(text.arg(line + 1), q, [this, line] { q->addBreakpoint(line); }); |
| 429 | } |
| 430 | |
| 431 | auto &ctx = dpfInstance.serviceContext(); |
| 432 | DebuggerService *debuggerService = ctx.service<DebuggerService>(DebuggerService::name()); |
| 433 | if (debuggerService->getDebugState() == AbstractDebugger::RunState::kStopped) { |
| 434 | menu.addSeparator(); |
| 435 | menu.addAction(tr("jump to %1 line").arg(line + 1), q, [this, line] { editor.jumpToLine(fileName, line); }); |
| 436 | menu.addAction(tr("run to %1 line").arg(line + 1), q, [this, line] { editor.runToLine(fileName, line); }); |
| 437 | } |
| 438 | |
| 439 | // notify other plugin to add action. |
| 440 | editor.marginMenu(QVariant::fromValue(&menu)); |
| 441 | menu.exec(QCursor::pos()); |
| 442 | } |
| 443 | |
| 444 | void TextEditorPrivate::gotoNextMark(uint mask) |
| 445 | { |
no test coverage detected