| 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 NAPISY24DOWNLOADENGINE_H |
| 16 | #define NAPISY24DOWNLOADENGINE_H |
| 17 | |
| 18 | #include "config/engineconfig.h" |
| 19 | #include "config/staticconfig.h" |
| 20 | #include "engines/subtitledownloadengine.h" |
| 21 | #include "utils/p7zipdecoder.h" |
| 22 | #include "utils/synchttp.h" |
| 23 | |
| 24 | #include <QSharedPointer> |
| 25 | |
| 26 | class Napisy24DownloadEngine : public SubtitleDownloadEngine { |
| 27 | public: |
| 28 | Napisy24DownloadEngine(const QString& tmpPath, const EngineConfig& config, |
| 29 | const QSharedPointer<const P7ZipDecoder>& p7zipDecoder, |
| 30 | const QStringList& subtitleExtensions); |
| 31 | ~Napisy24DownloadEngine(); |
| 32 | |
| 33 | static SubtitleDownloadEngineMetadata metadata; |
| 34 | static const char* const pixmapData[]; |
| 35 | |
| 36 | SubtitleDownloadEngineMetadata meta() const; |
| 37 | const char* const* enginePixmapData() const; |
| 38 | |
| 39 | QString checksum(QString filename = ""); |
| 40 | bool lookForSubtitles(QString lang); |
| 41 | QList<SubtitleInfo> listSubtitles(); |
| 42 | bool download(QUuid id); |
| 43 | bool unpack(QUuid id); |
| 44 | void cleanup(); |
| 45 | |
| 46 | private: |
| 47 | QPair<QString, QString> getCredentials() const; |
| 48 | |
| 49 | EngineConfig engineConfig; |
| 50 | QSharedPointer<const P7ZipDecoder> p7zipDecoder; |
| 51 | QStringList subtitleExtensions; |
| 52 | |
| 53 | quint64 fileSize; |
| 54 | }; |
| 55 | |
| 56 | #endif // NAPISY24DOWNLOADENGINE_H |