JS8Call-Improved master
Loading...
Searching...
No Matches
ActivityStorageController Class Reference

Orchestrates per-band persistent activity storage (issue #267). More...

#include <ActivityStorageController.h>

Inheritance diagram for ActivityStorageController:
Collaboration diagram for ActivityStorageController:

Classes

struct  Context
 The window state and operations this controller needs. More...

Public Member Functions

 ActivityStorageController (Context context, QObject *parent=nullptr)
 Construct the controller over an already-built window.
bool importLegacyActivityIfNeeded ()
 Import the legacy .ini activity once per configuration.
void beginStartupGrace ()
 Start the grace period allowed for the rig to report a band.
void showLegacyRxTextIfDegraded ()
 Show the legacy .ini RX text when the store is unavailable.
void setupRxTextAutosave ()
 Connect the debounced RX-text write-back timers.
QString currentBucket () const
 The bucket the on-screen panes belong to ("" = out-of-plan).
bool isBucketLoaded () const
 Whether a bucket has been restored into the panes yet.
void bandUnchanged (QString const &band)
 The rig reported the band the panes already hold.
void bandChanged (QString const &band)
 The rig reported a different band; park and switch buckets.
void bucketRestored (QString const &band, bool paneReloaded)
 Record that the window has restored a bucket's panes.
void persistCallActivity (CallDetail const &d, bool fallbackToCurrentBand=false)
 Upsert one station into the store.
void adjustCallActivityOffsets (int hzDelta)
 Shift every stored offset for the current bucket.
void beginBatch ()
 Open a write batch; nested batches share one transaction.
void endBatch ()
 Close a write batch, committing at the outermost level.
void clearAllActivity ()
 Drop every stored row, across all buckets and both panes.
void clearRxActivity ()
 Drop the current bucket's stored RX text.
void clearCallActivity ()
 Drop the current bucket's stored Call Activity rows.
void removeStoredCall (QString const &call)
 Drop one station from the current bucket.
void flushOnClose ()
 Final flush: sweep every confirmed bucket's pending writes.

Detailed Description

Orchestrates per-band persistent activity storage (issue #267).

ActivityDB is the SQLite wrapper; this is everything above it - which bucket the panes belong to, when a bucket's stored history may be merged into the session, when the RX pane may be written back, the write batching, the one-time legacy .ini import, and the close-time sweep. It deliberately does not know about UI_Constructor: the window state it needs arrives through Context, so the window keeps only a pointer to this object and thin delegating calls.

"Bucket" rather than "band" throughout: the bucket a pane belongs to is a band name, or "" - the out-of-plan bucket, which persists activity heard on dials outside the band plan (transverter IFs, channelized operation) the way the legacy un-banded ini did.

Constructor & Destructor Documentation

◆ ActivityStorageController()

ActivityStorageController::ActivityStorageController ( Context context,
QObject * parent = nullptr )
explicit

Construct the controller over an already-built window.

Parameters
contextThe window state and callbacks it may use.
parentOptional QObject parent. UI_Constructor passes none and holds the sole owning std::unique_ptr instead: the window is the only thing that ever refers to this object, and single ownership keeps the teardown order obvious rather than relying on a member unique_ptr running before ~QObject reaps its children.

Member Function Documentation

◆ adjustCallActivityOffsets()

void ActivityStorageController::adjustCallActivityOffsets ( int hzDelta)

Shift every stored offset for the current bucket.

Rewrite every displayed offset after a waterfall nudge.

Parameters
hzDeltaSigned offset change in Hz.
hzDeltaThe shift applied to the receiver's offsets.

Only writes back rows whose own dial belongs to the current band; cross-band stragglers and dial-less RAM-only entries are skipped (dial-less manual adds go through the fallback path instead).

Here is the call graph for this function:

◆ bandChanged()

void ActivityStorageController::bandChanged ( QString const & band)

The rig reported a different band; park and switch buckets.

The rig reported a different band from the one on screen.

Parameters
bandThe newly confirmed band name.
bandThe band reported.

◆ bandUnchanged()

void ActivityStorageController::bandUnchanged ( QString const & band)

The rig reported the band the panes already hold.

The rig reported the band the window already believes it is on.

Parameters
bandThe confirmed band name.
bandThe band reported.

◆ beginBatch()

void ActivityStorageController::beginBatch ( )

Open a write batch; nested batches share one transaction.

Open a write batch; nested batches share one lazily-started transaction.

Here is the caller graph for this function:

◆ beginStartupGrace()

void ActivityStorageController::beginStartupGrace ( )

Start the grace period allowed for the rig to report a band.

Start the grace period for an as-yet unconfirmed bucket.

Until it does (or this lapses, covering Rig=None), RX text is not filed: it carries no per-line frequency, so the bucket would only be the previous session's guess.

◆ bucketRestored()

void ActivityStorageController::bucketRestored ( QString const & band,
bool paneReloaded )

Record that the window has restored a bucket's panes.

Take up the bucket the window has just restored on screen.

Parameters
bandThe bucket restored.
paneReloadedtrue if the RX pane was replaced wholesale.
bandThe bucket now displayed.
paneReloadedTrue when panes were reloaded from the RAM band caches; false when re-entering the bucket already on screen.

◆ clearAllActivity()

void ActivityStorageController::clearAllActivity ( )

Drop every stored row, across all buckets and both panes.

Storage half of the "Clear All Activity" action.

Spans every band, including RAM band caches, not just the bucket on screen. Every bucket is marked unseeded afterward so nothing reloads stale pre-clear history. Called after the window clears its panes, to avoid the inbox refresh repopulating what was just wiped.

◆ clearCallActivity()

void ActivityStorageController::clearCallActivity ( )

Drop the current bucket's stored Call Activity rows.

The "Clear Call Activity" action, store and pane.

Bucket-scoped: rows stored under another band (e.g. a post-QSY decode) are untouched. Unread inbox senders reappear regardless, re-synthesized from inbox.db3. On failure the bucket is left seeded, since the pane still holds its stored text.

◆ clearRxActivity()

void ActivityStorageController::clearRxActivity ( )

Drop the current bucket's stored RX text.

The "Clear RX Activity" action, store and pane.

Store is cleared before the pane, so a delete failure leaves the pane intact rather than risking a later seed splicing the stored text back in. On failure the bucket is forced unseeded and its debounce stopped.

◆ endBatch()

void ActivityStorageController::endBatch ( )

Close a write batch, committing at the outermost level.

Close the outermost batch, committing its transaction.

Here is the caller graph for this function:

◆ flushOnClose()

void ActivityStorageController::flushOnClose ( )

Final flush: sweep every confirmed bucket's pending writes.

Final flush of everything the session has not written yet.

Seeds the current bucket once more if it never seeded, then flushes its RX text. Other dirty bands that only exist in the RAM cache get one last write too: appended to stored text if never seeded, or replacing it if already seeded (since the cached doc then already contains that history).

◆ importLegacyActivityIfNeeded()

bool ActivityStorageController::importLegacyActivityIfNeeded ( )

Import the legacy .ini activity once per configuration.

One-time import of legacy .ini activity data into activity.db3.

Returns
true if an import ran to completion this call.
True when the configuration needs no further import.

Rows go to the band of their stored dial; the RX text blob (no per-line frequency) goes to the last-known dial's band. Gated by a fire-once marker row keyed by configuration id, written in the same transaction as the import so a failure retries cleanly. A clone (carrying a source marker instead of its own id) copies its source's rows first.

◆ persistCallActivity()

void ActivityStorageController::persistCallActivity ( CallDetail const & d,
bool fallbackToCurrentBand = false )

Upsert one station into the store.

Write one call-activity row to the store.

Parameters
dThe station as displayed.
fallbackToCurrentBandFile under the on-screen bucket when the record carries no usable dial frequency of its own.
dThe row to persist.
fallbackToCurrentBandFile a dial-less row under the bucket on screen; only for manual adds, grid backfills, and qsy()'s write-back for those same rows.

Filed under the band of the row's own dial (not the live band), so post-QSY decodes and inbox senders keep the band they were heard on. If that's a different bucket than the one displayed, the row is merged into that bucket's RAM cache instead of forcing a re-seed.

Here is the caller graph for this function:

◆ removeStoredCall()

void ActivityStorageController::removeStoredCall ( QString const & call)

Drop one station from the current bucket.

Drop one station's stored row for the bucket on screen.

Parameters
callThe callsign to remove.
callThe callsign the operator removed from the table.

Bucket-scoped; a row on another band is untouched. Whether the store was open is read before the delete, so a self-close triggered by the delete itself doesn't get misreported as the row being on another band.

◆ setupRxTextAutosave()

void ActivityStorageController::setupRxTextAutosave ( )

Connect the debounced RX-text write-back timers.

Wire up the debounced write-on-change persistence of the RX pane.

◆ showLegacyRxTextIfDegraded()

void ActivityStorageController::showLegacyRxTextIfDegraded ( )

Show the legacy .ini RX text when the store is unavailable.

Show the legacy ini RX text on a degraded or disabled start.

Display only, and recorded as such, so a later recovery does not bank a second copy of history the import already holds.

Display only. Records the copy's extent in m_rxTextLegacyBand / m_rxTextLegacyBlocks so later saves/seeds treat only session text below it as the session's own.


The documentation for this class was generated from the following files: