MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / beginProgressiveLayoutRestore

Method beginProgressiveLayoutRestore

pj_app/src/MainWindow.cpp:2879–2921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2877}
2878
2879void 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
2923void MainWindow::cancelProgressiveLayoutRestore() {
2924 QObject::disconnect(pending_items_added_conn_);

Callers

nothing calls this directly

Calls 8

toAxisDoubleFunction · 0.85
trFunction · 0.85
collectMethod · 0.80
currentTimeMethod · 0.80
getMethod · 0.80
isEmptyMethod · 0.45
stateIdMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected