Updraft
1.0
Open source glider flight visualisation tool.
|
Opened task file. More...
#include <taskfile.h>
Public Types | |
enum | StorageState { UNSTORED_EMPTY, UNSTORED_EDITED, STORED_SYNCHRONIZED, STORED_DIRTY } |
State of task storage (on disk) More... | |
Signals | |
void | dataChanged () |
Signal which is emitted when the content of the file has been changed. | |
void | storageStateChanged () |
Signal which is emitted when the storage state has been changed. | |
Public Member Functions | |
TaskFile () | |
Creates a new empty TaskFile. | |
TaskFile (const QString &filePath_) | |
Creates a new TaskFile from specified file on a disk. | |
QString | getFileName () const |
QString | getFilePath () const |
StorageState | getStorageState () const |
bool | isFirstInHistory () const |
bool | isLastInHistory () const |
void | save () |
Save to current location. | |
void | saveAs (const QString &filePath_) |
Save to new location. | |
TaskData * | beginEdit (bool createNewState) |
Initialize editing session of current data. | |
void | endEdit () |
Ends editing session. | |
const TaskData * | beginRead () const |
Initializes reading session for current data. | |
void | endRead () const |
Ends reading session. | |
void | undo () |
Steps back in file history. | |
void | redo () |
Steps forward in file history. | |
Private Member Functions | |
void | updateOnUndoRedo () |
Proceeds update actions on either undo or redo. | |
Private Attributes | |
QString | filePath |
Full path to file in filesystem. Could be empty, if task is not saved. | |
StorageState | storageState |
StorageState indicates whether file is saved on disk and if it has been changed since last save/load operation. | |
DataHistory | dataHistory |
DataHistory holds task editing history and also current data. | |
bool | locked |
Flag indicating reading/editing process. |
Opened task file.
Creates a new empty TaskFile.
Updraft::TaskFile::TaskFile | ( | const QString & | filePath_ | ) | [explicit] |
Creates a new TaskFile from specified file on a disk.
If the file couldn't be loaded, empty task is created.
filePath_ | full path to a disk file |
TaskData * Updraft::TaskFile::beginEdit | ( | bool | createNewState | ) |
Initialize editing session of current data.
createNewState | If it is true, current state is saved to history. |
const TaskData * Updraft::TaskFile::beginRead | ( | ) | const |
Initializes reading session for current data.
void Updraft::TaskFile::dataChanged | ( | ) | [signal] |
Signal which is emitted when the content of the file has been changed.
void Updraft::TaskFile::endEdit | ( | ) |
Ends editing session.
void Updraft::TaskFile::endRead | ( | ) | const |
Ends reading session.
QString Updraft::TaskFile::getFileName | ( | ) | const |
QString Updraft::TaskFile::getFilePath | ( | ) | const |
bool Updraft::TaskFile::isFirstInHistory | ( | ) | const |
bool Updraft::TaskFile::isLastInHistory | ( | ) | const |
void Updraft::TaskFile::redo | ( | ) |
Steps forward in file history.
void Updraft::TaskFile::save | ( | ) |
Save to current location.
To obtain used path call getFilePath().
void Updraft::TaskFile::saveAs | ( | const QString & | filePath_ | ) |
Save to new location.
filePath_ | new file path. Next call of save() will use this path. |
void Updraft::TaskFile::storageStateChanged | ( | ) | [signal] |
Signal which is emitted when the storage state has been changed.
void Updraft::TaskFile::undo | ( | ) |
Steps back in file history.
void Updraft::TaskFile::updateOnUndoRedo | ( | ) | [private] |
Proceeds update actions on either undo or redo.
DataHistory Updraft::TaskFile::dataHistory [private] |
DataHistory holds task editing history and also current data.
QString Updraft::TaskFile::filePath [private] |
Full path to file in filesystem. Could be empty, if task is not saved.
bool Updraft::TaskFile::locked [mutable, private] |
Flag indicating reading/editing process.
Set in beginEdit(),beginRead(), freed in endEdit(),endRead().
StorageState Updraft::TaskFile::storageState [private] |
StorageState indicates whether file is saved on disk and if it has been changed since last save/load operation.