fix(gui): shrink the per-network connect button and name its network - #683
Conversation
|
@LSalami I think this button does the same thing as connect and it can be removed too (if you didn't already) |
ngosang noted on amule-org#402/amule-org#683 that this button looked like it duplicated Connect. Confirmed: OnBnClickedBootstrapKnown called the exact same theApp->StartKad() as the Kad tab's own Connect/Cancel/Disconnect toggle when off, so it was a second control for the same action rather than a distinct one -- removed.
Confirmed and removed --
Good idea, but I'd rather keep it out of this PR -- it's a real layout redesign (graph sizing, collapsing the 4-field IP entry into one, matching your WebUI reference) rather than a fix to what's already here, and this PR is getting long enough as review feedback accumulates. Happy to pick it up as a follow-up once this one's settled, or if you'd rather open a tracking issue for it that works too. Rebuilt clean, clang-format v18 applied, po regenerated, pushed. |
b22b026 to
d8b2476
Compare
ngosang noted on amule-org#402/amule-org#683 that this button looked like it duplicated Connect. Confirmed: OnBnClickedBootstrapKnown called the exact same theApp->StartKad() as the Kad tab's own Connect/Cancel/Disconnect toggle when off, so it was a second control for the same action rather than a distinct one -- removed.
|
Reviewed and built this on three platforms at Both removals verified. Please fold the Bootstrap removal into the PR body. It's explained in the thread, but the body's "Dead code removal" section still covers only the toolbar button, and the body is what survives as the record for whoever reads this later. The On the Kad tab layout: I'm with ngosang, and I'd like it done rather than deferred to a tracking issue. Concretely, Two more things to fix in this PR. |
ngosang noted on amule-org#402/amule-org#683 that this button looked like it duplicated Connect. Confirmed: OnBnClickedBootstrapKnown called the exact same theApp->StartKad() as the Kad tab's own Connect/Cancel/Disconnect toggle when off, so it was a second control for the same action rather than a distinct one -- removed.
… tab Addresses got3nks's remaining PR amule-org#683 review items: - SetBitmapMargins() now used on wxMSW/wxOSX (both implement DoSetBitmapMargins); the old comment had this backwards, claiming only wxOSX did. wxGTK keeps the leading-space trick since it's the actual no-op port. - ScaledConnButImg scales via FromDIP and caches the three resulting bitmaps as statics instead of rescaling on every SetConnectButtonState call (previously on every connection-state update). - Kad tab: dropped the two-column layout (graph | bootstrap box) for the same vertical shape serverListDlgUp uses -- full-width graph, then a full-width bootstrap-from-node row below. Collapsed the ID_NODE_IP1..4 four-octet fields into one, matching the eD2k tab's IDC_IPADDRESS. Verified (build + run, not just compile): the first version of the Kad redesign crashed reproducibly on tab switch -- amule.exe died inside COMCTL32.dll (access violation) every time the Kad tab was selected. Isolated via a stashed before/after comparison: the pre-redesign build switches to Kad fine, the redesign crashed 100% of the time. Root cause was the sizer restructuring -- replacing the wxFlexGridSizer that wrapped the nodes-stats graph with a direct item0->Add() changed the wrapping depth the graph's OScopeCtrl gets its first layout pass through. Fixed by keeping the original wrapping (a wxBoxSizer around the graph's wxStaticBoxSizer, same as before) and only removing the second column, rather than flattening both. Re-verified clean: Kad tab switches, populates (Nodes stats, Disconnect Kad, Bootstrap from node row) and no crash, confirmed against Windows Event Log for Application Error entries.
d8b2476 to
ec13cc5
Compare
|
All four addressed.
Icons: Kad tab redesign: done -- dropped the two-column layout for the same vertical shape Bootstrap removal: folded into the PR body now, alongside the toolbar button. One thing worth flagging since it's exactly the kind of thing you asked me to watch for on the last round: the first version of the Kad redesign had a real crash bug. Switching to the Kad tab reproducibly killed Root-caused by stashing the change and comparing: the pre-redesign build switches to Kad fine, the redesign crashed 100% of the time. The cause was sizer restructuring, not the single-IP-field change or the tooltip on it (both cleared as suspects first) -- replacing the Rebuilt clean, clang-format v18 applied (the real CI image this time), po regenerated, rebased onto current master, force-pushed. |
|
All four review points are addressed, and I re-tested the result on three platforms at I checked the IP-parsing rewrite for behavioural equivalence rather than taking the comment's word: the old code read fields 1→4 and built This needs a rebase before it can go in. Master moved after your last one — #689 landed and touched Since you'll be pushing again anyway, it'd be good to fold these three in rather than leaving them for a follow-up: Drop the explicit Key the bitmap cache by DPI. Trim whitespace on the pasted IP. The single field's whole point is easier copy-paste, and a paste carrying a leading or trailing space currently fails with "Invalid ip to bootstrap"; The rest looks good as it stands — ping me when it's rebased and I'll merge. |
…mule-org#402) Follow-up review feedback on amule-org#663/amule-org#677's per-tab connect/disconnect toggle: the button/icon were too large and sat flush against the tab strip, and since the same button occupies the same spot on both the ED2K and Kad tabs, its label ("Disconnect") didn't say which network it affects. Icons are now a uniform 16x16 (down from an inconsistent 32x32/16x16 mix), each row gets a top border, and the label now reads "Connect ED2K" / "Disconnect Kad" / etc. Also drops the global Connect/Disconnect toolbar button (ID_BUTTONCONNECT): it lost its click handler somewhere across the combined both-networks action is still reachable from the tray icon.
ngosang noted on amule-org#402/amule-org#683 that this button looked like it duplicated Connect. Confirmed: OnBnClickedBootstrapKnown called the exact same theApp->StartKad() as the Kad tab's own Connect/Cancel/Disconnect toggle when off, so it was a second control for the same action rather than a distinct one -- removed.
…e-equals-default
The previous commit was formatted with a different "clang-format 18"
Docker image (xianpengshen/clang-tools:18, actually 18.1.3) instead of
CI's ghcr.io/jidicula/clang-format:18 (18.1.8) -- they disagree on
~Dtor(){} spacing, which failed both the format check and, since that
line was now "changed", clang-tidy's modernize-use-equals-default.
… tab Addresses got3nks's remaining PR amule-org#683 review items: - SetBitmapMargins() now used on wxMSW/wxOSX (both implement DoSetBitmapMargins); the old comment had this backwards, claiming only wxOSX did. wxGTK keeps the leading-space trick since it's the actual no-op port. - ScaledConnButImg scales via FromDIP and caches the three resulting bitmaps as statics instead of rescaling on every SetConnectButtonState call (previously on every connection-state update). - Kad tab: dropped the two-column layout (graph | bootstrap box) for the same vertical shape serverListDlgUp uses -- full-width graph, then a full-width bootstrap-from-node row below. Collapsed the ID_NODE_IP1..4 four-octet fields into one, matching the eD2k tab's IDC_IPADDRESS. Verified (build + run, not just compile): the first version of the Kad redesign crashed reproducibly on tab switch -- amule.exe died inside COMCTL32.dll (access violation) every time the Kad tab was selected. Isolated via a stashed before/after comparison: the pre-redesign build switches to Kad fine, the redesign crashed 100% of the time. Root cause was the sizer restructuring -- replacing the wxFlexGridSizer that wrapped the nodes-stats graph with a direct item0->Add() changed the wrapping depth the graph's OScopeCtrl gets its first layout pass through. Fixed by keeping the original wrapping (a wxBoxSizer around the graph's wxStaticBoxSizer, same as before) and only removing the second column, rather than flattening both. Re-verified clean: Kad tab switches, populates (Nodes stats, Disconnect Kad, Bootstrap from node row) and no crash, confirmed against Windows Event Log for Application Error entries.
…d IP Addresses got3nks's final PR amule-org#683 round: - SetBitmapMargins() means different things per port: wxOSX stores it as the margin around the bitmap (a real gap fix there), but wxMSW applies it between bitmap and label only, on top of a font-derived default (GetCharWidth()/GetCharHeight()) that already matches native Windows button metrics -- overriding it moved the button away from platform convention rather than toward it. Now wxOSX-only; wxMSW keeps its untouched native default, wxGTK keeps the leading-space trick (still the only no-op port for this call). - ScaledConnButImg's cache is now keyed by the FromDIP-resolved physical pixel size, not just the state index, so a window dragged to a differently-scaled monitor (per-monitor DPI v2) gets a freshly-rescaled bitmap instead of a stale one left over from wherever it was first computed. - The Kad tab's single IP field is now Trim()med before wxSplit, so a copy-paste carrying leading/trailing whitespace -- the whole point of collapsing four fields into one -- no longer fails as "Invalid ip to bootstrap". Rebased onto current master (resolves the amule-org#689 conflict).
ec13cc5 to
b9082ea
Compare
|
All three folded in, plus the rebase. Rebased onto current master (both the #689 and #691 conflicts -- master moved again mid-review -- are resolved; no manual conflicts left in the source, only the usual po/ catalog churn from the regen).
Icon cache is now keyed by physical size, not just state. Pasted IP is now trimmed. Rebuilt clean, clang-format v18 applied (the real CI image), po regenerated, force-pushed. |
|
Merged as |
|
Screenshot of the new UI for @ngosang 's review
|
|
Thank you both. It looks muuuch better. |





Follow-up to the #663/#677 review feedback ngosang left on #402 after the per-tab connect/disconnect toggle landed:
Changes
connButImg's source pixel data is an inconsistent 32x32 (off/connected) vs 16x16 (connecting).SetConnectButtonStatenow scales all three to a uniform,FromDIP-aware size (so it stays crisp on HiDPI/Retina) rather than reworking the XPM data, and caches the three scaled bitmaps as statics instead of rescaling on every connection-state update.Border(wxTOP, 5).SetConnectButtonStategained anetworkNameparameter, so the label now reads "Connect ED2K" / "Disconnect Kad" / "Cancel ED2K" etc. instead of the bare, ambiguous "Connect"/"Disconnect"/"Cancel"._("ED2K")/_("Kad")reuse the same translatable strings as the tab labels, so a translation stays consistent between the two.SetBitmapMargins()is a real gap on wxMSW and wxOSX (both overrideDoSetBitmapMargins) but a silent no-op on wxGTK, which inherits the base class's empty implementation -- the previous comment here had this backwards (said only wxOSX implements it). Now callsSetBitmapMargins()on the ports that support it and keeps the old leading-space trick only for wxGTK.wxFlexGridSizer(graph in one column, "Bootstrap"/"New node" boxes in the other) in favor of the same vertical shapeserverListDlgUpalready uses: top row, full-width primary area (the graph, now with the full tab width instead of half), then a full-width manual-entry row below. That row also collapses the four-octetID_NODE_IP1..4fields into a single IP text field, matching the eD2k tab'sIDC_IPADDRESS-- easier to read and paste.OnBnClickedBootstrapClientnow splits that one field on.instead of reading four controls (still reverses the octets beforeStringIPtoUint32, same as before, since that function returns anti-host order and Kad wants host order).ID_BUTTONCONNECT) has noEVT_TOOLbinding anywhere inamuleDlg.cpp(confirmed there's noEVT_MENUalias either, which is the one thing that could have hidden a live binding here since wx mapswxEVT_TOOL/wxEVT_MENUtogether) -- it looks like the click handler was dropped somewhere across feat(gui): remove the global Connect/Disconnect toolbar button #663/fix(gui): consistent ED2K/Kad connect-button rows + macOS URL field height #677 and the button has been inert (visible, does nothing on click) ever since. Removed it; the combined both-networks action is still reachable from the tray icon (CMuleTrayIcon::DoConnectDisconnect), consistent with what was agreed on [GUI] Remove the global Connect/Disconnect button from the amulegui toolbar and move it into the Networks view #402.ID_KNOWNNODECONNECT) called the exact sametheApp->StartKad()the tab's own Connect/Cancel/Disconnect toggle already calls when off -- a second control for the same action. Removed (ngosang, this thread).po/*.poregenerated viascripts/update-po.sheach time a commit touched a translatable string.Testing
Built
amuleandamuleguiclean on Windows (MSYS2/MinGW-w64). clang-format v18 applied via the exact CI image (ghcr.io/jidicula/clang-format:18-- a substitute image with the same version string but a different point release,xianpengshen/clang-tools:18, disagreed with CI on a destructor-spacing edge case in an earlier push; fixed and confirmed idempotent against the real image).Fixes #402 (follow-up review comments).