##// END OF EJS Templates
Fixes refresh problem in Variable widget
Fixes refresh problem in Variable widget

File last commit:

r327:b3b541ccaa5a
r340:fc12ad933c3b
Show More
AmdaPlugin.cpp
39 lines | 1.1 KiB | text/x-c | CppLexer
#include "AmdaPlugin.h"
#include "AmdaParser.h"
#include <DataSource/DataSourceController.h>
#include <DataSource/DataSourceItem.h>
#include <SqpApplication.h>
Q_LOGGING_CATEGORY(LOG_AmdaPlugin, "AmdaPlugin")
namespace {
/// Name of the data source
const auto DATA_SOURCE_NAME = QStringLiteral("AMDA");
/// Path of the file used to generate the data source item for AMDA
const auto JSON_FILE_PATH = QStringLiteral(":/samples/AmdaSample.json");
} // 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
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");
}
}
else {
qCWarning(LOG_AmdaPlugin()) << tr("Can't access to SciQlop application");
}
}