feat(gui): add "Connected since" to the ED2K/Kad Info panes - #650
Conversation
got3nks
left a comment
There was a problem hiding this comment.
Thanks @LSalami — the change itself is clean (stamping the timestamp off the same false→true transition ShowConnectionState() already detects is the right call, and the panes read well).
For the next release we're trying to make every feature available across all three clients — amule, amulegui, and amuleapi — so I'd rather not land this monolithic-only (it's currently #ifndef CLIENT_GUI, so amulegui and amuleapi don't get it). Could you wire "Connected since" over the EC protocol instead? The connection state already flows to the remote clients, so carrying the two timestamps alongside it is the natural spot — that surfaces it to amulegui, and lets amuleapi expose it too.
One heads-up on the EC tag: we keep the abstract and the committed header in sync by hand — add the tag to src/libs/ec/abstracts/ECCodes.abstract, then hand-add the two matching lines to src/libs/ec/cpp/ECCodes.h (the EC_TAG_… = 0xNNNN, enum entry and its case 0xNNNN: return "EC_TAG_…"; in the debug-name switch). Please don't regenerate the committed header — the generator reflows the whole license block into a huge diff.
Ping me when it's ready and I'll review again.
…g#174) CamuleApp::ShowConnectionState() already detects the exact tick a connection flips false->true (and back) to decide whether to log "Connected to ..." / "Disconnected from ..." -- stamp that same transition into m_ed2kConnectedSince / m_kadConnectedSince instead of tracking it separately, so the timestamp can't drift from what the log already says happened. CServerWnd::UpdateED2KInfo/UpdateKadInfo (Networks -> ED2K Info / Kad Info) add a "Connected since:" row when connected, using the locale-aware date+time format ("%x %X"). Monolithic-only: the timestamp lives on CamuleApp and isn't carried over the EC protocol, so amulegui doesn't show it -- gated behind small, self-contained change. Verified both the monolithic amule and amulegui targets still build with the guard in place. Manually verified in a running app: both panes show "Connected since:" with the expected timestamp once ed2k/Kad connect.
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).
2421d7b to
f62aa77
Compare
|
Done in f62aa77 — wired "Connected since" over EC as two new optional
Rebased onto current master and regenerated the Verified for real, not just compiled: built and ran all three targets (amule, amulegui, amuleapi) locally, plus the full unit test suite (26/26 passing, including |
got3nks
left a comment
There was a problem hiding this comment.
Thanks — this is exactly the shape I wanted: full parity across amule / amulegui / amuleapi, ECCodes hand-synced cleanly, docs and tests included. Merging once CI's green.
Pre-existing m_CurrServer = 0 in CServerConnectRem::HandlePacket ended up on a changed line when the ed2k-branch was restructured to also set m_ed2kConnectedSince, tripping clang-tidy's changed-lines Tier-2 check (modernize-use-nullptr) in CI on amule-org#650.
Mechanical rebase to resolve the po/ catalog conflicts against master's amule-org#648/amule-org#650/amule-org#651 (per got3nks's note on amule-org#643) -- no source changes here, scripts/update-po.sh output only, so the diff is just the tree back in sync with the current strings.
Mechanical rebase to resolve the po/ conflicts against master's amule-org#643/amule-org#646/amule-org#648/amule-org#650/amule-org#651 -- no source changes here. Confirms got3nks's prediction on the Alt+<letter>-outside-_() fix: the only genuinely new msgid in the diff is "Navigate" (the new macOS menu itself); every other hunk is line-number-comment churn from the rebase, not orphaned or duplicated translations.
Mechanical rebase to resolve the po/ catalog conflicts against master's amule-org#648/amule-org#650/amule-org#651 (per got3nks's note on amule-org#643) -- no source changes here, scripts/update-po.sh output only, so the diff is just the tree back in sync with the current strings.
* feat(search): persist search history across restarts (#641) The search field was a plain text control with no memory of past searches. Swap it for a wxComboBox (a wxTextEntry, like wxTextCtrl, so the existing GetValue()/Clear() call sites keep working via that shared base) and persist submitted terms to wxConfig, most-recent first, capped at 20 entries and deduplicated case-insensitively. Right-clicking the field opens a small menu ("Remember search history" checkbox + "Clear search history") so history can be paused or wiped without a dedicated Preferences page. i18n: ran scripts/update-po.sh to register the two new menu strings. * style(search): separate the destructive Clear item from the toggle above A separator between the checkbox and "Clear search history" keeps the one-shot destructive action visually distinct from the persistent on/off state, instead of reading as a second toggle in the same group. * style(search): use nullptr instead of NULL for the new combo box Fixes the modernize-use-nullptr clang-tidy finding on the changed line; matches the nullptr convention already used a couple of wxComboBox constructions below in the same file. * feat(search): rework query history per #643 review — file, prefs toggle, edit menu Addresses all four blocking points from got3nks's review, plus both optional suggestions: 1. Edit context menu restored. Overriding the field's context menu no longer drops Cut/Copy/Paste/Select All -- same custom-Paste-ID idiom as CMuleTextCtrl::OnRightDown (wxMenu over-permits wxID_PASTE, so it gets a manual clipboard-content check), plus a separator, plus the history's own Clear action. 2. Persisted to a dedicated searchhistory.dat (via CTextFile, one term per line) instead of amule.conf -- mirrors eMule's AC_SearchStrings.dat. Query terms no longer bloat the main config or travel with config backups / the --amule-config-file push to amuleweb/amuleapi. 3. "Remember search history" moved into Preferences > General as an ordinary Cfg_Bool checkbox (IDC_SEARCHHISTORYENABLED), same NewCfgItem wiring as every other GUI-behavior toggle on that page. It's a client-side-only setting, so the one checkbox works unchanged in both amule and amuleGUI. The context menu keeps only Clear (a one-shot action, not a setting to toggle from a hidden menu). 4. Cap raised from 20 to 30, matching eMule's CCustomAutoComplete default. Optional, done anyway: - wxComboBox::AutoComplete() wired up (eMule's ACO_AUTOSUGGEST equivalent), re-armed after every load/record/clear so it always reflects the current entry set. - Explicitly framed as *query* history throughout (comments, tooltip) to distinguish it from the separate, not-yet-implemented result persistence that's the rest of #641. The dedup/move-to-front/cap logic that used to live inline in CSearchDlg::RecordSearchHistory is extracted into a pure function, ApplySearchHistoryEntry() (SearchHistory.h/.cpp), decoupled from wxComboBox/wxConfig specifically so it's unit-testable without a wx event loop -- new SearchHistoryTest covers empty-list insert, reorder of an existing term, case-insensitive dedup, empty-term no-op, and capping (including locking in the actual 30-entry constant). Rebased onto current master; po/ catalogs regenerated as the final step so the diff is just the new/changed strings in sync with the tree. Verified for real: built and ran both amule and amulegui, plus the full unit test suite (27/27 passing, including the new SearchHistoryTest's 7 cases). * fix(tests): link Format.cpp + strerror_r.c into SearchHistoryTest Same Linux/mingw-only link failure as CMuleCollectionTest/MagnetURITest already work around: muleunit's MuleDebug.cpp needs CFormat for its glibc backtrace path, which isn't compiled in on macOS -- so the target linked fine locally but failed on the Ubuntu/mingw CI builds (and the clang-tidy jobs, which build the tree first). * i18n: regenerate po/ catalogs after rebasing onto current master Mechanical rebase to resolve the po/ catalog conflicts against master's #648/#650/#651 (per got3nks's note on #643) -- no source changes here, scripts/update-po.sh output only, so the diff is just the tree back in sync with the current strings. * fix(search): avoid an unnamed EReadTextFile bitmask cast in history load txtIgnoreEmptyLines|txtStripWhitespace has no single named enumerator to cast to -- clang-tidy Tier-1 flagged it (clang-analyzer-optin.core. EnumCastOutOfRange), correctly: EReadTextFile isn't a flag enum, so a synthesized OR'd value is genuinely out of its declared range even though CTextFile::ReadLines treats it as bitflags at runtime. txtReadDefault would dodge the cast but also drops '#'-led lines, silently eating a legitimate search term that happens to start with one. Read unfiltered (txtReadAll, a real enumerator) and do the trim/empty-line-drop by hand instead -- same behavior, no cast, no lost terms. * i18n: regenerate po/ catalogs after rebasing onto current master Mechanical rebase to resolve the po/ conflicts against master's #642 (just merged) -- no source changes here.
Summary
Fixes #174 — "Nothing major here but knowing the connect time is sometimes useful."
Implementation
CamuleApp::ShowConnectionState()already detects the exact tick aconnection flips false→true (and back) to decide whether to log
"Connected to ..." / "Disconnected from ...". This stamps that same
transition into
m_ed2kConnectedSince/m_kadConnectedSinceinstead oftracking it separately, so the timestamp can't drift from what the log
already says happened.
CServerWnd::UpdateED2KInfo/UpdateKadInfo(Networks → ED2K Info /Kad Info) add a "Connected since:" row when connected, using the
locale-aware date+time format (
%x %X).Monolithic-only: the timestamp lives on
CamuleAppand isn't carriedover the EC protocol, so
amuleguidoesn't show it — gated behind#ifndef CLIENT_GUIrather than adding new EC wiring, to keep this asmall, self-contained change matching the issue's "nothing major" scope.
Happy to extend it over EC in a follow-up if that's wanted.
Test plan
amuleandamuleguitargets build cleanly with the#ifndef CLIENT_GUIguard in placescripts/update-po.shrun to register the new string