| 1078 | } |
| 1079 | |
| 1080 | void MainWindow::triggerProject(int index, ui::ProjectAction a) noexcept { |
| 1081 | std::shared_ptr<ProjectEditor> editor = mApp.getProjects().value(index); |
| 1082 | if (!editor) return; |
| 1083 | |
| 1084 | switch (a) { |
| 1085 | case ui::ProjectAction::Close: { |
| 1086 | if (editor->requestClose()) { |
| 1087 | mApp.closeProject(index); |
| 1088 | } |
| 1089 | break; |
| 1090 | } |
| 1091 | case ui::ProjectAction::OpenLibraryManager: { |
| 1092 | openProjectLibraryTab(index); |
| 1093 | break; |
| 1094 | } |
| 1095 | case ui::ProjectAction::NewSheet: { |
| 1096 | if (auto schEditor = editor->execNewSheetDialog()) { |
| 1097 | openSchematicTab(index, schEditor->getUiIndex()); |
| 1098 | } |
| 1099 | break; |
| 1100 | } |
| 1101 | case ui::ProjectAction::NewBoard: { |
| 1102 | if (auto brdEditor = editor->execNewBoardDialog(std::nullopt)) { |
| 1103 | openBoard2dTab(index, brdEditor->getUiIndex()); |
| 1104 | } |
| 1105 | break; |
| 1106 | } |
| 1107 | default: { |
| 1108 | editor->trigger(a); |
| 1109 | break; |
| 1110 | } |
| 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | void MainWindow::triggerSchematic(int project, int schematic, |
| 1115 | ui::SchematicAction a) noexcept { |
nothing calls this directly
no test coverage detected