mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-25 19:32:54 +00:00

there aren't many markdown document viewers, are there? well, this one does remote images too: https://ibb.co/T1GVZt9 Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
/***************************************************************************
|
|
* Copyright (C) 2022 by Ivailo Monev <xakepa10@gmail.com> *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
***************************************************************************/
|
|
|
|
#ifndef MD_DOCUMENT_H
|
|
#define MD_DOCUMENT_H
|
|
|
|
#include <QtGui/QTextDocument>
|
|
#include <kio/job.h>
|
|
|
|
struct MDResourceData
|
|
{
|
|
int type;
|
|
QUrl url;
|
|
QByteArray kiodata;
|
|
};
|
|
|
|
class MDDocument : public QTextDocument
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
MDDocument(const QString &fileName);
|
|
|
|
void slotMdCallback(const char* data, qlonglong datasize);
|
|
|
|
protected:
|
|
QVariant loadResource(int type, const QUrl &url) final;
|
|
|
|
private Q_SLOTS:
|
|
void slotKIOData(KIO::Job *kiojob, const QByteArray &data);
|
|
void slotKIOResult(KJob *kiojob);
|
|
|
|
private:
|
|
QByteArray m_mddata;
|
|
QMap<KIO::TransferJob*, MDResourceData> m_kiojobs;
|
|
};
|
|
|
|
#endif // MD_DOCUMENT_H
|