#ifndef GENTMPTHREAD_H
#define GENTMPTHREAD_H

#include <QThread>
class ProgItem;
class GenTmpThread : public QThread {
    Q_OBJECT
public:
    explicit GenTmpThread(ProgItem *progItem, const QString &prog_name, const QString &zip_file, const QString &password, QObject *parent = nullptr);

    ProgItem *mProgItem;
protected:
    virtual void run() override;

    QJsonObject cvtPage(const QJsonDocument &, const QJsonDocument &);
    QJsonObject cvtEle(const QString &type, const QJsonObject &json);
    QJsonObject convertText(const QJsonObject &json);
    QJsonObject convertPhoto(const QJsonObject &json);
    QJsonObject convertGif(const QJsonObject &json);
    QJsonObject convertDClock(const QJsonObject &json);
    QJsonObject convertAClock(const QJsonObject &json);
    QJsonObject convertWeb(const QJsonObject &json);
    QJsonObject convertTimer(const QJsonObject &json);
signals:
    void sProgress(QString, int, bool = false);
    void onErr(QString);
private:
    QString prog_name, dstDir, srcPageDir;
    QString zip_file, password;
    int res_id = 0;
};

#endif // GENTMPTHREAD_H
