BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
GUI::Project::Utils Namespace Reference

Description

Defines convenience function for project manager and document.

Functions

QString autosaveDir (const QString &projectFileName)
 Returns name of autosave directory for project with given project file name. E.g. from '/projects/Untitled2/Untitled2.pro' returns '/projects/Untitled2/autosave'. More...
 
QString autosaveName (const QString &projectFileName)
 Returns name of project for autoSave from given project file name. E.g. from '/projects/Untitled2/Untitled2.pro' returns '/projects/Untitled2/autosave/Untitled2.pro'. More...
 
QString autosaveSubdir ()
 Returns fixed name for autosave sub-directory. More...
 
bool hasAutosavedData (const QString &projectFileName)
 Returns true if project with given projectFileName contains autosaved 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...
 

Variables

constexpr const char * projectFileExtension {".pro"}
 

Function Documentation

◆ autosaveDir()

QString GUI::Project::Utils::autosaveDir ( const QString &  projectFileName)

Returns name of autosave directory for project with given project file name. E.g. from '/projects/Untitled2/Untitled2.pro' returns '/projects/Untitled2/autosave'.

Definition at line 33 of file ProjectUtils.cpp.

34 {
35  return projectDir(projectFileName) + "/" + autosaveSubdir();
36 }
QString autosaveSubdir()
Returns fixed name for autosave sub-directory.
QString projectDir(const QString &projectFileName)
Returns project directory deduced from project file name.

References autosaveSubdir(), and projectDir().

Referenced by AutosaveController::autosaveDir(), and autosaveName().

Here is the call graph for this function:

◆ autosaveName()

QString GUI::Project::Utils::autosaveName ( const QString &  projectFileName)

Returns name of project for autoSave from given project file name. E.g. from '/projects/Untitled2/Untitled2.pro' returns '/projects/Untitled2/autosave/Untitled2.pro'.

Definition at line 38 of file ProjectUtils.cpp.

39 {
40  return autosaveDir(projectFileName) + "/" + projectName(projectFileName) + projectFileExtension;
41 }
constexpr const char * projectFileExtension
Definition: ProjectUtils.h:24
QString autosaveDir(const QString &projectFileName)
Returns name of autosave directory for project with given project file name. E.g. from '/projects/Unt...
QString projectName(const QString &projectFileName)
Returns project name deduced from project file name.

References autosaveDir(), projectFileExtension, and projectName().

Referenced by AutosaveController::autosaveName(), hasAutosavedData(), ProjectManager::loadProject(), and ProjectManager::restoreProjectDialog().

Here is the call graph for this function:

◆ autosaveSubdir()

QString GUI::Project::Utils::autosaveSubdir ( )

Returns fixed name for autosave sub-directory.

Definition at line 28 of file ProjectUtils.cpp.

29 {
30  return "autosave";
31 }

Referenced by AutosaveController::assureAutoSaveDirExists(), autosaveDir(), and SaveService::process_queue().

◆ hasAutosavedData()

bool GUI::Project::Utils::hasAutosavedData ( const QString &  projectFileName)

Returns true if project with given projectFileName contains autosaved data.

Definition at line 43 of file ProjectUtils.cpp.

44 {
45  return QFile::exists(projectFileName) && QFile::exists(autosaveName(projectFileName));
46 }
QString autosaveName(const QString &projectFileName)
Returns name of project for autoSave from given project file name. E.g. from '/projects/Untitled2/Unt...

References autosaveName().

Referenced by ProjectManager::loadProject().

Here is the call graph for this function:

◆ projectDir()

◆ projectName()

QString GUI::Project::Utils::projectName ( const QString &  projectFileName)

Returns project name deduced from project file name.

Definition at line 18 of file ProjectUtils.cpp.

19 {
20  return QFileInfo(projectFileName).baseName();
21 }

Referenced by NewProjectDialog::NewProjectDialog(), autosaveName(), NewProjectDialog::checkIfProjectNameIsValid(), ProjectManager::restoreProjectDialog(), and ProjectDocument::setProjectFileName().

Variable Documentation

◆ projectFileExtension

constexpr const char* GUI::Project::Utils::projectFileExtension {".pro"}
inlineconstexpr