| 22 | } |
| 23 | |
| 24 | void MenuManager::initialize(WindowService *windowService) |
| 25 | { |
| 26 | if (!windowService) |
| 27 | return; |
| 28 | |
| 29 | auto initAction = [&](QAction *action, const QString &id, const QString &description, |
| 30 | QKeySequence key, const QString &iconName = {}) -> Command * { |
| 31 | action->setIcon(QIcon::fromTheme(iconName)); |
| 32 | auto cmd = ActionManager::instance()->registerAction(action, id); |
| 33 | cmd->setDescription(description); |
| 34 | if (!key.isEmpty()) |
| 35 | cmd->setDefaultKeySequence(key); |
| 36 | return cmd; |
| 37 | }; |
| 38 | |
| 39 | auto mDebug = ActionManager::instance()->actionContainer(M_DEBUG); |
| 40 | |
| 41 | startDebugging.reset(new QAction(MWMDA_START_DEBUG)); |
| 42 | connect(startDebugging.get(), &QAction::triggered, debugManager, &DebugManager::run); |
| 43 | auto actionImpl = initAction(startDebugging.get(), "Debug.Start.Debugging", |
| 44 | MWMDA_START_DEBUG, QKeySequence(Qt::Key::Key_F5), |
| 45 | "debugger_start"); |
| 46 | mDebug->addAction(actionImpl); |
| 47 | windowService->addTopToolItem(actionImpl, false, Priority::medium); |
| 48 | #if 0 // not used yet. |
| 49 | detachDebugger.reset(new QAction("Detach Debugger")); |
| 50 | connect(detachDebugger.get(), &QAction::triggered, debugManager, &DebugManager::detachDebug); |
| 51 | actionImpl = new AbstractAction(detachDebugger.get()); |
| 52 | windowService->addAction(QString::fromStdString(MENU_DEBUG), actionImpl); |
| 53 | #endif |
| 54 | //register action to appoutputpane |
| 55 | auto appOutPutPane = AppOutputPane::instance(); |
| 56 | |
| 57 | interrupt.reset(new QAction(MWMDA_INTERRUPT)); |
| 58 | interrupt->setEnabled(false); |
| 59 | connect(interrupt.get(), &QAction::triggered, debugManager, &DebugManager::interruptDebug); |
| 60 | |
| 61 | actionImpl = initAction(interrupt.get(), "Debug.Interrupt", |
| 62 | MWMDA_INTERRUPT, QKeySequence(Qt::Key::Key_F5), |
| 63 | "debugger_interrupt"); |
| 64 | mDebug->addAction(actionImpl); |
| 65 | appOutPutPane->registerItemToToolBar(debugToolBarName, actionImpl->action(), true); |
| 66 | |
| 67 | continueDebugging.reset(new QAction(MWMDA_CONTINUE)); |
| 68 | continueDebugging->setEnabled(false); |
| 69 | connect(continueDebugging.get(), &QAction::triggered, debugManager, &DebugManager::continueDebug); |
| 70 | actionImpl = initAction(continueDebugging.get(), "Debug.Continue", |
| 71 | MWMDA_CONTINUE, QKeySequence(Qt::Key::Key_F5), |
| 72 | "debugger_continue"); |
| 73 | mDebug->addAction(actionImpl); |
| 74 | appOutPutPane->registerItemToToolBar(debugToolBarName, actionImpl->action(), false); |
| 75 | |
| 76 | abortDebugging.reset(new QAction(MWMDA_ABORT_DEBUGGING)); |
| 77 | abortDebugging->setEnabled(false); |
| 78 | connect(abortDebugging.get(), &QAction::triggered, debugManager, &DebugManager::abortDebug); |
| 79 | actionImpl = initAction(abortDebugging.get(), "Debug.Abort.Debugging", |
| 80 | MWMDA_ABORT_DEBUGGING, QKeySequence(Qt::Modifier::SHIFT | Qt::Key::Key_F5), |
| 81 | "debugger_stop"); |
nothing calls this directly
no test coverage detected