MCPcopy Create free account
hub / github.com/MultiMC/Launcher / setInstanceGroup

Method setInstanceGroup

launcher/InstanceList.cpp:216–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216void InstanceList::setInstanceGroup(const InstanceId& id, const GroupId& name)
217{
218 auto inst = getInstanceById(id);
219 if(!inst)
220 {
221 qDebug() << "Attempt to set a null instance's group";
222 return;
223 }
224
225 bool changed = false;
226 auto iter = m_instanceGroupIndex.find(inst->id());
227 if(iter != m_instanceGroupIndex.end())
228 {
229 if(*iter != name)
230 {
231 *iter = name;
232 changed = true;
233 }
234 }
235 else
236 {
237 changed = true;
238 m_instanceGroupIndex[id] = name;
239 }
240
241 if(changed)
242 {
243 m_groupNameCache.insert(name);
244 auto idx = getInstIndex(inst.get());
245 emit dataChanged(index(idx), index(idx), {GroupRole});
246 saveGroupList();
247 }
248}
249
250QStringList InstanceList::getGroups()
251{

Callers 2

dropEventMethod · 0.80

Calls 5

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

Tested by

no test coverage detected