Fix duplicate profiles appearing in New Project dialog

Fixes the duplicate HD 720p (and other) profiles shown in the New Project profile picker.

Root cause

Two compounding bugs:

Bug 1 : MLT ships duplicate profile files with identical specs. For example, atsc_720p_25 and hdv_720_25p both describe "HD 720p 25 fps" (1280×720, 25/1, progressive, SAR 1:1). The old refresh() loaded all files indiscriminately, so both appeared in the UI.

Bug 2 : refresh() is called multiple times, breaking naïve deduplication. ProfileTreeModel::construct() calls refresh() a second time after the constructor already called it once. On the second call, the first file is already in m_profiles and gets skipped, but the duplicate is not, so it sneaks back in as a "new" profile.

Fix

refresh() was rewritten with a three-step approach:

  1. Snapshot spec strings of everything already in m_profiles into loadedSpecs before doing any work, so subsequent calls cannot add a spec-twin of an already-loaded profile.
  2. Load MLT profiles into a temporary mltBySpec map (spec -> profile), skipping any spec already in loadedSpecs or mltBySpec. One representative per unique spec survives.
  3. Load Kdenlive AppDataLocation profiles, for each, erase the matching entry from mltBySpec (Kdenlive's copy wins over MLT's), then insert into m_profiles.
  4. Flush remaining mltBySpec entries (MLT profiles with no Kdenlive equivalent) into m_profiles.

BUG: 475724

Edited by Yash Bavadiya

Merge request reports

Loading