feat: cache extra mod info (like links and body)

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow
2022-07-18 19:17:44 -03:00
parent 74c6c5cfbc
commit 5bc67d3f6b
3 changed files with 32 additions and 9 deletions

View File

@ -169,13 +169,13 @@ void ModPage::setSearchTerm(QString term)
ui->searchEdit->setText(term);
}
void ModPage::onSelectionChanged(QModelIndex first, QModelIndex second)
void ModPage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
{
ui->versionSelectionBox->clear();
if (!first.isValid()) { return; }
if (!curr.isValid()) { return; }
current = listModel->data(first, Qt::UserRole).value<ModPlatform::IndexedPack>();
current = listModel->data(curr, Qt::UserRole).value<ModPlatform::IndexedPack>();
if (!current.versionsLoaded) {
qDebug() << QString("Loading %1 mod versions").arg(debugName());
@ -195,7 +195,8 @@ void ModPage::onSelectionChanged(QModelIndex first, QModelIndex second)
if(!current.extraDataLoaded){
qDebug() << QString("Loading %1 mod info").arg(debugName());
listModel->requestModInfo(current);
listModel->requestModInfo(current, curr);
}
updateUi();