Skip to content

Resolve relative UI theme paths#24514

Open
TurboTheTurtle wants to merge 2 commits into
qbittorrent:masterfrom
TurboTheTurtle:codex/qbt-24489-relative-theme-path
Open

Resolve relative UI theme paths#24514
TurboTheTurtle wants to merge 2 commits into
qbittorrent:masterfrom
TurboTheTurtle:codex/qbt-24489-relative-theme-path

Conversation

@TurboTheTurtle

@TurboTheTurtle TurboTheTurtle commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Closes #24489.

Resolves relative custom UI theme paths against the application directory while preserving existing absolute path behavior.

Proof

Validated on Windows using the PR-head CI artifact.

  • Configured a relative custom UI theme path: themes/pr24514-relative.qbtheme
  • Launched qBittorrent from a different working directory
  • Confirmed the relative path resolved against the application directory, not the launch CWD
  • Confirmed existing absolute path behavior is preserved

@glassez

glassez commented Jun 14, 2026

Copy link
Copy Markdown
Member

Local validation:

  • git diff --check
  • cmake -S . -B build/codex-24489 -DCMAKE_BUILD_TYPE=Debug -DGUI=ON -DWEBUI=OFF -DTESTING=OFF -DSTACKTRACE=OFF
  • cmake --build build/codex-24489 --target qbt_gui --parallel 4
  • cmake --build build/codex-24489 --target qbt_app -j4

@TurboTheTurtle
Could you ask your AI assistant not to add this "garbage" text to the PR description? And put a period at the end of sentences like Closes #24489..

@TurboTheTurtle

TurboTheTurtle commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

@TurboTheTurtle Could you ask your AI assistant not to add this "garbage" text to the PR description? And put a period at the end of sentences like Closes #24489..

Fair point. I updated my PRs to remove those blocks and made a note to avoid them in the future

@TurboTheTurtle TurboTheTurtle marked this pull request as ready for review June 14, 2026 21:48
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

Windows proof for latest head a464881033b37bb024d1fd9a1a9bdd9ca7413070.

I tested the PR-head Windows CI artifact on a real Windows 11 machine:

  • Host: Windows 11 Home 64-bit, build 10.0.26200
  • Artifact run: https://github.com/qbittorrent/qBittorrent/actions/runs/27494256383
  • Artifact: qBittorrent-CI_Windows-x64_libtorrent-2.0.12
  • Isolated profile: --profile=<temp>\profile
  • Launch CWD deliberately different from the app directory: <temp>\launch-cwd
  • Configured custom UI theme path: themes/pr24514-relative.qbtheme
  • Test file location: <artifact>\qBittorrent\themes\pr24514-relative.qbtheme

The test theme file was intentionally not a valid Qt resource, so successful path resolution should still produce a load warning that names the resolved file. The app was launched from the isolated profile, allowed to initialize, then stopped after the proof line was written.

Observed qBittorrent log line:

(W) 2026-06-14T15:00:32 - Failed to load UI theme from file: "C:\Users\<user>\AppData\Local\Temp\qbt-pr24514-proof-20260614-150031\artifact\qBittorrent\themes\pr24514-relative.qbtheme"

Proof checks from the harness:

{
  "marker": "PR24514-WINDOWS-RELATIVE-THEME-20260614",
  "configuredRelativeTheme": "themes/pr24514-relative.qbtheme",
  "logContainsAppDirThemePath": true,
  "logContainsRawRelativeOnly": false
}

This confirms the Windows GUI artifact resolves a relative custom UI theme path against QCoreApplication::applicationDirPath() / the qBittorrent application directory, not the launch working directory and not the raw relative string. Existing PR CI is also green.

@glassez glassez added GUI GUI-related issues/changes Bugfix labels Jun 15, 2026
@glassez glassez modified the milestones: 5.2.2, 5.3, 5.2.3 Jun 15, 2026
glassez
glassez previously approved these changes Jun 15, 2026
@glassez glassez requested a review from a team June 15, 2026 04:41
Comment thread src/gui/uithememanager.cpp Outdated
if (themePath.isAbsolute())
return themePath;

return (Path(QCoreApplication::applicationDirPath()) / themePath);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't you use the profile folder path instead of app dir path?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@TurboTheTurtle
Why did you mark it as resolved?

@thalieht

Copy link
Copy Markdown
Contributor

Only one issue that shows up for all relative paths even though the theme is actually applied:

Screenshot_20260615_143919

@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

Manual UI validation on macOS:

  • Selected a custom UI theme config.json from the isolated test profile and restarted qBittorrent.
  • Confirmed the theme loads after restart.
  • Reopened Options and confirmed the UI Theme field shows the selected file without a validation warning.
Custom theme loaded after restart Options UI theme field without validation warning

@TurboTheTurtle TurboTheTurtle requested a review from Chocobo1 June 16, 2026 01:43
Comment thread src/gui/optionsdialog.cpp Outdated
@TurboTheTurtle TurboTheTurtle force-pushed the codex/qbt-24489-relative-theme-path branch from dcebf9f to 8edf92d Compare June 16, 2026 07:58
@glassez glassez changed the title Resolve relative UI theme paths from app directory Resolve relative UI theme paths Jun 19, 2026

@Chocobo1 Chocobo1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

Adjusted this so the stored preference and Options field stay as entered, and relative theme paths are resolved only when the theme manager loads them. The resolution now goes through the existing profile path conversion instead of the application directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix GUI GUI-related issues/changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relative paths in the UI Theme File should be resolved relative to the qBittorrent directory

4 participants