MCPcopy Create free account
hub / github.com/PrismLauncher/PrismLauncher / loadComponents

Method loadComponents

launcher/minecraft/ComponentUpdateTask.cpp:176–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174} // namespace
175
176void ComponentUpdateTask::loadComponents()
177{
178 LoadResult result = LoadResult::LoadedLocal;
179 size_t taskIndex = 0;
180 size_t componentIndex = 0;
181 d->remoteLoadSuccessful = true;
182
183 // load all the components OR their lists...
184 for (auto component : d->m_profile->d->components) {
185 Task::Ptr loadTask;
186 LoadResult singleResult;
187 RemoteLoadStatus::Type loadType;
188 component->resetComponentProblems();
189 // FIXME: to do this right, we need to load the lists and decide on which versions to use during dependency resolution. For now,
190 // ignore all that...
191#if 0
192 switch(d->mode)
193 {
194 case Mode::Launch:
195 {
196 singleResult = loadComponent(component, loadTask, d->netmode);
197 loadType = RemoteLoadStatus::Type::Version;
198 break;
199 }
200 case Mode::Resolution:
201 {
202 singleResult = loadPackProfile(component, loadTask, d->netmode);
203 loadType = RemoteLoadStatus::Type::List;
204 break;
205 }
206 }
207#else
208 singleResult = loadComponent(component, loadTask, d->netmode);
209 loadType = RemoteLoadStatus::Type::Version;
210#endif
211 if (singleResult == LoadResult::LoadedLocal) {
212 component->updateCachedData();
213 }
214 result = composeLoadResult(result, singleResult);
215 if (loadTask) {
216 qCDebug(instanceProfileResolveC) << d->m_profile->d->m_instance->name() << "|"
217 << "Remote loading is being run for" << component->getName();
218 connect(loadTask.get(), &Task::succeeded, this, [this, taskIndex]() { remoteLoadSucceeded(taskIndex); });
219 connect(loadTask.get(), &Task::failed, this, [this, taskIndex](const QString& error) { remoteLoadFailed(taskIndex, error); });
220 connect(loadTask.get(), &Task::aborted, this, [this, taskIndex]() { remoteLoadFailed(taskIndex, tr("Aborted")); });
221 RemoteLoadStatus status;
222 status.type = loadType;
223 status.PackProfileIndex = componentIndex;
224 status.task = loadTask;
225 d->remoteLoadStatusList.append(status);
226 taskIndex++;
227 }
228 componentIndex++;
229 }
230 d->remoteTasksInProgress = taskIndex;
231 m_progressTotal = static_cast<int>(taskIndex);
232 switch (result) {
233 case LoadResult::LoadedLocal: {

Callers

nothing calls this directly

Calls 9

loadComponentFunction · 0.85
loadPackProfileFunction · 0.85
composeLoadResultFunction · 0.85
updateCachedDataMethod · 0.80
getNameMethod · 0.80
appendMethod · 0.80
nameMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected