// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include #include #include #include "../../image_analysis/scale_merge/Merge.h" // MergeStatistics #include "../../image_analysis/scale_merge/TwinningAnalysis.h" // TwinningAnalysisResult #include "../../image_analysis/scale_merge/SearchSpaceGroup.h" // SearchSpaceGroupResult class QComboBox; class QLabel; class QStackedWidget; class QTableWidget; class JFJochSimpleChartView; // Pop-up analysis window for a finished scaling/merging run: a row of eye-catching overall numbers // (ISa, CC1/2, R-meas, completeness, multiplicity, the Wilson B and the radiation-damage Delta-B, and // CCref when a reference was used) above a per-resolution-shell plot whose metric is chosen from a // combo, a per-shell table, and an ISa diagnostic scatter. Opened automatically when a merge job // finishes and on demand from the processing-jobs dock. Modeless; deletes on close. class JFJochMergeStatsWindow : public QWidget { Q_OBJECT public: // `report` is the rugnux result report text (_report.txt), shown as its own view. JFJochMergeStatsWindow(const QString &title, const MergeStatistics &stats, double isa, bool has_reference, const TwinningAnalysisResult &twinning, const std::optional &space_group, const std::optional &space_group_search, const std::vector> &merged_i_sigma, const QString &report, QWidget *parent = nullptr); private: MergeStatistics stats_; bool has_reference_; QComboBox *metric_ = nullptr; QLabel *metricLabel_ = nullptr; // "Metric:" — hidden in table view QStackedWidget *stack_ = nullptr; // page 0: plot, page 1: table, page 2: ISa, page 3: report JFJochSimpleChartView *chart_ = nullptr; QTableWidget *table_ = nullptr; QWidget *isa_page_ = nullptr; QWidget *report_page_ = nullptr; void updatePlot(); void buildTable(); // Merged I/sigma against I, with the reported ISa drawn as its asymptote. Returns nullptr when // there is nothing to draw. QWidget *buildIsaDiagnostic(const std::vector> &i_sigma, double isa); };