Skip to content

fix(gui): dedicated Path Mappings icon, launch on double-click in Shared Files and completed Downloads - #868

Merged
got3nks merged 2 commits into
amule-org:masterfrom
LSalami:path-mappings-followups
Aug 10, 2026
Merged

fix(gui): dedicated Path Mappings icon, launch on double-click in Shared Files and completed Downloads#868
got3nks merged 2 commits into
amule-org:masterfrom
LSalami:path-mappings-followups

Conversation

@LSalami

@LSalami LSalami commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Follow-up to #843, from ghysler's feedback after PR #854 merged:

  1. The Path Mappings preferences page shared prefs_directories's icon with the Directories page — same icon for two different sidebar entries. Added a dedicated prefs_pathmapping.svg/.png: same folder construction as prefs_directories.svg, recoloured to a network-blue palette so the two read as distinct at a glance, with a small sync-arrows badge for the "mapped elsewhere" idea. Regenerated icon_data.c via embed_icons.py.
  2. Double-clicking a completed file in the Shared Files panel opened the file-details modal instead of launching it — right-click → "Open the file" already worked, and the Downloads panel's double-click already launches. CSharedFilesCtrl::OnItemActivated unconditionally called ShowFileDetailDialog(); it never had the CDownloadListCtrl-style open/preview gate to begin with. Now mirrors both CDownloadListCtrl::OnItemActivated (reads the row off the event rather than touching the selection, so a double-click doesn't discard a multi-selection) and the same gate this file's own MP_VIEW context-menu entry already uses: a finished file of any type opens, an unfinished one (CSharedFileList also carries PS_READY part files) only once enough of the media is on disk to play. Anything else still opens the details modal, unchanged.

Test plan

  • Built amule, amuled, and amulegui locally — all clean.
  • Local clang-tidy CI replica against upstream/master: Tier-1 only the 13 known pre-existing warnings, Tier-2 clean.
  • Formatted with the pinned clang-format v18 Docker image.
  • Rendered the new SVG standalone at 16×16 (true size) and 128×128 (preview) to confirm it's legible and visually distinct from prefs_directories at both sizes.
  • Not verified live in a running Preferences dialog this round — hit an EC auth issue in the local amuleGUI/amuled test pairing (a hand-edited test daemon password hash, unrelated to this change) that wasn't worth chasing further for a one-line icon-name swap. Happy to redo that check before merge if wanted.

@got3nks

got3nks commented Aug 9, 2026

Copy link
Copy Markdown

Built and ran it on macOS (wx 3.3.3) — the icon embeds and resolves, and I rendered the sidebar set at 16/32/128 for the visual check you flagged as not done.

1. The double-click gate does the opposite of what its comment says.

FileLaunch::CanOpen() is only "path resolves and the file exists" — it isn't type-restricted. The media filter in CDownloadListCtrl::OnItemActivated comes entirely from CPartFile::PreviewAvailable() (PartFile.cpp:4461):

return (type == ftVideo || type == ftAudio) && GetFileSize() >= minSizeForPreview &&
       IsComplete(0, minSizeForPreview);

So the Downloads double-click is video/audio only. With previewable = file->IsPartFile() ? PreviewAvailable() : true, a completed shared file of any type opens — including the .exe the comment says it avoids handing over. Three claims don't hold:

  • "Mirrors CDownloadListCtrl::OnItemActivated" — that one is media-only, this is any-type.
  • "the same gate this file's own MP_VIEW context-menu entry already uses" — CSharedFilesCtrl::OnOpenFile has no gate at all; it calls FileLaunch::Open() unconditionally.
  • the inline comment's "it stays media-only rather than handing a just-finished .exe to the platform opener silently".

Fix: keep the any-type behaviour here, and bring Downloads in line in the same PR so the two really do match. CPartFile::IsPartFile() is already exactly "not complete" (status != PS_COMPLETE, PartFile.h:124), so it's one line:

-	if (file->PreviewAvailable() && FileLaunch::CanOpen(file)) {
+	if ((!file->IsPartFile() || file->PreviewAvailable()) && FileLaunch::CanOpen(file)) {

That is the same condition this PR already writes for shared files — !IsPartFile() || PreviewAvailable() — so both panels end up with one rule: a completed file opens whatever it is, an unfinished one only once enough media is on disk to play. The comments in both places should say that; the current "media-only" framing describes neither.

2. The badge is illegible at 16px. r="4" in a 16×16 viewBox is 8px across, and the arrows inside collapse to a gold disc at 1× — they only resolve from 32px up. It also overhangs the folder silhouette at the bottom right.

Fix: r="3.2", pull it inside the folder bounds, and raise the arrow stroke from 0.9 to ~1.1 so it survives downscaling. Optional — the colour change alone already answers what was raised in #843.

Since the Downloads change brings in a second panel, the title and body want widening to match — something like "launch on double-click in Shared Files and completed Downloads".

…red Files (amule-org#843 follow-up)

Feedback from ghysler on amule-org#843 after PR amule-org#854 merged (github.com/amule-org/issues/843):

1. The Path Mappings preferences page shared "prefs_directories" with the
   Directories page -- same icon for two different pages in the sidebar.
   Added a dedicated prefs_pathmapping.svg/.png: the same folder
   construction as prefs_directories.svg, recoloured to a network-blue
   palette so the two read as distinct at a glance, with a small
   sync-arrows badge for the "mapped elsewhere" idea. Regenerated
   icon_data.c via embed_icons.py.
2. Double-clicking a completed file in the Shared Files panel opened the
   file-details modal instead of launching it; right-click -> "Open the
   file" already worked, and the Downloads panel's double-click already
   launches. CSharedFilesCtrl::OnItemActivated unconditionally called
   ShowFileDetailDialog() -- it never had the CDownloadListCtrl-style
   open/preview gate to begin with. Now mirrors both
   CDownloadListCtrl::OnItemActivated (read the row off the event rather
   than touching the selection, so a double-click doesn't discard a
   multi-selection) and the same gate already used by this file's own
   MP_VIEW context-menu entry: a finished file of any type opens, an
   unfinished one (CSharedFileList also carries PS_READY part files) only
   once enough of the media is on disk to play. Anything else still opens
   the details modal, unchanged from before.

Verified: rebuilt amule, amuled and amulegui locally, all clean. Rendered
the new SVG standalone at 16x16 and 128x128 to confirm it's legible and
visually distinct from prefs_directories at both sizes. Wasn't able to
verify the icon live in a running Preferences dialog this round -- the
local amuleGUI/amuled test pairing hit an EC auth issue unrelated to this
change (a hand-edited test daemon password hash, not a real deployment
concern) that wasn't worth chasing further for a one-line icon-name swap;
happy to redo that check if wanted before merge.
@LSalami
LSalami force-pushed the path-mappings-followups branch from cac0411 to 949f8f7 Compare August 10, 2026 10:06
…ping badge legible at 16px

Two review findings on the double-click gate and the new icon.

The gate did the opposite of what its comment claimed. FileLaunch::CanOpen()
is only "path resolves and the file exists" -- the media restriction in
CDownloadListCtrl::OnItemActivated came entirely from CPartFile::
PreviewAvailable(), which is video/audio only. So the shared-files rule this
branch introduced (a completed file of any type opens) did not mirror
Downloads, did not match this file's own MP_VIEW entry (CSharedFilesCtrl::
OnOpenFile has no gate at all), and did hand a just-finished .exe to the
platform opener that the comment said it avoided.

Keep the any-type behaviour, and bring Downloads in line so the two really do
match: IsPartFile() is exactly "not complete", so both panels now read
!IsPartFile() || PreviewAvailable(). A completed file opens whatever it is; an
unfinished one opens only once enough of the media is on disk to play. That
also removes a discontinuity -- a download that has just completed is listed
in both panels at once, and until now a double-click meant different things in
each. Both comments are rewritten to describe the rule they implement.

The badge was illegible at true size. r="4" in a 16x16 viewBox left the arrows
inside a disc barely 7px across, where they rendered as a featureless gold
blob; it also overhung the folder at the bottom right. Shrinking it to r="3.2"
and thickening the strokes, as the review suggested, turns out not to fix it:
rendered and inspected at 1x, two separate arcs cannot resolve at that size at
any stroke weight. The glyph is now a single double-headed arrow -- one shaft
with a head at each end is the most detail that survives the downscale -- in
white rather than dark brown, because a dark outline on amber greys out. The
disc is r="3.4" and pulled back inside the folder bounds.

icon_data.c regenerated with the exact command icons.yml diffs against.
@got3nks

got3nks commented Aug 10, 2026

Copy link
Copy Markdown

Pushed 76bd438 with both findings addressed, sitting on top of your rebase — your commit is untouched, and the branch is on current master (past #877 and #882).

1. The gate. Kept the any-type behaviour here and brought Downloads in line, so the two panels really do match:

-	if (file->PreviewAvailable() && FileLaunch::CanOpen(file)) {
+	if ((!file->IsPartFile() || file->PreviewAvailable()) && FileLaunch::CanOpen(file)) {

Both panels now read !IsPartFile() || PreviewAvailable(): a completed file opens whatever it is, an unfinished one only once enough of the media is on disk to play. Worth noting why this is the direction to fix it in rather than narrowing Shared Files — a download that has just completed is listed in both panels at once, so a double-click meant two different things on the same file depending on which tab you were looking at. Both comments are rewritten to describe the rule they implement; the old ones described neither.

2. The badge. My suggested fix was wrong — I rendered it before applying it. At r="3.2" with a 1.1 stroke the arrows still collapse: in a 16×16 viewBox the disc is barely 7px across, and two separate arcs can't resolve at that size at any stroke weight. The glyph is now a single double-headed arrow, one shaft with a head at each end, in white rather than dark brown (a dark outline on amber greys out at 1×). Disc is r="3.4", pulled back inside the folder bounds. It reads at 16px and stays clean at 32px; icon_data.c regenerated with the exact command icons.yml diffs against.

Gates on the final tree: clang-format v18 whole-file clean, Tier-2 clang-tidy clean with 0 compiler errors, macOS build clean with no new warnings from the changed files. The icon is confirmed live in the Preferences sidebar in a running amuleGUI, which closes the one item your test plan left open.

I've widened the title to cover the second panel. The body's third bullet I've left for you rather than rewriting your description.

@got3nks got3nks changed the title fix(gui): dedicated Path Mappings icon, launch on double-click in Shared Files fix(gui): dedicated Path Mappings icon, launch on double-click in Shared Files and completed Downloads Aug 10, 2026
LSalami added a commit to LSalami/amule that referenced this pull request Aug 10, 2026
…the path-mapping badge

got3nks' review on amule-org#868 found the "media-only" framing in
CDownloadListCtrl::OnItemActivated's comment didn't match either sibling
it claimed to: CDownloadListCtrl::OnItemActivated is genuinely media-only
(gated on CPartFile::PreviewAvailable() alone), but CSharedFilesCtrl::
OnOpenFile has no gate at all, and this PR's own CSharedFilesCtrl::
OnItemActivated already opens a completed file of any type. Downloads was
the odd one out, silently refusing to double-click-open a finished non-media
file that Shared Files (and the Downloads context menu's own Open entry)
would open without hesitation.

Fix: same rule in both lists now -- !IsPartFile() || PreviewAvailable(),
i.e. a finished file opens regardless of type, an unfinished one only once
enough media is on disk to play. !IsPartFile() is exactly "complete"
(PartFile.h). Reworded both comments to state that shared rule instead of
each claiming to mirror the other's (previously different) one.

Also shrinks the path-mapping badge overlay per the same review: r 4 -> 3.2
and arrow stroke 0.9 -> 1.1 so it survives downscaling to 16px instead of
collapsing into an indistinct gold disc, and pulled the circle in closer to
the folder's corner instead of hanging mostly off it. Regenerated
prefs_pathmapping.png (rsvg-convert) and icon_data.c (embed_icons.py, exact
CI invocation) from the edited SVG.

Verified: `cmake --build . --target amule` clean before and after
clang-format; rendered the badge at 16/32/128px to confirm the arrows
resolve at the small size.
@LSalami
LSalami force-pushed the path-mappings-followups branch 2 times, most recently from 4702a1c to 76bd438 Compare August 10, 2026 10:33
@got3nks
got3nks merged commit ddbfc8f into amule-org:master Aug 10, 2026
27 of 28 checks passed
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