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

Method showMainWindow

launcher/Application.cpp:1472–1554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1470}
1471
1472MainWindow* Application::showMainWindow(bool minimized)
1473{
1474 if(m_mainWindow)
1475 {
1476 m_mainWindow->setWindowState(m_mainWindow->windowState() & ~Qt::WindowMinimized);
1477 m_mainWindow->raise();
1478 m_mainWindow->activateWindow();
1479 }
1480 else
1481 {
1482 m_mainWindow = new MainWindow();
1483 m_mainWindow->restoreState(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowState").toByteArray()));
1484 m_mainWindow->restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("MainWindowGeometry").toByteArray()));
1485 if(minimized)
1486 {
1487 m_mainWindow->showMinimized();
1488 }
1489 else
1490 {
1491 m_mainWindow->show();
1492 }
1493
1494 m_mainWindow->checkInstancePathForProblems();
1495 connect(this, &Application::updateAllowedChanged, m_mainWindow, &MainWindow::updatesAllowedChanged);
1496 connect(m_mainWindow, &MainWindow::isClosing, this, &Application::on_windowClose);
1497 m_openWindows++;
1498 }
1499 // FIXME: move this somewhere else...
1500 if(m_analytics)
1501 {
1502 auto windowSize = m_mainWindow->size();
1503 auto sizeString = QString("%1x%2").arg(windowSize.width()).arg(windowSize.height());
1504 qDebug() << "Viewport size" << sizeString;
1505 m_analytics->setViewportSize(sizeString);
1506 /*
1507 * cm1 = java min heap [MB]
1508 * cm2 = java max heap [MB]
1509 * cm3 = system RAM [MB]
1510 *
1511 * cd1 = java version
1512 * cd2 = java architecture
1513 * cd3 = system architecture
1514 * cd4 = CPU architecture
1515 */
1516 QVariantMap customValues;
1517 int min = m_settings->get("MinMemAlloc").toInt();
1518 int max = m_settings->get("MaxMemAlloc").toInt();
1519 if(min < max)
1520 {
1521 customValues["cm1"] = min;
1522 customValues["cm2"] = max;
1523 }
1524 else
1525 {
1526 customValues["cm1"] = max;
1527 customValues["cm2"] = min;
1528 }
1529

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