MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / load

Method load

core/src/emuutils.cpp:62–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62QJsonArray EmuUtils::load()
63{
64 QJsonArray emuOptions;
65 QFileInfoList fileList = PkgManager::listFilesInfo(QStringList() << scopy::config::pkgEmuDir(),
66 QStringList() << scopy::config::emuSetupFile());
67 for(QFileInfo &f : fileList) {
68 QFile configFile(f.filePath());
69 if(!configFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
70 qWarning() << "Failed to open file:" << f.filePath();
71 continue;
72 }
73 QJsonDocument d = QJsonDocument::fromJson(configFile.readAll());
74 if(!d.isArray()) {
75 qWarning() << "Invalid JSON format in file:" << f.filePath();
76 continue;
77 }
78 QJsonArray entries = d.array();
79 for(auto optConfig : entries) {
80 QJsonObject jsonObj = optConfig.toObject();
81 if(jsonObj.isEmpty()) {
82 continue;
83 }
84 jsonObj.insert("path", f.absolutePath());
85 emuOptions.append(jsonObj);
86 }
87 }
88 return emuOptions;
89}

Callers 6

load_configFunction · 0.45
maybe_clear_plugin_dirFunction · 0.45
loadTranslationsMethod · 0.45
loadSetupMethod · 0.45
loadPluginMethod · 0.45
SpinBoxAMethod · 0.45

Calls 4

filePathMethod · 0.80
appendMethod · 0.80
openMethod · 0.45
readAllMethod · 0.45

Tested by

no test coverage detected