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

Method addInstance

launcher/ui/MainWindow.cpp:894–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892}
893
894void MainWindow::addInstance(const QString& url, const QMap<QString, QString>& extra_info)
895{
896 QString groupName;
897 do {
898 QObject* obj = sender();
899 if (!obj)
900 break;
901 QAction* action = qobject_cast<QAction*>(obj);
902 if (!action)
903 break;
904 auto map = action->data().toMap();
905 if (!map.contains("group"))
906 break;
907 groupName = map["group"].toString();
908 } while (0);
909
910 if (groupName.isEmpty()) {
911 groupName = APPLICATION->settings()->get("LastUsedGroupForNewInstance").toString();
912 }
913
914 NewInstanceDialog newInstDlg(groupName, url, extra_info, this);
915 if (!newInstDlg.exec())
916 return;
917
918 APPLICATION->settings()->set("LastUsedGroupForNewInstance", newInstDlg.instGroup());
919
920 InstanceTask* creationTask = newInstDlg.extractTask();
921 if (creationTask) {
922 instanceFromInstanceTask(creationTask);
923 }
924}
925
926void MainWindow::on_actionAddInstance_triggered()
927{

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected