| 490 | ******************************************************************************/ |
| 491 | |
| 492 | void GuiApplication::createProject(const FilePath& parentDir, bool eagleImport, |
| 493 | QWidget* parent) noexcept { |
| 494 | const NewProjectWizard::Mode mode = eagleImport |
| 495 | ? NewProjectWizard::Mode::EagleImport |
| 496 | : NewProjectWizard::Mode::NewProject; |
| 497 | NewProjectWizard wizard(*mTheme, mWorkspace, mode, parent); |
| 498 | wizard.setWindowModality(Qt::WindowModal); |
| 499 | if (parentDir.isValid()) { |
| 500 | wizard.setLocationOverride(parentDir); |
| 501 | } |
| 502 | if (wizard.exec() == QWizard::Accepted) { |
| 503 | try { |
| 504 | std::unique_ptr<Project> project = wizard.createProject(); // can throw |
| 505 | const FilePath fp = project->getFilepath(); |
| 506 | project.reset(); // Release lock. |
| 507 | openProject(fp, parent); |
| 508 | } catch (const Exception& e) { |
| 509 | QMessageBox::critical(parent, tr("Could not create project"), e.getMsg()); |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | std::shared_ptr<ProjectEditor> GuiApplication::openProject( |
| 515 | FilePath fp, QWidget* parent) noexcept { |
no test coverage detected