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:
- Snapshot spec strings of everything already in
m_profilesintoloadedSpecsbefore doing any work, so subsequent calls cannot add a spec-twin of an already-loaded profile. - Load MLT profiles into a temporary
mltBySpecmap (spec -> profile), skipping any spec already inloadedSpecsormltBySpec. One representative per unique spec survives. - Load Kdenlive AppDataLocation profiles, for each, erase the matching entry from
mltBySpec(Kdenlive's copy wins over MLT's), then insert intom_profiles. - Flush remaining
mltBySpecentries (MLT profiles with no Kdenlive equivalent) intom_profiles.
Edited by Yash Bavadiya