From 2d10c246a8e80a5af7535e2ff94442c6db178486 Mon Sep 17 00:00:00 2001 From: flow Date: Sat, 4 Jun 2022 21:18:51 -0300 Subject: feat: add update mods to the ui / mod model Signed-off-by: flow --- launcher/minecraft/mod/ModFolderModel.cpp | 12 ++++++++++++ launcher/minecraft/mod/ModFolderModel.h | 2 ++ 2 files changed, 14 insertions(+) (limited to 'launcher/minecraft/mod') diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp index 5ee08cbf..e72eb13e 100644 --- a/launcher/minecraft/mod/ModFolderModel.cpp +++ b/launcher/minecraft/mod/ModFolderModel.cpp @@ -259,6 +259,18 @@ bool ModFolderModel::isValid() return m_dir.exists() && m_dir.isReadable(); } +auto ModFolderModel::selectedMods(QModelIndexList& indexes) -> std::list +{ + std::list selected_mods; + for (auto i : indexes) { + if(i.column() != 0) + continue; + + selected_mods.push_back(mods[i.row()]); + } + return selected_mods; +} + // FIXME: this does not take disabled mod (with extra .disable extension) into account... bool ModFolderModel::installMod(const QString &filename) { diff --git a/launcher/minecraft/mod/ModFolderModel.h b/launcher/minecraft/mod/ModFolderModel.h index 24b4d358..c3b493b8 100644 --- a/launcher/minecraft/mod/ModFolderModel.h +++ b/launcher/minecraft/mod/ModFolderModel.h @@ -144,6 +144,8 @@ public: return mods; } + auto selectedMods(QModelIndexList& indexes) -> std::list; + public slots: void disableInteraction(bool disabled); -- cgit