QCodeEdit  2.2
Classes | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
QEditSession Class Reference

A session recording class. More...

Inheritance diagram for QEditSession:
Inheritance graph
[legend]

Classes

struct  Cursor
 
struct  Document
 

Public Slots

virtual void addEditor (QEditor *e)
 Add an editor to the session.
 
virtual void removeEditor (QEditor *e)
 Remove an editor from the session.
 
virtual void updateData ()
 Updates the data. More...
 
virtual void setAutoUpdateInterval (int ms)
 Set the update interval. More...
 
virtual void setFileName (const QString &filename, bool restore=false)
 Set the storage destination. More...
 
virtual void clear (bool cleanup=false)
 
virtual void save ()
 Serialize session data.
 
virtual void restore ()
 Serialize session data.
 
virtual void save (QDataStream &s)
 Serialize session data.
 
virtual void restore (QDataStream &s)
 Deserialize session data.
 

Signals

void restored (QEditor *e)
 

Public Member Functions

 QEditSession (QObject *p=0)
 ctor
 
 QEditSession (const QString &f, QObject *p=0)
 ctor
 
virtual ~QEditSession ()
 dtor
 
int autoUpdateInterval () const
 
QString fileName () const
 

Protected Slots

virtual void destroyed (QObject *o)
 
virtual void saved (QEditor *e, const QString &fn)
 Called whenever an editor is saved. More...
 
virtual void loaded (QEditor *e, const QString &fn)
 Called whenever an editor is loaded with new content. More...
 

Protected Member Functions

virtual void timerEvent (QTimerEvent *e)
 
virtual QEditorcreateEditor ()
 
virtual void update (QEditor *e, Document *d)
 

Protected Attributes

int m_id
 
int m_delay
 
QString m_fileName
 
QList< QEditor * > m_editors
 
QList< Document * > m_sessionData
 

Detailed Description

A session recording class.

The purpose of this class is to collect session data from several QEditor object, to serialize it and to re-create the same session by deserializing the stored data.

Member Function Documentation

◆ autoUpdateInterval()

int QEditSession::autoUpdateInterval ( ) const
Returns
The update interval, in milliseconds

A value of zero means the data is NOT automatically updated.

See also
updateData()

◆ clear

void QEditSession::clear ( bool  cleanup = false)
virtualslot

◆ fileName()

QString QEditSession::fileName ( ) const
Returns
The file name used as storage

If it is empty then no auto-save is performed.

◆ loaded

void QEditSession::loaded ( QEditor e,
const QString &  fn 
)
protectedvirtualslot

Called whenever an editor is loaded with new content.

This handler is responsible for updating file names and time stamps which is needed to avoid data loss upon session restoration

Referenced by addEditor(), and removeEditor().

◆ saved

void QEditSession::saved ( QEditor e,
const QString &  fn 
)
protectedvirtualslot

Called whenever an editor is saved.

This handler is responsible for updating file names and time stamps which is needed to avoid data loss upon session restoration

Referenced by addEditor(), and removeEditor().

◆ setAutoUpdateInterval

void QEditSession::setAutoUpdateInterval ( int  ms)
virtualslot

Set the update interval.

If ms is strictly positive then the data will be updated every ms milliseconds

If the session has been given a valid filename, the updated data will automatically be saved to that file.

◆ setFileName

void QEditSession::setFileName ( const QString &  filename,
bool  r = false 
)
virtualslot

Set the storage destination.

Every time the data is updated, either when the autoupdate timer ticks or when updateData() is called programmatically, it will be written to that file, provided the filename is valid and points to a writeable location.

See also
updateData()
autoUpdateInterval()

References restore().

Referenced by QEditSession().

◆ updateData

void QEditSession::updateData ( )
virtualslot

Updates the data.

Fetches up-to-date session data from the attached editors.

If the session has been given a valid filename the data will automatically be saved.

Note
This will NOT affect the automatic updates timing

References save().


The documentation for this class was generated from the following files: