feat: use mod metadata for getting mod information

For now this doesn't mean much, but it will help when we need data
exclusive from the metadata, such as addon id and mod provider.

Also removes the metadata when the mod is deleted, and make the Mod.h
file a little more pleasing to look at :)
This commit is contained in:
flow
2022-04-15 00:24:57 -03:00
committed by flow
parent e93b9560b5
commit fcfb2cfc3d
5 changed files with 90 additions and 60 deletions

View File

@ -79,10 +79,14 @@ bool ModFolderModel::update()
return true;
}
auto task = new ModFolderLoadTask(m_dir);
auto index_dir = indexDir();
auto task = new ModFolderLoadTask(dir(), index_dir);
m_update = task->result();
QThreadPool *threadPool = QThreadPool::globalInstance();
connect(task, &ModFolderLoadTask::succeeded, this, &ModFolderModel::finishUpdate);
threadPool->start(task);
return true;
}
@ -334,7 +338,8 @@ bool ModFolderModel::deleteMods(const QModelIndexList& indexes)
for (auto i: indexes)
{
Mod &m = mods[i.row()];
m.destroy();
auto index_dir = indexDir();
m.destroy(index_dir);
}
return true;
}