| 799 | } |
| 800 | |
| 801 | void MainWindow::trigger(ui::Action a) noexcept { |
| 802 | switch (a) { |
| 803 | // General |
| 804 | case ui::Action::KeyboardShortcutsReference: { |
| 805 | StandardEditorCommandHandler handler(mApp.getWorkspace().getSettings(), |
| 806 | mWidget); |
| 807 | handler.shortcutsReference(); |
| 808 | break; |
| 809 | } |
| 810 | case ui::Action::Quit: { |
| 811 | mApp.quit(mWidget); |
| 812 | break; |
| 813 | } |
| 814 | |
| 815 | // Window |
| 816 | case ui::Action::WindowNew: { |
| 817 | mApp.createNewWindow(); |
| 818 | break; |
| 819 | } |
| 820 | case ui::Action::WindowClose: { |
| 821 | closeRequested(); |
| 822 | break; |
| 823 | } |
| 824 | |
| 825 | // Workspace |
| 826 | case ui::Action::WorkspaceOpenFolder: { |
| 827 | StandardEditorCommandHandler handler(mApp.getWorkspace().getSettings(), |
| 828 | mWidget); |
| 829 | handler.fileManager(mApp.getWorkspace().getPath()); |
| 830 | break; |
| 831 | } |
| 832 | case ui::Action::WorkspaceSwitch: { |
| 833 | mApp.switchWorkspace(mWidget); |
| 834 | break; |
| 835 | } |
| 836 | case ui::Action::WorkspaceSettings: { |
| 837 | mApp.execWorkspaceSettingsDialog(mWidget); |
| 838 | break; |
| 839 | } |
| 840 | case ui::Action::WorkspaceLibrariesRescan: { |
| 841 | mApp.getWorkspace().getLibraryDb().startLibraryRescan(); |
| 842 | break; |
| 843 | } |
| 844 | case ui::Action::ProjectImportExamples: { |
| 845 | mApp.addExampleProjects(mWidget); |
| 846 | break; |
| 847 | } |
| 848 | |
| 849 | // Library |
| 850 | case ui::Action::LibraryCreate: { |
| 851 | if (!switchToTab<CreateLibraryTab>()) { |
| 852 | auto tab = std::make_shared<CreateLibraryTab>(mApp); |
| 853 | connect( |
| 854 | tab.get(), &CreateLibraryTab::libraryCreated, this, |
| 855 | [this](const FilePath& fp) { openLibraryTab(fp, true); }, |
| 856 | Qt::QueuedConnection); |
| 857 | addTab(tab); |
| 858 | } |
no test coverage detected