##// END OF EJS Templates
Merge branch 'feature/AmdaParser' into develop
Merge branch 'feature/AmdaParser' into develop

File last commit:

r354:b3b541ccaa5a
r366:d29614e18380 merge
Show More
AmdaPlugin.cpp
39 lines | 1.1 KiB | text/x-c | CppLexer
Alexandre Leroux
Initializes plugin
r352 #include "AmdaPlugin.h"
Alexandre Leroux
Creates JSON parser
r354 #include "AmdaParser.h"
Alexandre Leroux
Initializes plugin
r352
#include <DataSource/DataSourceController.h>
Alexandre Leroux
Creates JSON parser
r354 #include <DataSource/DataSourceItem.h>
Alexandre Leroux
Initializes plugin
r352
#include <SqpApplication.h>
Q_LOGGING_CATEGORY(LOG_AmdaPlugin, "AmdaPlugin")
namespace {
/// Name of the data source
const auto DATA_SOURCE_NAME = QStringLiteral("AMDA");
Alexandre Leroux
Adds a sample JSON file as a resource in AMDA plugin...
r353 /// Path of the file used to generate the data source item for AMDA
const auto JSON_FILE_PATH = QStringLiteral(":/samples/AmdaSample.json");
Alexandre Leroux
Initializes plugin
r352 } // namespace
void AmdaPlugin::initialize()
{
if (auto app = sqpApp) {
// Registers to the data source controller
auto &dataSourceController = app->dataSourceController();
auto dataSourceUid = dataSourceController.registerDataSource(DATA_SOURCE_NAME);
// Sets data source tree
Alexandre Leroux
Creates JSON parser
r354 if (auto dataSourceItem = AmdaParser::readJson(JSON_FILE_PATH)) {
dataSourceController.setDataSourceItem(dataSourceUid, std::move(dataSourceItem));
}
else {
qCCritical(LOG_AmdaPlugin()) << tr("No data source item could be generated for AMDA");
}
Alexandre Leroux
Initializes plugin
r352 }
else {
qCWarning(LOG_AmdaPlugin()) << tr("Can't access to SciQlop application");
}
}