// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include #include #include #include #include "../widgets/NumberLineEdit.h" #include "../widgets/NumericComboBox.h" #include "../JFJochImageReadingWorker.h" // Navigation / acquisition toolbar: which image is shown (first/prev/next/last, an editable // number, and a prominent scrub slider), Jump/Sum, movie playback, and live HTTP sync. class JFJochViewerToolbarImage : public QToolBar { Q_OBJECT JFJochImageReadingWorker::AutoloadMode autoload_mode = JFJochImageReadingWorker::AutoloadMode::None; bool http_connected = false; size_t image_count_in_dataset; int64_t curr_image; int jump_value = 1; int sum = 1; QLabel *total_number_label; QLineEdit *current_image_edit; QIntValidator *current_image_edit_validator; QToolButton *leftmost_button; QToolButton *left_button; QToolButton *right_button; QToolButton *rightmost_button; QSlider *image_number_slider; QTimer *image_number_slider_timer; bool image_number_slider_manual = false; // On a remote display the counter/slider would otherwise repaint once per produced frame // during live follow or movie playback - a full-window upload each. Hold updateButtons() // to the remote cadence; the tail run shows the final number. QElapsedTimer number_rate_; QTimer *number_tail_timer_ = nullptr; QToolButton *movie_button; QToolButton *open_button; QToolButton *autoload_button; NumericComboBox *jump; void updateButtons(); void updateHttpButton(); signals: void loadImage(int64_t number, int summation); void autoLoadButtonPressed(JFJochImageReadingWorker::AutoloadMode mode); void imageJumpChanged(int64_t val); void requestHttpConnect(); // clicked while not connected: ask the window to open the dialog void requestOpenFile(); // open-dataset button: ask the window to open the file dialog public: explicit JFJochViewerToolbarImage(QWidget *parent = nullptr); public slots: void setImageNumber(int64_t total_images, int64_t current_image); void stepImage(int steps); void setAutoloadMode(JFJochImageReadingWorker::AutoloadMode input); void setHttpConnection(bool connected, QString addr); private slots: void leftButtonPressed(); void rightButtonPressed(); void leftmostButtonPressed(); void rightmostButtonPressed(); void editFinalized(); void imageNumberSliderPressed(); void imageNumberSliderMoved(int val); void imageNumberSliderReleased(); void setImageJump(int val); void setSummation(int val); void movieButtonPressed(); void autoloadButtonPressed(); };