| 897 | } // namespace |
| 898 | |
| 899 | MainWindow::MainWindow(QWidget* parent) |
| 900 | : QMainWindow(parent) |
| 901 | , m_sessions(makeInitialSessions()) |
| 902 | , m_session(m_sessions.front().get()) |
| 903 | , m_radioModel(m_session->radioModel()) |
| 904 | { |
| 905 | // Status bar is the only top-level shell besides the spectrum / applet |
| 906 | // rail / titlebar that the operator can directly retheme. Declare its |
| 907 | // container here — statusBar() lazy-creates the QStatusBar on first |
| 908 | // call, so this is also the construction point. |
| 909 | theme::setContainer(statusBar(), QStringLiteral("statusbar")); |
| 910 | |
| 911 | setWindowTitle(QString("AetherSDR v%1").arg(QCoreApplication::applicationVersion())); |
| 912 | setWindowIcon(QIcon(":/icon.png")); |
| 913 | setMinimumSize(1024, 400); |
| 914 | resize(1400, 800); |
| 915 | |
| 916 | // Apply frameless flag before first show() so the window is created |
| 917 | // without chrome from the start — avoids the flash + re-create that |
| 918 | // setWindowFlags() after show would cause (#framleess via View menu). |
| 919 | // Default ON: TitleBar provides drag, double-click-maximize, and the |
| 920 | // min/max/close trio at the far right. View → Frameless Window can |
| 921 | // still toggle it off as an escape hatch. |
| 922 | { |
| 923 | auto& s = AppSettings::instance(); |
| 924 | // One-shot migration: existing installs have FramelessWindow=False |
| 925 | // saved from when frameless was opt-in. Force ON for the |
| 926 | // transition so users see the new chrome by default; the View |
| 927 | // menu toggle still lets them flip it off afterwards. |
| 928 | if (!s.contains("FramelessMigratedV0823")) { |
| 929 | s.setValue("FramelessWindow", "True"); |
| 930 | s.setValue("FramelessMigratedV0823", "True"); |
| 931 | s.save(); |
| 932 | } |
| 933 | if (s.value("FramelessWindow", "True").toString() == "True") { |
| 934 | #ifndef Q_OS_WIN |
| 935 | setWindowFlags(windowFlags() | Qt::FramelessWindowHint); |
| 936 | #endif |
| 937 | } |
| 938 | |
| 939 | // Theming layer-0 backdrop (Phase 5 PR 3 — "fade to desktop" |
| 940 | // experiment). Disabling the default opaque window background |
| 941 | // lets MainWindow::paintEvent() honour color.background.app's |
| 942 | // alpha. Today's installs see no visual change because the |
| 943 | // bundled themes ship the token fully opaque (#0f0f1a / #f5f5f8) — |
| 944 | // the architectural hook just lets operators dial alpha down |
| 945 | // through the Theme Editor to A/B test which applets/docks still |
| 946 | // need their own opaque backgrounds. |
| 947 | setAttribute(Qt::WA_TranslucentBackground, true); |
| 948 | setAutoFillBackground(false); |
| 949 | connect(&ThemeManager::instance(), &ThemeManager::themeChanged, |
| 950 | this, qOverload<>(&QWidget::update)); |
| 951 | |
| 952 | // 8-axis edge resize for frameless mode — same install pattern |
| 953 | // as the floating dialogs (SpotHub, RadioSetup, MemoryDialog). |
| 954 | // Filter sits on the native QWindow so it doesn't compete with |
| 955 | // the TitleBar's drag-to-move handler (the 6 px resize margin |
| 956 | // is well clear of the 18+ px title-bar height). Stays |
nothing calls this directly
no test coverage detected