Minor formatting tidying up.
[qwerkisync] / EventLogBackupManager.h
1 /*
2  * Copyright (C) 2011, Jamie Thompson
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public
6  * License as published by the Free Software Foundation; either
7  * version 3 of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef EVENTLOGBACKUPMANAGER_H
20 #define EVENTLOGBACKUPMANAGER_H
21
22 class Settings;
23
24 #include <QFileInfoList>
25 #include <QString>
26
27 class EventLogBackupManager
28 {
29 public:
30         EventLogBackupManager(const Settings & currentSettings);
31         ~EventLogBackupManager();
32
33         void CreateBackup();
34         void RestoreBackup(const QString &backup);
35
36         void LockCurrentBackup();
37         void UnlockCurrentBackup();
38
39         void LockBackup(const QString &backupPath);
40         void UnlockBackup(const QString &backupPath);
41
42         void PurgeOldBackups();
43         void EnsureBackupValid(const QString &backupPath);
44
45 public:
46         const QString & BackupDirectoryPath() const { return m_BackupDirectoryPath; }
47         void setBackupDirectoryPath(const QString & backupDirectoryPath) { m_BackupDirectoryPath = backupDirectoryPath; }
48         const QString & DataDirectoryPath() const { return m_DataDirectoryPath; }
49         void setDataDirectoryPath(const QString & dataDirectoryPath) { m_DataDirectoryPath = dataDirectoryPath; }
50         const QString & CurrentBackupName() const { return m_CurrentBackupName; }
51         void setCurrentBackupName(const QString & currentBackupName) { m_CurrentBackupName = currentBackupName; }
52         const QString & LockFilename() const { return m_LockFilename; }
53         void setLockFilename(const QString & lockFilename) { m_LockFilename = lockFilename; }
54         const uint & MaxNumberOfBackups() const { return m_MaxNumberOfBackups; }
55         void setMaxNumberOfBackups(const uint maxNumberOfBackups) { m_MaxNumberOfBackups = maxNumberOfBackups; }
56         const QString CurrentBackupPath() const { return BackupDirectoryPath() + CurrentBackupName(); }
57         const QFileInfoList CurrentBackups(bool lockedOnly);
58         const Settings & CurrentSettings() const { return m_kCurrentSettings; }
59
60 private:
61         void RemoveDirRecusively(const QFileInfo &dirInfo);
62
63 private:
64         QString m_BackupDirectoryPath;
65         QString m_DataDirectoryPath;
66         QString m_CurrentBackupName;
67         QString m_LockFilename;
68         uint m_MaxNumberOfBackups;
69         const Settings & m_kCurrentSettings;
70 };
71
72 #endif // EVENTLOGBACKUPMANAGER_H