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

Method save

src/plugins/binarytools/configure/binarytoolsmanager.cpp:271–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271void BinaryToolsManager::save()
272{
273 QJsonArray groupsArray;
274
275 auto iter = allTools.begin();
276 for (; iter != allTools.end(); ++iter) {
277 QJsonObject groupObject;
278 groupObject[NameKey] = iter.key();
279
280 QJsonArray itemsArray;
281 for (const auto &item : iter.value()) {
282 QJsonObject itemObject;
283 itemObject[IdKey] = item.id;
284 itemObject[NameKey] = item.name;
285 itemObject[DescriptionKey] = item.description;
286 itemObject[TypeKey] = item.type;
287 itemObject[CommandKey] = item.command;
288 itemObject[ArgumentsKey] = item.arguments;
289 itemObject[WorkingDirectoryKey] = item.workingDirectory;
290 itemObject[OutputOptionKey] = item.outputOption;
291 itemObject[ErrorOutputOptionKey] = item.errorOutputOption;
292 itemObject[AddToToolbarKey] = item.addToToolbar;
293 itemObject[IconKey] = item.icon;
294 itemObject[EnvironmentKey] = QJsonDocument::fromVariant(item.environment).object();
295
296 QJsonObject advObject;
297 advObject[MissingHintKey] = item.advSettings.missingHint;
298 advObject[InstallCommandKey] = item.advSettings.installCommand;
299 advObject[ChannelDataKey] = item.advSettings.channelData;
300 advObject[TriggerEventKey] = item.advSettings.triggerEvent;
301 itemObject[AdvanceObject] = advObject;
302
303 itemsArray.append(itemObject);
304 }
305
306 groupObject[ToolObject] = itemsArray;
307 groupsArray.append(groupObject);
308 }
309
310 QJsonObject obj;
311 obj[GroupObject] = groupsArray;
312 obj[VersionKey] = cfgVersion;
313
314 QJsonDocument doc(obj);
315 QString confPath = CustomPaths::user(CustomPaths::Flags::Configures) + QDir::separator() + QString("binarytools.json");
316 QFile file(confPath);
317 if (file.open(QIODevice::WriteOnly)) {
318 file.write(doc.toJson());
319 file.close();
320 }
321}
322
323void BinaryToolsManager::setTools(const BinaryTools &dataMap)
324{

Callers 7

saveConfigMethod · 0.45
drawBackgroundMethod · 0.45
drawExpandArrowMethod · 0.45
paintItemBackgroundMethod · 0.45
paintItemColumnMethod · 0.45
paintFixButtonMethod · 0.45

Calls 11

QStringClass · 0.50
beginMethod · 0.45
endMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45
objectMethod · 0.45
appendMethod · 0.45
openMethod · 0.45
writeMethod · 0.45
toJsonMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected