BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Triggers autosave request after some accumulated ammount of document changes.
Definition at line 25 of file AutosaveController.h.
Signals | |
void | autosaveRequest () |
Public Member Functions | |
AutosaveController (QObject *parent=nullptr) | |
QString | autosaveDir () const |
The complete path to the autosave dir (e.g. '/projects/Untitled2/autosave'). More... | |
QString | autosaveName () const |
void | removeAutosaveDir () const |
remove auto save directory for given project and all its content More... | |
void | setAutosaveTime (int timerInterval) |
Sets autosave time (in msec) More... | |
void | setDocument (ProjectDocument *document) |
Private Slots | |
void | onDocumentDestroyed (QObject *object) |
void | onDocumentModified () |
void | onTimerTimeout () |
Private Member Functions | |
bool | assureAutoSaveDirExists () const |
Tries to make sure that the directory for auto saving exists. Tries to create it if not existing so far. No creation, if project directory itself doesn't exist at all. Returns true, if the directory finally exists. More... | |
void | autosave () |
Private Attributes | |
ProjectDocument * | m_document |
UpdateTimer * | m_timer |
|
explicit |
Definition at line 26 of file AutosaveController.cpp.
References m_timer, onTimerTimeout(), and UpdateTimer::timeToUpdate().
|
private |
Tries to make sure that the directory for auto saving exists. Tries to create it if not existing so far. No creation, if project directory itself doesn't exist at all. Returns true, if the directory finally exists.
Definition at line 111 of file AutosaveController.cpp.
References autosaveDir(), GUI::Project::Utils::autosaveSubdir(), ProjectDocument::hasValidNameAndPath(), m_document, ProjectDocument::projectDir(), and GUI::Project::Utils::projectDir().
Referenced by autosave().
|
private |
Definition at line 124 of file AutosaveController.cpp.
References assureAutoSaveDirExists(), autosaveName(), and autosaveRequest().
Referenced by onTimerTimeout().
QString AutosaveController::autosaveDir | ( | ) | const |
The complete path to the autosave dir (e.g. '/projects/Untitled2/autosave').
Returns the name of autosave directory.
Definition at line 64 of file AutosaveController.cpp.
References GUI::Project::Utils::autosaveDir(), ProjectDocument::hasValidNameAndPath(), m_document, and ProjectDocument::projectFileName().
Referenced by assureAutoSaveDirExists(), and removeAutosaveDir().
QString AutosaveController::autosaveName | ( | ) | const |
Definition at line 72 of file AutosaveController.cpp.
References GUI::Project::Utils::autosaveName(), ProjectDocument::hasValidNameAndPath(), m_document, and ProjectDocument::projectFileName().
Referenced by autosave(), and SaveService::onAutosaveRequest().
|
signal |
Referenced by autosave(), and SaveService::setAutosaveEnabled().
|
privateslot |
Definition at line 95 of file AutosaveController.cpp.
References m_document, m_timer, and UpdateTimer::reset().
Referenced by setDocument().
|
privateslot |
Definition at line 102 of file AutosaveController.cpp.
References ProjectDocument::hasValidNameAndPath(), ProjectDocument::isModified(), m_document, m_timer, and UpdateTimer::scheduleUpdate().
Referenced by setDocument().
|
privateslot |
Definition at line 89 of file AutosaveController.cpp.
References autosave(), ProjectDocument::isModified(), and m_document.
Referenced by AutosaveController().
void AutosaveController::removeAutosaveDir | ( | ) | const |
remove auto save directory for given project and all its content
Definition at line 80 of file AutosaveController.cpp.
References autosaveDir().
Referenced by SaveService::stopService().
void AutosaveController::setAutosaveTime | ( | int | timerInterval | ) |
Sets autosave time (in msec)
Definition at line 56 of file AutosaveController.cpp.
References m_timer, UpdateTimer::reset(), and UpdateTimer::setWallclockTimer().
Referenced by SaveService::setAutosaveTime().
void AutosaveController::setDocument | ( | ProjectDocument * | document | ) |
Definition at line 34 of file AutosaveController.cpp.
References m_document, m_timer, ProjectDocument::modified(), onDocumentDestroyed(), onDocumentModified(), and UpdateTimer::reset().
Referenced by SaveService::setAutosaveEnabled(), and SaveService::setDocument().
|
private |
Definition at line 58 of file AutosaveController.h.
Referenced by assureAutoSaveDirExists(), autosaveDir(), autosaveName(), onDocumentDestroyed(), onDocumentModified(), onTimerTimeout(), and setDocument().
|
private |
Definition at line 59 of file AutosaveController.h.
Referenced by AutosaveController(), onDocumentDestroyed(), onDocumentModified(), setAutosaveTime(), and setDocument().