MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / buildLoadConfig

Function buildLoadConfig

pj_app/src/FileLoader.cpp:66–78  ·  view source on GitHub ↗

Merge the file path into the (possibly empty) saved JSON config. Saved config carries the dialog state from the previous load (delimiter, time column, etc.) so the dialog opens pre-populated. If saved_config doesn't parse, treat it as empty rather than failing the import.

Source from the content-addressed store, hash-verified

64// column, etc.) so the dialog opens pre-populated. If saved_config doesn't
65// parse, treat it as empty rather than failing the import.
66std::string buildLoadConfig(std::string_view saved_config, const QString& path) {
67 QJsonObject obj;
68 if (!saved_config.empty()) {
69 const QByteArray bytes(saved_config.data(), static_cast<qsizetype>(saved_config.size()));
70 const QJsonDocument doc = QJsonDocument::fromJson(bytes);
71 if (doc.isObject()) {
72 obj = doc.object();
73 }
74 }
75 obj.insert(QStringLiteral("filepath"), path);
76 const QByteArray out = QJsonDocument(obj).toJson(QJsonDocument::Compact);
77 return std::string(out.constData(), static_cast<std::size_t>(out.size()));
78}
79
80QString pluginConfigKey(const std::string& plugin_id) {
81 return QString::fromLatin1(kPluginConfigKeyPrefix) + QString::fromStdString(plugin_id);

Callers 1

beginLoadMethod · 0.85

Calls 4

emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected