Skip to content

[DX Assistant] Wire DXClusterAssistant into MainWindow #1013

Description

@ea4k

Summary

Connect all DX Assistant components inside MainWindow. Currently the DXClusterAssistant action and instance are commented out (lines ~2681–2684 and ~873–875 in mainwindow.cpp). This issue activates them and wires the full signal/slot pipeline.

New members in mainwindow.h

std::unique_ptr<DXClusterAssistant>  dxClusterAssistant;
DXAssistantEngine                   *dxAssistantEngine   = nullptr;
ClubLogMostWanted                   *clubLogMostWanted   = nullptr;
QString                              myContinent;         // derived once at startup
QAction                             *dxClusterAssistantAct = nullptr;

Startup sequence (in init() / startServices())

  1. myContinent = world->getQRZContinentShortName(stationCallsign)
  2. Instantiate ClubLogMostWanted (if enabled in settings); call fetch()
  3. Instantiate DXAssistantEngine with &awards, world, dataProxy, clubLogMostWanted, myContinent
  4. Lazy-instantiate DXClusterAssistant (created on first slotShowDXClusterAssistant() call, same pattern as StatisticsWidget)

Signal connections

// New cluster spot → score it → feed to assistant
connect(dxClusterWidget.get(), &DXClusterWidget::dxspotArrived,
        this, &MainWindow::slotDXAssistantNewSpot);

// New QSO logged → recalculate all spot scores
connect(&awards, &Awards::awardDXCCUpdated,
        this, &MainWindow::slotDXAssistantRecalculate);

// ClubLog most-wanted list refreshed → recalculate
connect(clubLogMostWanted, &ClubLogMostWanted::mostWantedUpdated,
        this, &MainWindow::slotDXAssistantRecalculate);

// User activates a spot → tune radio + fill QSO entry form
connect(dxClusterAssistant.get(), &DXClusterAssistant::spotTuneRequested,
        this, &MainWindow::slotDXAssistantSpotTuneRequested);

New slots

// Called for every arriving DXCluster spot
void MainWindow::slotDXAssistantNewSpot(const DXSpot &spot)
{
    if (!dxClusterAssistant) return;
    DXAssistantSpot scored = dxAssistantEngine->score(spot);
    if (scored.score >= 0)   // score == -1 means discard (confirmed / invalid)
        dxClusterAssistant->addOrUpdateSpot(scored);
}

// Called after Awards update or ClubLog list refresh
void MainWindow::slotDXAssistantRecalculate()
{
    if (dxClusterAssistant)
        dxClusterAssistant->recalculateAll();
}

// Called when user double-clicks or context-menu "tunes" to a spot
void MainWindow::slotDXAssistantSpotTuneRequested(const DXAssistantSpot &spot)
{
    clusterSpotToLog(spot.dxCall, spot.freq);
}

// Lazy show/hide
void MainWindow::slotShowDXClusterAssistant()
{
    if (!dxClusterAssistant) {
        dxClusterAssistant = std::make_unique<DXClusterAssistant>(
            &awards, world, dataProxy, Q_FUNC_INFO, this);
        dxClusterAssistant->init();
        // re-connect spotTuneRequested here
    }
    dxClusterAssistant->show();
    dxClusterAssistant->raise();
}

Tools menu

Uncomment and complete (currently commented at lines ~2681–2684):

dxClusterAssistantAct = new QAction(tr("DX Assistant"), this);
dxClusterAssistantAct->setToolTip(tr("Show the DX Assistant — prioritised list of workable spots."));
toolMenu->addAction(dxClusterAssistantAct);
connect(dxClusterAssistantAct, &QAction::triggered,
        this, &MainWindow::slotShowDXClusterAssistant);

Settings guard

All wiring is conditional on DXAssistant/enabled in QSettings. If disabled, the menu action is hidden and no signals are connected.

Files affected

  • src/mainwindow.h — new members, new slots
  • src/mainwindow.cpp — implement slots, connect signals, uncomment menu action
  • src/CMakeLists.txt (or equivalent) — add new source files to build if not already included

Related

Part of the DX Assistant feature. Requires the widget redesign, scoring engine, and ClubLogMostWanted issues to be completed first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions