| 1063 | } |
| 1064 | |
| 1065 | void Application::performMainStartupAction() |
| 1066 | { |
| 1067 | m_status = Application::Initialized; |
| 1068 | if(!m_instanceIdToLaunch.isEmpty()) |
| 1069 | { |
| 1070 | auto inst = instances()->getInstanceById(m_instanceIdToLaunch); |
| 1071 | if(inst) |
| 1072 | { |
| 1073 | MinecraftServerTargetPtr serverToJoin = nullptr; |
| 1074 | MinecraftAccountPtr accountToUse = nullptr; |
| 1075 | bool offline = m_offline; |
| 1076 | |
| 1077 | qDebug() << "<> Instance" << m_instanceIdToLaunch << "launching"; |
| 1078 | if(!m_serverToJoin.isEmpty()) |
| 1079 | { |
| 1080 | // FIXME: validate the server string |
| 1081 | serverToJoin.reset(new MinecraftServerTarget(MinecraftServerTarget::parse(m_serverToJoin))); |
| 1082 | qDebug() << " Launching with server" << m_serverToJoin; |
| 1083 | } |
| 1084 | |
| 1085 | if(!m_profileToUse.isEmpty()) |
| 1086 | { |
| 1087 | accountToUse = accounts()->getAccountByProfileName(m_profileToUse); |
| 1088 | if(!accountToUse) { |
| 1089 | return; |
| 1090 | } |
| 1091 | qDebug() << " Launching with account" << m_profileToUse; |
| 1092 | } |
| 1093 | |
| 1094 | launch(inst, !offline, nullptr, serverToJoin, accountToUse, m_offlineName); |
| 1095 | return; |
| 1096 | } |
| 1097 | } |
| 1098 | if(!m_mainWindow) |
| 1099 | { |
| 1100 | // normal main window |
| 1101 | showMainWindow(false); |
| 1102 | qDebug() << "<> Main window shown."; |
| 1103 | } |
| 1104 | if(!m_zipToImport.isEmpty()) |
| 1105 | { |
| 1106 | qDebug() << "<> Importing instance from zip:" << m_zipToImport; |
| 1107 | m_mainWindow->droppedURLs({ m_zipToImport }); |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | void Application::showFatalErrorMessage(const QString& title, const QString& content) |
| 1112 | { |
nothing calls this directly
no test coverage detected