aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-07-08 16:25:35 +0200
committerGitHub <noreply@github.com>2022-07-08 16:25:35 +0200
commit08989bde5ea2f08ece041b5b6d092ad324d2f431 (patch)
treee49083bb881ca4baf40bfe10ec4a4907f42807fa /launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
parentf1902a44716201d9d6431cab762663cd749b58eb (diff)
parente5f6dc1b14a03b078b69be1c4c3c5819092604c3 (diff)
downloadPrismLauncher-08989bde5ea2f08ece041b5b6d092ad324d2f431.tar.gz
PrismLauncher-08989bde5ea2f08ece041b5b6d092ad324d2f431.tar.bz2
PrismLauncher-08989bde5ea2f08ece041b5b6d092ad324d2f431.zip
Merge pull request #839 from flowln/modrinth_packs_bug_hunt
Diffstat (limited to 'launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp')
-rw-r--r--launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
index 39b935a6..3633d575 100644
--- a/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
+++ b/launcher/ui/pages/modplatform/modrinth/ModrinthModel.cpp
@@ -104,6 +104,17 @@ auto ModpackListModel::data(const QModelIndex& index, int role) const -> QVarian
return {};
}
+bool ModpackListModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ int pos = index.row();
+ if (pos >= modpacks.size() || pos < 0 || !index.isValid())
+ return false;
+
+ modpacks[pos] = value.value<Modrinth::Modpack>();
+
+ return true;
+}
+
void ModpackListModel::performPaginatedSearch()
{
// TODO: Move to standalone API
@@ -279,6 +290,10 @@ void ModpackListModel::searchRequestFinished(QJsonDocument& doc_all)
searchState = CanPossiblyFetchMore;
}
+ // When you have a Qt build with assertions turned on, proceeding here will abort the application
+ if (newList.size() == 0)
+ return;
+
beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1);
modpacks.append(newList);
endInsertRows();