fix: mod skipping between pages and remove dead code
This commit is contained in:
parent
696a711e39
commit
2e9d7f5c3d
@ -109,11 +109,12 @@ void ModpackListModel::performPaginatedSearch()
|
|||||||
auto searchAllUrl = QString(BuildConfig.MODRINTH_PROD_URL +
|
auto searchAllUrl = QString(BuildConfig.MODRINTH_PROD_URL +
|
||||||
"/search?"
|
"/search?"
|
||||||
"offset=%1&"
|
"offset=%1&"
|
||||||
"limit=20&"
|
"limit=%2&"
|
||||||
"query=%2&"
|
"query=%3&"
|
||||||
"index=%3&"
|
"index=%4&"
|
||||||
"facets=[[\"project_type:modpack\"]]")
|
"facets=[[\"project_type:modpack\"]]")
|
||||||
.arg(nextSearchOffset)
|
.arg(nextSearchOffset)
|
||||||
|
.arg(m_modpacks_per_page)
|
||||||
.arg(currentSearchTerm)
|
.arg(currentSearchTerm)
|
||||||
.arg(currentSort);
|
.arg(currentSort);
|
||||||
|
|
||||||
@ -269,10 +270,10 @@ void ModpackListModel::searchRequestFinished(QJsonDocument& doc_all)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packs_all.size() < 25) {
|
if (packs_all.size() < m_modpacks_per_page) {
|
||||||
searchState = Finished;
|
searchState = Finished;
|
||||||
} else {
|
} else {
|
||||||
nextSearchOffset += 25;
|
nextSearchOffset += m_modpacks_per_page;
|
||||||
searchState = CanPossiblyFetchMore;
|
searchState = CanPossiblyFetchMore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,25 +309,6 @@ void ModpackListModel::searchRequestFailed(QString reason)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModpackListModel::versionRequestSucceeded(QJsonDocument doc, QString id)
|
|
||||||
{
|
|
||||||
auto& current = m_parent->getCurrent();
|
|
||||||
if (id != current.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto arr = doc.isObject() ? Json::ensureArray(doc.object(), "data") : doc.array();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// loadIndexedPackVersions(current, arr);
|
|
||||||
} catch (const JSONValidationError& e) {
|
|
||||||
qDebug() << doc;
|
|
||||||
qWarning() << "Error while reading " << debugName() << " mod version: " << e.cause();
|
|
||||||
}
|
|
||||||
|
|
||||||
// m_parent->updateModVersions();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Modrinth
|
} // namespace Modrinth
|
||||||
|
|
||||||
/******** Helpers ********/
|
/******** Helpers ********/
|
||||||
|
@ -79,8 +79,6 @@ class ModpackListModel : public QAbstractListModel {
|
|||||||
void searchRequestFinished(QJsonDocument& doc_all);
|
void searchRequestFinished(QJsonDocument& doc_all);
|
||||||
void searchRequestFailed(QString reason);
|
void searchRequestFailed(QString reason);
|
||||||
|
|
||||||
void versionRequestSucceeded(QJsonDocument doc, QString addonId);
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void logoFailed(QString logo);
|
void logoFailed(QString logo);
|
||||||
@ -112,5 +110,7 @@ class ModpackListModel : public QAbstractListModel {
|
|||||||
|
|
||||||
QByteArray m_all_response;
|
QByteArray m_all_response;
|
||||||
QByteArray m_specific_response;
|
QByteArray m_specific_response;
|
||||||
|
|
||||||
|
int m_modpacks_per_page = 20;
|
||||||
};
|
};
|
||||||
} // namespace ModPlatform
|
} // namespace ModPlatform
|
||||||
|
Loading…
Reference in New Issue
Block a user