summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/ModList.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-08-04 22:57:16 +0200
committerPetr Mrázek <peterix@gmail.com>2016-08-04 22:57:16 +0200
commit6ec2652b4562119ccf45d3bc455ef865fdfbd3ce (patch)
tree908d1d7155c68b7960ea14b5d1e7803ecf97e0b3 /api/logic/minecraft/ModList.cpp
parenteec87db86a8a00db0a9145a3b17c53408f7b1f5b (diff)
downloadMultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar.gz
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar.lz
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar.xz
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.zip
GH-1273 allow extended selection in mod lists
Diffstat (limited to 'api/logic/minecraft/ModList.cpp')
-rw-r--r--api/logic/minecraft/ModList.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/api/logic/minecraft/ModList.cpp b/api/logic/minecraft/ModList.cpp
index ad588f16..b9c7d9ba 100644
--- a/api/logic/minecraft/ModList.cpp
+++ b/api/logic/minecraft/ModList.cpp
@@ -175,35 +175,14 @@ bool ModList::installMod(const QString &filename)
return false;
}
-bool ModList::deleteMod(int index)
+bool ModList::deleteMods(const QModelIndexList& indexes)
{
- if (index >= mods.size() || index < 0)
- return false;
- Mod &m = mods[index];
- if (m.destroy())
- {
- emit changed();
+ if(indexes.isEmpty())
return true;
- }
- return false;
-}
-bool ModList::deleteMods(int first, int last)
-{
- for (int i = first; i <= last; i++)
- {
- Mod &m = mods[i];
- m.destroy();
- }
- emit changed();
- return true;
-}
-
-bool ModList::deleteMods(const QVector<int> &indexes)
-{
for (auto i: indexes)
{
- Mod &m = mods[i];
+ Mod &m = mods[i.row()];
m.destroy();
}
emit changed();