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
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,
50 const QString &dstFile,
51 const QString &fileNameToRemove)
52 : FilePropertiesPostJobAction(srcFile, dstFile)
53 , m_fileNameToRemove(fileNameToRemove)
54 {}
55 void doAction();
56
57private:
58 QString m_fileNameToRemove;
59};
60
61class ReplaceOnePostJobAction : public FilePropertiesPostJobAction
62{
63public:
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
76private:
77 QString m_fileNameToRemove;
78 QUuid m_uuid;
79 int m_in;
80};
81
82class ReplaceAllPostJobAction : public FilePropertiesPostJobAction
83{
84public:
85 ReplaceAllPostJobAction(const QString &srcFile, const QString &dstFile, const QString &srcHash)
86 : FilePropertiesPostJobAction(srcFile, dstFile)
87 , m_hash(srcHash)
88 {}
89 void doAction();
90
91private:
92 QString m_hash;
93};
94
95class ProxyReplacePostJobAction : public FilePropertiesPostJobAction
96{
97public:
98 ProxyReplacePostJobAction(const QString &srcFile,
99 const QString &dstFile,
100 const QString &srcHash,
101 int rotation = 0)
102 : FilePropertiesPostJobAction(srcFile, dstFile)
103 , m_srcFile(srcFile)
104 , m_dstFile(dstFile)
105 , m_hash(srcHash)
106 , m_rotation(rotation)
107 {}
108 void doAction();
109
110private:
111 QString m_srcFile;
112 QString m_dstFile;
113 QString m_hash;
114 int m_rotation;
115};
116
117class ProxyFinalizePostJobAction : public FilePropertiesPostJobAction
118{
119public:
120 ProxyFinalizePostJobAction(const QString &srcFile, const QString &dstFile, int rotation = 0)
121 : FilePropertiesPostJobAction(srcFile, dstFile)
122 , m_dstFile(dstFile)
123 , m_rotation(rotation)
124 {}
125 void doAction();
126
127private:
128 QString m_dstFile;
129 int m_rotation;
130};
131
132class SubtitlesDock;
133
134class ImportSrtPostJobAction : public PostJobAction
135{
136public:
137 ImportSrtPostJobAction(const QString &srtFile,
138 const QString &trackName,
139 const QString &lang,
140 bool includeNonspoken,
141 SubtitlesDock *dock)
142 : m_srtFile(srtFile)
143 , m_trackName(trackName)
144 , m_lang(lang)
145 , m_includeNonspoken(includeNonspoken)
146 , m_dock(dock)
147 {}
148 virtual ~ImportSrtPostJobAction() {}
149 void doAction();
150
151protected:
152 const QString m_srtFile;
153 const QString m_trackName;
154 const QString m_lang;
155 const bool m_includeNonspoken;
156 SubtitlesDock *m_dock;
157};
158
159#endif // POSTJOBACTION_H