CuteLogger
Fast and simple logging solution for Qt based applications
htmlgeneratorwidget.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 HTMLGENERATORWIDGET_H
19#define HTMLGENERATORWIDGET_H
20
21#include "abstractproducerwidget.h"
22
23#include <QWidget>
24
25namespace Ui {
26class HtmlGeneratorWidget;
27}
28
29class HtmlGeneratorWidget : public QWidget, public AbstractProducerWidget
30{
31 Q_OBJECT
32
33public:
34 static const char *kColorProperty;
35 static const char *kCssProperty;
36 static const char *kBodyProperty;
37 static const char *kJavaScriptProperty;
38 static const char *kLine1Property;
39 static const char *kLine2Property;
40 static const char *kLine3Property;
41
42 explicit HtmlGeneratorWidget(QWidget *parent = 0);
43 ~HtmlGeneratorWidget();
44
45 // AbstractProducerWidget overrides
46 Mlt::Producer *newProducer(Mlt::Profile &) override;
47 Mlt::Properties getPreset() const override;
48 void loadPreset(Mlt::Properties &) override;
49 void setProducer(Mlt::Producer *p) override;
50
51signals:
52 void producerChanged(Mlt::Producer *);
53
54private slots:
55 void on_colorButton_clicked();
56 void on_preset_selected(void *p);
57 void on_preset_saveClicked();
58
59 void on_imageButton_clicked();
60
61 void on_pushButton_clicked();
62
63 void on_videoButton_clicked();
64
65 void on_cssToggleButton_toggled(bool checked);
66
67 void on_bodyToggleButton_toggled(bool checked);
68
69 void on_javascriptToggleButton_toggled(bool checked);
70
71 void on_bodyTextEdit_textChanged();
72
73 void on_presetIconView_itemClicked(class QListWidgetItem *item);
74
75protected:
76 bool eventFilter(QObject *watched, QEvent *event) override;
77
78private:
79 QString generateHtml() const;
80 void updateTextSectionVisibility();
81 void populatePresetIconView();
82 QString findPresetIconPath(const QString &presetName);
83 void setupIconAnimation(class QListWidgetItem *item, const QString &iconPath);
84 Ui::HtmlGeneratorWidget *ui;
85 QList<class QMovie *> m_iconMovies;
86 class QListWidgetItem *m_lastHoveredItem = nullptr;
87};
88
89#endif // TEXTPRODUCERWIDGET_H