MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / fromJson

Method fromJson

src/common/settings/settings.cpp:61–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void SettingsPrivate::fromJson(const QByteArray &json, SettingData *data)
62{
63 QJsonParseError error;
64 const QJsonDocument &doc = QJsonDocument::fromJson(json, &error);
65 if (error.error != QJsonParseError::NoError) {
66 qWarning() << "Failed to parse the setting file: " << error.errorString();
67 return;
68 }
69
70 const QJsonObject &groupList = doc.object();
71 for (auto grpIter = groupList.constBegin(); grpIter != groupList.constEnd(); ++grpIter) {
72 const QJsonValue &value = grpIter.value();
73 if (!value.isObject())
74 continue;
75
76 const QJsonObject &groupObj = value.toObject();
77 QVariantHash hash = groupObj.toVariantHash();
78 data->values[grpIter.key()] = hash;
79 }
80}
81
82QByteArray SettingsPrivate::toJson(const SettingData &data)
83{

Callers 1

importConfigMethod · 0.45

Calls 4

errorStringMethod · 0.45
objectMethod · 0.45
valueMethod · 0.45
keyMethod · 0.45

Tested by

no test coverage detected