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, 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
106private:
107 QString m_srcFile;
108 QString m_dstFile;
109 QString m_hash;
110};
111
112class ProxyFinalizePostJobAction : public FilePropertiesPostJobAction
113{
114public:
115 ProxyFinalizePostJobAction(const QString &srcFile, const QString &dstFile)
116 : FilePropertiesPostJobAction(srcFile, dstFile)
117 , m_dstFile(dstFile)
118 {}
119 void doAction();
120
121private:
122 QString m_dstFile;
123};
124
125class SubtitlesDock;
126
127class ImportSrtPostJobAction : public PostJobAction
128{
129public:
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
144protected:
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