Debian Codegraph @

src/librssguard/miscellaneous/autosaver.h

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.
2
3 #ifndef AUTOSAVER_H
4 #define AUTOSAVER_H
5
6 #include "definitions/definitions.h"
7
8 #include <QElapsedTimer>
9 #include <QObject>
10 #include <QTimer>
11
12 #define AUTOSAVE_IN (1000 * 3) // In seconds.
13 #define MAX_WAIT (1000 * 15) // In seconds.
14
15 class AutoSaver : public QObject {
16 Q_OBJECT
17
18 public:
19 explicit AutoSaver(QObject* parent,
20 const QString& saving_slot = QSL("save"),
21 int max_wait_secs = MAX_WAIT,
22 int periodic_save_secs = AUTOSAVE_IN);
23 virtual ~AutoSaver();
24
25 public slots:
26 void changeOccurred();
27 void saveIfNeccessary();
28
29 private:
30 QTimer m_timer;
31 QElapsedTimer m_firstChange;
32 int m_maxWaitMsecs;
33 int m_periodicSaveMsecs;
34 QString m_savingSlot;
35 };
36
37 #endif // AUTOSAVER_H