diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-04-11 01:30:50 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-04-11 01:30:50 +0200 |
commit | 432ec7417499c6fa6b0c2935c96ad5f3d1d097c1 (patch) | |
tree | ff18776574ceb0023bfa373dddc4601252776b72 /logic/InstanceList.cpp | |
parent | b795ad52099562a90b961e2e294daf6a3dc00883 (diff) | |
download | MultiMC-432ec7417499c6fa6b0c2935c96ad5f3d1d097c1.tar MultiMC-432ec7417499c6fa6b0c2935c96ad5f3d1d097c1.tar.gz MultiMC-432ec7417499c6fa6b0c2935c96ad5f3d1d097c1.tar.lz MultiMC-432ec7417499c6fa6b0c2935c96ad5f3d1d097c1.tar.xz MultiMC-432ec7417499c6fa6b0c2935c96ad5f3d1d097c1.zip |
GH-1404 allow deleting groups and creating instances in groups directly using context menu
Diffstat (limited to 'logic/InstanceList.cpp')
-rw-r--r-- | logic/InstanceList.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp index 8197fe24..741b8611 100644 --- a/logic/InstanceList.cpp +++ b/logic/InstanceList.cpp @@ -133,8 +133,43 @@ QStringList InstanceList::getGroups() return m_groups.toList(); } +void InstanceList::suspendGroupSaving() +{ + suspendedGroupSave = true; +} + +void InstanceList::resumeGroupSaving() +{ + if(suspendedGroupSave) + { + suspendedGroupSave = false; + if(queuedGroupSave) + { + saveGroupList(); + } + } +} + +void InstanceList::deleteGroup(const QString& name) +{ + for(auto & instance: m_instances) + { + auto instGroupName = instance->group(); + if(instGroupName == name) + { + instance->setGroupPost(QString()); + } + } +} + void InstanceList::saveGroupList() { + if(suspendedGroupSave) + { + queuedGroupSave = true; + return; + } + QString groupFileName = m_instDir + "/instgroups.json"; QMap<QString, QSet<QString>> groupMap; for (auto instance : m_instances) |