viewer: per-image plot reuses the dataset-info combo (no second combo)
In per-image mode the embedded chart brought its own combo box, so the plot panel showed two. Drop the per-image chart's combo and drive it from the one dataset-info combo: - JFJochViewerSidePanelChart loses its combo; it exposes PlotTypes() (the available profiles) and a setPlotType(code) slot, driven externally. - JFJochViewerDatasetInfo fills its single combo with the per-image plot types while in per-image mode (per-dataset metrics otherwise) and routes the selection to the chart; dataset/runs/live updates leave the per-image combo and plot untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -105,7 +105,9 @@ JFJochViewerDatasetInfo::JFJochViewerDatasetInfo(QWidget *parent) : QWidget(pare
|
||||
[this]() {
|
||||
if (image_button->isChecked())
|
||||
grid_button->setChecked(false);
|
||||
combo_box->setEnabled(!image_button->isChecked()); // the metric combo is for the dataset plot
|
||||
UpdateLabels(); // swap the one combo's contents for the mode
|
||||
combo_box->setCurrentIndex(0);
|
||||
comboBoxSelected(0); // apply the first option of the new mode
|
||||
UpdateView();
|
||||
});
|
||||
connect(image_chart, &JFJochViewerSidePanelChart::writeStatusBar,
|
||||
@@ -121,6 +123,13 @@ void JFJochViewerDatasetInfo::UpdateLabels() {
|
||||
|
||||
combo_box->clear();
|
||||
|
||||
// In per-image mode the one combo selects which per-image profile to show (no second combo).
|
||||
if (image_button && image_button->isChecked()) {
|
||||
for (const auto &pt : JFJochViewerSidePanelChart::PlotTypes())
|
||||
combo_box->addItem(pt.first, pt.second);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->dataset) {
|
||||
combo_box->addItem("Background estimate", 0);
|
||||
combo_box->addItem("Resolution estimate", 7);
|
||||
@@ -173,6 +182,12 @@ void JFJochViewerDatasetInfo::UpdateLabels() {
|
||||
|
||||
void JFJochViewerDatasetInfo::datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset) {
|
||||
this->dataset = dataset;
|
||||
// Per-image mode: the combo holds plot types and the chart follows the displayed image, so a
|
||||
// new dataset must not repopulate the combo or run the per-dataset plot.
|
||||
if (image_button && image_button->isChecked()) {
|
||||
UpdateView();
|
||||
return;
|
||||
}
|
||||
if (dataset) {
|
||||
UpdateLabels();
|
||||
if (last_selection < combo_box->count())
|
||||
@@ -312,6 +327,8 @@ void JFJochViewerDatasetInfo::UpdateView() {
|
||||
void JFJochViewerDatasetInfo::runsChanged(QVector<RunData> runs, QString active_id) {
|
||||
runs_ = std::move(runs);
|
||||
active_id_ = std::move(active_id);
|
||||
if (image_button && image_button->isChecked())
|
||||
return; // per-image mode: runs/overlays are a per-dataset concern
|
||||
UpdateLabels();
|
||||
if (last_selection < combo_box->count())
|
||||
combo_box->setCurrentIndex(last_selection);
|
||||
@@ -320,11 +337,19 @@ void JFJochViewerDatasetInfo::runsChanged(QVector<RunData> runs, QString active_
|
||||
|
||||
void JFJochViewerDatasetInfo::liveRunUpdated(std::shared_ptr<const JFJochReaderDataset> in_dataset) {
|
||||
live_run_ = std::move(in_dataset);
|
||||
if (image_button && image_button->isChecked())
|
||||
return;
|
||||
UpdatePlot(); // lightweight refresh; no combo rebuild on every live tick
|
||||
}
|
||||
|
||||
void JFJochViewerDatasetInfo::comboBoxSelected(int index) {
|
||||
UpdatePlot();
|
||||
// The one combo means per-dataset metrics in normal mode, per-image plot types in image mode.
|
||||
if (image_button && image_button->isChecked()) {
|
||||
if (image_chart && index >= 0 && index < combo_box->count())
|
||||
image_chart->setPlotType(combo_box->itemData(index).toInt());
|
||||
} else {
|
||||
UpdatePlot();
|
||||
}
|
||||
}
|
||||
|
||||
void JFJochViewerDatasetInfo::setColorMap(int color_map) {
|
||||
|
||||
Reference in New Issue
Block a user