2 * Copyright (C) 2011, Jamie Thompson
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.
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.
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/>.
19 #ifndef EVENTLOGBACKUPMANAGER_H
20 #define EVENTLOGBACKUPMANAGER_H
24 #include <QFileInfoList>
27 class EventLogBackupManager
30 EventLogBackupManager(const Settings & currentSettings);
31 ~EventLogBackupManager();
34 void RestoreBackup(const QString &backup);
36 void LockCurrentBackup();
37 void UnlockCurrentBackup();
39 void LockBackup(const QString &backupPath);
40 void UnlockBackup(const QString &backupPath);
42 void PurgeOldBackups();
43 void EnsureBackupValid(const QString &backupPath);
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; }
61 void RemoveDirRecusively(const QFileInfo &dirInfo);
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;
72 #endif // EVENTLOGBACKUPMANAGER_H