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.

LSalami added a commit to LSalami/amule that referenced this pull request Jul 27, 2026
got3nks's review of amule-org#650 asked for this to reach amulegui and amuleapi,
not just the monolithic app, ahead of the push to keep every feature
available across all three clients.

Adds two optional EC_TAG_CONNSTATE sub-tags, hand-synced into
ECCodes.abstract/.h per the project's existing convention (never
regenerate the committed header -- it reflows the whole license block):

- EC_TAG_ED2K_CONNECTED_SINCE / EC_TAG_KAD_CONNECTED_SINCE (uint32 unix
  timestamps), populated in CEC_ConnState_Tag's constructor from
  CamuleApp's existing m_ed2kConnectedSince/m_kadConnectedSince, present
  only while actually connected.

Consumption side:
- CamuleRemoteGuiApp (amulegui) gets matching m_ed2kConnectedSince/
  m_kadConnectedSince members and GetED2KConnectedSince()/
  GetKadConnectedSince() accessors -- same names as CamuleApp's, so
  ServerWnd.cpp's "Connected since" rows no longer need a
  #ifndef CLIENT_GUI gate; each build's theApp resolves to whichever
  class actually has the data.
- amuleapi's Refresher.cpp reads the same sub-tags directly into
  StatusSnapshot.{ed2k,kad}_connected_since, surfaced in GET /status as
  ed2k.connected_since / kad.connected_since (0 while disconnected).
  Documented in docs/api/REFERENCE.md.

po/ catalogs regenerated as the final step (scripts/update-po.sh) so
the diff is just the "Connected since:" string in sync with the tree,
per got3nks's note on amule-org#278 about avoiding line-number-shift churn.

Verified by building and running all three targets (amule, amulegui,
amuleapi) plus the full unit test suite (26/26 passing, including
RefresherTest which exercises the new StatusSnapshot fields directly).
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