Files
Jungfraujoch/viewer/windows/JFJochAlgorithmDocWindow.cpp
T
leonarski_fandClaude Opus 5 6f15ae04b7 Viewer: read the data-analysis algorithm documentation from Help
Adds Help > Data Analysis Algorithms, showing docs/CPU_DATA_ANALYSIS.md in a
window. The document is baked into the binary through the Qt resource system
(aliased to :/cpu_data_analysis.md), so it needs no docs/ directory at runtime
and cannot drift from the build it shipped with. Same shape as the existing
third-party licences window, created once and raised thereafter.

Limitation worth knowing: QTextBrowser::setMarkdown renders the headings, lists,
emphasis and inline code well, but it has no math support, so the inline LaTeX in
the more quantitative sections appears as raw "$...$" source. The descriptive
material - which is most of the 744 lines - reads fine. Fixing that properly
means either pre-rendering the document to HTML with a math filter at build time,
or sending the user to the Read The Docs copy instead; neither seemed worth doing
without knowing which you would prefer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-26 22:05:11 +02:00

24 lines
731 B
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include "JFJochAlgorithmDocWindow.h"
#include <QFile>
#include <QTextBrowser>
#include <QVBoxLayout>
JFJochAlgorithmDocWindow::JFJochAlgorithmDocWindow(QWidget *parent) : QDialog(parent) {
setWindowTitle("Data Analysis Algorithms");
resize(900, 700);
auto *browser = new QTextBrowser(this);
browser->setOpenExternalLinks(true);
QFile file(":/cpu_data_analysis.md");
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
browser->setMarkdown(QString::fromUtf8(file.readAll()));
auto *layout = new QVBoxLayout(this);
layout->addWidget(browser);
}