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/CMakeLists.txt | 3 +- src/filterlist.cpp | 5 +- src/settings.cpp | 10 + src/settings.h | 5 + src/settingsdialog.cpp | 2 + src/settingsdialog.ui | 785 ++++++++++++++++++------------------ src/settingsdialoggeneral.cpp | 27 -- src/settingsdialoggeneral.h | 1 - src/settingsdialoguserinterface.cpp | 53 +++ src/settingsdialoguserinterface.h | 15 + src/settingsdialogworkarounds.cpp | 2 - 11 files changed, 488 insertions(+), 420 deletions(-) create mode 100644 src/settingsdialoguserinterface.cpp create mode 100644 src/settingsdialoguserinterface.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4b74137e..a068f1a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,7 +103,6 @@ add_filter(NAME src/mainwindow GROUPS filetree filetreeitem filetreemodel - filterlist mainwindow savestab statusbar @@ -145,6 +144,7 @@ add_filter(NAME src/modlist GROUPS ) add_filter(NAME src/modlist/view GROUPS + filterlist modlistview modlistviewactions modlistcontextmenu @@ -202,6 +202,7 @@ add_filter(NAME src/settingsdialog GROUPS settingsdialogplugins settingsdialogsteam settingsdialogworkarounds + settingsdialoguserinterface disableproxyplugindialog ) diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 4c1c6fff..b594bcc6 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -234,7 +234,10 @@ void FilterList::restoreState(const Settings& s) s.widgets().restoreIndex(ui->filtersSeparators); s.widgets().restoreChecked(ui->filtersAnd); s.widgets().restoreChecked(ui->filtersOr); - s.widgets().restoreTreeCheckState(ui->filters, CriteriaItem::StateRole); + + if (m_core.settings().interface().saveFilters()) { + s.widgets().restoreTreeCheckState(ui->filters, CriteriaItem::StateRole); + } checkCriteria(); } diff --git a/src/settings.cpp b/src/settings.cpp index e04cd0c1..7f943904 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::saveFilters() const +{ + return get(m_Settings, "Settings", "save_filters", false); +} + +void InterfaceSettings::setSaveFilters(bool b) +{ + set(m_Settings, "Settings", "save_filters", b); +} + bool InterfaceSettings::compactDownloads() const { return get(m_Settings, "Settings", "compact_downloads", false); diff --git a/src/settings.h b/src/settings.h index 043b22a4..d61f3c20 100644 --- a/src/settings.h +++ b/src/settings.h @@ -631,6 +631,11 @@ public: bool collapsibleSeparatorsConflicts() const; void setCollapsibleSeparatorsConflicts(bool b); + // whether to save/restore filter states between runs + // + bool saveFilters() const; + void setSaveFilters(bool b); + // whether to show compact downloads // bool compactDownloads() const; diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index c4a53fcd..d6b7ceec 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -25,6 +25,7 @@ along with Mod Organizer. If not, see . #include "settingsdialogpaths.h" #include "settingsdialogplugins.h" #include "settingsdialogsteam.h" +#include "settingsdialoguserinterface.h" #include "settingsdialogworkarounds.h" using namespace MOBase; @@ -39,6 +40,7 @@ SettingsDialog::SettingsDialog(PluginContainer *pluginContainer, Settings& setti ui->setupUi(this); m_tabs.push_back(std::unique_ptr(new GeneralSettingsTab(settings, *this))); + m_tabs.push_back(std::unique_ptr(new UserInterfaceSettingsTab(settings, *this))); m_tabs.push_back(std::unique_ptr(new PathsSettingsTab(settings, *this))); m_tabs.push_back(std::unique_ptr(new DiagnosticsSettingsTab(settings, *this))); m_tabs.push_back(std::unique_ptr(new NexusSettingsTab(settings, *this))); 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 diff --git a/src/settingsdialoggeneral.cpp b/src/settingsdialoggeneral.cpp index 7b854260..11294d2a 100644 --- a/src/settingsdialoggeneral.cpp +++ b/src/settingsdialoggeneral.cpp @@ -17,32 +17,17 @@ GeneralSettingsTab::GeneralSettingsTab(Settings& s, SettingsDialog& d) addStyles(); selectStyle(); - ui->colorTable->load(s); - - // connect before setting to trigger - QObject::connect(ui->collapsibleSeparatorsBox, &QCheckBox::stateChanged, [=](auto&& state) { - ui->collapsibleSeparatorsConflictsBox->setEnabled(state == Qt::Checked); - }); - ui->centerDialogs->setChecked(settings().geometry().centerDialogs()); ui->changeGameConfirmation->setChecked(settings().interface().showChangeGameConfirmation()); ui->doubleClickPreviews->setChecked(settings().interface().doubleClicksOpenPreviews()); - ui->compactBox->setChecked(settings().interface().compactDownloads()); - ui->showMetaBox->setChecked(settings().interface().metaDownloads()); ui->checkForUpdates->setChecked(settings().checkForUpdates()); ui->usePrereleaseBox->setChecked(settings().usePrereleases()); - ui->colorSeparatorsBox->setChecked(settings().colors().colorSeparatorScrollbar()); - ui->collapsibleSeparatorsConflictsBox->setChecked(settings().interface().collapsibleSeparatorsConflicts()); - ui->collapsibleSeparatorsBox->setChecked(settings().interface().collapsibleSeparators()); QObject::connect(ui->exploreStyles, &QPushButton::clicked, [&]{ onExploreStyles(); }); QObject::connect( ui->categoriesBtn, &QPushButton::clicked, [&]{ onEditCategories(); }); - QObject::connect( - ui->resetColorsBtn, &QPushButton::clicked, [&]{ onResetColors(); }); - QObject::connect( ui->resetDialogsButton, &QPushButton::clicked, [&]{ onResetDialogs(); }); } @@ -67,18 +52,11 @@ void GeneralSettingsTab::update() emit settings().styleChanged(newStyle); } - ui->colorTable->commitColors(); - settings().geometry().setCenterDialogs(ui->centerDialogs->isChecked()); settings().interface().setShowChangeGameConfirmation(ui->changeGameConfirmation->isChecked()); settings().interface().setDoubleClicksOpenPreviews(ui->doubleClickPreviews->isChecked()); - settings().interface().setCompactDownloads(ui->compactBox->isChecked()); - settings().interface().setMetaDownloads(ui->showMetaBox->isChecked()); settings().setCheckForUpdates(ui->checkForUpdates->isChecked()); settings().setUsePrereleases(ui->usePrereleaseBox->isChecked()); - settings().colors().setColorSeparatorScrollbar(ui->colorSeparatorsBox->isChecked()); - settings().interface().setCollapsibleSeparators(ui->collapsibleSeparatorsBox->isChecked()); - settings().interface().setCollapsibleSeparatorsConflicts(ui->collapsibleSeparatorsConflictsBox->isChecked()); } void GeneralSettingsTab::addLanguages() @@ -204,11 +182,6 @@ void GeneralSettingsTab::onEditCategories() } } -void GeneralSettingsTab::onResetColors() -{ - ui->colorTable->resetColors(); -} - void GeneralSettingsTab::onResetDialogs() { const auto r = QMessageBox::question( diff --git a/src/settingsdialoggeneral.h b/src/settingsdialoggeneral.h index 455edcaf..51e0dc72 100644 --- a/src/settingsdialoggeneral.h +++ b/src/settingsdialoggeneral.h @@ -22,7 +22,6 @@ private: void onExploreStyles(); void onEditCategories(); - void onResetColors(); void onResetDialogs(); }; diff --git a/src/settingsdialoguserinterface.cpp b/src/settingsdialoguserinterface.cpp new file mode 100644 index 00000000..550b4ddd --- /dev/null +++ b/src/settingsdialoguserinterface.cpp @@ -0,0 +1,53 @@ +#include "settingsdialoguserinterface.h" +#include "ui_settingsdialog.h" +#include "shared/appconfig.h" +#include "categoriesdialog.h" +#include "colortable.h" +#include +#include + +using namespace MOBase; + +UserInterfaceSettingsTab::UserInterfaceSettingsTab(Settings& s, SettingsDialog& d) + : SettingsTab(s, d) +{ + + // connect before setting to trigger + QObject::connect(ui->collapsibleSeparatorsBox, &QGroupBox::toggled, [=](auto&& on) { + ui->collapsibleSeparatorsConflictsBox->setEnabled(on); + }); + + // mod list + ui->displayForeignBox->setChecked(settings().interface().displayForeign()); + ui->colorSeparatorsBox->setChecked(settings().colors().colorSeparatorScrollbar()); + ui->collapsibleSeparatorsConflictsBox->setChecked(settings().interface().collapsibleSeparatorsConflicts()); + ui->collapsibleSeparatorsBox->setChecked(settings().interface().collapsibleSeparators()); + ui->saveFiltersBox->setChecked(settings().interface().saveFilters()); + + // download list + ui->compactBox->setChecked(settings().interface().compactDownloads()); + ui->showMetaBox->setChecked(settings().interface().metaDownloads()); + + // colors + ui->colorTable->load(s); + + QObject::connect(ui->resetColorsBtn, &QPushButton::clicked, [&] { ui->colorTable->resetColors(); }); + +} + +void UserInterfaceSettingsTab::update() +{ + // mod list + settings().colors().setColorSeparatorScrollbar(ui->colorSeparatorsBox->isChecked()); + settings().interface().setDisplayForeign(ui->displayForeignBox->isChecked()); + settings().interface().setCollapsibleSeparators(ui->collapsibleSeparatorsBox->isChecked()); + settings().interface().setCollapsibleSeparatorsConflicts(ui->collapsibleSeparatorsConflictsBox->isChecked()); + settings().interface().setSaveFilters(ui->saveFiltersBox->isChecked()); + + // download list + settings().interface().setCompactDownloads(ui->compactBox->isChecked()); + settings().interface().setMetaDownloads(ui->showMetaBox->isChecked()); + + // colors + ui->colorTable->commitColors(); +} diff --git a/src/settingsdialoguserinterface.h b/src/settingsdialoguserinterface.h new file mode 100644 index 00000000..8b4d48fa --- /dev/null +++ b/src/settingsdialoguserinterface.h @@ -0,0 +1,15 @@ +#ifndef SETTINGSDIALOGUSERINTERFACE_H +#define SETTINGSDIALOGUSERINTERFACE_H + +#include "settingsdialog.h" +#include "settings.h" + +class UserInterfaceSettingsTab : public SettingsTab +{ +public: + UserInterfaceSettingsTab(Settings& settings, SettingsDialog& dialog); + + void update() override; +}; + +#endif // SETTINGSDIALOGGENERAL_H diff --git a/src/settingsdialogworkarounds.cpp b/src/settingsdialogworkarounds.cpp index 1c5fbe26..c050c722 100644 --- a/src/settingsdialogworkarounds.cpp +++ b/src/settingsdialogworkarounds.cpp @@ -24,7 +24,6 @@ WorkaroundsSettingsTab::WorkaroundsSettingsTab(Settings& s, SettingsDialog& d) ui->hideUncheckedBox->setChecked(settings().game().hideUncheckedPlugins()); ui->forceEnableBox->setChecked(settings().game().forceEnableCoreFiles()); - ui->displayForeignBox->setChecked(settings().interface().displayForeign()); ui->lockGUIBox->setChecked(settings().interface().lockGUI()); ui->enableArchiveParsingBox->setChecked(settings().archiveParsing()); @@ -48,7 +47,6 @@ void WorkaroundsSettingsTab::update() settings().game().setHideUncheckedPlugins(ui->hideUncheckedBox->isChecked()); settings().game().setForceEnableCoreFiles(ui->forceEnableBox->isChecked()); - settings().interface().setDisplayForeign(ui->displayForeignBox->isChecked()); settings().interface().setLockGUI(ui->lockGUIBox->isChecked()); settings().setArchiveParsing(ui->enableArchiveParsingBox->isChecked()); settings().setExecutablesBlacklist(m_ExecutableBlacklist); -- cgit v1.3.1