MCPcopy Create free account
hub / github.com/ChiyukiGana/Quickinput / loadAll

Method loadAll

source/src/macro.cpp:234–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 macro.name = name;
233 macro.fromPack(pack);
234 return true;
235}
236#endif
237
238void Macro::loadAll()
239{
240 Qi::macroGroups.clear();
241 Qi::macroGroups.append(MacroGroup(true, "默认分组"));
242
243 QList<QString> dirs;
244 {
245 QDir dir(Qi::macroDir);
246 dir.setFilter(QDir::Filter::Dirs);
247 QFileInfoList dirInfos = dir.entryInfoList();
248 if (dirInfos.isEmpty()) return;
249
250 dirs.append(Qi::macroDir);
251 for (auto& i : dirInfos) if (i.fileName() != "." && i.fileName() != "..") dirs.append(i.fileName());
252 }
253
254 bool base = true;
255 for (auto& dir : dirs)
256 {
257 QString path = Qi::macroDir;
258 MacroGroup* group;
259 if (base)
260 {
261 group = &Qi::macroGroups.front();
262 base = false;
263 }
264 else
265 {
266 group = &Qi::macroGroups.append(MacroGroup(false, dir));
267 group->name = dir;
268 path += dir + "/";
269 }
270
271#ifdef Q_ENCRYPT
272 for (const QFileInfo& file : File::Find(path, QString("*") + Qi::emacroType))
273 {
274 if (file.fileName().compare(Qi::configFile, Qt::CaseInsensitive) == 0) continue;
275 Macro macro;
276 macro.groupName = group->name;
277 macro.groupBase = group->base;
278 if (LoadEMacro(macro, file.filePath(), file.baseName())) group->macros.append(std::move(macro));
279 }
280#endif
281#if !defined(Q_ENCRYPT) || defined(Q_ENCRYPT_CVT)
282 for (size_t i = 0; i < Macro::StorageType::QIM + 1; i++)
283 {
284 const QString type = i == Macro::StorageType::QIM ? Qi::macroQimType : Qi::macroType;
285 const QString filter = QString("*") + type;
286 for (const QFileInfo& file : File::Find(path, filter))
287 {
288 if (file.fileName().compare(Qi::configFile, Qt::CaseInsensitive) == 0) continue;
289
290 Macro macro;
291 macro.groupName = group->name;

Callers

nothing calls this directly

Calls 13

MacroGroupClass · 0.85
LoadQimMacroFunction · 0.85
LoadJsonMacroFunction · 0.85
ErrorEnum · 0.85
compareMethod · 0.80
saveMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
clearMethod · 0.45
appendMethod · 0.45
makePathMethod · 0.45
makeNameMethod · 0.45

Tested by

no test coverage detected