Skip to content

play a file from the shared file tab#278

Open
tbo47 wants to merge 1 commit into
amule-org:masterfrom
tbo47:play
Open

play a file from the shared file tab#278
tbo47 wants to merge 1 commit into
amule-org:masterfrom
tbo47:play

Conversation

@tbo47

@tbo47 tbo47 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

Play a file from the shared file tab.

I tried to use the feedback from
#272

@got3nks

got3nks commented Jul 3, 2026

Copy link
Copy Markdown

Thanks @tbo47 — this addresses most of the #272 points: the preview logic is now a single shared PreviewFile instead of a third copy, Delete is split out, the macOS VLC prefill is gone, and the title says what it does. Good iteration.

A few things before it can go in:

1. Gate Play/Open to the monolithic app — on both tabs. The new Shared-tab item (EVT_MENU(MP_VIEW…), the menu entry, and OnPlayFile) isn't wrapped in #ifndef CLIENT_GUI. In amulegui the paths are the daemon's, so it opens a nonexistent local path. Please add the gate — and since you're in this code, the existing Download-tab preview (OnPreviewFile / its MP_VIEW) has the same gap, so give it the same #ifndef CLIENT_GUI gate while we're here.

2. Guard the downcast. static_cast<CPartFile *>(file) (in the menu enable-check and in PreviewFile's incomplete branch) is only valid because an incomplete shared file is always a CPartFile. That invariant holds today, but the raw downcast is a latent crash if it ever changes — please add an IsPartFile() guard so it's explicit and safe.

3. Replace the reinterpret_cast. reinterpret_cast<CKnownFile *>(GetItemData(index)) in OnPlayFile is heavier than needed and unsafe if the stored type ever differs — please use a proper static_cast matching how the item pointer is stored/retrieved elsewhere in this control.

4. Label it "Open" on the Shared tab and route by file type — aMule already has the helper. The Shared list is arbitrary files, not just media, so a completed file should say "Open". Right now the configured video player is forced on every type, so "Play" on a non-media file (a .zip, a document) launches the video player on it. Classify with GetFiletype(file->GetFileName()) from OtherFunctions.h — the same helper CPartFile::PreviewAvailable() already uses — and route: ftVideo / ftAudio → the configured video player (or the OS opener if none is set); everything else → the OS default opener (open / xdg-open / start) regardless of the video-player setting. (Incomplete shared partfiles are media-in-progress, so previewing those via the player as today is fine.)

5. The po diff. The large catalog churn is because your branch predates recent string additions on master — the #: source line numbers have all shifted. Please rebase onto current master and regenerate the catalogs as the final step, so the diff shows just your new string, in sync with the tree.

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