File indexing completed on 2024-05-12 16:23:45

0001 // SPDX-FileCopyrightText: 2022 Alexey Andreyev <aa13q@ya.ru>
0002 //
0003 // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0004 
0005 #include "domdistiller.h"
0006 
0007 #include <QFile>
0008 #include <QTextStream>
0009 
0010 DomDistiller::DomDistiller(QObject *parent)
0011     : QObject{parent}
0012     , m_applyScript(QStringLiteral("org.chromium.distiller.DomDistiller.apply()"))
0013 {
0014     QFile domDistillerFile(QStringLiteral(":/domdistiller.js"));
0015 
0016     if (domDistillerFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
0017         QTextStream textStream(&domDistillerFile);
0018         m_script = textStream.readAll();
0019         domDistillerFile.close();
0020     }
0021 }
0022 
0023 const QString &DomDistiller::script() const
0024 {
0025     return m_script;
0026 }
0027 
0028 const QString &DomDistiller::applyScript() const
0029 {
0030     return m_applyScript;
0031 }
0032 
0033 #include "moc_domdistiller.cpp"