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 
24 class PostJobAction
25 {
26 public:
27  virtual ~PostJobAction() {}
28  virtual void doAction() = 0;
29 };
30 
31 class FilePropertiesPostJobAction : public PostJobAction
32 {
33 public:
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 
41 protected:
42  QString m_srcFile;
43  QString m_dstFile;
44 };
45 
46 class OpenPostJobAction : public FilePropertiesPostJobAction
47 {
48 public:
49  OpenPostJobAction(const QString& srcFile, const QString& dstFile, const QString& fileNameToRemove)
50  : FilePropertiesPostJobAction(srcFile, dstFile)
51  , m_fileNameToRemove(fileNameToRemove)
52  {}
53  void doAction();
54 
55 private:
56  QString m_fileNameToRemove;
57 };
58 
59 class ReplaceOnePostJobAction : public FilePropertiesPostJobAction
60 {
61 public:
62  ReplaceOnePostJobAction(const QString& srcFile, const QString& dstFile, const QString& fileNameToRemove, const QUuid& srcUuid, int in)
63  : FilePropertiesPostJobAction(srcFile, dstFile)
64  , m_fileNameToRemove(fileNameToRemove)
65  , m_uuid(srcUuid)
66  , m_in(in)
67  {}
68  void doAction();
69 
70 private:
71  QString m_fileNameToRemove;
72  QUuid m_uuid;
73  int m_in;
74 };
75 
76 class ReplaceAllPostJobAction : public FilePropertiesPostJobAction
77 {
78 public:
79  ReplaceAllPostJobAction(const QString& srcFile, const QString& dstFile, const QString& srcHash)
80  : FilePropertiesPostJobAction(srcFile, dstFile)
81  , m_hash(srcHash)
82  {}
83  void doAction();
84 
85 private:
86  QString m_hash;
87 };
88 
89 class ProxyReplacePostJobAction : public FilePropertiesPostJobAction
90 {
91 public:
92  ProxyReplacePostJobAction(const QString& srcFile, const QString& dstFile, const QString& srcHash)
93  : FilePropertiesPostJobAction(srcFile, dstFile)
94  , m_srcFile(srcFile)
95  , m_dstFile(dstFile)
96  , m_hash(srcHash)
97  {}
98  void doAction();
99 
100 private:
101  QString m_srcFile;
102  QString m_dstFile;
103  QString m_hash;
104 };
105 
106 class ProxyFinalizePostJobAction : public FilePropertiesPostJobAction
107 {
108 public:
109  ProxyFinalizePostJobAction(const QString& srcFile, const QString& dstFile)
110  : FilePropertiesPostJobAction(srcFile, dstFile)
111  , m_dstFile(dstFile)
112  {}
113  void doAction();
114 
115 private:
116  QString m_dstFile;
117 };
118 
119 #endif // POSTJOBACTION_H