File: domdistiller.cpp

package info (click to toggle)
angelfish 25.08.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,720 kB
  • sloc: cpp: 2,751; xml: 607; javascript: 273; makefile: 16; sh: 11; sql: 7
file content (34 lines) | stat: -rw-r--r-- 868 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-FileCopyrightText: 2022 Alexey Andreyev <aa13q@ya.ru>
//
// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL

#include "domdistiller.h"

#include <QFile>
#include <QTextStream>
#include <QDebug>

DomDistiller::DomDistiller(QObject *parent)
    : QObject{parent}
    , m_applyScript(QStringLiteral("org.chromium.distiller.DomDistiller.apply()"))
{
    QFile domDistillerFile(QStringLiteral(":/dom-distiller-dist/domdistiller.js"));

    if (domDistillerFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream textStream(&domDistillerFile);
        m_script = textStream.readAll();
        domDistillerFile.close();
    }
}

const QString &DomDistiller::script() const
{
    return m_script;
}

const QString &DomDistiller::applyScript() const
{
    return m_applyScript;
}

#include "moc_domdistiller.cpp"