Skip to content

dialogs: migrate to wxSizerFlags, retire wxDesigner, eliminate GCC 15 enum-enum conversion warnings - #473

Merged
mrjimenez merged 4 commits into
amule-project:masterfrom
got3nks:dialogs-wxsizerflags-migration
Apr 24, 2026
Merged

dialogs: migrate to wxSizerFlags, retire wxDesigner, eliminate GCC 15 enum-enum conversion warnings#473
mrjimenez merged 4 commits into
amule-project:masterfrom
got3nks:dialogs-wxsizerflags-migration

Conversation

@got3nks

@got3nks got3nks commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Four atomic commits that clear the last deprecation warning class emitted by -Wdeprecated-declarations -Wdeprecated-copy -Wdeprecated in hand-written aMule code: GCC 15's -Wdeprecated-enum-enum-conversion (a C++20 deprecation of bitwise OR between distinct enumeration types, e.g. wxALIGN_CENTER|wxALL). Approach: migrate legacy sizer->Add(item, prop, flags, border) calls to the modern sizer->Add(item, wxSizerFlags(prop).chain()) idiom. The wxSizerFlags builder method-chains alignment / border / stretch options instead of OR-ing distinct wx enum types, sidesteps the warning entirely, and is wx's documented recommendation since 2.9.

While we're at it, retire the long-abandoned wxDesigner pipeline: src/muuli.wdr (a proprietary Roebling Systems binary format) hasn't been round-trippable for years — src/muuli_wdr.cpp has been maintained by hand despite the "Do not modify" comment. Delete the .wdr, replace the generated-file banner with the standard aMule GPL header.

Net: -Wdeprecated-enum-enum-conversion on GCC 15 drops from 706 hits to 0 on Ubuntu ARM64. Mac / Ubuntu x86_64 / Windows are unaffected (their compilers don't emit this warning class).

Commits in review order

# Commit Scope
1 dialogs: retire wxDesigner, take ownership of muuli_wdr.{cpp,h} Delete src/muuli.wdr (no longer round-trippable), replace "generated by wxDesigner / Do not modify" headers in src/muuli_wdr.{cpp,h} with the standard aMule GPL block plus a short historical note. Pure ownership-transfer commit, no code change.
2 dialogs: migrate muuli_wdr sizer->Add to wxSizerFlags 612 sites in src/muuli_wdr.cpp. Mechanical transform: sizer->Add(item, proportion, wxALIGN_CENTER|wxALL, 5)sizer->Add(item, wxSizerFlags(proportion).Center().Border(wxALL, 5)). Flag mapping: wxGROW/wxEXPAND.Expand(); wxSHAPED.Shaped(); wxFIXED_MINSIZE.FixedMinSize(); wxRESERVE_SPACE_EVEN_IF_HIDDEN.ReserveSpaceEvenIfHidden(); wxALIGN_CENTER.Center(); wxALIGN_CENTER_HORIZONTAL.CenterHorizontal(); wxALIGN_CENTER_VERTICAL.CenterVertical(); wxALIGN_RIGHT.Right(); wxALIGN_BOTTOM.Bottom(); direction flags + border → .Border(dir, px). Same-enum direction ORs inside .Border() (e.g. wxLEFT|wxRIGHT) stay — not deprecated. Net -612 lines because wxSizerFlags chains are more compact than the 4-arg form.
3 dialogs: migrate hand-written sizer->Add to wxSizerFlags 97 sites across 7 hand-written dialog files (src/PrefsUnifiedDlg.cpp, src/amuleDlg.cpp, src/CaptchaDialog.cpp, src/EditServerListDlg.cpp, src/utils/wxCas/src/wxcasprefs.cpp, src/utils/wxCas/src/wxcasframe.cpp, src/utils/aLinkCreator/src/alcframe.cpp). Same transform as commit 2. Remaining OR sites in these files are widget-style flags (wxOK|wxCANCEL, wxTE_MULTILINE|wxTE_READONLY, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, …) — plain int macros, not wx enum types, not deprecated.
4 dialogs: silence the last 4 enum-enum conversion sites Four residuals that the wxSizerFlags sweep didn't cover because they use different call shapes: two wxSizer::Add(w, h, prop, flags, border) 5-arg spacer calls in PrefsUnifiedDlg.cpp (migrated to Add(w, h, wxSizerFlags().Center())), one CreateToolBar() style mask in amuleDlg.cpp that OR'd wxToolBarStyleFlags with wxBorder (fixed by casting wxNO_BORDER to int), and one wxRadioBox ctor style mask in muuli_wdr.cpp with the same wxBorder-vs-wxRA_SPECIFY_ROWS mix (same int() cast). After this commit the warning is at 0 for the entire tree.

Warning audit

Audit flags: -Wdeprecated-declarations -Wdeprecated-copy -Wdeprecated. Fresh clean build. "Before" is upstream master at the branch base; "After" is this PR's tip.

Platform Before (-Wdeprecated-enum-enum-conversion) After Eliminated
Ubuntu ARM64 (GCC 15, wx 3.2) 706 0 706
Ubuntu x86_64 (GCC 13, wx 3.2) 0 0 — (GCC 13 doesn't emit this warning category)
macOS (Apple clang 21, wx 3.3.2) 0 0 — (clang doesn't emit this warning category)
Windows (MSYS2 CLANGARM64, wx 3.2) 0 0 — (same clang base)

Risk

No runtime behaviour change. wxSizerFlags is wx's documented sizer-flags builder (introduced in wx 2.9, recommended since wx 3.0); the method chain produces the same sizer flag bits the OR-form assembled by hand. Verified for each translated pattern:

  • wxEXPAND/wxGROW.Expand() — both set wxEXPAND.
  • wxALIGN_CENTER.Center() — both set wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL.
  • wxALIGN_X/wxALIGN_Y / .Right()/.Bottom()/.CenterHorizontal()/.CenterVertical() — one-to-one.
  • wxFIXED_MINSIZE.FixedMinSize() — one-to-one.
  • wxALL/wxLEFT/… + border size → .Border(dir, px) — one-to-one; same-enum direction ORs inside .Border() are not deprecated.
  • Proportion 0 collapses to default-constructed wxSizerFlags(); non-zero keeps the explicit wxSizerFlags(n) form.

The four manual fixes in commit 4 are type casts only — they change the narrow type of one operand from a wxBorder enum value to int, which is what the wxSizer / toolbar / radiobox constructors already accept via implicit conversion. No semantic change.

Verified

  • Ubuntu ARM64 (GCC 15, wx 3.2): clean build, 0 -Wdeprecated-enum-enum-conversion, UI spot-check on main window tabs + dialogs — no layout regressions.
  • macOS (Apple clang 21, wx 3.3.2): clean build + 9/9 unit tests pass.
  • CI (ubuntu-latest GCC + wx 3.2, macos-latest Apple clang + wx 3.3.2, windows-latest MINGW64 + wx 3.2): pending.

Not in this PR

  • Widget-side deprecations (non-sizer flags): OR patterns like wxOK|wxCANCEL, wxTE_MULTILINE|wxTE_READONLY, wxLC_REPORT|wxSUNKEN_BORDER are plain int macros (not wx enum types) and don't fire -Wdeprecated-enum-enum-conversion. Left untouched.

got3nks added 4 commits April 24, 2026 16:55
The .wdr source was maintained in a proprietary wxDesigner binary format
from Roebling Systems, which is effectively abandonware — no modern
contributor has a working copy and the .cpp/.h are already being edited
by hand despite the "Do not modify" header. Make that official:

- Delete src/muuli.wdr (no longer round-trippable).
- Replace the "generated by wxDesigner / Do not modify" headers in both
  src/muuli_wdr.cpp and src/muuli_wdr.h with the standard aMule GPL
  copyright block plus a short historical note explaining the origin.

No code change, no functional change — pure ownership-transfer commit.
612 sites. Mechanical transform:

    sizer->Add(item, proportion, wxALIGN_CENTER|wxALL, 5);
becomes
    sizer->Add(item, wxSizerFlags(proportion).Center().Border(wxALL, 5));

Flag-to-method mapping:
- wxGROW / wxEXPAND           -> .Expand()
- wxSHAPED                    -> .Shaped()
- wxFIXED_MINSIZE             -> .FixedMinSize()
- wxRESERVE_SPACE_EVEN_IF_HIDDEN -> .ReserveSpaceEvenIfHidden()
- wxALIGN_CENTER              -> .Center()
- wxALIGN_CENTER_HORIZONTAL   -> .CenterHorizontal()
- wxALIGN_CENTER_VERTICAL     -> .CenterVertical()
- wxALIGN_RIGHT               -> .Right()
- wxALIGN_BOTTOM              -> .Bottom()
- wxALIGN_LEFT, wxALIGN_TOP   -> default (no method)
- direction flags + border px -> .Border(dir, px)

This eliminates the C++20 -Wdeprecated-enum-enum-conversion that fires on
the legacy OR between wxStretch, wxAlignment, and wxDirection enum types;
wxSizerFlags' method chaining doesn't OR enums. Proportion 0 collapses to
the default wxSizerFlags() constructor. Same-enum direction ORs inside
.Border() (e.g. wxLEFT|wxRIGHT) stay — they're not deprecated.
Same mechanical transform as the muuli_wdr.cpp commit applied to the 7
hand-written dialog files that use the legacy
wxALIGN_*/wxALL/wxGROW-OR idiom as the 3rd arg to sizer->Add:

- src/PrefsUnifiedDlg.cpp
- src/amuleDlg.cpp
- src/CaptchaDialog.cpp
- src/EditServerListDlg.cpp
- src/utils/wxCas/src/wxcasprefs.cpp
- src/utils/wxCas/src/wxcasframe.cpp
- src/utils/aLinkCreator/src/alcframe.cpp

Total 97 sites. Remaining wx-OR-wx expressions in these files are
widget-style flags (wxOK|wxCANCEL, wxTE_MULTILINE|wxTE_READONLY,
wxLB_SINGLE|wxLB_NEEDED_SB, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER,
etc.) that are plain int macros — not wx enum types, not deprecated.
Four residual -Wdeprecated-enum-enum-conversion hits that the
wxSizerFlags sweep didn't cover because they use different call shapes:

- PrefsUnifiedDlg.cpp:1251,1268 — wxSizer::Add(w, h, prop, flags, border)
  spacer-overload (5-arg form). Migrated to the equivalent
  Add(w, h, wxSizerFlags().Center()) shape; the old border=0 drop-through
  is preserved by defaulting wxSizerFlags with no .Border() call.
- amuleDlg.cpp:1346 — CreateToolBar() style mask OR'd wxToolBarStyleFlags
  with wxBorder enum (wxNO_BORDER). Cast wxNO_BORDER to int so the
  compound expression has a single enum type on each operator.
- muuli_wdr.cpp:2839 — wxRadioBox ctor style mask OR'd wxBorder
  (wxNO_BORDER) with wxRA_SPECIFY_ROWS. Same int() cast treatment.

After this commit, -Wdeprecated-enum-enum-conversion is at 0 on GCC 15
for the entire aMule tree.
@mrjimenez
mrjimenez merged commit 0027d65 into amule-project:master Apr 24, 2026
4 checks passed
@got3nks
got3nks deleted the dialogs-wxsizerflags-migration branch May 3, 2026 15:19
got3nks added a commit to got3nks/amule that referenced this pull request Jul 13, 2026
…mule-project#466) (amule-project#473)

The Shared Files view could only show static counters (transferred,
requests, accepts, complete sources) — unlike Downloads, there was no way
to tell an actively-seeded file from an idle one. Surface per-file upload
activity over EC so clients (the REST API now, the desktop GUI later) can
add the corresponding columns.

Core (CKnownFile):
  * GetUploadDatarate() / GetTransferringClientCount() — live, summed from
    m_ClientUploadList: current upload speed and peers uploading now.
  * m_lastUploadDatetime — stamped in CFileStatistic::AddTransferred (the
    single point where sent bytes are attributed to a file), the upload-side
    analogue of the download's m_lastDateChanged.
  * m_dateShared — stamped once when a file completes (CompleteFileEnded) or
    is first hashed into the share (CKnownFileList::Append, afterHashing).
  Both persist in known.met as new FT_ tags (FT_LASTUPLOADED / FT_SHAREDSINCE);
  absent on a pre-feature known.met => 0 (unknown). Uploading never rewrites
  the shared file, so the timestamp can't ride the .met date the way downloads
  do — it needs its own tag. The unknown-tag preserve-and-rewrite path keeps
  this forward/backward compatible.

EC / dirty-marking:
  * New tags EC_TAG_KNOWNFILE_UPLOAD_SPEED / _UPLOADING_COUNT / _LAST_UPLOAD
    (live, emitted before the UPDATE early-return) and _SHARED_SINCE (full
    detail).
  * SetUploadState marks the file EC-dirty on US_UPLOADING transitions so a
    file that stops uploading but stays queued drops its speed to 0 —
    completed/shared files have no per-tick Process() sweep like downloads.

REST + SSE (amuleapi):
  * /shared list + detail gain upload_speed_bps, uploading, last_upload,
    shared_since; the SSE shared_added/shared_updated payload and EqualShared
    comparator carry them so live changes emit events.

Tests: RefresherTest decodes the new tags; curl 04 asserts the fields.
Docs: docs/api/REFERENCE.md.
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Aug 1, 2026
…ct#675) (amule-project#744)

This is a deliberate UI change, not a behaviour-preserving refactor --
worth being explicit about per review discussion on amule-project#675. None of the
74 sites touched here have ever rendered their border: the legacy
`Add(window, proportion, flag, border)` form only applies `border`
when `flag` carries a direction bit (wxALL/wxLEFT/wxRIGHT/wxTOP/
wxBOTTOM), and all 74 omitted it. Converting to wxSizerFlags() and
supplying a real direction bit means these borders render for the
first time, which will reflow the affected dialogs to some degree.

Per amule-project#663 (the case that originally surfaced this pattern): the
recorded border values were never validated by anything, since they
never rendered. Each site was judged against its structural siblings
rather than ported verbatim -- where siblings already carried a
working border, matched to it; where a site was the outlier in an
otherwise-consistent row/grid, adjusted to match rather than
introducing a new, never-tested value. A few sites lost their border
entirely where every sibling in the same row already had none (the
stray value read as leftover noise, not an intended margin).

Three additional non-legacy-syntax inconsistencies folded into the
same pass (found while scoping amule-project#675, confirmed still present):
- PreferencesRemoteControlsTab: "Low rights password" carried
  Border(wxLEFT|wxRIGHT, 20) while every other same-column label in
  the grid ("Web template", "Full rights password") uses
  Border(wxRIGHT, 5) -- the 20px left indent looked like it was
  copy-pasted from the unrelated UPnP-port row's indent, not a
  deliberate choice for this row.
- PreferencesOnlineSigTab: the "Save online signature file in" path
  field had no Expand()/proportion despite sitting in a column its
  parent FlexGridSizer marks growable -- it couldn't actually grow to
  fill the space reserved for it.
- PreferencesGeneralTab: the "Browser Selection" row (text field +
  Browse button) still used the legacy 3-arg Add() form while the
  structurally identical "Video Player" row already used
  wxSizerFlags() -- modernized for consistency, no behaviour change
  (both used border 0).

Scope: src/muuli_wdr.cpp only, matching where amule-project#663/amule-project#473 originally
established (and didn't fully carry through) the wxSizerFlags()
convention.

Testing: full build verified (macOS). Visually walked every dialog
these 20 functions produce that's reachable without live server/
download/client data in a fresh test config: main status bar,
search, transfer panes, shared-files header, servers/Kad tabs,
Friends/Messages panels, and all 15 Preferences tabs -- no clipped or
overlapping controls, and the two directly-testable fixes (the
OnlineSig path field now expanding, the RemoteControls password grid
column now aligned) confirmed visually.

NOT independently verified: fileDetails, clientDetails, commentLstDlg,
and CategoriesEditWindow all require live downloads/shared files/
clients/categories to reach via the UI, which a from-scratch test
config doesn't have -- these got the same siblings-based border
review as everything else, but I have not seen them rendered.
Sizer-border rendering is exactly where wxGTK/wxMSW/wxOSX diverge, so
this needs eyes on Linux and Windows too, per the amule-project#675 review
discussion.
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