File indexing completed on 2024-05-12 16:06:49

0001 /*
0002     SPDX-FileCopyrightText: 2013 Azat Khuzhin <a3at.mail@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "converter.h"
0008 
0009 #include <QTextFrame>
0010 
0011 #include "document.h"
0012 
0013 using namespace Txt;
0014 
0015 Converter::Converter()
0016 {
0017 }
0018 
0019 Converter::~Converter()
0020 {
0021 }
0022 
0023 QTextDocument *Converter::convert(const QString &fileName)
0024 {
0025     Document *textDocument = new Document(fileName);
0026 
0027     textDocument->setPageSize(QSizeF(600, 800));
0028 
0029     QTextFrameFormat frameFormat;
0030     frameFormat.setMargin(20);
0031 
0032     QTextFrame *rootFrame = textDocument->rootFrame();
0033     rootFrame->setFrameFormat(frameFormat);
0034 
0035     Q_EMIT addMetaData(Okular::DocumentInfo::MimeType, QStringLiteral("text/plain"));
0036 
0037     return textDocument;
0038 }