Updraft  1.0
Open source glider flight visualisation tool.
Updraft::TaskFile Class Reference

Opened task file. More...

#include <taskfile.h>

Collaboration diagram for Updraft::TaskFile:

List of all members.

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.
TaskDatabeginEdit (bool createNewState)
 Initialize editing session of current data.
void endEdit ()
 Ends editing session.
const TaskDatabeginRead () 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.

Detailed Description

Opened task file.


Member Enumeration Documentation

State of task storage (on disk)

Enumerator:
UNSTORED_EMPTY 
UNSTORED_EDITED 
STORED_SYNCHRONIZED 
STORED_DIRTY 

Constructor & Destructor Documentation

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.

Parameters:
filePath_full path to a disk file

Member Function Documentation

TaskData * Updraft::TaskFile::beginEdit ( bool  createNewState)

Initialize editing session of current data.

Parameters:
createNewStateIf it is true, current state is saved to history.
Returns:
Current TaskData If other editing session is started, it returns NULL.

Initializes reading session for current data.

Returns:
Current TaskData
void Updraft::TaskFile::dataChanged ( ) [signal]

Signal which is emitted when the content of the file has been changed.

Ends editing session.

Ends reading session.

QString Updraft::TaskFile::getFileName ( ) const
Returns:
File name
QString Updraft::TaskFile::getFilePath ( ) const
Returns:
Absolute (full) file path
Returns:
State of file storage
Returns:
True if the current item is the first one in file history.
Returns:
True if the current item is the last one in file history.

Steps forward in file history.

Save to current location.

To obtain used path call getFilePath().

void Updraft::TaskFile::saveAs ( const QString &  filePath_)

Save to new location.

Parameters:
filePath_new file path. Next call of save() will use this path.

Signal which is emitted when the storage state has been changed.

Steps back in file history.

Proceeds update actions on either undo or redo.


Member Data Documentation

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 indicates whether file is saved on disk and if it has been changed since last save/load operation.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines