Debian Codegraph @

libqnapi/src/engines/subtitledownloadengine.cpp

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 #include "engines/subtitledownloadengine.h"cxx . . $ `<file>/libqnapi/src/engines/subtitledownloadengine.h`/
16 #include <QDir>
17 #include <QFlags>
18 #include "subconvert/subtitleformatsregistry.h"cxx . . $ `<file>/libqnapi/src/subconvert/subtitleformatsregistry.h`/
19
20 SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#SubtitleDownloadEngine(3520e46b33348bf6).(const QStringcxx . . $ QString#& tmpPath)
21 : tmpPathcxx . . $ SubtitleDownloadEngine#tmpPath.(tmpPath) {}
22
23 void SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::setMoviePathcxx . . $ SubtitleDownloadEngine#setMoviePath(3520e46b33348bf6).(const QStringcxx . . $ QString#& path) { moviecxx . . $ SubtitleDownloadEngine#movie. =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). path; }
24
25 QStringcxx . . $ QString# SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::moviePathcxx . . $ SubtitleDownloadEngine#moviePath(4365c3963150523e).() { return moviecxx . . $ QString#QString(3520e46b33348bf6).; }
26
27 void SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::clearSubtitlesListcxx . . $ SubtitleDownloadEngine#clearSubtitlesList(49f6e7a06ebc5aa8).() {
28 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (SubtitleInfo s, subtitlesList) {
29 if (QFilecxx . . $ QFile#::existscxx . . $ QFile#exists(e1defb592416720d).(s.sourceLocationcxx . . $ SubtitleInfo#sourceLocation.)) QFilecxx . . $ QFile#::removecxx . . $ QFile#remove(e1defb592416720d).(s.sourceLocationcxx . . $ SubtitleInfo#sourceLocation.);
30 }
31 subtitlesListcxx . . $ SubtitleDownloadEngine#subtitlesList..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
32 }
33
34 Maybecxx . . $ Maybe#<SubtitleInfocxx . . $ SubtitleInfo#> SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::resolveByIdcxx . . $ SubtitleDownloadEngine#resolveById(efe4ef1cfff5bbe2).(QUuidcxx . . $ QUuid# id) {
35 foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (SubtitleInfo s, subtitlesList) {
36 if (s.idcxx . . $ SubtitleInfo#id. ==cxx . . $ QUuid#`operator==`(4b97da787e0d8010). id) return justcxx . . $ just(62f398f3cea75aa5).(s);
37 }
38 return nothingcxx . . $ nothing(adb11f779fe07013).();
39 }
40
41 void SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::updateSubtitleInfocxx . . $ SubtitleDownloadEngine#updateSubtitleInfo(3bb0ad1a0c893c81).(const SubtitleInfocxx . . $ SubtitleInfo#& si) {
42 for (int i = 0; i < subtitlesListcxx . . $ SubtitleDownloadEngine#subtitlesList..sizecxx . . $ QList#size(455f465bc33b4cdf).(); ++i) {
43 if (subtitlesListcxx . . $ SubtitleDownloadEngine#subtitlesList.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i].idcxx . . $ SubtitleInfo#id. ==cxx . . $ QUuid#`operator==`(4b97da787e0d8010). si.idcxx . . $ SubtitleInfo#id.) {
44 subtitlesListcxx . . $ SubtitleDownloadEngine#subtitlesList.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i] =cxx . . $ SubtitleInfo#`operator=`(2af552746e302f1). si;
45 break;
46 }
47 }
48 }
49
50 QStringcxx . . $ QString# SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::generateTmpFileNamecxx . . $ SubtitleDownloadEngine#generateTmpFileName(6ef7b6c27b00b43d).() const {
51 static bool gen_inited;
52 if (!gen_inited) {
53 qsrandcxx . . $ qsrand(cb2f890c2fdad230).(time(0));
54 gen_inited = true;
55 }
56 return QStringcxx . . $ QString#QString(e1217c004a86c950).("QNapi.%1.tmp").argcxx . . $ QString#arg(64ab2ed17cc11715).(qrandcxx . . $ qrand(b126dc7c1de90089).());
57 }
58
59 QStringcxx . . $ QString# SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#::generateTmpPathcxx . . $ SubtitleDownloadEngine#generateTmpPath(6ef7b6c27b00b43d).() const {
60 QStringcxx . . $ QString# newTmpFilePath =
61 QStringcxx . . $ QString#QString(e1217c004a86c950).("%1/%2").argcxx . . $ QString#arg(bc823072288cbbb5).(tmpPathcxx . . $ SubtitleDownloadEngine#tmpPath.).argcxx . . $ QString#arg(bc823072288cbbb5).(generateTmpFileNamecxx . . $ SubtitleDownloadEngine#generateTmpFileName(6ef7b6c27b00b43d).());
62 return QDircxx . . $ QString#QString(e1217c004a86c950).::toNativeSeparatorscxx . . $ QDir#toNativeSeparators(fd988a2ab94d906b).(newTmpFilePath);
63 }