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

Method addInstance

launcher/ui/MainWindow.cpp:1757–1790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1755}
1756
1757void MainWindow::addInstance(QString url)
1758{
1759 QString groupName;
1760 do
1761 {
1762 QObject* obj = sender();
1763 if(!obj)
1764 break;
1765 QAction *action = qobject_cast<QAction *>(obj);
1766 if(!action)
1767 break;
1768 auto map = action->data().toMap();
1769 if(!map.contains("group"))
1770 break;
1771 groupName = map["group"].toString();
1772 } while(0);
1773
1774 if(groupName.isEmpty())
1775 {
1776 groupName = APPLICATION->settings()->get("LastUsedGroupForNewInstance").toString();
1777 }
1778
1779 NewInstanceDialog newInstDlg(groupName, url, this);
1780 if (!newInstDlg.exec())
1781 return;
1782
1783 APPLICATION->settings()->set("LastUsedGroupForNewInstance", newInstDlg.instGroup());
1784
1785 InstanceTask * creationTask = newInstDlg.extractTask();
1786 if(creationTask)
1787 {
1788 instanceFromInstanceTask(creationTask);
1789 }
1790}
1791
1792void MainWindow::on_actionAddInstance_triggered()
1793{

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