CuteLogger
Fast and simple logging solution for Qt based applications
postjobaction.h
1/*
2 * Copyright (c) 2018-2021 Meltytech, LLC
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef POSTJOBACTION_H
19#define POSTJOBACTION_H
20
21#include <QString>
22#include <QUuid>
23
24class PostJobAction
25{
26public:
27 virtual ~PostJobAction() {}
28 virtual void doAction() = 0;
29};
30
31class FilePropertiesPostJobAction : public PostJobAction
32{
33public:
34 FilePropertiesPostJobAction(const QString &srcFile, const QString &dstFile)
35 : m_srcFile(srcFile)
36 , m_dstFile(dstFile)
37 {}
38 virtual ~FilePropertiesPostJobAction() {}
39 virtual void doAction();
40
41protected:
42 QString m_srcFile;
43 QString m_dstFile;
44};
45
46class OpenPostJobAction : public FilePropertiesPostJobAction
47{
48public:
49 OpenPostJobAction(const QString &srcFile, const QString &dstFile, const QString &fileNameToRemove)
50 : FilePropertiesPostJobAction(srcFile, dstFile)
51 , m_fileNameToRemove(fileNameToRemove)
52 {}
53 void doAction();
54
55private:
56 QString m_fileNameToRemove;
57};
58
59class ReplaceOnePostJobAction : public FilePropertiesPostJobAction
60{
61public:
62 ReplaceOnePostJobAction(const QString &srcFile, const QString &dstFile,
63 const QString &fileNameToRemove, const QUuid &srcUuid, int in)
64 : FilePropertiesPostJobAction(srcFile, dstFile)
65 , m_fileNameToRemove(fileNameToRemove)
66 , m_uuid(srcUuid)
67 , m_in(in)
68 {}
69 void doAction();
70
71private:
72 QString m_fileNameToRemove;
73 QUuid m_uuid;
74 int m_in;
75};
76
77class ReplaceAllPostJobAction : public FilePropertiesPostJobAction
78{
79public:
80 ReplaceAllPostJobAction(const QString &srcFile, const QString &dstFile, const QString &srcHash)
81 : FilePropertiesPostJobAction(srcFile, dstFile)
82 , m_hash(srcHash)
83 {}
84 void doAction();
85
86private:
87 QString m_hash;
88};
89
90class ProxyReplacePostJobAction : public FilePropertiesPostJobAction
91{
92public:
93 ProxyReplacePostJobAction(const QString &srcFile, const QString &dstFile, const QString &srcHash)
94 : FilePropertiesPostJobAction(srcFile, dstFile)
95 , m_srcFile(srcFile)
96 , m_dstFile(dstFile)
97 , m_hash(srcHash)
98 {}
99 void doAction();
100
101private:
102 QString m_srcFile;
103 QString m_dstFile;
104 QString m_hash;
105};
106
107class ProxyFinalizePostJobAction : public FilePropertiesPostJobAction
108{
109public:
110 ProxyFinalizePostJobAction(const QString &srcFile, const QString &dstFile)
111 : FilePropertiesPostJobAction(srcFile, dstFile)
112 , m_dstFile(dstFile)
113 {}
114 void doAction();
115
116private:
117 QString m_dstFile;
118};
119
120#endif // POSTJOBACTION_H