Herunterladen als
root/src/sqlitebackupprocessor.h @ 49762cb7
c047c335 | Christian Ehringfeld | /*
|
|
* Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
|
|||
*
|
|||
* This program is free software; you can redistribute it and/or modify it
|
|||
* under the terms of the GNU Lesser General Public License as published by
|
|||
* the Free Software Foundation.
|
|||
*
|
|||
* This program is distributed in the hope that it will be useful, but
|
|||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|||
* for more details.
|
|||
*
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
|||
a66d2871 | Christian Ehringfeld | #ifndef SQLITEBACKUPPROCESSOR_H
|
|
#define SQLITEBACKUPPROCESSOR_H
|
|||
#include <QObject>
|
|||
#include <QtSql/QSqlDriver>
|
|||
#include <QString>
|
|||
#include <QVariant>
|
|||
6262bb8b | Christian Ehringfeld | #include <QTimer>
|
|
126e71e3 | Christian Ehringfeld | #include <QDir>
|
|
a66d2871 | Christian Ehringfeld | #include "database.h"
|
|
namespace CuteEntityManager {
|
|||
class SqliteBackupProcessor : public QObject {
|
|||
public:
|
|||
6262bb8b | Christian Ehringfeld | explicit SqliteBackupProcessor(QSharedPointer<Database> database,
|
|
QString destination);
|
|||
126e71e3 | Christian Ehringfeld | /**
|
|
* @brief SqliteBackupProcessor
|
|||
* @param database
|
|||
* @param destination
|
|||
* @param backupFilename
|
|||
* @param timer
|
|||
* @param incrementalBackups
|
|||
* @param backupCount
|
|||
* You must start the timer.
|
|||
*/
|
|||
6262bb8b | Christian Ehringfeld | explicit SqliteBackupProcessor(QSharedPointer<Database> database,
|
|
f89ad1ad | Christian Ehringfeld | QString destination, QString backupFilename, QSharedPointer<QTimer> timer,
|
|
6262bb8b | Christian Ehringfeld | bool incrementalBackups = false, int backupCount = 1);
|
|
bcd2b697 | Christian Ehringfeld | ~SqliteBackupProcessor();
|
|
a66d2871 | Christian Ehringfeld | QSharedPointer<Database> getDatabase() const;
|
|
void setDatabase(const QSharedPointer<Database> &value);
|
|||
QString getDestination() const;
|
|||
void setDestination(const QString &value);
|
|||
6262bb8b | Christian Ehringfeld | QString getBackupFilename() const;
|
|
void setBackupFilename(const QString &value);
|
|||
int getBackupCount() const;
|
|||
void setBackupCount(int value);
|
|||
bool getIncrementalBackups() const;
|
|||
void setIncrementalBackups(bool value);
|
|||
f89ad1ad | Christian Ehringfeld | QSharedPointer<QTimer> getTimer() const;
|
|
void setTimer(const QSharedPointer<QTimer> &value);
|
|||
126e71e3 | Christian Ehringfeld | public slots:
|
|
6262bb8b | Christian Ehringfeld | bool sqliteDBMemFile(bool save, QString fileName = "db.sqlite.bak");
|
|
void backup();
|
|||
126e71e3 | Christian Ehringfeld | protected slots:
|
|
void rotateBackup();
|
|||
6262bb8b | Christian Ehringfeld | private:
|
|
a66d2871 | Christian Ehringfeld | QSharedPointer<Database> database;
|
|
QString destination;
|
|||
6262bb8b | Christian Ehringfeld | QString backupFilename;
|
|
f89ad1ad | Christian Ehringfeld | QSharedPointer<QTimer> timer;
|
|
6262bb8b | Christian Ehringfeld | bool incrementalBackups;
|
|
int backupCount;
|
|||
int counter = 0;
|
|||
a66d2871 | Christian Ehringfeld | };
|
|
}
|
|||
#endif // SQLITEBACKUPPROCESSOR_H
|