Skip to content

Optimization: Move ADIF import off the UI thread #1024

@ea4k

Description

@ea4k

Problem

The ADIF import loop in src/filemanager.cpp:872-933 parses the file and inserts every QSO synchronously on the main (GUI) thread. The work is correctly wrapped in a single transaction (beginTransaction() at src/filemanager.cpp:870), but the event loop is still starved for the whole duration.

filemanager.cpp contains no QThread/QtConcurrent usage, even though the codebase already uses QtConcurrent::run elsewhere (e.g., src/dataproxy_sqlite.cpp:69, :9029), so the pattern is established in the project.

User-visible symptom

Importing a 5k–50k QSO ADIF file freezes the window for tens of seconds to minutes. The app appears hung ("not responding"), and users may force-kill it mid-import.

Proposed fix

  • Run the parse + insert loop in a worker via QtConcurrent::run (note: SQLite/QSqlDatabase requires a separate connection per thread).
  • Report progress back through queued signals to the existing progress dialog (the progress UI infrastructure is already there).
  • Refresh log model / awards / DXCC widgets once at the end, not per QSO.

Combined with the missing-index fix on the log table (duplicate checks during import are currently full-table scans), import time should drop dramatically and the UI stays responsive throughout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions