| 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 "subtitledownloadenginesregistry.h"cxx . . $ `<file>/libqnapi/src/engines/subtitledownloadenginesregistry.h`/ |
| 16 | |
| 17 | #include "engines/napiprojektdownloadengine.h"cxx . . $ `<file>/libqnapi/src/engines/napiprojektdownloadengine.h`/ |
| 18 | #include "engines/napisy24downloadengine.h"cxx . . $ `<file>/libqnapi/src/engines/napisy24downloadengine.h`/ |
| 19 | #include "engines/opensubtitlesdownloadengine.h"cxx . . $ `<file>/libqnapi/src/engines/opensubtitlesdownloadengine.h`/ |
| 20 | |
| 21 | #include "utils/p7zipdecoder.h"cxx . . $ `<file>/libqnapi/src/utils/p7zipdecoder.h`/ |
| 22 | |
| 23 | #include <Maybe.h>cxx . . $ `<file>/deps/qt-maybe/Maybe.h`/ |
| 24 | |
| 25 | #include <QPair> |
| 26 | |
| 27 | SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#::SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#SubtitleDownloadEnginesRegistry(c1ce25f1ead06c7d).( |
| 28 | const QStringcxx . . $ QString# &qnapiDisplayableVersion, |
| 29 | const QStringListcxx . . $ QStringList# &subtitleExtensions, |
| 30 | stdcxx . . $ std/::functioncxx . . $ std/function#<QSharedPointercxx . . $ QSharedPointer#<const P7ZipDecodercxx . . $ P7ZipDecoder#>(const QStringcxx . . $ QString# &)> |
| 31 | p7zipDecoderFactory) |
| 32 | : qnapiDisplayableVersioncxx . . $ SubtitleDownloadEnginesRegistry#qnapiDisplayableVersion.(qnapiDisplayableVersion), |
| 33 | subtitleExtensionscxx . . $ SubtitleDownloadEnginesRegistry#subtitleExtensions.(subtitleExtensions), |
| 34 | p7zipDecoderFactorycxx . . $ SubtitleDownloadEnginesRegistry#p7zipDecoderFactory.(p7zipDecoderFactory) {} |
| 35 | |
| 36 | QStringListcxx . . $ QStringList# SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#::listEngineNamescxx . . $ SubtitleDownloadEnginesRegistry#listEngineNames(e1dbd5c4feadc8f5).() const { |
| 37 | static QStringListcxx . . $ QStringList# engineNames = {cxx . . $ QStringList#QStringList(d3efa563c6b2065f). |
| 38 | NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).(), |
| 39 | OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#::metadatacxx . . $ OpenSubtitlesDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).(), |
| 40 | Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#::metadatacxx . . $ Napisy24DownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()}; |
| 41 | return engineNames; |
| 42 | } |
| 43 | |
| 44 | SubtitleDownloadEngineMetadatacxx . . $ SubtitleDownloadEngineMetadata# SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#::engineMetadatacxx . . $ SubtitleDownloadEnginesRegistry#engineMetadata(b33a41f6a1dd084a).( |
| 45 | const QStringcxx . . $ QString# &engineName) const { |
| 46 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) |
| 47 | return NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata.; |
| 48 | |
| 49 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#::metadatacxx . . $ OpenSubtitlesDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) |
| 50 | return OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#::metadatacxx . . $ OpenSubtitlesDownloadEngine#metadata.; |
| 51 | |
| 52 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#::metadatacxx . . $ Napisy24DownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) |
| 53 | return Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#::metadatacxx . . $ Napisy24DownloadEngine#metadata.; |
| 54 | |
| 55 | return SubtitleDownloadEngineMetadatacxx . . $ SubtitleDownloadEngineMetadata#SubtitleDownloadEngineMetadata(274a86c14fe7729a).(""cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., nothingcxx . . $ nothing(adb11f779fe07013).(), nothingcxx . . $ nothing(adb11f779fe07013).()); |
| 56 | } |
| 57 | |
| 58 | const char *const *SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#::enginePixmapDatacxx . . $ SubtitleDownloadEnginesRegistry#enginePixmapData(9d6760e3d9ac89d6).( |
| 59 | const QStringcxx . . $ QString# &engineName) const { |
| 60 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) |
| 61 | return NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::pixmapDatacxx . . $ NapiProjektDownloadEngine#pixmapData.; |
| 62 | |
| 63 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#::metadatacxx . . $ OpenSubtitlesDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) |
| 64 | return OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#::pixmapDatacxx . . $ OpenSubtitlesDownloadEngine#pixmapData.; |
| 65 | |
| 66 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#::metadatacxx . . $ Napisy24DownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) |
| 67 | return Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#::pixmapDatacxx . . $ Napisy24DownloadEngine#pixmapData.; |
| 68 | |
| 69 | return {}; |
| 70 | } |
| 71 | |
| 72 | QSharedPointercxx . . $ QSharedPointer#<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#> |
| 73 | SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#::createEnginecxx . . $ SubtitleDownloadEnginesRegistry#createEngine(b18130c81906ed).(const QStringcxx . . $ QString# &engineName, |
| 74 | const QNapiConfigcxx . . $ QNapiConfig# &config) const { |
| 75 | QSharedPointercxx . . $ QSharedPointer#<const P7ZipDecodercxx . . $ P7ZipDecoder#> p7zipDecoder = |
| 76 | p7zipDecoderFactorycxx . . $ QSharedPointer#QSharedPointer(21100a343a80bccd).(cxx . . $ std/function#`operator()`(39e0826ffb540481).config.generalConfigcxx . . $ QNapiConfig#generalConfig(e033123d5cc30136).().p7zipPathcxx . . $ GeneralConfig#p7zipPath(6ef7b6c27b00b43d).()); |
| 77 | const QStringcxx . . $ QString# &tmpPath = config.generalConfigcxx . . $ QNapiConfig#generalConfig(e033123d5cc30136).().tmpPathcxx . . $ GeneralConfig#tmpPath(6ef7b6c27b00b43d).(); |
| 78 | |
| 79 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) { |
| 80 | const EngineConfigcxx . . $ EngineConfig# &engineConfig = config.enginesConfigcxx . . $ QNapiConfig#enginesConfig(489b69d55339f0a1).().valuecxx . . $ QMap#value(866b0a4e5fb46e14).( |
| 81 | NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#::metadatacxx . . $ NapiProjektDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).(), EngineConfigcxx . . $ EngineConfig#::emptycxx . . $ EngineConfig#empty.); |
| 82 | return QSharedPointercxx . . $ QSharedPointer#QSharedPointer(21100a343a80bccd).<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#>( |
| 83 | new NapiProjektDownloadEnginecxx . . $ NapiProjektDownloadEngine#(tmpPath, engineConfig, p7zipDecoder)); |
| 84 | } |
| 85 | |
| 86 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#::metadatacxx . . $ OpenSubtitlesDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) { |
| 87 | const EngineConfigcxx . . $ EngineConfig# &engineConfig = config.enginesConfigcxx . . $ QNapiConfig#enginesConfig(489b69d55339f0a1).().valuecxx . . $ QMap#value(866b0a4e5fb46e14).( |
| 88 | OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#::metadatacxx . . $ OpenSubtitlesDownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).(), EngineConfigcxx . . $ EngineConfig#::emptycxx . . $ EngineConfig#empty.); |
| 89 | const QStringcxx . . $ QString# &language = config.generalConfigcxx . . $ QNapiConfig#generalConfig(e033123d5cc30136).().languagecxx . . $ GeneralConfig#language(6ef7b6c27b00b43d).(); |
| 90 | return QSharedPointercxx . . $ QSharedPointer#QSharedPointer(21100a343a80bccd).<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#>( |
| 91 | new OpenSubtitlesDownloadEnginecxx . . $ OpenSubtitlesDownloadEngine#(tmpPath, engineConfig, p7zipDecoder, |
| 92 | qnapiDisplayableVersioncxx . . $ SubtitleDownloadEnginesRegistry#qnapiDisplayableVersion., language)); |
| 93 | } |
| 94 | |
| 95 | if (engineName ==cxx . . $ `operator==`(edf9e4f73813982f). Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#::metadatacxx . . $ Napisy24DownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).()) { |
| 96 | const EngineConfigcxx . . $ EngineConfig# &engineConfig = config.enginesConfigcxx . . $ QNapiConfig#enginesConfig(489b69d55339f0a1).().valuecxx . . $ QMap#value(866b0a4e5fb46e14).( |
| 97 | Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#::metadatacxx . . $ Napisy24DownloadEngine#metadata..namecxx . . $ SubtitleDownloadEngineMetadata#name(6ef7b6c27b00b43d).(), EngineConfigcxx . . $ EngineConfig#::emptycxx . . $ EngineConfig#empty.); |
| 98 | return QSharedPointercxx . . $ QSharedPointer#QSharedPointer(21100a343a80bccd).<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#>(new Napisy24DownloadEnginecxx . . $ Napisy24DownloadEngine#( |
| 99 | tmpPath, engineConfig, p7zipDecoder, subtitleExtensionscxx . . $ SubtitleDownloadEnginesRegistry#subtitleExtensions.)); |
| 100 | } |
| 101 | |
| 102 | return QSharedPointercxx . . $ QSharedPointer#QSharedPointer(21100a343a80bccd).<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#>(); |
| 103 | } |
| 104 | |
| 105 | QListcxx . . $ QList#<QSharedPointercxx . . $ QSharedPointer#<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#>> |
| 106 | SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#::createEnginescxx . . $ SubtitleDownloadEnginesRegistry#createEngines(abc6d94894b3b316).( |
| 107 | const QStringListcxx . . $ QStringList# &engineNames, const QNapiConfigcxx . . $ QNapiConfig# &config) const { |
| 108 | QListcxx . . $ QList#<QSharedPointercxx . . $ QSharedPointer#<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#>> enginescxx . . $ QList#QList(49f6e7a06ebc5aa8).; |
| 109 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QString engineName, engineNames) { |
| 110 | engines <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). createEnginecxx . . $ SubtitleDownloadEnginesRegistry#createEngine(b18130c81906ed).(engineName, config); |
| 111 | } |
| 112 | return enginescxx . . $ QList#QList(b1a5d2b9a710f6d1).; |
| 113 | } |
| 114 | |
| 115 | QListcxx . . $ QList#<QSharedPointercxx . . $ QSharedPointer#<SubtitleDownloadEnginecxx . . $ SubtitleDownloadEngine#>> |
| 116 | SubtitleDownloadEnginesRegistrycxx . . $ SubtitleDownloadEnginesRegistry#::createEnabledEnginescxx . . $ SubtitleDownloadEnginesRegistry#createEnabledEngines(14f0aea4fb408033).( |
| 117 | const QNapiConfigcxx . . $ QNapiConfig# &config) const { |
| 118 | QStringListcxx . . $ QStringList# engineNamescxx . . $ QStringList#QStringList(49f6e7a06ebc5aa8).; |
| 119 | typedef QPaircxx . . $ QPair#<QStringcxx . . $ QString#, bool> EngineEnableCfgcxx . . $ SubtitleDownloadEnginesRegistry#createEnabledEngines(14f0aea4fb408033).EngineEnableCfg#; |
| 120 | |
| 121 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (EngineEnableCfg engineCfg, config.enabledEngines()) { |
| 122 | if (engineCfg.secondcxx . . $ QPair#second.) engineNames <<cxx . . $ QStringList#`operator<<`(85116071a693d053). engineCfg.firstcxx . . $ QPair#first.; |
| 123 | } |
| 124 | |
| 125 | return createEnginescxx . . $ QList#QList(b1a5d2b9a710f6d1).(engineNames, config); |
| 126 | } |