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

Method showMainWindow

launcher/Application.cpp:1413–1495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1411}
1412
1413MainWindow* Application::showMainWindow(bool minimized)
1414{
1415 if(m_mainWindow)
1416 {
1417 m_mainWindow->setWindowState(m_mainWindow->windowState() & ~Qt::WindowMinimized);
1418 m_mainWindow->raise();
1419 m_mainWindow->activateWindow();
1420 }
1421 else
1422 {
1423 m_mainWindow = new MainWindow();
1424 m_mainWindow->restoreState(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowState").toByteArray()));
1425 m_mainWindow->restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowGeometry").toByteArray()));
1426 if(minimized)
1427 {
1428 m_mainWindow->showMinimized();
1429 }
1430 else
1431 {
1432 m_mainWindow->show();
1433 }
1434
1435 m_mainWindow->checkInstancePathForProblems();
1436 connect(this, &Application::updateAllowedChanged, m_mainWindow, &MainWindow::updatesAllowedChanged);
1437 connect(m_mainWindow, &MainWindow::isClosing, this, &Application::on_windowClose);
1438 m_openWindows++;
1439 }
1440 // FIXME: move this somewhere else...
1441 if(m_analytics)
1442 {
1443 auto windowSize = m_mainWindow->size();
1444 auto sizeString = QString("%1x%2").arg(windowSize.width()).arg(windowSize.height());
1445 qDebug() << "Viewport size" << sizeString;
1446 m_analytics->setViewportSize(sizeString);
1447 /*
1448 * cm1 = java min heap [MB]
1449 * cm2 = java max heap [MB]
1450 * cm3 = system RAM [MB]
1451 *
1452 * cd1 = java version
1453 * cd2 = java architecture
1454 * cd3 = system architecture
1455 * cd4 = CPU architecture
1456 */
1457 QVariantMap customValues;
1458 int min = m_settings->get("MinMemAlloc").toInt();
1459 int max = m_settings->get("MaxMemAlloc").toInt();
1460 if(min < max)
1461 {
1462 customValues["cm1"] = min;
1463 customValues["cm2"] = max;
1464 }
1465 else
1466 {
1467 customValues["cm1"] = max;
1468 customValues["cm2"] = min;
1469 }
1470

Callers

nothing calls this directly

Calls 8

QStringClass · 0.85
setViewportSizeMethod · 0.80
isEmptyMethod · 0.80
sendScreenViewMethod · 0.80
getMethod · 0.45
settingsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected