| 2877 | } |
| 2878 | |
| 2879 | void MainWindow::beginProgressiveLayoutRestore(QDomDocument doc, const QString& path) { |
| 2880 | cancelProgressiveLayoutRestore(); |
| 2881 | progressive_layout_in_flight_ = true; |
| 2882 | |
| 2883 | bool applied = false; |
| 2884 | { |
| 2885 | QScopedValueRollback guard(applying_state_, true); |
| 2886 | const QDomElement root = doc.documentElement(); |
| 2887 | restoreDataProcessors(root); |
| 2888 | // rebindCurvesToLoadedDatasets rewrites doc in place; its unresolved-paths return is |
| 2889 | // not needed here — the progressive binder reports unresolved curves at drain. |
| 2890 | static_cast<void>(rebindCurvesToLoadedDatasets(doc)); |
| 2891 | if (xmlLoadState(doc)) { |
| 2892 | QHash<QString, PlotWidget*> plots_by_state_id; |
| 2893 | forEachPlot([&plots_by_state_id](PlotWidget* plot) { |
| 2894 | if (!plot->stateId().isEmpty()) { |
| 2895 | plots_by_state_id.insert(plot->stateId(), plot); |
| 2896 | } |
| 2897 | }); |
| 2898 | pending_binder_->collect(doc, plots_by_state_id); |
| 2899 | restoreChromeAndPanels(doc, path); |
| 2900 | broadcastTrackerTime(toAxisDouble(session_->playbackEngine().currentTime())); |
| 2901 | applied = true; |
| 2902 | } |
| 2903 | } |
| 2904 | |
| 2905 | if (!applied) { |
| 2906 | cancelProgressiveLayoutRestore(); |
| 2907 | MessageBox::warning(this, tr("Load Layout"), tr("Layout was parsed but could not be applied.")); |
| 2908 | return; |
| 2909 | } |
| 2910 | |
| 2911 | pending_items_added_conn_ = connect( |
| 2912 | &session_->catalogModel(), &CatalogModel::itemsAdded, this, [this](const std::vector<CatalogItem>& items) { |
| 2913 | flushPendingCurveBindings(items); |
| 2914 | retryPendingSceneRestores(items); |
| 2915 | }); |
| 2916 | pending_queue_drained_conn_ = connect( |
| 2917 | file_loader_.get(), &FileLoader::queueDrained, this, &MainWindow::onProgressiveLayoutDrained, |
| 2918 | Qt::SingleShotConnection); |
| 2919 | flushPendingCurveBindings({}); |
| 2920 | retryPendingSceneRestores({}); |
| 2921 | } |
| 2922 | |
| 2923 | void MainWindow::cancelProgressiveLayoutRestore() { |
| 2924 | QObject::disconnect(pending_items_added_conn_); |
nothing calls this directly
no test coverage detected