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

Method showInstanceWindow

launcher/Application.cpp:1718–1754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1716}
1717
1718InstanceWindow* Application::showInstanceWindow(BaseInstance* instance, QString page)
1719{
1720 if (!instance)
1721 return nullptr;
1722 auto id = instance->id();
1723 QMutexLocker locker(&m_instanceExtrasMutex);
1724 auto& extras = m_instanceExtras[id];
1725 auto& window = extras.window;
1726
1727 if (window) {
1728// If the window is minimized on macOS or Windows, activate and bring it up
1729#ifdef Q_OS_MACOS
1730 if (window->isMinimized()) {
1731 window->setWindowState(window->windowState() & ~Qt::WindowMinimized);
1732 }
1733#elif defined(Q_OS_WIN)
1734 if (window->isMinimized()) {
1735 window->showNormal();
1736 }
1737#endif
1738
1739 window->raise();
1740 window->activateWindow();
1741 } else {
1742 window = new InstanceWindow(instance);
1743 m_openWindows++;
1744 connect(window, &InstanceWindow::isClosing, this, &Application::on_windowClose);
1745 }
1746
1747 if (!page.isEmpty()) {
1748 window->selectPage(page);
1749 }
1750 if (extras.controller) {
1751 extras.controller->setParentWidget(window);
1752 }
1753 return window;
1754}
1755
1756void Application::on_windowClose()
1757{

Callers 3

launchInstanceMethod · 0.80
onFailedMethod · 0.80

Calls 4

setParentWidgetMethod · 0.80
idMethod · 0.45
isEmptyMethod · 0.45
selectPageMethod · 0.45

Tested by

no test coverage detected