aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-05-16 19:17:37 -0300
committerflow <flowlnlnln@gmail.com>2022-05-16 19:17:37 -0300
commit2e9d7f5c3d3cbc33ad95d830af4fdcab6eab6a06 (patch)
treeb6c848e7f65bcdf5b0055ef6b773a4c7dc9e4fd7 /launcher/ui
parent696a711e397440275a55f4dbe02947a78ab0b208 (diff)
downloadPrismLauncher-2e9d7f5c3d3cbc33ad95d830af4fdcab6eab6a06.tar.gz
PrismLauncher-2e9d7f5c3d3cbc33ad95d830af4fdcab6eab6a06.tar.bz2
PrismLauncher-2e9d7f5c3d3cbc33ad95d830af4fdcab6eab6a06.zip
fix: mod skipping between pages and remove dead code
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp30
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.h4
2 files changed, 8 insertions, 26 deletions
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
index 701a2032..7cacf37a 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
@@ -109,11 +109,12 @@ void ModpackListModel::performPaginatedSearch()
auto searchAllUrl = QString(BuildConfig.MODRINTH_PROD_URL +
"/search?"
"offset=%1&"
- "limit=20&"
- "query=%2&"
- "index=%3&"
+ "limit=%2&"
+ "query=%3&"
+ "index=%4&"
"facets=[[\"project_type:modpack\"]]")
.arg(nextSearchOffset)
+ .arg(m_modpacks_per_page)
.arg(currentSearchTerm)
.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;
} else {
- nextSearchOffset += 25;
+ nextSearchOffset += m_modpacks_per_page;
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
/******** Helpers ********/
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.h b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.h
index bffea54d..14aa6747 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.h
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.h
@@ -79,8 +79,6 @@ class ModpackListModel : public QAbstractListModel {
void searchRequestFinished(QJsonDocument& doc_all);
void searchRequestFailed(QString reason);
- void versionRequestSucceeded(QJsonDocument doc, QString addonId);
-
protected slots:
void logoFailed(QString logo);
@@ -112,5 +110,7 @@ class ModpackListModel : public QAbstractListModel {
QByteArray m_all_response;
QByteArray m_specific_response;
+
+ int m_modpacks_per_page = 20;
};
} // namespace ModPlatform