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

Method merge

launcher/meta/VersionList.cpp:205–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void VersionList::merge(const VersionListPtr &other)
206{
207 if (m_name != other->m_name)
208 {
209 setName(other->m_name);
210 }
211
212 // TODO: do not reset the whole model. maybe?
213 beginResetModel();
214 m_versions.clear();
215 if(other->m_versions.isEmpty())
216 {
217 qWarning() << "Empty list loaded ...";
218 }
219 for (const VersionPtr &version : other->m_versions)
220 {
221 // we already have the version. merge the contents
222 if (m_lookup.contains(version->version()))
223 {
224 m_lookup.value(version->version())->mergeFromList(version);
225 }
226 else
227 {
228 m_lookup.insert(version->uid(), version);
229 }
230 // connect it.
231 setupAddedVersion(m_versions.size(), version);
232 m_versions.append(version);
233 m_recommended = getBetterVersion(m_recommended, version);
234 }
235 endResetModel();
236}
237
238void VersionList::setupAddedVersion(const int row, const VersionPtr &version)
239{

Callers

nothing calls this directly

Calls 9

isEmptyMethod · 0.80
mergeFromListMethod · 0.80
insertMethod · 0.80
appendMethod · 0.80
clearMethod · 0.45
containsMethod · 0.45
versionMethod · 0.45
uidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected