MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / setInstanceGroup

Method setInstanceGroup

launcher/InstanceList.cpp:242–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242void InstanceList::setInstanceGroup(const InstanceId& id, GroupId name)
243{
244 if (name.isEmpty() && !name.isNull())
245 name = QString();
246
247 auto inst = getInstanceById(id);
248 if (!inst) {
249 qDebug() << "Attempt to set a null instance's group";
250 return;
251 }
252
253 bool changed = false;
254 auto iter = m_instanceGroupIndex.find(inst->id());
255 if (iter != m_instanceGroupIndex.end()) {
256 if (*iter != name) {
257 decreaseGroupCount(*iter);
258 *iter = name;
259 changed = true;
260 }
261 } else {
262 changed = true;
263 m_instanceGroupIndex[id] = name;
264 }
265
266 if (changed) {
267 increaseGroupCount(name);
268 auto idx = getInstIndex(inst.get());
269 emit dataChanged(index(idx), index(idx), { GroupRole });
270 saveGroupList();
271 }
272}
273
274QStringList InstanceList::getGroups()
275{

Callers 2

dropEventMethod · 0.80

Calls 5

QStringClass · 0.85
isEmptyMethod · 0.45
findMethod · 0.45
idMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected