CuteLogger
Fast and simple logging solution for Qt based applications
htmlgeneratorjob.h
1/*
2 * Copyright (c) 2025 Meltytech, LLC
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef HTMLGENERATORJOB_H
19#define HTMLGENERATORJOB_H
20
21#include "abstractjob.h"
22#include "htmlgenerator.h"
23
24#include <QDir>
25#include <QTemporaryDir>
26
27class HtmlGeneratorJob : public AbstractJob
28{
29 Q_OBJECT
30public:
31 HtmlGeneratorJob(const QString &name,
32 const QString &html,
33 const QString &outputPath,
34 int duration,
35 QThread::Priority priority = QThread::HighPriority);
36 void start() override;
37
38protected slots:
39 void onFinished(int exitCode, QProcess::ExitStatus exitStatus) override;
40 void onReadyRead() override;
41
42private slots:
43 void onAnimationFramesReady();
44 void onHtmlGeneratorProgress(float progress);
45 void onOpenTriggered();
46
47private:
48 QString m_html;
49 QString m_outputPath;
50 int m_duration;
51 HtmlGenerator *m_generator; // owned via parent QObject
52 std::unique_ptr<QTemporaryDir> m_tempDir;
53 QString m_htmlFilePath;
54 bool m_isGeneratingFrames;
55 int m_previousPercent;
56};
57
58#endif // HTMLGENERATORJOB_H