* @brief Serializes the active group's layout and writes it to the project file; * no-ops during a layout restore so restore-driven signals can't loop back. */
| 359 | * no-ops during a layout restore so restore-driven signals can't loop back. |
| 360 | */ |
| 361 | void UI::Taskbar::saveLayout() |
| 362 | { |
| 363 | if (!m_windowManager || m_windowIDs.isEmpty() || m_activeGroupId < -2) |
| 364 | return; |
| 365 | |
| 366 | if (m_restoringLayout) |
| 367 | return; |
| 368 | |
| 369 | const auto opMode = AppState::instance().operationMode(); |
| 370 | if (opMode != SerialStudio::ProjectFile) |
| 371 | return; |
| 372 | |
| 373 | auto* model = &DataModel::ProjectModel::instance(); |
| 374 | if (model->jsonFilePath().isEmpty()) |
| 375 | return; |
| 376 | |
| 377 | if (m_taskbarButtons && m_windowIDs.count() < m_taskbarButtons->rowCount()) |
| 378 | return; |
| 379 | |
| 380 | model->saveWidgetSetting(Keys::layoutKey(m_layoutScope, m_activeGroupId), |
| 381 | QStringLiteral("data"), |
| 382 | m_windowManager->serializeLayout()); |
| 383 | } |
| 384 | |
| 385 | //-------------------------------------------------------------------------------------------------- |
| 386 | // Taskbar group selection code (e.g. when a tab is selected in the tab bar) |
nothing calls this directly
no test coverage detected