MCPcopy Create free account
hub / github.com/YACReader/yacreader / load

Method load

YACReaderLibrary/yacreader_libraries.cpp:166–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void YACReaderLibraries::load()
167{
168 QSettings settings(YACReader::getSettingsPath() + "/" + QCoreApplication::applicationName() + ".ini", QSettings::IniFormat);
169
170 if (settings.value(LIBRARIES).isValid()) {
171 QByteArray data = settings.value(LIBRARIES).toByteArray();
172
173 // in 9.14 the format of libraries has changed, so we need to check if we can do a migration
174 QDataStream legacyIn(&data, QIODevice::ReadOnly);
175 QMap<QString, QPair<int, QString>> legacyLibraries;
176 legacyIn >> legacyLibraries;
177
178 auto needsMigration = !legacyLibraries.isEmpty();
179 if (needsMigration) {
180 QList<YACReaderLibrary> migratedLibraries;
181
182 for (auto i = legacyLibraries.cbegin(), end = legacyLibraries.cend(); i != end; ++i) {
183 auto name = i.key();
184 auto value = i.value();
185 auto newId = QUuid::createUuid();
186
187 writeIdToLibraryFolder(value.second, newId);
188
189 auto library = YACReaderLibrary(name, value.second, value.first, newId);
190 migratedLibraries.append(library);
191 }
192
193 libraries = migratedLibraries;
194 save();
195 } else {
196 QDataStream in(&data, QIODevice::ReadOnly);
197 in >> libraries;
198 }
199 }
200}
201
202bool YACReaderLibraries::save()
203{

Callers 12

updateIfNeededMethod · 0.45
createLibraryMethod · 0.45
addExistingLibraryMethod · 0.45
removeLibraryMethod · 0.45
mainFunction · 0.45
startFunction · 0.45
extractMethod · 0.45
runMethod · 0.45
getLibrariesMethod · 0.45
runMethod · 0.45
loadLibrariesMethod · 0.45

Calls 4

writeIdToLibraryFolderFunction · 0.85
YACReaderLibraryClass · 0.85
isEmptyMethod · 0.80
isValidMethod · 0.45

Tested by

no test coverage detected