| 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 SUBTITLEDOWNLOADENGINESREGISTRY_H |
| 16 | #define SUBTITLEDOWNLOADENGINESREGISTRY_H |
| 17 | |
| 18 | #include "config/qnapiconfig.h" |
| 19 | |
| 20 | #include "engines/subtitledownloadengine.h" |
| 21 | |
| 22 | #include "utils/p7zipdecoder.h" |
| 23 | |
| 24 | #include <QSharedPointer> |
| 25 | #include <QString> |
| 26 | #include <QStringList> |
| 27 | #include <QUrl> |
| 28 | #include <functional> |
| 29 | |
| 30 | class SubtitleDownloadEnginesRegistry { |
| 31 | public: |
| 32 | SubtitleDownloadEnginesRegistry( |
| 33 | const QString &qnapiDisplayableVersion, |
| 34 | const QStringList &subtitleExtensions, |
| 35 | std::function<QSharedPointer<const P7ZipDecoder>(const QString &)> |
| 36 | p7zipDecoderFactory); |
| 37 | |
| 38 | QStringList listEngineNames() const; |
| 39 | SubtitleDownloadEngineMetadata engineMetadata( |
| 40 | const QString &engineName) const; |
| 41 | const char *const *enginePixmapData(const QString &engineName) const; |
| 42 | |
| 43 | QSharedPointer<SubtitleDownloadEngine> createEngine( |
| 44 | const QString &engineName, const QNapiConfig &config) const; |
| 45 | QList<QSharedPointer<SubtitleDownloadEngine>> createEngines( |
| 46 | const QStringList &engineNames, const QNapiConfig &config) const; |
| 47 | QList<QSharedPointer<SubtitleDownloadEngine>> createEnabledEngines( |
| 48 | const QNapiConfig &config) const; |
| 49 | |
| 50 | private: |
| 51 | const QString qnapiDisplayableVersion; |
| 52 | const QStringList subtitleExtensions; |
| 53 | std::function<QSharedPointer<const P7ZipDecoder>(const QString &)> |
| 54 | p7zipDecoderFactory; |
| 55 | }; |
| 56 | |
| 57 | #endif // SUBTITLEDOWNLOADENGINESREGISTRY_H |