Files
Jungfraujoch/viewer/windows/JFJochMouseShortcutsWindow.cpp
T
leonarski_fandClaude Sonnet 5 d24cdfcff4 jfjoch_viewer: navigation keys, one-shot auto-contrast, file manager panel, cleanup
* Dataset-info plot hover shows a horizontal crosshair alongside the existing
  vertical one, so a run of hovers reads as a level or a drift at a glance.
* `A` applies auto-contrast once instead of switching on persistent Auto mode
  (a new `oneShotAutoForeground()`, distinct from the toolbar's Auto toggle);
  pressing it a second time on the same image switches Auto on for good, and
  pressing it while Auto is already on leaves it on. The value itself comes
  from one `AutoForegroundValue()` shared with the continuous Auto path.
* `Home`/`End`/`Page Up`/`Page Down` navigate the dataset (first/last image,
  one image forward/back); claimed in the diffraction view's keyPressEvent
  before QGraphicsView's default handling, which otherwise eats them to
  scroll the viewport.
* Alt+wheel dataset navigation is removed - some window managers already
  took it before the app ever saw it, per the caveat that used to sit next
  to its entry in the shortcuts list.
* The image strip dock and its dedicated thumbnail-rendering machinery in
  the reading worker (SetThumbnail*, RenderThumbnail_i) are removed; it cost
  a lot and nothing else used any of it.
* Toolbar text: "Colour" -> "Color".
* Color map, Auto and HDR mode now persist across sessions, the same way the
  window layout already does.
* The Inspector's "Dataset:" path wraps at '/' (a zero-width space after
  each one) instead of being cut off when it doesn't fit one line.
* LoadFile no longer reopens an already-open file - it forwards straight to
  LoadImage instead - which was the likely cause of a D-Bus client's per-image
  navigation lagging behind the same navigation done via the grid-scan hover.
* New file-manager dock (left, tabbed with Settings via tabifyDockWidget):
  a directory tree filtered to *_master.h5/*_process.h5, rooted at
  JUNGFRAUJOCH_DATA_ROOT if set, else the last-browsed root, else the home
  directory. Most beamline users care about opening images, not
  reprocessing settings, so it's the tab raised by default. Its filter box
  narrows files only - a directory always passes - because filtering the
  directories too hid the matching files under any directory whose own name
  did not match, and hid the root's ancestors, which left the tree with no
  valid root index until the root was set again by hand.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PogHY7bWXV4bpctDPdyuDN
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 18:45:20 +02:00

74 lines
3.8 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include "JFJochMouseShortcutsWindow.h"
#include <QTextBrowser>
#include <QVBoxLayout>
namespace {
struct Shortcut { QString action; QString effect; };
struct Section { QString title; QVector<Shortcut> rows; };
QString BuildHtml() {
const QVector<Section> sections = {
// JFJochImage / JFJochDiffractionImage mouse handling
{"Diffraction image", {
{"Wheel", "Zoom in / out, centred on the cursor"},
{"Shift + wheel", "Move the foreground (upper contrast limit) in linear steps"},
{"Ctrl + wheel", "Move the foreground in multiplicative steps (&times;1.15 per notch)"},
{"F held + wheel", "Same as Shift + wheel, for as long as F is held"},
{"A", "Apply auto-contrast once; press again to switch on continuous Auto"},
{"Home / End", "Jump to the first / last image in the dataset"},
{"Page Up / Page Down", "Step one image forward / back"},
{"Hover", "Status bar shows the pixel position, its value and the resolution"},
{"Drag", "Pan the image"},
{"Shift + drag", "Draw a rectangular ROI"},
{"Shift + Ctrl + drag", "Draw a circular ROI"},
{"Drag an ROI or its handle", "Move or resize the selected ROI"},
{"Right click", "Copy / save the image, fit to view, clear the ROI"},
}},
// JFJochGridScanImage
{"Grid scan", {
{"Hover", "Status bar shows the image number, the grid position and its value"},
{"Shift + hover", "Load the image under the cursor while moving over the grid"},
{"Double click", "Load the image under the cursor"},
}},
{"Other views", {
{"2D azimuthal image: double click", "Zoom the diffraction image on the corresponding detector position"},
{"Dataset-info plot: hover", "Status bar shows the image number and the plotted value"},
{"Dataset-info plot: Shift + hover", "Load the hovered image"},
{"Spot / reflection list: double click", "Zoom the diffraction image on that spot or prediction"},
{"Image list: double click", "Load that image"},
{"Reciprocal space: drag", "Rotate the view"},
{"Reciprocal space: right drag", "Pan the view"},
{"Reciprocal space: wheel", "Zoom the view"},
{"Reciprocal space: double click", "Zoom the diffraction image on the nearest spot"},
{"Magnifier: wheel", "Zoom the magnifier; it follows the cursor on the main image"},
}},
};
QString html = "<html><body>";
for (const auto &section : sections) {
html += "<h3>" + section.title + "</h3>";
html += "<table cellspacing='0' cellpadding='4' width='100%'>";
for (const auto &row : section.rows)
html += "<tr><td width='38%'><b>" + row.action + "</b></td><td>" + row.effect + "</td></tr>";
html += "</table>";
}
html += "</body></html>";
return html;
}
}
JFJochMouseShortcutsWindow::JFJochMouseShortcutsWindow(QWidget *parent) : QDialog(parent) {
setWindowTitle("Mouse Shortcuts");
resize(620, 620);
auto *browser = new QTextBrowser(this);
browser->setHtml(BuildHtml());
auto *layout = new QVBoxLayout(this);
layout->addWidget(browser);
}