Skip to content

Desktop: Use the Packaged HTML User Manual when Opening the Manual in the Browser.#4735

Merged
mikeller merged 1 commit intosubsurface:masterfrom
mikeller:use_local_browser_manual
Mar 2, 2026
Merged

Desktop: Use the Packaged HTML User Manual when Opening the Manual in the Browser.#4735
mikeller merged 1 commit intosubsurface:masterfrom
mikeller:use_local_browser_manual

Conversation

@mikeller
Copy link
Member

@mikeller mikeller commented Mar 1, 2026

Describe the pull request:

  • Bug fix
  • Functional change
  • New feature
  • Code cleanup
  • Build system change
  • Documentation change
  • Language translation

Pull request long description:

When the built-in html viewer for the user manual can not be built, we
are currently opening the user manual on the website in the system
default browser. This obviously does not work when there is no internet
connection. Default to using the packaged HTML version of the user manual
when opening the manual in the browser.

Changes made:

Related issues:

#4717

Additional information:

Documentation change:

Mentions:

Copilot AI review requested due to automatic review settings March 1, 2026 10:16
@mikeller mikeller mentioned this pull request Mar 1, 2026
7 tasks
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves offline usability by preferring the locally packaged HTML user manual when opening the manual in an external browser (e.g., when the built-in HTML viewer cannot be built), falling back to the website only if the packaged manual isn’t found.

Changes:

  • Added a shared helper to resolve the packaged user manual’s local file URL (with language fallbacks) and a “best available” manual URL selector.
  • Refactored the in-app user manual dialog to use the shared packaged-manual resolver.
  • Updated the “User Manual” action (when NO_USERMANUAL is defined) to open the packaged manual in the system browser instead of always using the website.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
desktop-widgets/usermanualpath.h Declares helper functions to locate the packaged manual and choose the best manual URL.
desktop-widgets/usermanualpath.cpp Implements packaged-manual discovery (localized fallback) and website fallback URL selection.
desktop-widgets/usermanual.cpp Uses the new packaged-manual resolver instead of duplicating path/language lookup logic.
desktop-widgets/mainwindow.cpp Opens getUserManualUrl() in the system browser under NO_USERMANUAL.
desktop-widgets/CMakeLists.txt Adds the new helper source/header to the desktop-widgets build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

QString searchPath = getSubsurfaceDataPath("Documentation");
if (searchPath.size()) {
QString lang = getUiLanguage();
QString prefix = searchPath.append("/user-manual");
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In getPackagedUserManualUrl(), QString prefix = searchPath.append("/user-manual"); mutates searchPath as a side effect, which is easy to miss and makes the path-building logic harder to follow. Prefer constructing prefix without modifying searchPath (e.g., concatenation or QDir(searchPath).filePath(...)).

Suggested change
QString prefix = searchPath.append("/user-manual");
QString prefix = searchPath + "/user-manual";

Copilot uses AI. Check for mistakes.
#endif
}
} else {
report_info("unable to find packaged user manual");
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure log message here no longer includes the documentation directory that was searched (the previous implementation logged it). Including the resolved documentation path and/or selected language in this report_info would make missing-packaged-manual issues easier to diagnose.

Suggested change
report_info("unable to find packaged user manual");
report_info("unable to find packaged user manual (resolved URL: %s)", manualUrl.toString().toUtf8().constData());

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Linux-AppImage-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Android-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Windows-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Windows-MSVC-qt-6-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

… the Browser.

When the built-in html viewer for the user manual can not be built, we
are currently opening the user manual on the website in the system
default browser. This obviously does not work when there is no internet
connection. Default to using the packaged HTML version of the user manual
when opening the manual in the browser.

Signed-off-by: Michael Keller <github@ike.ch>
@mikeller mikeller force-pushed the use_local_browser_manual branch from 42db91b to 36396e7 Compare March 1, 2026 11:00
@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Linux-AppImage-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Android-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Windows-MSVC-qt-6-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Artifacts:
Subsurface-Windows-6.0.5553-patch.1.pull-request.use-local-browser-manual
WARNING: Use at your own risk.

@mikeller mikeller merged commit 15f72c8 into subsurface:master Mar 2, 2026
25 checks passed
@mikeller mikeller deleted the use_local_browser_manual branch March 2, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants