| 1716 | } |
| 1717 | |
| 1718 | InstanceWindow* 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 | |
| 1756 | void Application::on_windowClose() |
| 1757 | { |
no test coverage detected