CuteLogger
Fast and simple logging solution for Qt based applications
postjobaction.h
1 /*
2  * Copyright (c) 2018-2024 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,
50  const QString &dstFile,
51  const QString &fileNameToRemove)
52  : FilePropertiesPostJobAction(srcFile, dstFile)
53  , m_fileNameToRemove(fileNameToRemove)
54  {}
55  void doAction();
56 
57 private:
58  QString m_fileNameToRemove;
59 };
60 
61 class ReplaceOnePostJobAction : public FilePropertiesPostJobAction
62 {
63 public:
64  ReplaceOnePostJobAction(const QString &srcFile,
65  const QString &dstFile,
66  const QString &fileNameToRemove,
67  const QUuid &srcUuid,
68  int in)
69  : FilePropertiesPostJobAction(srcFile, dstFile)
70  , m_fileNameToRemove(fileNameToRemove)
71  , m_uuid(srcUuid)
72  , m_in(in)
73  {}
74  void doAction();
75 
76 private:
77  QString m_fileNameToRemove;
78  QUuid m_uuid;
79  int m_in;
80 };
81 
82 class ReplaceAllPostJobAction : public FilePropertiesPostJobAction
83 {
84 public:
85  ReplaceAllPostJobAction(const QString &srcFile, const QString &dstFile, const QString &srcHash)
86  : FilePropertiesPostJobAction(srcFile, dstFile)
87  , m_hash(srcHash)
88  {}
89  void doAction();
90 
91 private:
92  QString m_hash;
93 };
94 
95 class ProxyReplacePostJobAction : public FilePropertiesPostJobAction
96 {
97 public:
98  ProxyReplacePostJobAction(const QString &srcFile, const QString &dstFile, const QString &srcHash)
99  : FilePropertiesPostJobAction(srcFile, dstFile)
100  , m_srcFile(srcFile)
101  , m_dstFile(dstFile)
102  , m_hash(srcHash)
103  {}
104  void doAction();
105 
106 private:
107  QString m_srcFile;
108  QString m_dstFile;
109  QString m_hash;
110 };
111 
112 class ProxyFinalizePostJobAction : public FilePropertiesPostJobAction
113 {
114 public:
115  ProxyFinalizePostJobAction(const QString &srcFile, const QString &dstFile)
116  : FilePropertiesPostJobAction(srcFile, dstFile)
117  , m_dstFile(dstFile)
118  {}
119  void doAction();
120 
121 private:
122  QString m_dstFile;
123 };
124 
125 class SubtitlesDock;
126 
127 class ImportSrtPostJobAction : public PostJobAction
128 {
129 public:
130  ImportSrtPostJobAction(const QString &srtFile,
131  const QString &trackName,
132  const QString &lang,
133  bool includeNonspoken,
134  SubtitlesDock *dock)
135  : m_srtFile(srtFile)
136  , m_trackName(trackName)
137  , m_lang(lang)
138  , m_includeNonspoken(includeNonspoken)
139  , m_dock(dock)
140  {}
141  virtual ~ImportSrtPostJobAction() {}
142  void doAction();
143 
144 protected:
145  const QString m_srtFile;
146  const QString m_trackName;
147  const QString m_lang;
148  const bool m_includeNonspoken;
149  SubtitlesDock *m_dock;
150 };
151 
152 #endif // POSTJOBACTION_H