Address the review on the image strip / hit feed: - Height constraints: JFJochSimpleChartView used a hard setFixedHeight(300) and, being a page in the dataset-info stack, forced the whole plot dock (and thus the window) taller than the screen once the strip was stacked below. Make it a soft minimum (120). Wrap the settings dock in a QScrollArea so its content can scroll instead of forcing window height. Smaller strip thumbnails (96) and lower default bottom-dock heights. The window no longer grows past its requested size. - Stochastic selection: representatives are now picked at random within N equal bins (over image index, or a metric's sorted order), and a Refresh button re-rolls a fresh set — avoiding deterministic-spacing artefacts. "Most spots" stays deterministic; "Indexed" becomes spaced-random. - Live stability: the strip stores dataset updates but only rebuilds on file open (worker fileOpened) / mode / Spots / Refresh, so HTTP sync image updates no longer trigger constant thumbnail refetching. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include <QMap>
|
|
#include <memory>
|
|
|
|
#include "../../reader/JFJochReaderDataset.h"
|
|
|
|
class QComboBox;
|
|
class QCheckBox;
|
|
class QHBoxLayout;
|
|
class QToolButton;
|
|
|
|
// A strip of thumbnails for a handful of representative images (evenly spaced, most spots, or
|
|
// indexed), optionally overlaid with spots so a real pattern reads like a constellation. Clicking
|
|
// a thumbnail opens that image. Thumbnails are rendered off-thread by the reading worker.
|
|
class JFJochViewerImageStrip : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit JFJochViewerImageStrip(QWidget *parent = nullptr);
|
|
|
|
public slots:
|
|
void datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset);
|
|
void thumbnailReady(qint64 image_number, QImage thumb);
|
|
void resetForNewFile(); // a new file/stream opened: rebuild once, then stay put on live updates
|
|
|
|
signals:
|
|
void requestThumbnails(QVector<qint64> image_numbers, bool show_spots);
|
|
void imageSelected(int64_t image_number, int64_t summation);
|
|
|
|
private:
|
|
std::shared_ptr<const JFJochReaderDataset> dataset_;
|
|
QComboBox *mode_ = nullptr;
|
|
QCheckBox *spots_ = nullptr;
|
|
QHBoxLayout *strip_ = nullptr;
|
|
QMap<qint64, QToolButton *> slots_; // image number -> its thumbnail button
|
|
|
|
QVector<qint64> ComputeRepresentatives() const;
|
|
void Rebuild();
|
|
};
|