From 76796796bec37a1670cfc4e0b1e42e7b1096b237 Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Wed, 6 Jan 2021 18:44:10 +0100 Subject: Re-organize settings. Add setting to remember filters when restarting MO. --- src/settingsdialog.ui | 785 +++++++++++++++++++++++++------------------------- 1 file changed, 397 insertions(+), 388 deletions(-) (limited to 'src/settingsdialog.ui') diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index ae4f4f34..a22beacd 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -7,7 +7,7 @@ 0 0 820 - 652 + 651 @@ -23,434 +23,473 @@ General - - - - - Qt::Vertical - - + + + + - 0 - 0 + 16777215 + 16777215 - + + Reset all choices made in dialogs. + + + Reset all choices made in dialogs. + + + Reset Dialog Choices + + - - - - Updates + + + + Show confirmation when changing instance - - - - - Check for Mod Organizer updates on Github on startup. - - - Check for Mod Organizer updates on Github on startup. - + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + - Check for updates + Language - - - - Update to non-stable releases. - - - Update to non-stable releases. - + + - Install Pre-releases (Betas) + Style - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - User Interface - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Language - - - - - - - Style - - - - - - - Visual theme of the user interface. - - - Visual theme of the user interface. - - - - - - - Explore... - - - - - - - The language of the user interface. - - - The language of the user interface. - - - - - - - https://www.transifex.com/mod-organizer-2-team/mod-organizer-2/ - - - <a href="https://www.transifex.com/mod-organizer-2-team/mod-organizer-2/">Help translate Mod Organizer</a> - - - true - - - - - - - - + + - Dialogs will always be centered on the main window, but will remember their size. + Visual theme of the user interface. - Dialogs will always be centered on the main window, but will remember their size. - - - Always center dialogs + Visual theme of the user interface. - - + + - Show confirmation when changing instance + Explore... - - + + - Whether double-clicking on a file opens the preview window or launches the program associated with it. This applies to the Data tab as well as the Conflicts and Filetree tabs in the mod info window. - - - Open previews on double-click - - - - - - - - 16777215 - 16777215 - - - - Reset all choices made in dialogs. + The language of the user interface. - Reset all choices made in dialogs. - - - Reset Dialog Choices + The language of the user interface. - - + + - Modify the categories available to arrange your mods. - - - Modify the categories available to arrange your mods. + https://www.transifex.com/mod-organizer-2-team/mod-organizer-2/ - Configure Mod Categories - - - - - - - Qt::Vertical + <a href="https://www.transifex.com/mod-organizer-2-team/mod-organizer-2/">Help translate Mod Organizer</a> - - - 0 - 0 - + + true - + - - + + + + Modify the categories available to arrange your mods. + + + Modify the categories available to arrange your mods. + + + Configure Mod Categories + + + + + + + Dialogs will always be centered on the main window, but will remember their size. + + + Dialogs will always be centered on the main window, but will remember their size. + + + Always center dialogs + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + Whether double-clicking on a file opens the preview window or launches the program associated with it. This applies to the Data tab as well as the Conflicts and Filetree tabs in the mod info window. + + + Open previews on double-click + + + + + - Download List + Updates - + - + - Show meta information instead of file names in the download list. + Check for Mod Organizer updates on Github on startup. - Show meta information instead of file names in the download list. + Check for Mod Organizer updates on Github on startup. - Show Meta Information + Check for updates - + - Make the download list more compact. + Update to non-stable releases. - Make the download list more compact. + Update to non-stable releases. - Compact List + Install Pre-releases (Betas) - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - Colors + + + + + + + + User Interface + + + + + + 0 - - - - - QAbstractItemView::NoEditTriggers - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - QAbstractItemView::ScrollPerPixel - - - false - - - false - - - false - - - true - - - false - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Colors set on separators will also be shown in the mod list scrollbar at the location of the separator. This can be useful for quickly navigating to a specific separator. - - - Colors set on separators will also be shown in the mod list scrollbar at the location of the separator. This can be useful for quickly navigating to a specific separator. - - - Show mod list separator colors on the scrollbar - - - true + + + + + 0 + 0 + + + + Mod List + + + + + + Colors set on separators will also be shown in the mod list scrollbar at the location of the separator. This can be useful for quickly navigating to a specific separator. + + + Colors set on separators will also be shown in the mod list scrollbar at the location of the separator. This can be useful for quickly navigating to a specific separator. + + + Show mod list separator colors on the scrollbar + + + true + + + + + + + Disable this to no longer display mods installed outside MO in the mod list (left pane). Assets from those mods will then be treated as having lowest mod priority together with the original game content. + + + By default Mod Organizer will display esp+bsa bundles installed with foreign tools as mods (left pane). This allows you to control their priority in relation to other mods. This is particularly useful if you also use Steam Workshop to install mods. +However, if you installed loose file mods outside MO which conflict with BSAs also installed outside MO those conflicts can't be resolved correctly. + +If you disable this feature, MO will only display official DLCs this way. Please note that plugins (esps, esms, and esls) displayed in the right pane are completely unaffected by this feature. + + + Display mods installed outside MO + + + true + + + + + + + Save the current filters when closing MO2 and restore them on startup. + + + Save the current filters when closing MO2 and restore them on startup. + + + Remembers selected filters after restarting MO + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 0 + 5 + + + + + + + + Collapsible Separators + + + false + + + true + + + + 7 - - - - - - Qt::Horizontal + + 7 - - - 40 - 20 - + + + + Display mod conflicts on separator when collapsed. + + + Display mod conflicts on separator when collapsed. + + + Show conflicts on separators + + + true + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 0 + 0 + + + + + + + + + + + Download List + + + + + + Show meta information instead of file names in the download list. + + + Show meta information instead of file names in the download list. + + + Show Meta Information + + + + + + + Make the download list more compact. + + + Make the download list more compact. + + + Compact List + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + + + + + + + Colors + + + + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + QAbstractItemView::ScrollPerPixel + + + false + + + false + + + false + + + true + + + false + + + + + + + + 0 - - - - - - Reset all colors to their default value. + + 0 - - Reset all colors to their default value. + + 0 - - Reset Colors + + 0 - - - - - - - + + + + Reset all colors to their default value. + + + Reset all colors to their default value. + + + Reset Colors + + + + + + + + + + - - - + + + + Qt::Vertical + + - 0 - 0 + 20 + 40 - - Mod List - - - - - - Allow collapsing separators when sorting by ascending priority. - - - Use collapsible separators - - - true - - - false - - - - - - - Display mod conflicts on separator when collapsed. - - - Display mod conflicts on separator when collapsed. - - - Show conflicts on separators - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 0 - 0 - - - - - - + @@ -1520,25 +1559,6 @@ I don't yet know what the circumstances are, but user reports imply it is in som - - - - Disable this to no longer display mods installed outside MO in the mod list (left pane). Assets from those mods will then be treated as having lowest mod priority together with the original game content. - - - By default Mod Organizer will display esp+bsa bundles installed with foreign tools as mods (left pane). This allows you to control their priority in relation to other mods. This is particularly useful if you also use Steam Workshop to install mods. -However, if you installed loose file mods outside MO which conflict with BSAs also installed outside MO those conflicts can't be resolved correctly. - -If you disable this feature, MO will only display official DLCs this way. Please note that plugins (esps, esms, and esls) displayed in the right pane are completely unaffected by this feature. - - - Display mods installed outside MO - - - true - - - @@ -1572,7 +1592,7 @@ Uncheck this if you want to use Mod Organizer with total conversions (like Nehri - + Enable parsing of Archives. This is an Experimental Feature. Has negative effects on performance and known incorrectness. @@ -1824,16 +1844,7 @@ programs you are intentionally running. tabWidget languageBox styleBox - centerDialogs - resetDialogsButton - categoriesBtn - showMetaBox - compactBox - checkForUpdates usePrereleaseBox - colorTable - colorSeparatorsBox - resetColorsBtn baseDirEdit browseBaseDirBtn downloadDirEdit @@ -1869,8 +1880,6 @@ programs you are intentionally running. hideUncheckedBox forceEnableBox lockGUIBox - displayForeignBox - enableArchiveParsingBox bsaDateBtn execBlacklistBtn resetGeometryBtn -- cgit v1.3.1 From f919e0917344d7396f03423ef4fcd4d41fe37b07 Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 7 Jan 2021 20:11:26 +0100 Subject: Show conflicts and highligth plugins from collapsed separators. --- src/modinfo.cpp | 1 + src/modinfo.h | 63 ++++++++++++++----------------- src/modinfowithconflictinfo.h | 21 ++++------- src/modlistview.cpp | 87 ++++++++++++++++++++----------------------- src/modlistview.h | 15 +++++--- src/settingsdialog.ui | 6 +-- 6 files changed, 89 insertions(+), 104 deletions(-) (limited to 'src/settingsdialog.ui') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index c76cb4ad..b46a68ab 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -49,6 +49,7 @@ using namespace MOBase; using namespace MOShared; +const std::set ModInfo::s_EmptySet; std::vector ModInfo::s_Collection; ModInfo::Ptr ModInfo::s_Overwrite; std::map ModInfo::s_ModsByName; diff --git a/src/modinfo.h b/src/modinfo.h index 08ed94f8..634ea900 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -868,46 +868,35 @@ public: // Nexus stuff public: // Conflicts - /** - * @return retrieve list of mods (as mod index) that are overwritten by this one. - * Updates may be delayed. - */ - virtual std::set getModOverwrite() const { - return std::set(); } + // retrieve the list of mods (as mod index) that are overwritten by this one. + // Updates may be delayed. + // + virtual const std::set& getModOverwrite() const { return s_EmptySet; } - /** - * @return list of mods (as mod index) that overwrite this one. Updates may be delayed. - */ - virtual std::set getModOverwritten() const { - return std::set(); } + // retrieve the list of mods (as mod index) that overwrite this one. + // Updates may be delayed. + // + virtual const std::set& getModOverwritten() const { return s_EmptySet; } - /** - * @return retrieve list of mods (as mod index) with archives that are overwritten by - * this one. Updates may be delayed - */ - virtual std::set getModArchiveOverwrite() const { - return std::set(); } + // retrieve the list of mods (as mod index) with archives that are overwritten by + // this one. Updates may be delayed + // + virtual const std::set& getModArchiveOverwrite() const { return s_EmptySet; } - /** - * @return list of mods (as mod index) with archives that overwrite this one. Updates - * may be delayed. - */ - virtual std::set getModArchiveOverwritten() const { - return std::set(); } + // retrieve the list of mods (as mod index) with archives that overwrite this one. Updates + // may be delayed. + // + virtual const std::set& getModArchiveOverwritten() const { return s_EmptySet; } - /** - * @return the list of mods (as mod index) with archives that are overwritten by loose - * files of this mod. Updates may be delayed. - */ - virtual std::set getModArchiveLooseOverwrite() const { - return std::set(); } + // retrieve the list of mods (as mod index) with archives that are overwritten by loose + // files of this mod. Updates may be delayed. + // + virtual const std::set& getModArchiveLooseOverwrite() const { return s_EmptySet; } - /** - * @return the list of mods (as mod index) with loose files that overwrite this one's - * archive files. Updates may be delayed. - */ - virtual std::set getModArchiveLooseOverwritten() const { - return std::set(); } + // retrieve the list of mods (as mod index) with loose files that overwrite this one's + // archive files. Updates may be delayed. + // + virtual const std::set& getModArchiveLooseOverwritten() const { return s_EmptySet; } /** * @brief Update conflict information. @@ -960,6 +949,10 @@ protected: MOBase::VersionInfo m_Version; bool m_PluginSelected = false; + // empty set that can be returned in overwrite functions by + // default + static const std::set s_EmptySet; + protected: friend class OrganizerCore; diff --git a/src/modinfowithconflictinfo.h b/src/modinfowithconflictinfo.h index 889f1246..c9cddb60 100644 --- a/src/modinfowithconflictinfo.h +++ b/src/modinfowithconflictinfo.h @@ -52,21 +52,16 @@ public: /** * @brief clear all caches held for this mod */ - virtual void clearCaches() override; + void clearCaches() override; - virtual std::set getModOverwrite() const override { return m_OverwriteList; } + const std::set& getModOverwrite() const override { return m_OverwriteList; } + const std::set& getModOverwritten() const override { return m_OverwrittenList; } + const std::set& getModArchiveOverwrite() const override { return m_ArchiveOverwriteList; } + const std::set& getModArchiveOverwritten() const override { return m_ArchiveOverwrittenList; } + const std::set& getModArchiveLooseOverwrite() const override { return m_ArchiveLooseOverwriteList; } + const std::set& getModArchiveLooseOverwritten() const override { return m_ArchiveLooseOverwrittenList; } - virtual std::set getModOverwritten() const override { return m_OverwrittenList; } - - virtual std::set getModArchiveOverwrite() const override { return m_ArchiveOverwriteList; } - - virtual std::set getModArchiveOverwritten() const override { return m_ArchiveOverwrittenList; } - - virtual std::set getModArchiveLooseOverwrite() const override { return m_ArchiveLooseOverwriteList; } - - virtual std::set getModArchiveLooseOverwritten() const override { return m_ArchiveLooseOverwrittenList; } - - virtual void doConflictCheck() const override; + void doConflictCheck() const override; public slots: diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 7c770709..2c9634bd 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -417,7 +417,7 @@ void ModListView::onModPrioritiesChanged(const QModelIndexList& indices) } // update conflict check on the moved mod modInfo->doConflictCheck(); - setOverwriteMarkers(modInfo); + setOverwriteMarkers(selectionModel()->selectedRows()); } } } @@ -682,7 +682,8 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo m_actions = new ModListViewActions(core, *m_filters, factory, this, mwui->espList, mw); ui = { mwui->groupCombo, mwui->activeModsCounter, mwui->modFilterEdit, - mwui->currentCategoryLabel, mwui->clearFiltersButton, mwui->filtersSeparators + mwui->currentCategoryLabel, mwui->clearFiltersButton, mwui->filtersSeparators, + mwui->espList }; connect(m_core, &OrganizerCore::modInstalled, [=](auto&& name) { onModInstalled(name); }); @@ -765,16 +766,6 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo header()->setSectionResizeMode(ModList::COL_NAME, QHeaderView::Stretch); } - // highligth plugins - connect(selectionModel(), &QItemSelectionModel::selectionChanged, [=](auto&& selected) { - std::vector modIndices; - for (auto& idx : selectionModel()->selectedRows()) { - modIndices.push_back(idx.data(ModList::IndexRole).toInt()); - } - m_core->pluginList()->highlightPlugins(modIndices, *m_core->directoryStructure()); - mwui->espList->verticalScrollBar()->repaint(); - }); - // prevent the name-column from being hidden header()->setSectionHidden(ModList::COL_NAME, false); @@ -962,35 +953,23 @@ void ModListView::clearOverwriteMarkers() m_markers.archiveLooseOverwritten.clear(); } -void ModListView::setOverwriteMarkers(const std::set& overwrite, const std::set& overwritten) -{ - m_markers.overwrite = overwrite; - m_markers.overwritten = overwritten; -} - -void ModListView::setArchiveOverwriteMarkers(const std::set& overwrite, const std::set& overwritten) -{ - m_markers.archiveOverwrite = overwrite; - m_markers.archiveOverwritten = overwritten; -} - -void ModListView::setArchiveLooseOverwriteMarkers(const std::set& overwrite, const std::set& overwritten) -{ - m_markers.archiveLooseOverwrite = overwrite; - m_markers.archiveLooseOverwritten = overwritten; -} - -void ModListView::setOverwriteMarkers(ModInfo::Ptr mod) +void ModListView::setOverwriteMarkers(const QModelIndexList& indexes) { - if (mod) { - setOverwriteMarkers(mod->getModOverwrite(), mod->getModOverwritten()); - setArchiveOverwriteMarkers(mod->getModArchiveOverwrite(), mod->getModArchiveOverwritten()); - setArchiveLooseOverwriteMarkers(mod->getModArchiveLooseOverwrite(), mod->getModArchiveLooseOverwritten()); - } - else { - setOverwriteMarkers({}, {}); - setArchiveOverwriteMarkers({}, {}); - setArchiveLooseOverwriteMarkers({}, {}); + const auto insert = [](auto& dest, const auto& from) { + dest.insert(from.begin(), from.end()); + }; + clearOverwriteMarkers(); + for (auto& idx : indexes) { + auto mIndex = idx.data(ModList::IndexRole); + if (mIndex.isValid()) { + auto info = ModInfo::getByIndex(mIndex.toInt()); + insert(m_markers.overwrite, info->getModOverwrite()); + insert(m_markers.overwritten, info->getModOverwritten()); + insert(m_markers.archiveOverwrite, info->getModArchiveOverwrite()); + insert(m_markers.archiveOverwritten, info->getModArchiveOverwritten()); + insert(m_markers.archiveLooseOverwrite, info->getModArchiveLooseOverwrite()); + insert(m_markers.archiveLooseOverwritten, info->getModArchiveLooseOverwritten()); + } } dataChanged(model()->index(0, 0), model()->index(model()->rowCount(), model()->columnCount())); verticalScrollBar()->repaint(); @@ -1207,15 +1186,29 @@ void ModListView::onSelectionChanged(const QItemSelection& selected, const QItem } } - if (selected.count()) { - auto index = selected.indexes().last(); - ModInfo::Ptr selectedMod = ModInfo::getByIndex(index.data(ModList::IndexRole).toInt()); - setOverwriteMarkers(selectedMod); - } - else { - setOverwriteMarkers(nullptr); + QModelIndexList indexes = selectionModel()->selectedRows(); + + if (m_core->settings().interface().collapsibleSeparatorsConflicts()) { + for (auto& idx : selectionModel()->selectedRows()) { + if (hasCollapsibleSeparators() + && model()->hasChildren(idx) + && !isExpanded(idx)) { + for (int i = 0; i < model()->rowCount(idx); ++i) { + indexes.append(model()->index(i, idx.column(), idx)); + } + } + } } + setOverwriteMarkers(indexes); + + // highligth plugins + std::vector modIndices; + for (auto& idx : indexes) { + modIndices.push_back(idx.data(ModList::IndexRole).toInt()); + } + m_core->pluginList()->highlightPlugins(modIndices, *m_core->directoryStructure()); + ui.pluginList->verticalScrollBar()->repaint(); } void ModListView::onFiltersCriteria(const std::vector& criteria) diff --git a/src/modlistview.h b/src/modlistview.h index 08ecd935..53be08c5 100644 --- a/src/modlistview.h +++ b/src/modlistview.h @@ -23,6 +23,7 @@ class MainWindow; class Profile; class ModListByPriorityProxy; class ModListViewActions; +class PluginListView; class ModListView : public QTreeView { @@ -183,15 +184,14 @@ private: void onModInstalled(const QString& modName); void onModFilterActive(bool filterActive); - // overwrite markers + // clear overwrite markers (without repainting) + // void clearOverwriteMarkers(); - void setOverwriteMarkers(const std::set& overwrite, const std::set& overwritten); - void setArchiveOverwriteMarkers(const std::set& overwrite, const std::set& overwritten); - void setArchiveLooseOverwriteMarkers(const std::set& overwrite, const std::set& overwritten); - // set overwrite markers from the mod and repaint (if mod is nullptr, clear overwrite and repaint) + // set overwrite markers from the mod in the given list and repaint (if the list + // is empty, clear overwrite and repaint) // - void setOverwriteMarkers(ModInfo::Ptr mod); + void setOverwriteMarkers(const QModelIndexList& indexes); // retrieve the marker color for the given index // @@ -251,6 +251,9 @@ private: QLabel* currentCategory; QPushButton* clearFilters; QComboBox* filterSeparators; + + // the plugin list (for highligths) + PluginListView* pluginList; }; OrganizerCore* m_core; diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index a22beacd..527f9a91 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -318,13 +318,13 @@ If you disable this feature, MO will only display official DLCs this way. Please - Display mod conflicts on separator when collapsed. + Display mod conflicts on and from separator when collapsed, and show plugins from collapsed separators. - Display mod conflicts on separator when collapsed. + Display mod conflicts on and from separator when collapsed, and show plugins from collapsed separators. - Show conflicts on separators + Show conflicts and plugins on separators and from separators true -- cgit v1.3.1 From fc60ea5b7a023493375a6fced6572156f48e36c3 Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 7 Jan 2021 20:56:08 +0100 Subject: Add option to have different separator collapsed/expanded states between profiles. --- src/mainwindow.cpp | 1 - src/modlistview.cpp | 22 +++++++++++++++++++--- src/modlistview.h | 5 +---- src/organizercore.cpp | 1 + src/organizercore.h | 7 +++++++ src/settings.cpp | 10 ++++++++++ src/settings.h | 5 +++++ src/settingsdialog.ui | 13 +++++++++++++ src/settingsdialoguserinterface.cpp | 3 +++ 9 files changed, 59 insertions(+), 8 deletions(-) (limited to 'src/settingsdialog.ui') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f761a5f0..ce98772a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1495,7 +1495,6 @@ void MainWindow::startExeAction() void MainWindow::activateSelectedProfile() { m_OrganizerCore.setCurrentProfile(ui->profileBox->currentText()); - ui->modList->setProfile(m_OrganizerCore.currentProfile()); m_SavesTab->refreshSaveList(); m_OrganizerCore.refresh(); 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(); }); diff --git a/src/modlistview.h b/src/modlistview.h index 1a174568..d8e08a99 100644 --- a/src/modlistview.h +++ b/src/modlistview.h @@ -57,10 +57,6 @@ public: void restoreState(const Settings& s); void saveState(Settings& s) const; - // set the current profile - // - void setProfile(Profile* profile); - // check if collapsible separators are currently used // bool hasCollapsibleSeparators() const; @@ -170,6 +166,7 @@ protected slots: void onCustomContextMenuRequested(const QPoint& pos); void onDoubleClicked(const QModelIndex& index); void onFiltersCriteria(const std::vector& filters); + void onProfileChanged(Profile* oldProfile, Profile* newProfile); private: diff --git a/src/organizercore.cpp b/src/organizercore.cpp index d952bc4c..90771c0a 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -602,6 +602,7 @@ void OrganizerCore::setCurrentProfile(const QString &profileName) m_CurrentProfile->debugDump(); + emit profileChanged(oldProfile.get(), m_CurrentProfile.get()); m_ProfileChanged(oldProfile.get(), m_CurrentProfile.get()); } diff --git a/src/organizercore.h b/src/organizercore.h index 24de26ee..905fb111 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -406,6 +406,13 @@ signals: void close(); + // emitted when the profile is changed, before notifying plugins + // + // the new profile can be stored but the old one is temporary and + // should not be + // + void profileChanged(Profile* oldProfile, Profile* newProfile); + // Notify that the directory structure is ready to be used on the main thread // Use queued connections void directoryStructureReady(); diff --git a/src/settings.cpp b/src/settings.cpp index 7f943904..251e2b15 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2195,6 +2195,16 @@ void InterfaceSettings::setCollapsibleSeparatorsConflicts(bool b) set(m_Settings, "Settings", "collapsible_separators_conflicts", b); } +bool InterfaceSettings::collapsibleSeparatorsPerProfile() const +{ + return get(m_Settings, "Settings", "collapsible_separators_per_profile", false); +} + +void InterfaceSettings::setCollapsibleSeparatorsPerProfile(bool b) +{ + set(m_Settings, "Settings", "collapsible_separators_per_profile", b); +} + bool InterfaceSettings::saveFilters() const { return get(m_Settings, "Settings", "save_filters", false); diff --git a/src/settings.h b/src/settings.h index d61f3c20..efcfee57 100644 --- a/src/settings.h +++ b/src/settings.h @@ -631,6 +631,11 @@ public: bool collapsibleSeparatorsConflicts() const; void setCollapsibleSeparatorsConflicts(bool b); + // whether each profile should have its own expansion state + // + bool collapsibleSeparatorsPerProfile() const; + void setCollapsibleSeparatorsPerProfile(bool b); + // whether to save/restore filter states between runs // bool saveFilters() const; diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 527f9a91..b09a26de 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -331,6 +331,19 @@ If you disable this feature, MO will only display official DLCs this way. Please + + + + Do not share the collapse/expanded state of separators between profiles. + + + Do not share the collapse/expanded state of separators between profiles. + + + Profile-specific collapse states for separators + + + diff --git a/src/settingsdialoguserinterface.cpp b/src/settingsdialoguserinterface.cpp index 550b4ddd..5d856395 100644 --- a/src/settingsdialoguserinterface.cpp +++ b/src/settingsdialoguserinterface.cpp @@ -15,6 +15,7 @@ UserInterfaceSettingsTab::UserInterfaceSettingsTab(Settings& s, SettingsDialog& // connect before setting to trigger QObject::connect(ui->collapsibleSeparatorsBox, &QGroupBox::toggled, [=](auto&& on) { ui->collapsibleSeparatorsConflictsBox->setEnabled(on); + ui->collapsibleSeparatorsPerProfileBox->setEnabled(on); }); // mod list @@ -22,6 +23,7 @@ UserInterfaceSettingsTab::UserInterfaceSettingsTab(Settings& s, SettingsDialog& ui->colorSeparatorsBox->setChecked(settings().colors().colorSeparatorScrollbar()); ui->collapsibleSeparatorsConflictsBox->setChecked(settings().interface().collapsibleSeparatorsConflicts()); ui->collapsibleSeparatorsBox->setChecked(settings().interface().collapsibleSeparators()); + ui->collapsibleSeparatorsPerProfileBox->setChecked(settings().interface().collapsibleSeparatorsPerProfile()); ui->saveFiltersBox->setChecked(settings().interface().saveFilters()); // download list @@ -42,6 +44,7 @@ void UserInterfaceSettingsTab::update() settings().interface().setDisplayForeign(ui->displayForeignBox->isChecked()); settings().interface().setCollapsibleSeparators(ui->collapsibleSeparatorsBox->isChecked()); settings().interface().setCollapsibleSeparatorsConflicts(ui->collapsibleSeparatorsConflictsBox->isChecked()); + settings().interface().setCollapsibleSeparatorsPerProfile(ui->collapsibleSeparatorsPerProfileBox->isChecked()); settings().interface().setSaveFilters(ui->saveFiltersBox->isChecked()); // download list -- cgit v1.3.1 From 05efc74e402ca3770d9fdaa2557f4030c31ee198 Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Mon, 11 Jan 2021 12:43:28 +0100 Subject: Fix text for new option. --- src/settingsdialog.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settingsdialog.ui') diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index b09a26de..d5c93c5c 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -277,7 +277,7 @@ If you disable this feature, MO will only display official DLCs this way. Please Save the current filters when closing MO2 and restore them on startup. - Remembers selected filters after restarting MO + Remember selected filters after restarting MO -- cgit v1.3.1