| 29 | } |
| 30 | |
| 31 | bool DebuggerPlugin::start() |
| 32 | { |
| 33 | auto &ctx = dpfInstance.serviceContext(); |
| 34 | windowService = ctx.service<WindowService>(WindowService::name()); |
| 35 | if (!windowService) { |
| 36 | qCritical() << "Failed, can't found window service"; |
| 37 | abort(); |
| 38 | } |
| 39 | |
| 40 | DebuggerService *debuggerService = ctx.service<DebuggerService>(DebuggerService::name()); |
| 41 | if (!debuggerService) { |
| 42 | qCritical() << "Failed, can't found debugger service"; |
| 43 | abort(); |
| 44 | } |
| 45 | |
| 46 | debugManager->initialize(windowService, debuggerService); |
| 47 | |
| 48 | if (windowService->addNavigationItem) { |
| 49 | QAction *action = new QAction(MWNA_DEBUG, this); |
| 50 | action->setIcon(QIcon::fromTheme("debug-navigation")); |
| 51 | auto *actionImpl = new AbstractAction(action); |
| 52 | windowService->addNavigationItem(actionImpl, Priority::high); |
| 53 | windowService->registerWidgetToMode(mainWindow, new AbstractWidget(debugManager->getDebugMainPane()), CM_DEBUG, Position::Left, true, true); |
| 54 | windowService->bindWidgetToNavigation(mainWindow, actionImpl); |
| 55 | windowService->setDockHeaderName(mainWindow, tr("debug")); |
| 56 | auto localsPaneImpl = new AbstractWidget(debugManager->getLocalsPane()); |
| 57 | QString variablesPane = tr("Variables Watcher"); |
| 58 | windowService->addWidgetRightspace(variablesPane, localsPaneImpl, ""); |
| 59 | connect(action, &QAction::triggered, this, [=]() { |
| 60 | if (debugManager->getRunState() != AbstractDebugger::kNoRun) |
| 61 | windowService->showWidgetAtRightspace(variablesPane); |
| 62 | }, Qt::DirectConnection); |
| 63 | connect(debugManager, &DebugManager::debugStarted, this, [=](){ |
| 64 | uiController.doSwitch(MWNA_DEBUG); |
| 65 | windowService->showWidgetAtRightspace(variablesPane); |
| 66 | uiController.switchContext(tr("&Application Output")); |
| 67 | }, Qt::DirectConnection); |
| 68 | } |
| 69 | |
| 70 | return true; |
| 71 | } |
| 72 | |
| 73 | dpf::Plugin::ShutdownFlag DebuggerPlugin::stop() |
| 74 | { |
nothing calls this directly
no test coverage detected