From 05a52648701187716de5a5ca4dcde7e73436d2ab Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Sat, 5 Jul 2025 19:03:05 +0200 Subject: [PATCH] Fix import of xpt and xptz files (#7986) (#7990) Fix the import of `xpt` and `xptz` files by adding upgrade code to `DataFile::type`. The new code maps the old textual representation "pattern" to the enum `Type::MidiClip`. Without the extra upgrade code the text "pattern" is mapped to `Type::Unknown`. This then leads to problems at the end of `DataFile::loadData` where the enum representation is mapped back to the textual representation again to retrieve the root element from the upgraded XML. So without the upgrade it's: * Map "pattern" to `Type::Unknown` * Upgrade XML from "pattern" to "midiclip" * `Type::Unknown` does not map to "midiclip" and fetching the root element fails. With the upgrade it's: * Map "pattern" to `Type::MidiClip` * Upgrade XML from "pattern" to "midiclip" * `Type::MidiClip` is mapped to "midiclip" and fetching the root element succeeds. --- src/core/DataFile.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index a724f25c0..04a3574d7 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -605,6 +605,11 @@ DataFile::Type DataFile::type( const QString& typeName ) return Type::InstrumentTrackSettings; } + if (typeName == "pattern") + { + return Type::MidiClip; + } + return Type::Unknown; }