| 3763 | // buildMenuBar() lives in MainWindow_Menus.cpp (#3351 Phase 1b). |
| 3764 | |
| 3765 | void MainWindow::buildUI() |
| 3766 | { |
| 3767 | // ── Title bar + central splitter ───────────────────────────────────────── |
| 3768 | m_titleBar = new TitleBar(this); |
| 3769 | // Embed the menu bar into the title bar (left side) |
| 3770 | m_titleBar->setMenuBar(menuBar()); |
| 3771 | updatePcAudioTooltip(); |
| 3772 | connect(m_audio, &AudioEngine::inputDeviceChanged, |
| 3773 | this, &MainWindow::updatePcAudioTooltip, Qt::QueuedConnection); |
| 3774 | connect(m_audio, &AudioEngine::outputDeviceChanged, |
| 3775 | this, &MainWindow::updatePcAudioTooltip, Qt::QueuedConnection); |
| 3776 | connect(m_titleBar, &TitleBar::multiFlexClicked, |
| 3777 | this, &MainWindow::showMultiFlexDialog); |
| 3778 | connect(m_titleBar, &TitleBar::minimalModeRequested, this, [this]() { |
| 3779 | toggleMinimalMode(!m_minimalMode); |
| 3780 | if (m_minimalModeAction) { |
| 3781 | QSignalBlocker b(m_minimalModeAction); |
| 3782 | m_minimalModeAction->setChecked(m_minimalMode); |
| 3783 | } |
| 3784 | }); |
| 3785 | connect(m_titleBar, &TitleBar::minimalModeWindowedExitRequested, this, [this]() { |
| 3786 | toggleMinimalMode(false); |
| 3787 | }); |
| 3788 | // Title-bar dock-side click: clicking the active-side icon hides the |
| 3789 | // applet panel; clicking the inactive-side icon moves it there (and |
| 3790 | // shows it if hidden). |
| 3791 | auto handleDockClick = [this](bool wantLeft) { |
| 3792 | // If currently floating, dock back first so the float window is |
| 3793 | // torn down via the canonical path; otherwise reparenting the |
| 3794 | // contents into the splitter leaves an empty float window alive |
| 3795 | // and visible (the "black box" in #2584). |
| 3796 | if (m_appletPanelFloatWindow) { |
| 3797 | toggleAppletPanelFloating(false); |
| 3798 | } |
| 3799 | const bool dockedLeft = AppSettings::instance() |
| 3800 | .value("AppletPanelDockedLeft", "False").toString() == "True"; |
| 3801 | const bool visible = m_appletPanel && m_appletPanel->isVisible(); |
| 3802 | if (visible && dockedLeft == wantLeft) { |
| 3803 | setAppletPanelVisible(false); |
| 3804 | } else { |
| 3805 | if (!visible) setAppletPanelVisible(true); |
| 3806 | if (dockedLeft != wantLeft) setAppletPanelDockedLeft(wantLeft); |
| 3807 | } |
| 3808 | }; |
| 3809 | connect(m_titleBar, &TitleBar::dockAppletLeftRequested, this, [handleDockClick]() { handleDockClick(true); }); |
| 3810 | connect(m_titleBar, &TitleBar::dockAppletRightRequested, this, [handleDockClick]() { handleDockClick(false); }); |
| 3811 | // Pop-out icon: toggle floating via the shared helper so the icon, the |
| 3812 | // Ctrl+Shift+S shortcut, and the float-window close-X stay in sync. |
| 3813 | connect(m_titleBar, &TitleBar::popOutAppletRequested, this, [this]() { |
| 3814 | toggleAppletPanelFloating(m_appletPanelFloatWindow == nullptr); |
| 3815 | }); |
| 3816 | |
| 3817 | m_splitter = new QSplitter(Qt::Horizontal, this); |
| 3818 | m_splitter->setHandleWidth(0); |
| 3819 | |
| 3820 | auto* central = new QWidget(this); |
| 3821 | auto* vbox = new QVBoxLayout(central); |
| 3822 | vbox->setContentsMargins(0, 0, 0, 0); |
nothing calls this directly
no test coverage detected