Build Packages / Build documentation (push) Successful in 1m47s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 22m9s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 12m31s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 13m14s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 22m22s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 4m55s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 5m55s
Build Packages / Unit tests (push) Successful in 1h3m54s
Build Packages / Validation Battery (push) Successful in 38m20s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 26m32s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 37m6s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 21m17s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 37m4s
Build Packages / Generate python client (push) Successful in 1m7s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 23m17s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 29m26s
Build Packages / Create release (push) Successful in 1m19s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 40m18s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 39m23s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 24m34s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 33m22s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 14m55s
* jfjoch_viewer: The file browser and the open dialog list every format the viewer opens, including frames numbered in their extension (`name.001`) and `.cbf.gz`, `.mccd`, `.sfrm`, `.nxs`, `.cxi` and `.xtc` files. * jfjoch_viewer: After processing a CBF, marCCD, SMV or SFRM sweep, the images stay on screen with the results drawn over them. * rugnux: No more Ceres thread warnings on machines with fewer than 16 CPU threads. Reviewed-on: #99 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
66 lines
2.9 KiB
C++
66 lines
2.9 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 <QFileSystemModel>
|
|
#include <QSortFilterProxyModel>
|
|
#include <QHash>
|
|
#include <QDateTime>
|
|
|
|
class QLineEdit;
|
|
class QTreeView;
|
|
class QModelIndex;
|
|
|
|
// Left-side dock alternative to the Processing (reprocessing settings) panel: a directory tree rooted at a
|
|
// configurable data root, filtered down to subdirectories and the files the viewer opens, for browsing to and opening a dataset without caring about reprocessing. Backed by QFileSystemModel,
|
|
// which only lists a directory once it is expanded - so a root with hundreds of sibling directories
|
|
// (e.g. an SLS beamline's /sls/mx/data/) costs one readdir at each level actually opened, never a
|
|
// recursive scan of the whole tree.
|
|
//
|
|
// New files show up by themselves: F5 (or the refresh button) re-lists the root and every expanded
|
|
// directory at once, and a timer does the same every few seconds while the panel is visible. The model's
|
|
// own inotify watching covers a local disk, but not files written by another host onto NFS/GPFS/Lustre,
|
|
// which is exactly how a detector writer fills a beamline's data directory - hence the polling.
|
|
class JFJochViewerFileBrowser : public QWidget {
|
|
Q_OBJECT
|
|
|
|
QLineEdit *root_edit_;
|
|
QLineEdit *filter_edit_;
|
|
QTreeView *tree_;
|
|
QFileSystemModel *model_;
|
|
QSortFilterProxyModel *proxy_;
|
|
// Modification time of each directory when it was last listed, so a poll re-lists only those that changed.
|
|
QHash<QString, QDateTime> listed_mtime_;
|
|
|
|
void SetRoot(const QString &path);
|
|
void CollectExpanded(const QModelIndex &parent, QStringList &dirs) const;
|
|
[[nodiscard]] static QString DefaultRoot();
|
|
// An SLS account eNNNNN browses its proposal group's raw data, which is pNNNNN with the
|
|
// same five digits; empty for any other user name, on any platform.
|
|
[[nodiscard]] static QString SlsDataRoot(const QString &user);
|
|
|
|
public slots:
|
|
// "Reset all settings to defaults": back to the root a fresh start would pick.
|
|
void ResetToDefaultRoot();
|
|
// Re-list the root and the expanded directories; unless forced, only those modified since last time.
|
|
void Refresh(bool force = true);
|
|
|
|
private slots:
|
|
void onBrowseClicked();
|
|
void onRootEditingFinished();
|
|
void onDoubleClicked(const QModelIndex &index);
|
|
|
|
signals:
|
|
// Mirrors JFJochViewerMenu::fileOpenSelected, so the window wires it to LoadFile the same way.
|
|
void openDataset(const QString &filename, qint64 image_number, qint64 summation, bool retry);
|
|
|
|
public:
|
|
explicit JFJochViewerFileBrowser(QWidget *parent = nullptr);
|
|
|
|
// A dataset opened elsewhere (menu, D-Bus) and lying inside the current root moves the tree's
|
|
// selection to it; one outside the root leaves the browser exactly as it was.
|
|
void FollowPath(const QString &path);
|
|
};
|