Plugin metasystem

This commit is contained in:
Jakub Melka
2020-11-17 18:28:34 +01:00
parent 1189d864f6
commit 4c410374db
17 changed files with 529 additions and 8 deletions

View File

@@ -69,6 +69,7 @@ SOURCES += \
sources/pdfdocument.cpp \
sources/pdfdocumentreader.cpp \
sources/pdfpattern.cpp \
sources/pdfplugin.cpp \
sources/pdfprogress.cpp \
sources/pdfsecurityhandler.cpp \
sources/pdfsignaturehandler.cpp \
@@ -130,6 +131,7 @@ HEADERS += \
sources/pdfdocument.h \
sources/pdfdocumentreader.h \
sources/pdfpattern.h \
sources/pdfplugin.h \
sources/pdfprogress.h \
sources/pdfsecurityhandler.h \
sources/pdfsignaturehandler.h \

View File

@@ -0,0 +1,54 @@
// Copyright (C) 2020 Jakub Melka
//
// This file is part of PdfForQt.
//
// PdfForQt is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PdfForQt is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDFForQt. If not, see <https://www.gnu.org/licenses/>.
#include "pdfplugin.h"
namespace pdf
{
PDFPlugin::PDFPlugin(QObject* parent) :
QObject(parent)
{
}
void PDFPlugin::setWidget(PDFWidget* widget)
{
Q_UNUSED(widget)
}
void PDFPlugin::setDocument(const PDFModifiedDocument& document)
{
Q_UNUSED(document)
}
PDFPluginInfo PDFPluginInfo::loadFromJson(const QJsonObject* json)
{
PDFPluginInfo result;
QJsonObject metadata = json->value("MetaData").toObject();
result.name = metadata.value(QLatin1String("Name")).toString();
result.author = metadata.value(QLatin1String("Author")).toString();
result.version = metadata.value(QLatin1String("Version")).toString();
result.license = metadata.value(QLatin1String("License")).toString();
result.description = metadata.value(QLatin1String("Description")).toString();
return result;
}
} // namespace pdf

View File

@@ -0,0 +1,55 @@
// Copyright (C) 2020 Jakub Melka
//
// This file is part of PdfForQt.
//
// PdfForQt is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PdfForQt is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDFForQt. If not, see <https://www.gnu.org/licenses/>.
#ifndef PDFPLUGIN_H
#define PDFPLUGIN_H
#include "pdfdocument.h"
#include <QObject>
#include <QJsonObject>
namespace pdf
{
class PDFWidget;
struct PDFFORQTLIBSHARED_EXPORT PDFPluginInfo
{
QString name;
QString author;
QString version;
QString license;
QString description;
static PDFPluginInfo loadFromJson(const QJsonObject* json);
};
using PDFPluginInfos = std::vector<PDFPluginInfo>;
class PDFFORQTLIBSHARED_EXPORT PDFPlugin : public QObject
{
Q_OBJECT
public:
explicit PDFPlugin(QObject* parent);
virtual void setWidget(PDFWidget* widget);
virtual void setDocument(const PDFModifiedDocument& document);
};
} // namespace pdf
#endif // PDFPLUGIN_H