Lines 1-5
Link Here
|
1 |
/* |
1 |
/* |
2 |
* SPDX-FileCopyrightText: 2014-2023 Megan Conkle <megan.conkle@kdemail.net> |
2 |
* SPDX-FileCopyrightText: 2014-2024 Megan Conkle <megan.conkle@kdemail.net> |
3 |
* |
3 |
* |
4 |
* SPDX-License-Identifier: GPL-3.0-or-later |
4 |
* SPDX-License-Identifier: GPL-3.0-or-later |
5 |
*/ |
5 |
*/ |
Lines 38-44
class HtmlPreviewPrivate
Link Here
|
38 |
HtmlPreviewPrivate(HtmlPreview *q_ptr) |
38 |
HtmlPreviewPrivate(HtmlPreview *q_ptr) |
39 |
: q_ptr(q_ptr) |
39 |
: q_ptr(q_ptr) |
40 |
{ |
40 |
{ |
41 |
; |
41 |
proxy = new PreviewProxy(q_ptr); |
42 |
} |
42 |
} |
43 |
|
43 |
|
44 |
~HtmlPreviewPrivate() |
44 |
~HtmlPreviewPrivate() |
Lines 51-57
class HtmlPreviewPrivate
Link Here
|
51 |
MarkdownDocument *document; |
51 |
MarkdownDocument *document; |
52 |
bool updateInProgress; |
52 |
bool updateInProgress; |
53 |
bool updateAgain; |
53 |
bool updateAgain; |
54 |
PreviewProxy proxy; |
54 |
PreviewProxy *proxy; |
55 |
QString baseUrl; |
55 |
QString baseUrl; |
56 |
QRegularExpression headingTagExp; |
56 |
QRegularExpression headingTagExp; |
57 |
Exporter *exporter; |
57 |
Exporter *exporter; |
Lines 91-97
HtmlPreview::HtmlPreview
Link Here
|
91 |
d->updateInProgress = false; |
91 |
d->updateInProgress = false; |
92 |
d->updateAgain = false; |
92 |
d->updateAgain = false; |
93 |
d->exporter = exporter; |
93 |
d->exporter = exporter; |
94 |
d->proxy.setMathEnabled(d->exporter->supportsMath()); |
94 |
d->proxy->setMathEnabled(d->exporter->supportsMath()); |
95 |
|
95 |
|
96 |
d->baseUrl = ""; |
96 |
d->baseUrl = ""; |
97 |
|
97 |
|
Lines 153-159
HtmlPreview::HtmlPreview
Link Here
|
153 |
this->setZoomFactor((horizontalDpi / 96.0)); |
153 |
this->setZoomFactor((horizontalDpi / 96.0)); |
154 |
|
154 |
|
155 |
QWebChannel *channel = new QWebChannel(this); |
155 |
QWebChannel *channel = new QWebChannel(this); |
156 |
channel->registerObject(QStringLiteral("previewProxy"), &d->proxy); |
156 |
channel->registerObject(QStringLiteral("previewProxy"), d->proxy); |
157 |
this->page()->setWebChannel(channel); |
157 |
this->page()->setWebChannel(channel); |
158 |
|
158 |
|
159 |
QFile wrapperHtmlFile(":/resources/preview.html"); |
159 |
QFile wrapperHtmlFile(":/resources/preview.html"); |
Lines 240-261
void HtmlPreview::setHtmlExporter(Exporter *exporter)
Link Here
|
240 |
|
240 |
|
241 |
d->exporter = exporter; |
241 |
d->exporter = exporter; |
242 |
d->setHtmlContent(""); |
242 |
d->setHtmlContent(""); |
243 |
d->proxy.setMathEnabled(d->exporter->supportsMath()); |
243 |
d->proxy->setMathEnabled(d->exporter->supportsMath()); |
244 |
updatePreview(); |
244 |
updatePreview(); |
245 |
} |
245 |
} |
246 |
|
246 |
|
247 |
void HtmlPreview::setStyleSheet(const QString &css) |
247 |
void HtmlPreview::setStyleSheet(const QString &css) |
248 |
{ |
248 |
{ |
249 |
Q_D(HtmlPreview); |
249 |
Q_D(HtmlPreview); |
250 |
|
250 |
|
251 |
d->proxy.setStyleSheet(css); |
251 |
d->proxy->setStyleSheet(css); |
252 |
} |
252 |
} |
253 |
|
253 |
|
254 |
void HtmlPreview::setMathEnabled(bool enabled) |
254 |
void HtmlPreview::setMathEnabled(bool enabled) |
255 |
{ |
255 |
{ |
256 |
Q_D(HtmlPreview); |
256 |
Q_D(HtmlPreview); |
257 |
|
257 |
|
258 |
d->proxy.setMathEnabled(enabled); |
258 |
d->proxy->setMathEnabled(enabled); |
259 |
} |
259 |
} |
260 |
|
260 |
|
261 |
void HtmlPreviewPrivate::onHtmlReady() |
261 |
void HtmlPreviewPrivate::onHtmlReady() |
Lines 312-318
void HtmlPreview::closeEvent(QCloseEvent *event)
Link Here
|
312 |
|
312 |
|
313 |
void HtmlPreviewPrivate::setHtmlContent(const QString &html) |
313 |
void HtmlPreviewPrivate::setHtmlContent(const QString &html) |
314 |
{ |
314 |
{ |
315 |
this->proxy.setHtmlContent(html); |
315 |
this->proxy->setHtmlContent(html); |
316 |
} |
316 |
} |
317 |
|
317 |
|
318 |
QString HtmlPreviewPrivate::exportToHtml |
318 |
QString HtmlPreviewPrivate::exportToHtml |