| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef READABILITY_H |
| 4 | #define READABILITY_H |
| 5 | |
| 6 | #include "miscellaneous/nodejs.h" |
| 7 | |
| 8 | #include <QObject> |
| 9 | #include <QProcess> |
| 10 | |
| 11 | class Readability : public QObject { |
| 12 | Q_OBJECT |
| 13 | |
| 14 | public: |
| 15 | explicit Readability(QObject* parent = nullptr); |
| 16 | |
| 17 | void makeHtmlReadable(QObject* sndr, const QString& html, const QString& base_url = {}); |
| 18 | |
| 19 | private slots: |
| 20 | void onReadabilityFinished(QObject* sndr, int exit_code, QProcess::ExitStatus exit_status); |
| 21 | void onPackageReady(const QObject* sndr, const QList<NodeJs::PackageMetadata>& pkgs, bool already_up_to_date); |
| 22 | void onPackageError(const QObject* sndr, const QList<NodeJs::PackageMetadata>& pkgs, const QString& error); |
| 23 | |
| 24 | signals: |
| 25 | void htmlReadabled(const QObject* sndr, const QString& better_html); |
| 26 | void errorOnHtmlReadabiliting(const QObject* sndr, const QString& error); |
| 27 | |
| 28 | private: |
| 29 | bool m_modulesInstalling; |
| 30 | bool m_modulesInstalled; |
| 31 | }; |
| 32 | |
| 33 | #endif // READABILITY_H |