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

Method setInstanceGroup

launcher/InstanceList.cpp:230–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void InstanceList::setInstanceGroup(const InstanceId& id, const GroupId& name)
231{
232 auto inst = getInstanceById(id);
233 if (!inst) {
234 qDebug() << "Attempt to set a null instance's group";
235 return;
236 }
237
238 bool changed = false;
239 auto iter = m_instanceGroupIndex.find(inst->id());
240 if (iter != m_instanceGroupIndex.end()) {
241 if (*iter != name) {
242 *iter = name;
243 changed = true;
244 }
245 } else {
246 changed = true;
247 m_instanceGroupIndex[id] = name;
248 }
249
250 if (changed) {
251 m_groupNameCache.insert(name);
252 auto idx = getInstIndex(inst.get());
253 emit dataChanged(index(idx), index(idx), { GroupRole });
254 saveGroupList();
255 }
256}
257
258QStringList InstanceList::getGroups()
259{

Callers 2

dropEventMethod · 0.80

Calls 5

endMethod · 0.80
insertMethod · 0.80
findMethod · 0.45
idMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected