This commit is contained in:
itsmattkc
2019-01-12 12:04:41 +11:00
parent 462e7ba586
commit 9a78ffdfac
2 changed files with 16 additions and 5 deletions
+10 -2
View File
@@ -238,7 +238,11 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
item->set_footage(m);
project_model.appendChild(find_loaded_folder_by_id(folder), item);
if (folder == 0) {
project_model.appendChild(NULL, item);
} else {
find_loaded_folder_by_id(folder)->appendChild(item);
}
// analyze media to see if it's the same
loaded_media_items.append(item);
@@ -568,7 +572,11 @@ void LoadThread::run() {
for (int i=0;i<loaded_folders.size();i++) {
Media* folder = loaded_folders.at(i);
int parent = folder->temp_id2;
project_model.appendChild(find_loaded_folder_by_id(parent), folder);
if (folder->temp_id2 == 0) {
project_model.appendChild(NULL, folder);
} else {
find_loaded_folder_by_id(parent)->appendChild(folder);
}
}
cont = load_worker(file, stream, MEDIA_TYPE_FOOTAGE);
+6 -3
View File
@@ -372,7 +372,11 @@ Media* Project::new_sequence(ComboAction *ca, Sequence *s, bool open, Media* par
ca->append(new NewSequenceCommand(item, parent));
if (open) ca->append(new ChangeSequenceAction(s));
} else {
project_model.appendChild(NULL, item);
if (parent == project_model.get_root()) {
project_model.appendChild(parent, item);
} else {
parent->appendChild(item);
}
if (open) set_sequence(s);
}
return item;
@@ -868,7 +872,6 @@ void Project::load_project(bool autorecovery) {
}
void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex& parent) {
bool root = (!parent.parent().isValid());
for (int i=0;i<project_model.rowCount(parent);i++) {
const QModelIndex& item = project_model.index(i, 0, parent);
Media* m = project_model.getItem(item);
@@ -892,7 +895,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
}
// save_folder(stream, item, type, set_ids_only);
} else {
int folder = root ? 0 : project_model.getItem(parent)->temp_id;
int folder = (m->parentItem() != NULL) ? m->parentItem()->temp_id : 0;
if (type == MEDIA_TYPE_FOOTAGE) {
Footage* f = m->to_footage();
f->save_id = media_id;