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

Method startUpdate

YACReaderLibrary/libraries_update_coordinator.cpp:128–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128LibrariesUpdateCoordinator::UpdateRequestResult LibrariesUpdateCoordinator::startUpdate(const QStringList &paths)
129{
130 QMutexLocker locker(&futureMutex);
131
132 if (updateFuture.valid() && updateFuture.wait_for(std::chrono::seconds(0)) != std::future_status::ready) {
133 return UpdateRequestResult::AlreadyRunning;
134 }
135
136 canceled = false;
137
138 QStringList targets = paths;
139 if (targets.isEmpty()) {
140 for (const auto &library : libraries.getLibraries()) {
141 targets.append(library.getPath());
142 }
143 }
144
145 updateFuture = std::async(std::launch::async, [this, targets] {
146 emit updateStarted();
147 for (const auto &path : targets) {
148 if (!canceled) {
149 updateLibrary(path);
150 }
151 }
152 emit updateEnded();
153 });
154
155 return UpdateRequestResult::Started;
156}
157
158void LibrariesUpdateCoordinator::updateLibrary(const QString &path)
159{

Callers

nothing calls this directly

Calls 4

updateLibraryFunction · 0.85
isEmptyMethod · 0.80
getPathMethod · 0.80
getLibrariesMethod · 0.45

Tested by

no test coverage detected