diff options
author | Jon Ander Peñalba <jonan88@gmail.com> | 2010-09-20 22:35:58 +0200 |
---|---|---|
committer | Jon Ander Peñalba <jonan88@gmail.com> | 2010-09-20 22:35:58 +0200 |
commit | 66fb43cdefd0de3946f8d6c931f4568384bdf57b (patch) | |
tree | 30c36d1e65f337a4004f1e3901baa972584c53f8 /src/history/autosaver.h | |
parent | Merge commit 'refs/merge-requests/216' of git://gitorious.org/rekonq/mainline... (diff) | |
download | rekonq-66fb43cdefd0de3946f8d6c931f4568384bdf57b.tar.xz |
History autosaver improved to be more general and less hackish
Diffstat (limited to 'src/history/autosaver.h')
-rw-r--r-- | src/history/autosaver.h | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/history/autosaver.h b/src/history/autosaver.h index 6927dbe8..685783a8 100644 --- a/src/history/autosaver.h +++ b/src/history/autosaver.h @@ -34,37 +34,42 @@ // Qt Includes #include <QtCore/QObject> -#include <QtCore/QBasicTimer> -#include <QtCore/QTime> -#include <QtCore/QTimerEvent> +// Forward Declarations +class QBasicTimer; /** - * This class will call the save() slot on the parent object when the parent changes. - * It will wait several seconds after changed() to combining multiple changes and - * prevent continuous writing to disk. - * + * This class emits the saveNeeded() signal. + * It will wait several seconds after changeOccurred() to combine + * multiple changes preventing continuous writing to disk. */ - class REKONQ_TESTS_EXPORT AutoSaver : public QObject { Q_OBJECT public: - AutoSaver(QObject *parent); - ~AutoSaver(); + explicit AutoSaver(QObject *parent); + virtual ~AutoSaver(); + + /** + * Emits the saveNeeded() signal if there's been any change since we last saved. + */ void saveIfNeccessary(); +signals: + void saveNeeded(); + public slots: void changeOccurred(); protected: - void timerEvent(QTimerEvent *event); + virtual void timerEvent(QTimerEvent *event); private: - QBasicTimer m_timer; - QTime m_firstChange; + void save(); + QBasicTimer *m_timer; + QTime *m_firstChange; }; #endif // AUTOSAVER_H |