|
WSF
|
A high-level interface into the Change History database. More...
#include <RevisionStore.hpp>
Inherits QObject.
Public Slots | |
| bool | Backup () |
| bool | RequestBackup () |
| void | QueueFile (TextSource *aDocPtr) |
| void | QueueAllProjectFiles () |
| void | HandleProxyAvailable (WsfPProxy *aProxy) |
| void | HandleParseUpdated (bool aParsed) |
| void | HandleProjectStartupFilesChanged (const std::vector< UtPath > &aStartupFiles) |
Public Member Functions | |
| RevisionStore () | |
| Default constructor. | |
| ~RevisionStore () override=default | |
| void | SetProject (const UtPath &aProjectDir, const UtPath &aProjectFile=UtPath()) |
| void | SetProjectWorkingDir (const UtPath &aWorkingDir) |
| bool | Open () |
| bool | OpenInMemory () |
| bool | Close () |
| bool | IsEmpty () |
| bool | IsOpen () const |
| bool | Exists () const |
| void | EnableAutoBackup (int aMin) |
| void | DisableAutoBackup () |
| Disables the automatic backup feature. | |
| void | QueueFile (const UtTextDocument *aDocPtr) |
| bool | Restore (int aRevNo, QStringList &aFailedFiles, QWidget *aRequestingWidget=nullptr) |
| bool | DeleteAllRevisions () |
| RevisionList | Revisions () |
| RevisionDb & | DB () |
Protected Member Functions | |
| RevisionChangeList | GenerateFileChanges (const RevisionPathSet &aRemovedPaths=RevisionPathSet()) |
| bool | StoreNewRevision (const RevisionChangeList &aChanges, const std::string &aWorkingDir, const std::vector< std::string > &aStartupFiles) |
A high-level interface into the Change History database.
|
explicit |
Default constructor.
References wizard::TextSourceSignals::GetInstance(), RequestBackup(), and wizard::TextSourceSignals::requestBackup().
Referenced by Open().
|
overridedefault |
References Backup(), Close(), DB(), DeleteAllRevisions(), DisableAutoBackup(), EnableAutoBackup(), Exists(), GenerateFileChanges(), HandleParseUpdated(), HandleProjectStartupFilesChanged(), HandleProxyAvailable(), IsEmpty(), IsOpen(), Open(), OpenInMemory(), QueueAllProjectFiles(), QueueFile(), RequestBackup(), Restore(), Revisions(), SetProject(), SetProjectWorkingDir(), and StoreNewRevision().
|
slot |
Blocks until parsing ends and then immediately attempts to create a backup. This will clear the "backup scheduled" flag if successful.
References wizard::Project::Instance(), and wizard::Project::WaitForAllParsing().
Referenced by wizard::Editor::AcceptsClose(), Restore(), and ~RevisionStore().
| bool wizard::RevisionStore::Close | ( | ) |
Closes the connection to the revision database.
References success.
Referenced by wizard::ExportFiles::ExportRevision(), and ~RevisionStore().
| wizard::RevisionDb & wizard::RevisionStore::DB | ( | ) |
Referenced by wizard::ExportFiles::ExportRevision(), and ~RevisionStore().
| bool wizard::RevisionStore::DeleteAllRevisions | ( | ) |
Deletes all revisions (and associated data) in the database.
References success.
Referenced by ~RevisionStore().
| void wizard::RevisionStore::DisableAutoBackup | ( | ) |
Disables the automatic backup feature.
Referenced by EnableAutoBackup(), and ~RevisionStore().
| void wizard::RevisionStore::EnableAutoBackup | ( | int | aMin | ) |
Sets the revision store to automatically backup every X minutes.
| aMin | How often (in minutes) an automatic backup should be created. |
References DisableAutoBackup(), and RequestBackup().
Referenced by ~RevisionStore().
| bool wizard::RevisionStore::Exists | ( | ) | const |
Referenced by ~RevisionStore().
|
protected |
Generates a list of changes for all queued files and removed files since the last revision. Queued files will included newly added files.
| aRemovedPaths | A set of relative paths to files that have been removed since the last revision. |
References wizard::RevisionChange::cNO_CHANGE, wizard::RevisionChange::cREMOVED_FILE, and wizard::RevisionChange::kind.
Referenced by ~RevisionStore().
|
slot |
Receives the signal that is sent when parsing has finished. A backup is performed if one has been scheduled.
| aParsed | Whether or not parsing data is up to date. |
Referenced by Open(), and ~RevisionStore().
|
slot |
Sets the project startup files. These will be associated with the current revision.
References RequestBackup().
Referenced by Open(), and ~RevisionStore().
|
slot |
Receives the signal that is sent when the proxy becomes available or unavailable. A backup is performed if one has been scheduled.
| aProxy | A valid proxy or NULL. |
References QueueAllProjectFiles().
Referenced by Open(), and ~RevisionStore().
| bool wizard::RevisionStore::IsEmpty | ( | ) |
Referenced by ~RevisionStore().
| bool wizard::RevisionStore::IsOpen | ( | ) | const |
Referenced by wizard::ExportFiles::ExportRevision(), and ~RevisionStore().
| bool wizard::RevisionStore::Open | ( | ) |
Opens (or creates) the database at the project root and connects to signals.
References wizard::ProxyWatcher::GetActiveProxy(), HandleParseUpdated(), HandleProjectStartupFilesChanged(), HandleProxyAvailable(), wizard::Project::Instance(), wizard::Project::ParseUpdatedDeferred, wizard::Signals::ProjectStartupFilesChanged(), wizard::ProxyWatcher::ProxyAvailable, QueueFile(), RevisionStore(), wizard::Signals::SourceModifiedStateChange(), success, and wizSignals.
Referenced by wizard::ExportFiles::ExportRevision(), and ~RevisionStore().
| bool wizard::RevisionStore::OpenInMemory | ( | ) |
Opens the revision database in memory. Useful for testing.
Referenced by ~RevisionStore().
|
slot |
Queues all included files in the project to be analyzed for changes during the next backup. This is useful upon a project first being opened (and receiving the first available proxy), so that all the files can be scanned for changes in the case that they were modified outside the Wizard since the last time the project was opened.
References wizard::TextSource::cINCLUDED, wizard::TextSource::GetFlags(), wizard::Project::GetSourceCache(), wizard::TextSourceCache::GetSources(), wizard::Project::Instance(), and QueueFile().
Referenced by HandleProxyAvailable(), and ~RevisionStore().
| void wizard::RevisionStore::QueueFile | ( | const UtTextDocument * | aDocPtr | ) |
Adds a file to the queue. This should be done if the file does not exist in the database or if its content has changed since the last revision.
| aDocPtr | The document object of the file to be queued. |
Referenced by Open(), QueueAllProjectFiles(), QueueFile(), and ~RevisionStore().
|
slot |
Slot used for connecting to "file modified" signals. Any file that's modified gets added to the queue.
| aDocPtr | The document object of a file that has been modified. |
References QueueFile().
|
slot |
Requests a backup. If the proxy is available and the Wizard is not currently parsing when this method is called, a backup will be created immediately. Otherwise, a flag will be set and another backup will be attempted once parsing is finished and/or the proxy is available.
References success.
Referenced by EnableAutoBackup(), HandleProjectStartupFilesChanged(), RevisionStore(), SetProjectWorkingDir(), and ~RevisionStore().
| bool wizard::RevisionStore::Restore | ( | int | aRevNo, |
| QStringList & | aFailedFiles, | ||
| QWidget * | aRequestingWidget = nullptr ) |
Creates a revision at the current point and then attempts to restore the user's files to the given revision number.
| aRevNo | The revision number to restore the user's files to. |
| aFailedFiles | Reference to a string list to hold the paths of files that failed to be restored, potentially due to lack of 'write' file permission. |
| aRequestingWidget | The widget initiating the restore request. |
References Backup(), wizard::Project::Instance(), wizard::Project::SetStartupFiles(), wizard::Project::SetWorkingDirectory(), success, wizard::Project::TriggerReparse(), and wizRunMgr.
Referenced by ~RevisionStore().
| wizard::RevisionList wizard::RevisionStore::Revisions | ( | ) |
Referenced by ~RevisionStore().
| void wizard::RevisionStore::SetProject | ( | const UtPath & | aProjectDir, |
| const UtPath & | aProjectFile = UtPath() ) |
Sets the project root directory and name. The database will be created in the project directory with a name based on the project name.
| aProjectDir | The project directory/root path. |
| aProjectFile | The project file path. |
Referenced by ~RevisionStore().
| void wizard::RevisionStore::SetProjectWorkingDir | ( | const UtPath & | aWorkingDir | ) |
Sets the project working directory. This will be stored as part of the revision.
References RequestBackup().
Referenced by ~RevisionStore().
|
protected |
Stores a new revision in the database if there are queued files with changes or if files have been added or removed from the project.
| aChanges | The list of changes that make up the revision. |
| aWorkingDir | The name of the working directory. |
| aStartupFiles | A container of the start-up file names. |
Referenced by ~RevisionStore().