diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-07 20:56:08 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-10 10:27:30 +0100 |
| commit | fc60ea5b7a023493375a6fced6572156f48e36c3 (patch) | |
| tree | e21d7d1d5941d271fadece63001dd3126460d441 /src/modlistview.cpp | |
| parent | 80371ae2ccdb233f9aa92c8982bad6a136c54ae9 (diff) | |
Add option to have different separator collapsed/expanded states between profiles.
Diffstat (limited to 'src/modlistview.cpp')
| -rw-r--r-- | src/modlistview.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 7b1b6f0c..ec31d4dc 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -167,10 +167,24 @@ void ModListView::refresh() updateGroupByProxy();
}
-void ModListView::setProfile(Profile* profile)
+void ModListView::onProfileChanged(Profile* oldProfile, Profile* newProfile)
{
- m_sortProxy->setProfile(profile);
- m_byPriorityProxy->setProfile(profile);
+ const auto perProfileSeparators =
+ m_core->settings().interface().collapsibleSeparatorsPerProfile();
+
+ // save expanded/collapsed state of separators
+ if (oldProfile && perProfileSeparators) {
+ auto& collapsed = m_collapsed[m_byPriorityProxy];
+ oldProfile->storeSetting("UserInterface", "collapsed_separators", QStringList(collapsed.begin(), collapsed.end()));
+ }
+
+ m_sortProxy->setProfile(newProfile);
+ m_byPriorityProxy->setProfile(newProfile);
+
+ if (newProfile && perProfileSeparators) {
+ auto collapsed = newProfile->setting("UserInterface", "collapsed_separators", QStringList()).toStringList();
+ m_collapsed[m_byPriorityProxy] = { collapsed.begin(), collapsed.end() };
+ }
}
bool ModListView::hasCollapsibleSeparators() const
@@ -694,7 +708,9 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo mwui->espList
};
+
connect(m_core, &OrganizerCore::modInstalled, [=](auto&& name) { onModInstalled(name); });
+ connect(m_core, &OrganizerCore::profileChanged, this, &ModListView::onProfileChanged);
connect(core.modList(), &ModList::modPrioritiesChanged, [=](auto&& indices) { onModPrioritiesChanged(indices); });
connect(core.modList(), &ModList::clearOverwrite, [=] { m_actions->clearOverwrite(); });
connect(core.modList(), &ModList::modStatesChanged, [=] { updateModCount(); });
|
