|
|
|
@ -2,9 +2,11 @@
|
|
|
|
|
|
|
|
|
|
#include <QJsonValue>
|
|
|
|
|
#include <QJsonArray>
|
|
|
|
|
#include <QJsonDocument>
|
|
|
|
|
#include <QLocale>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
#include <QFile>
|
|
|
|
|
|
|
|
|
|
#include "igridform.h"
|
|
|
|
|
|
|
|
|
@ -112,17 +114,8 @@ void IMetaDataPlugin::parseMetaData(const QJsonObject &metaData)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QJsonValue repArray = data.toObject()["reports"];
|
|
|
|
|
foreach (QJsonValue repVal, repArray.toArray()) {
|
|
|
|
|
QJsonObject repObj = repVal.toObject();
|
|
|
|
|
|
|
|
|
|
ReportPtr report = ReportPtr(new Report());
|
|
|
|
|
report->setName(repObj["name"].toString());
|
|
|
|
|
report->setDescription(repObj["description"].toString());
|
|
|
|
|
report->setListReport(repObj["listReport"].toBool());
|
|
|
|
|
report->setFile(repObj["file"].toString());
|
|
|
|
|
|
|
|
|
|
m_reports.append(report);
|
|
|
|
|
}
|
|
|
|
|
addReportsFromJson(repArray);
|
|
|
|
|
addCustomReports();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString IMetaDataPlugin::parseLocaleText(const QJsonObject &object)
|
|
|
|
@ -144,3 +137,31 @@ QString IMetaDataPlugin::parseLocaleText(const QJsonObject &object)
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IMetaDataPlugin::addCustomReports()
|
|
|
|
|
{
|
|
|
|
|
QString jsonPath = qApp->applicationDirPath() + REPORT_ROOT + "/" + pluginId().toLower() + ".json";
|
|
|
|
|
|
|
|
|
|
QFile f (jsonPath);
|
|
|
|
|
if (f.open(QIODevice::ReadOnly | QIODevice::Text))
|
|
|
|
|
{
|
|
|
|
|
QJsonDocument d = QJsonDocument::fromJson(f.readAll());
|
|
|
|
|
QJsonObject obj = d.object();
|
|
|
|
|
addReportsFromJson(obj.value("reports"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IMetaDataPlugin::addReportsFromJson(const QJsonValue &repArray)
|
|
|
|
|
{
|
|
|
|
|
foreach (QJsonValue repVal, repArray.toArray()) {
|
|
|
|
|
QJsonObject repObj = repVal.toObject();
|
|
|
|
|
|
|
|
|
|
ReportPtr report = ReportPtr(new Report());
|
|
|
|
|
report->setName(repObj["name"].toString());
|
|
|
|
|
report->setDescription(repObj["description"].toString());
|
|
|
|
|
report->setListReport(repObj["listReport"].toBool());
|
|
|
|
|
report->setFile(repObj["file"].toString());
|
|
|
|
|
|
|
|
|
|
m_reports.append(report);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|