MCPcopy Create free account
hub / github.com/LibrePCB/LibrePCB / createProject

Method createProject

libs/librepcb/editor/guiapplication.cpp:492–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490 ******************************************************************************/
491
492void 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
514std::shared_ptr<ProjectEditor> GuiApplication::openProject(
515 FilePath fp, QWidget* parent) noexcept {

Callers 2

MainWindowMethod · 0.45
triggerMethod · 0.45

Calls 5

getFilepathMethod · 0.80
isValidMethod · 0.45
setLocationOverrideMethod · 0.45
execMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected