BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Collection of utility functions to handle project saving and loading. More...
Functions | |
MVVM_MODEL_EXPORT std::unique_ptr< ProjectInterface > | CreateUntitledProject (const ProjectContext &context) |
Creates new untitled project. More... | |
MVVM_MODEL_EXPORT bool | IsPossibleProjectDir (const std::string &project_dir) |
Returns 'true' if given directory might be a project directory. More... | |
MVVM_MODEL_EXPORT std::string | ProjectWindowTitle (const ProjectInterface &project) |
Returns a MainWindow title for given project. More... | |
MVVM_MODEL_EXPORT std::string | ProjectWindowTitle (const std::string &project_dir, bool is_modified) |
Returns a title composed from last part of project path, and is_modified flag. More... | |
MVVM_MODEL_EXPORT std::string | SuggestFileName (const SessionModel &model) |
Suggests file name which can be used to store json content of given model. More... | |
Collection of utility functions to handle project saving and loading.
std::unique_ptr< ProjectInterface > ModelView::ProjectUtils::CreateUntitledProject | ( | const ProjectContext & | context | ) |
Creates new untitled project.
Definition at line 50 of file projectutils.cpp.
Referenced by ProjectManager::ProjectManagerImpl::createNewProject(), and TEST_F().
bool ModelView::ProjectUtils::IsPossibleProjectDir | ( | const std::string & | project_dir | ) |
Returns 'true' if given directory might be a project directory.
This simplified check counts number of files with json extention.
Definition at line 43 of file projectutils.cpp.
References ModelView::Utils::FindFiles().
Referenced by gui2::UserInteractor::onSelectDirRequest(), and TEST_F().
std::string ModelView::ProjectUtils::ProjectWindowTitle | ( | const ProjectInterface & | project | ) |
Returns a MainWindow title for given project.
Definition at line 57 of file projectutils.cpp.
References ModelView::project.
Referenced by TEST_F().
std::string ModelView::ProjectUtils::ProjectWindowTitle | ( | const std::string & | project_dir, |
bool | is_modified | ||
) |
Returns a title composed from last part of project path, and is_modified
flag.
Project without projectDir will be "Untitled", modified project will be "*Untitled". Project with projectDir in "/home/user/project1" will get title "project1".
Definition at line 66 of file projectutils.cpp.
std::string ModelView::ProjectUtils::SuggestFileName | ( | const SessionModel & | model | ) |
Suggests file name which can be used to store json content of given model.
Uses the model type to construct a filename: MaterialModel -> materialmodel.json
Definition at line 33 of file projectutils.cpp.
References ModelView::SessionModel::modelType().
Referenced by ModelView::Project::ProjectImpl::process(), and TEST_F().