summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/SimpleModList.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2018-11-15 00:36:47 +0100
committerPetr Mrázek <peterix@gmail.com>2018-11-15 00:36:47 +0100
commita8e77f0ecc2f6e15896b1d6171fd66c73478d5e8 (patch)
tree9ef4104434793e8847277c0bcbc6d49af9185545 /api/logic/minecraft/SimpleModList.cpp
parent5603133822880d7c00507e2eed26f0b2f5d1a164 (diff)
downloadMultiMC-a8e77f0ecc2f6e15896b1d6171fd66c73478d5e8.tar
MultiMC-a8e77f0ecc2f6e15896b1d6171fd66c73478d5e8.tar.gz
MultiMC-a8e77f0ecc2f6e15896b1d6171fd66c73478d5e8.tar.lz
MultiMC-a8e77f0ecc2f6e15896b1d6171fd66c73478d5e8.tar.xz
MultiMC-a8e77f0ecc2f6e15896b1d6171fd66c73478d5e8.zip
NOISSUE remove some nonsense and dead code
Diffstat (limited to 'api/logic/minecraft/SimpleModList.cpp')
-rw-r--r--api/logic/minecraft/SimpleModList.cpp41
1 files changed, 6 insertions, 35 deletions
diff --git a/api/logic/minecraft/SimpleModList.cpp b/api/logic/minecraft/SimpleModList.cpp
index adab5ba4..147be72a 100644
--- a/api/logic/minecraft/SimpleModList.cpp
+++ b/api/logic/minecraft/SimpleModList.cpp
@@ -71,47 +71,18 @@ bool SimpleModList::update()
if (!isValid())
return false;
- QList<Mod> orderedMods;
QList<Mod> newMods;
m_dir.refresh();
- auto folderContents = m_dir.entryInfoList();
- bool orderOrStateChanged = false;
-
- // if there are any untracked files...
- if (folderContents.size())
+ for (auto entry : m_dir.entryInfoList())
{
- // the order surely changed!
- for (auto entry : folderContents)
- {
- newMods.append(Mod(entry));
- }
- orderedMods.append(newMods);
- orderOrStateChanged = true;
- }
- // otherwise, if we were already tracking some mods
- else if (mods.size())
- {
- // if the number doesn't match, order changed.
- if (mods.size() != orderedMods.size())
- orderOrStateChanged = true;
- // if it does match, compare the mods themselves
- else
- for (int i = 0; i < mods.size(); i++)
- {
- if (!mods[i].strongCompare(orderedMods[i]))
- {
- orderOrStateChanged = true;
- break;
- }
- }
+ newMods.append(Mod(entry));
}
+
beginResetModel();
- mods.swap(orderedMods);
+ mods.swap(newMods);
endResetModel();
- if (orderOrStateChanged)
- {
- emit changed();
- }
+
+ emit changed();
return true;
}