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

Method setInstanceGroup

launcher/InstanceList.cpp:238–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

MainWindowMethod · 0.80
dropEventMethod · 0.80

Calls 4

QStringClass · 0.70
isEmptyMethod · 0.45
findMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected