BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Defines convenience function for project manager and document. More...
Functions | |
QString | autosaveDir (const QString &projectFileName) |
Returns name of autosave directory for project with given project file name. More... | |
QString | autosaveName (const QString &projectFileName) |
Returns name of project for autoSave from given project file name. More... | |
QString | autosaveSubdir () |
Returns fixed name for autosave sub-directory. More... | |
bool | exists (const QString &fileName) |
Returns true if file exists. More... | |
bool | hasAutosavedData (const QString &projectFileName) |
Returns true if project with given projectFileName contains autosaved data. More... | |
QString | lastModified (const QString &fileName) |
Returns a string representing modification time of given file. More... | |
QStringList | nonXMLDataInDir (const QString &dirname) |
Returns list of files on disk representing nonXML data. More... | |
QString | projectDir (const QString &projectFileName) |
Returns project directory deduced from project file name. More... | |
QString | projectName (const QString &projectFileName) |
Returns project name deduced from project file name. More... | |
QString | readTextFile (const QString &fileName) |
Returns multi-lione string representing content of text file. More... | |
bool | removeFile (const QString &dirname, const QString &filename) |
Remove file from given directory. More... | |
bool | removeFiles (const QString &dirname, const QStringList &filenames) |
bool | removeRecursively (const QString &dirname) |
Removes recursively directory with given name. More... | |
QStringList | substract (const QStringList &lhs, const QStringList &rhs) |
Returns list of string from lhs, which are not in rhs. More... | |
QString | userExportDir () |
Returns directory which user is normally using to export files. More... | |
Defines convenience function for project manager and document.
QString ProjectUtils::autosaveDir | ( | const QString & | projectFileName | ) |
Returns name of autosave directory for project with given project file name.
From '/projects/Untitled2/Untitled2.pro' returns '/projects/Untitled2/autosave'.
Definition at line 45 of file ProjectUtils.cpp.
References autosaveSubdir(), and projectDir().
Referenced by AutosaveController::autosaveDir(), and autosaveName().
QString ProjectUtils::autosaveName | ( | const QString & | projectFileName | ) |
Returns name of project for autoSave from given project file name.
From '/projects/Untitled2/Untitled2.pro' returns '/projects/Untitled2/autosave/Untitled2.pro'.
Definition at line 52 of file ProjectUtils.cpp.
References autosaveDir(), ProjectDocument::projectFileExtension(), and projectName().
Referenced by AutosaveController::autosaveName(), hasAutosavedData(), ProjectManager::loadProject(), and ProjectManager::restoreProjectDialog().
QString ProjectUtils::autosaveSubdir | ( | ) |
Returns fixed name for autosave sub-directory.
Definition at line 38 of file ProjectUtils.cpp.
Referenced by AutosaveController::assureAutoSaveDirExists(), autosaveDir(), and SaveService::process_queue().
bool ProjectUtils::exists | ( | const QString & | fileName | ) |
Returns true if file exists.
Definition at line 58 of file ProjectUtils.cpp.
Referenced by NewProjectDialog::checkIfProjectPathIsValid(), ModelView::Utils::exists(), FileSystemUtils::filesInDirectory(), hasAutosavedData(), and FileSystemUtils::IsFileExists().
bool ProjectUtils::hasAutosavedData | ( | const QString & | projectFileName | ) |
Returns true if project with given projectFileName contains autosaved data.
Definition at line 64 of file ProjectUtils.cpp.
References autosaveName(), and exists().
Referenced by ProjectManager::loadProject().
QString ProjectUtils::lastModified | ( | const QString & | fileName | ) |
Returns a string representing modification time of given file.
Definition at line 69 of file ProjectUtils.cpp.
Referenced by ProjectManager::restoreProjectDialog().
QStringList ProjectUtils::nonXMLDataInDir | ( | const QString & | dirname | ) |
Returns list of files on disk representing nonXML data.
Definition at line 75 of file ProjectUtils.cpp.
References ItemFileNameUtils::nonXMLFileNameFilters().
QString ProjectUtils::projectDir | ( | const QString & | projectFileName | ) |
Returns project directory deduced from project file name.
Definition at line 32 of file ProjectUtils.cpp.
Referenced by AutosaveController::assureAutoSaveDirExists(), autosaveDir(), NewProjectDialog::checkIfProjectNameIsValid(), OutputDataIOService::cleanOldFiles(), SaveLoadInterface::fileName(), NewProjectDialog::getProjectFileName(), DataItem::load(), PointwiseAxisItem::load(), OutputDataIOService::load(), OutputDataIOService::save(), DataItem::save(), PointwiseAxisItem::save(), ProjectDocument::save_project_data(), and ProjectDocument::setProjectFileName().
QString ProjectUtils::projectName | ( | const QString & | projectFileName | ) |
Returns project name deduced from project file name.
Definition at line 26 of file ProjectUtils.cpp.
Referenced by NewProjectDialog::NewProjectDialog(), autosaveName(), NewProjectDialog::checkIfProjectNameIsValid(), ProjectManager::restoreProjectDialog(), and ProjectDocument::setProjectFileName().
QString ProjectUtils::readTextFile | ( | const QString & | fileName | ) |
Returns multi-lione string representing content of text file.
Definition at line 135 of file ProjectUtils.cpp.
Referenced by PyImportAssistant::readFile().
bool ProjectUtils::removeFile | ( | const QString & | dirname, |
const QString & | filename | ||
) |
Remove file from given directory.
Definition at line 99 of file ProjectUtils.cpp.
References FileSystemUtils::filename(), and RealSpace::Particles::name().
Referenced by removeFiles().
bool ProjectUtils::removeFiles | ( | const QString & | dirname, |
const QStringList & | filenames | ||
) |
Definition at line 112 of file ProjectUtils.cpp.
References RealSpace::Particles::name(), and removeFile().
Referenced by OutputDataIOService::cleanOldFiles().
bool ProjectUtils::removeRecursively | ( | const QString & | dirname | ) |
Removes recursively directory with given name.
Directory name is relative to the parent (working directory of the executable).
Definition at line 87 of file ProjectUtils.cpp.
QStringList ProjectUtils::substract | ( | const QStringList & | lhs, |
const QStringList & | rhs | ||
) |
Returns list of string from lhs, which are not in rhs.
Definition at line 122 of file ProjectUtils.cpp.
Referenced by OutputDataIOService::cleanOldFiles().
QString ProjectUtils::userExportDir | ( | ) |
Returns directory which user is normally using to export files.
Definition at line 145 of file ProjectUtils.cpp.
References AppSvc::projectManager(), and ProjectManager::userExportDir().
Referenced by SaveProjectionsAssistant::saveProjections().