Internal
Public Access
Adds docs/USER_GUIDE.md, a 10-section end-user guide (getting started, managing/organizing profiles, SSH and RDP connections, session management, settings, troubleshooting). It's embedded into the app binary via a Qt resource file and rendered by a new Help -> User Guide window: a topic sidebar plus content pane, not a single scrolling document, with cross-reference links between sections routed to sidebar selection rather than relying on Qt's Markdown importer's lack of heading anchors. A separate, non-shipped tool (tools/user-guide-pdf/) renders the same source to a standalone PDF via QTextDocument + QPrinter, wrapped by packaging/docs/build-user-guide-pdf.sh. Kept fully outside the main CMake target so Qt6::PrintSupport never becomes a runtime dependency of the shipped app (confirmed via ldd). The PDF itself isn't committed -- generated per release like the platform installers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#include <QApplication>
|
|
#include <QFile>
|
|
#include <QPageSize>
|
|
#include <QPrinter>
|
|
#include <QTextDocument>
|
|
#include <QTextStream>
|
|
|
|
#include <cstdio>
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
QApplication app(argc, argv);
|
|
|
|
if (argc != 3) {
|
|
std::fprintf(stderr, "Usage: %s <input.md> <output.pdf>\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
const QString inputPath = QString::fromLocal8Bit(argv[1]);
|
|
const QString outputPath = QString::fromLocal8Bit(argv[2]);
|
|
|
|
QFile input(inputPath);
|
|
if (!input.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
std::fprintf(stderr, "Could not open %s\n", qPrintable(inputPath));
|
|
return 1;
|
|
}
|
|
|
|
QTextStream stream(&input);
|
|
const QString markdown = stream.readAll();
|
|
|
|
QTextDocument document;
|
|
document.setMarkdown(markdown);
|
|
|
|
QPrinter printer(QPrinter::HighResolution);
|
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
|
printer.setPageSize(QPageSize(QPageSize::Letter));
|
|
printer.setPageMargins(QMarginsF(50, 50, 50, 50), QPageLayout::Point);
|
|
printer.setOutputFileName(outputPath);
|
|
|
|
document.print(&printer);
|
|
|
|
std::printf("Wrote %s\n", qPrintable(outputPath));
|
|
return 0;
|
|
}
|