MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / startNext

Method startNext

launcher/tasks/ConcurrentTask.cpp:76–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void ConcurrentTask::startNext()
77{
78 if (m_aborted || m_doing.count() > m_total_max_size)
79 return;
80
81 if (m_queue.isEmpty() && m_doing.isEmpty() && !wasSuccessful()) {
82 emitSucceeded();
83 return;
84 }
85
86 if (m_queue.isEmpty())
87 return;
88
89 Task::Ptr next = m_queue.dequeue();
90
91 connect(next.get(), &Task::succeeded, this, [this, next] { subTaskSucceeded(next); });
92 connect(next.get(), &Task::failed, this, [this, next](QString msg) { subTaskFailed(next, msg); });
93
94 connect(next.get(), &Task::status, this, &ConcurrentTask::subTaskStatus);
95 connect(next.get(), &Task::stepStatus, this, &ConcurrentTask::subTaskStatus);
96
97 connect(next.get(), &Task::progress, this, &ConcurrentTask::subTaskProgress);
98
99 m_doing.insert(next.get(), next);
100
101 setStepStatus(next->isMultiStep() ? next->getStepStatus() : next->getStatus());
102 updateState();
103
104 QMetaObject::invokeMethod(
105 this, [=] { next->start(); }, Qt::QueuedConnection);
106}
107
108void ConcurrentTask::subTaskSucceeded(Task::Ptr task)
109{

Callers

nothing calls this directly

Calls 8

isEmptyMethod · 0.80
insertMethod · 0.80
getStatusMethod · 0.80
countMethod · 0.45
getMethod · 0.45
isMultiStepMethod · 0.45
getStepStatusMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected