Quark  0.1
AutoSaver Class Reference

A class to be used in implementing a document autosave feature. More...

#include <AutoSaver.h++>

Inheritance diagram for AutoSaver:

Public Slots

void changeOccurred ()
 Notifies the AutoSaver that the document has changed. More...
 
void saveIfNecessary ()
 Performs a save operation, if the document changed since the last save. More...
 

Public Member Functions

 AutoSaver (QObject *parent)
 Constructs a new AutoSaver. More...
 
virtual ~AutoSaver ()
 Destructor. More...
 
void setAutosaveInterval (int interval)
 Changes the autosave interval. More...
 
void setMaxDelay (int delay)
 Changes the maximum autosave delay. More...
 

Static Public Attributes

static const int DEFAULT_AUTOSAVE_INTERVAL
 The default autosave interval, in seconds. More...
 
static const int MAX_DELAY
 The maximum delay, in seconds, before a save operation occurs. More...
 

Protected Member Functions

virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

A class to be used in implementing a document autosave feature.

The application invokes the changeOccurred() slot to indicates that the document has been modified by the user. The AutoSaver will automatically save the document after a specified interval (or after a maximum delay has passed) by invoking the save() slot of its parent object.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ AutoSaver()

AutoSaver ( QObject *  parent)

Constructs a new AutoSaver.

Parameters
Theparent object. This object is expected to have a save() slot that takes no parameters.

◆ ~AutoSaver()

virtual ~AutoSaver ( )
virtual

Destructor.

Member Function Documentation

◆ changeOccurred

void changeOccurred ( )
slot

Notifies the AutoSaver that the document has changed.

◆ saveIfNecessary

void saveIfNecessary ( )
slot

Performs a save operation, if the document changed since the last save.

◆ setAutosaveInterval()

void setAutosaveInterval ( int  interval)

Changes the autosave interval.

Performs a save, if necessary, as a side-effect.

Parameters
intervalThe interval, in seconds.

◆ setMaxDelay()

void setMaxDelay ( int  delay)

Changes the maximum autosave delay.

Performs a save, if necessary, as a side-effect.

Parameters
delayThe delay, in seconds.

◆ timerEvent()

virtual void timerEvent ( QTimerEvent *  event)
protectedvirtual

Member Data Documentation

◆ DEFAULT_AUTOSAVE_INTERVAL

const int DEFAULT_AUTOSAVE_INTERVAL
static

The default autosave interval, in seconds.

◆ MAX_DELAY

const int MAX_DELAY
static

The maximum delay, in seconds, before a save operation occurs.


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