Commit 8c45212e authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

When opening a project saved with a previous Kdenlive version, ensure we...

When opening a project saved with a previous Kdenlive version, ensure we recover the guides categories if missing
parent 35a4d73f
Pipeline #260988 failed with stage
in 5 minutes and 23 seconds
......@@ -10,6 +10,7 @@
#include "dialogs/exportguidesdialog.h"
#include "dialogs/markerdialog.h"
#include "doc/docundostack.hpp"
#include "doc/kdenlivedoc.h"
#include "kdenlivesettings.h"
#include "macros.hpp"
#include "project/projectmanager.h"
......@@ -674,8 +675,15 @@ bool MarkerListModel::importFromJson(const QString &data, bool ignoreConflicts,
QString comment = entryObj[QLatin1String("comment")].toString(i18n("Marker"));
int type = entryObj[QLatin1String("type")].toInt(0);
if (!pCore->markerTypes.contains(type)) {
qDebug() << "Warning : invalid type found:" << type << " Defaulting to 0";
type = 0;
qDebug() << "Warning : invalid type found:" << type << " Recovering category";
type = type % 9;
if (!pCore->markerTypes.contains(type)) {
QString originalCategory = KdenliveDoc::getDefaultGuideCategories().at(type);
QColor color(originalCategory.section(QLatin1Char(':'), -1));
pCore->markerTypes.insert(type, {color, i18n("Recovered %1", type)});
emit categoriesChanged();
emit pCore->updateDefaultMarkerCategory();
}
}
bool res = true;
if (!ignoreConflicts && hasMarker(GenTime(pos, pCore->getCurrentFps()))) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment