Skip to content

feat(gui): port CGenericClientListCtrl to wxDataViewCtrl (#180, #801) - #850

Merged
got3nks merged 3 commits into
amule-org:masterfrom
LSalami:downloads-dataview-port
Aug 7, 2026
Merged

feat(gui): port CGenericClientListCtrl to wxDataViewCtrl (#180, #801)#850
got3nks merged 3 commits into
amule-org:masterfrom
LSalami:downloads-dataview-port

Conversation

@LSalami

@LSalami LSalami commented Aug 7, 2026

Copy link
Copy Markdown

Last remaining piece of #801's wxListCtrlwxDataViewCtrl migration: the shared base feeding CSourceListCtrl (download sources) and CSharedFilePeersListCtrl (shared-file peers).

Design notes

Unlike every prior port, ClientCtrlItem_Struct survives rather than being deleted: it's not a cache-avoidance wrapper, it's structurally required — one client (ECID) can be a source/peer of more than one file at once, so row identity has to be the (client, owner, type) tuple. Its dwUpdated/status fields (a 10s-TTL cached wxBitmap*) are dropped, matching the no-cache precedent from the Shared Files and Downloads ports — DrawStatusBar's ColumnUserAvailable path already shipped fully uncached.

Two bar columns, two renderers:

  • ColumnUserProgress (Sources only): CSourceBarRenderer draws the 5-state chunk bar via the base CMuleBarRenderer, except for A4AF rows, which get a bordered "A4AF: <filename>" text badge instead of a bar entirely — a real per-row renderer branch, not an overlay.
  • ColumnUserAvailable (Peers only): the plain base renderer is enough (2-state, no per-row branching). It has no Compare() case, matching pre-port behaviour where it was never sortable, so it's registered without wxDATAVIEW_COL_SORTABLE rather than showing a caret that does nothing.

The User Name column is a composite icon-cluster (status/software/credits/ext-protocol/identified/badguy/encryption badges) plus an optional country flag plus text — no single-icon AddIconTextColumn() cell can carry that. CClientNameRenderer reuses CMuleBarRenderer's identity-carrying CBarFillSpec/GetItemBarFill() extension point to reach the row's ClientCtrlItem_Struct and replay the whole cluster, the same mechanism CDownloadBarRenderer uses for its CPartFile* overlay — registered via AddBarColumn() since it isn't a literal bar. GetItemColumnText() still answers the plain username for this column, so type-ahead and the accessible row label (the actual point of #180) work off real text rather than the pre-port GetTTSText()'s hardcoded "".

CompareItemData() replicates the original SortProc's type-precedence pre-check (A4AF sources always sort last, direction-independent, not just per selected column) before dispatching to the per-column comparison.

Also: CMuleVirtualDataViewCtrl gains a GetModelRow() helper (wraps the wxDataViewIndexListModel::GetRow() cast); CDownloadListCtrl's two hand-rolled instances of the same cast now use it. muuli_wdr.cpp's two construction sites for these lists drop the legacy wxLC_REPORT|wxSUNKEN_BORDER flags (wxLC_REPORT aliases wxDV_VARIABLE_LINE_HEIGHT), matching every other ported list.

Verification

  • amule and amulegui build clean from a fresh CMake configure (wx 3.3.3)
  • Pinned clang-format v18 clean
  • Tier-1/Tier-2 clang-tidy clean via the local CI replica (wx 3.2.4) — the only Tier-1 hits are 13 pre-existing, unrelated warnings in unittests/tests/
  • Grepped for every orphaned pre-port symbol (DrawClientItem, DrawSourceStatusBar, DrawStatusBar, SortProc, dwUpdated/status) and confirmed every external caller (TransferWnd.cpp, SharedFilesWnd.cpp, GuiEvents.cpp, amuleDlg.cpp) still compiles unchanged against the same public API (AddSource/RemoveSource/ShowSources/UpdateItem/SetShowing/RemoveKnownFile)
  • Manually tested against a live daemon: Name column icon cluster + flag + username render correctly aligned, "Parti disponibili" bar shows plausible green/black/yellow chunk states, Version/Download Status/Origin columns populate

No translatable strings were added or changed, so po/ catalogs are not regenerated.

…, amule-org#801)

Last remaining piece of amule-org#801's wxListCtrl -> wxDataViewCtrl migration:
the shared base feeding CSourceListCtrl (download sources) and
CSharedFilePeersListCtrl (shared-file peers).

Unlike every prior port, ClientCtrlItem_Struct survives rather than
being deleted: it's not a cache-avoidance wrapper, it's structurally
required, since one client (ECID) can be a source/peer of more than
one file at once, so row identity has to be the (client, owner, type)
tuple. Its dwUpdated/status fields (a 10s-TTL cached wxBitmap*) are
dropped, matching the no-cache precedent from the Shared Files and
Downloads ports -- DrawStatusBar's ColumnUserAvailable path already
shipped fully uncached.

Two bar columns, two renderers:
- ColumnUserProgress (Sources only): CSourceBarRenderer draws the
  5-state chunk bar via the base CMuleBarRenderer, except for A4AF
  rows, which get a bordered "A4AF: <filename>" text badge instead of
  a bar entirely -- a real per-row renderer branch, not an overlay.
- ColumnUserAvailable (Peers only): the plain base renderer is enough
  (2-state, no per-row branching). It has no Compare() case, matching
  pre-port behaviour where it was never sortable, so it's registered
  without wxDATAVIEW_COL_SORTABLE rather than showing a caret that
  does nothing.

The User Name column is a composite icon-cluster (status/software/
credits/ext-protocol/identified/badguy/encryption badges) plus an
optional country flag plus text -- no single-icon AddIconTextColumn()
cell can carry that. CClientNameRenderer reuses CMuleBarRenderer's
identity-carrying CBarFillSpec/GetItemBarFill() extension point to
reach the row's ClientCtrlItem_Struct and replay the whole cluster,
the same mechanism CDownloadBarRenderer uses for its CPartFile*
overlay -- registered via AddBarColumn() since it isn't a literal bar.
GetItemColumnText() still answers the plain username for this column,
so type-ahead and the accessible row label (the actual point of amule-org#180)
work off real text rather than the pre-port GetTTSText()'s hardcoded
"".

CompareItemData() replicates the original SortProc's type-precedence
pre-check (A4AF sources always sort last, direction-independent, not
just per selected column) before dispatching to the per-column
comparison.

Also: CMuleVirtualDataViewCtrl gains a GetModelRow() helper (wraps the
wxDataViewIndexListModel::GetRow() cast); CDownloadListCtrl's two
hand-rolled instances of the same cast now use it. muuli_wdr.cpp's two
construction sites for these lists drop the legacy
wxLC_REPORT|wxSUNKEN_BORDER flags (wxLC_REPORT aliases
wxDV_VARIABLE_LINE_HEIGHT), matching every other ported list.

Verified: amule and amulegui build clean from a fresh CMake configure
(wx 3.3.3); pinned clang-format v18 clean; Tier-1/Tier-2 clang-tidy
clean via the local CI replica (wx 3.2.4) -- the only Tier-1 hits are
13 pre-existing, unrelated warnings in unittests/tests/. Grepped for
every orphaned pre-port symbol (DrawClientItem, DrawSourceStatusBar,
DrawStatusBar, SortProc, dwUpdated/status) and confirmed every
external caller (TransferWnd.cpp, SharedFilesWnd.cpp, GuiEvents.cpp,
amuleDlg.cpp) still compiles unchanged against the same public API
(AddSource/RemoveSource/ShowSources/UpdateItem/SetShowing/
RemoveKnownFile). No translatable strings were added or changed, so
po/ catalogs are not regenerated.
@LSalami
LSalami force-pushed the downloads-dataview-port branch from b6b6b4c to 6899edf Compare August 7, 2026 21:16
LSalami added 2 commits August 7, 2026 23:18
The CGenericClientListCtrl port moved the "A4AF" badge string from
GenericClientListCtrl.cpp into SourceListCtrl.cpp (CSourceBarRenderer's
A4AF branch), shifting its extraction position in po/amule.pot and
every po/*.po. Verified symmetric: each locale loses the msgid at its
old #: comment and regains it, translation intact, at the new one --
same pattern as the prior DownloadListCtrl.cpp catalog regeneration.

Regenerated via scripts/update-po.sh.
CI's Tier-2 clang-tidy (changed-lines gate) caught two
modernize-use-nullptr hits that the local ci-local replica's diff base
missed (it was run against a stale fork origin/master before the
upstream rebase). Grepped the whole file for the same pattern per
this repo's convention and fixed all six real NULL pointer
literals/comparisons in GenericClientListCtrl.h/.cpp, not just the
two CI pointed at -- left the "NULL" mentions inside string literals
and comments alone.

Verified: amule builds clean; clang-format v18 clean.
@got3nks
got3nks merged commit 435b1d0 into amule-org:master Aug 7, 2026
14 checks passed
@got3nks

got3nks commented Aug 7, 2026

Copy link
Copy Markdown

Merged — thanks @LSalami. That closes out #801's migration; built and checked on macOS, Ubuntu ARM64 and Windows ARM64.

@LSalami
LSalami deleted the downloads-dataview-port branch August 8, 2026 03:48
got3nks pushed a commit that referenced this pull request Aug 8, 2026
…endored wxGenericListCtrl (#855)

Follow-up to #801/#180: with the client-list port done in #850, CCommentDialogLst was the only remaining instantiator of CMuleListCtrl and CMuleVirtualListCtrl had no derivers left.

CCommentDialogLst drops to a plain wxListCtrl -- a small read-only modal list that does not warrant the CMuleDataViewCtrl treatment -- with click-to-sort reimplemented by hand. amuleDlg's exit-time SaveListControlSettings() widget walk goes too: it existed because CMuleListCtrl only saved lazily from its destructor, which the tray-Exit path could skip, whereas CMuleDataViewCtrl writes column widths and sort orders eagerly on every resize, sort and show/hide, and SaveGUIPrefs() still flushes on every close path.

That leaves CMuleVirtualListCtrl, CMuleListCtrl and the vendored wxGenericListCtrl with no consumers, so all four files are deleted. IsListBackgroundDark() moves to MuleColour.h. CListColumnStore's legacy config-migration path is untouched -- it still reads pre-dataview TableWidths* entries.

One known simplification: the comments dialog loses its header sort-arrow glyph, which plain wxListCtrl does not draw. A follow-up restores it via ShowSortIndicator().
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