23 const bool succeeded =
true;
24 const bool failed =
false;
43 bool projectHasDir()
const {
return !m_current_project->projectDir().empty(); }
51 return m_current_project->save(dirname);
55 bool loadFrom(
const std::string& dirname) {
return m_current_project->load(dirname); }
58 bool isModified()
const {
return m_current_project->isModified(); }
64 : p_impl(
std::make_unique<ProjectManagerImpl>(context))
77 p_impl->createNewProject();
78 return p_impl->saveCurrentProjectAs(dirname);
86 if (!
p_impl->projectHasDir())
88 return p_impl->saveCurrentProject();
96 return p_impl->saveCurrentProjectAs(dirname);
106 p_impl->createNewProject();
107 return p_impl->loadFrom(dirname);
114 return p_impl->m_current_project ?
p_impl->m_current_project->projectDir() : std::string();
121 return p_impl->isModified();
130 p_impl->createNewProject();
bool closeCurrentProject() const override
Closes current project (without saving).
bool openExistingProject(const std::string &dirname) override
Opens existing project, returns 'true' in the case of success.
bool saveProjectAs(const std::string &dirname) override
Saves the project under a given directory, returns true in the case of success.
bool saveCurrentProject() override
Saves current project, returns 'true' in the case of success.
std::unique_ptr< ProjectManagerImpl > p_impl
bool createNewProject(const std::string &dirname) override
Creates a new project, returns 'true' in the case of success.
~ProjectManager() override
ProjectManager(const ProjectContext &context)
Constructor for ProjectManager.
std::string currentProjectDir() const override
Returns current project directory.
bool isModified() const override
Returns true if project was modified since last save.
MVVM_MODEL_EXPORT std::unique_ptr< ProjectInterface > CreateUntitledProject(const ProjectContext &context)
Creates new untitled project.
materialitems.h Collection of materials to populate MaterialModel.
Provides necessary information for Project construction.
std::unique_ptr< ProjectInterface > m_current_project
void createNewProject()
Closes current project. Used in assumption that project was already saved.
ProjectManagerImpl(ProjectContext context)
bool projectHasDir() const
Returns true if the project has directory already defined.
bool saveCurrentProjectAs(const std::string &dirname)
Saves the project into a given directory.
bool loadFrom(const std::string &dirname)
Loads the project from a given directory.
ProjectContext m_project_context
bool saveCurrentProject()
Saves project in project directory. If directory is not defined.
bool isModified() const
Returns true if project has been modified after the last save.