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

Method addInstance

launcher/ui/MainWindow.cpp:1445–1478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1443}
1444
1445void MainWindow::addInstance(QString url)
1446{
1447 QString groupName;
1448 do
1449 {
1450 QObject* obj = sender();
1451 if(!obj)
1452 break;
1453 QAction *action = qobject_cast<QAction *>(obj);
1454 if(!action)
1455 break;
1456 auto map = action->data().toMap();
1457 if(!map.contains("group"))
1458 break;
1459 groupName = map["group"].toString();
1460 } while(0);
1461
1462 if(groupName.isEmpty())
1463 {
1464 groupName = APPLICATION->settings()->get("LastUsedGroupForNewInstance").toString();
1465 }
1466
1467 NewInstanceDialog newInstDlg(groupName, url, this);
1468 if (!newInstDlg.exec())
1469 return;
1470
1471 APPLICATION->settings()->set("LastUsedGroupForNewInstance", newInstDlg.instGroup());
1472
1473 InstanceTask * creationTask = newInstDlg.extractTask();
1474 if(creationTask)
1475 {
1476 instanceFromInstanceTask(creationTask);
1477 }
1478}
1479
1480void MainWindow::on_actionAddInstance_triggered()
1481{

Callers

nothing calls this directly

Calls 10

isEmptyMethod · 0.80
extractTaskMethod · 0.80
dataMethod · 0.45
containsMethod · 0.45
toStringMethod · 0.45
getMethod · 0.45
settingsMethod · 0.45
execMethod · 0.45
setMethod · 0.45
instGroupMethod · 0.45

Tested by

no test coverage detected