summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups/src/stdafx.h
blob: d1664425896669be3e5495d8bdca644eb637c334 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef _HEADERS_H
#define _HEADERS_H

#define _CRT_SECURE_NO_DEPRECATE

#include <windows.h>
#include <shlobj.h>
#include <time.h>

#include <string>
#include <vector>
#include <functional>
#include <filesystem>

namespace fs = std::filesystem;

#include <newpluginapi.h>
#include <m_clist.h>
#include <m_database.h>
#include <m_db_int.h>
#include <m_langpack.h>
#include <m_options.h>
#include <m_popup.h>
#include <m_skin.h>
#include <m_icolib.h>
#include <m_autobackups.h>
#include <m_gui.h>
#include <m_variables.h>

#include <m_folders.h>
#include <m_cloudfile.h>

#define MODULENAME "AutoBackups"

struct CMPlugin : public PLUGIN<CMPlugin>
{
	CMPlugin();

	CMOption<BYTE>	    backup_types;
	CMOption<WORD>	    period;
	CMOption<BYTE>	    period_type;
	wchar_t			    folder[MAX_PATH];
	CMOption<wchar_t*> file_mask;
	CMOption<WORD>	    num_backups;
	CMOption<BYTE>	    disable_progress;
	CMOption<BYTE>	    disable_popups;
	CMOption<BYTE>	    use_zip;
	CMOption<BYTE>	    backup_profile;
	CMOption<BYTE>	    use_cloudfile;
	CMOption<char*>    cloudfile_service;

	int Load() override;
};

#include "options.h"
#include "resource.h"
#include "version.h"

#define SUB_DIR L"\\AutoBackups"
#define DIR L"%miranda_userdata%"

int  SetBackupTimer(void);
int  OptionsInit(WPARAM wParam, LPARAM lParam);
void BackupStart(wchar_t *backup_filename);
int  BackupStatus(void);

struct ZipFile
{
	std::wstring sPath;
	std::wstring sZipPath;
	__forceinline ZipFile(const std::wstring &path, const std::wstring &zpath) : sPath(path), sZipPath(zpath) {}
};

int CreateZipFile(const wchar_t *szDestPath, OBJLIST<ZipFile> &lstFiles, const std::function<bool(size_t)> &fnCallback);

extern char g_szMirVer[];

static IconItem iconList[] = {
	{ LPGEN("Backup profile"),     "backup", IDI_BACKUP },
	{ LPGEN("Save profile as..."), "saveas", IDI_BACKUP }
};

#endif