Debian Codegraph @

libqnapi/src/subtitlematcher.h

raw symbols SCIP
1 /*****************************************************************************
2 ** QNapi
3 ** Copyright (C) 2008-2017 Piotr KrzemiƄski <[email protected]>
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 *****************************************************************************/
14
15 #ifndef SUBTITLE_MATCHER_H
16 #define SUBTITLE_MATCHER_H
17
18 #include "subconvert/subtitleformatsregistry.h"
19
20 #include <QFileInfo>
21 #include <QSharedPointer>
22
23 class SubtitleMatcher : public QObject {
24 Q_OBJECT
25 public:
26 SubtitleMatcher(bool _noBackup, bool _isPostProcessingEnabled,
27 QString _ppSubFormat, QString _ppSubExtension,
28 bool _changePermissions, QString _changePermissionsTo,
29 const QSharedPointer<const SubtitleFormatsRegistry>
30 &subtitleFormatsRegistry);
31
32 bool matchSubtitles(QString subtitlesTmpFilePath,
33 QString targetMovieFilePath) const;
34
35 private:
36 QString selectTargetExtension(QFileInfo subtitlesTmpFileInfo) const;
37 QString constructSubtitlePath(QString targetMovieFilePath,
38 QString targetExtension,
39 QString baseSuffix = "") const;
40 bool isWritablePath(QString path) const;
41 void removeOrCopy(QString targetMoviefilePath,
42 QString targetSubtitlesFilePath) const;
43 bool dryCopy(QString srcFilePath, QString dstFilePath) const;
44 void fixFilePermissions(QString targetSubtitlesFilePath,
45 QString changePermissionsTo) const;
46
47 bool noBackup;
48 bool isPostProcessingEnabled;
49 QString ppSubFormat;
50 QString ppSubExtension;
51 bool changePermissions;
52 QString changePermissionsTo;
53
54 QSharedPointer<const SubtitleFormatsRegistry> subtitleFormatsRegistry;
55 };
56
57 #endif // SUBTITLE_MATCHER_H