From 662a1eb3d7073166b1db3a05e34ecefd73046e3b Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 14 Jan 2021 20:11:02 +0100 Subject: Contextual menu entry for enable/disable all visible. --- src/modlistview.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/modlistview.cpp') diff --git a/src/modlistview.cpp b/src/modlistview.cpp index ae905a6e..63f38c46 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -214,6 +214,11 @@ Qt::SortOrder ModListView::sortOrder() const return m_sortProxy ? m_sortProxy->sortOrder() : Qt::AscendingOrder; } +bool ModListView::isFilterActive() const +{ + return m_sortProxy && m_sortProxy->isFilterActive(); +} + ModListView::GroupByMode ModListView::groupByMode() const { if (m_sortProxy == nullptr) { @@ -295,16 +300,6 @@ std::optional ModListView::prevMod(unsigned int modIndex) const return {}; } -void ModListView::enableAllVisible() -{ - m_core->modList()->setActive(indexViewToModel(flatIndex(model())), true); -} - -void ModListView::disableAllVisible() -{ - m_core->modList()->setActive(indexViewToModel(flatIndex(model())), false); -} - void ModListView::setFilterCriteria(const std::vector& criteria) { m_sortProxy->setCriteria(criteria); -- cgit v1.3.1 From 38129e6e7760ffcb660de88e7b87e691e16a49df Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 14 Jan 2021 20:30:06 +0100 Subject: Disable highlighting from/to separators separately. --- src/modlistview.cpp | 7 +--- src/settings.cpp | 18 +++++++-- src/settings.h | 13 +++++-- src/settingsdialog.ui | 73 +++++++++++++++++++++++++++++-------- src/settingsdialoguserinterface.cpp | 9 +++-- 5 files changed, 89 insertions(+), 31 deletions(-) (limited to 'src/modlistview.cpp') diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 63f38c46..9cc6d8b8 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -1029,7 +1029,7 @@ void ModListView::refreshMarkersAndPlugins() { QModelIndexList indexes = selectionModel()->selectedRows(); - if (m_core->settings().interface().collapsibleSeparatorsConflicts()) { + if (m_core->settings().interface().collapsibleSeparatorsHighlightFrom()) { for (auto& idx : selectionModel()->selectedRows()) { if (hasCollapsibleSeparators() && model()->hasChildren(idx) @@ -1103,7 +1103,7 @@ QColor ModListView::markerColor(const QModelIndex& index) const // collapsed separator auto rowIndex = index.sibling(index.row(), 0); if (hasCollapsibleSeparators() - && m_core->settings().interface().collapsibleSeparatorsConflicts() + && m_core->settings().interface().collapsibleSeparatorsHighlightTo() && model()->hasChildren(rowIndex) && !isExpanded(rowIndex)) { std::vector colors; @@ -1140,7 +1140,6 @@ std::vector ModListView::modFlags(const QModelIndex& index, bool bool compact = false; if (info->isSeparator() && hasCollapsibleSeparators() - && m_core->settings().interface().collapsibleSeparatorsConflicts() && !isExpanded(index.sibling(index.row(), 0))) { // combine the child conflicts @@ -1171,7 +1170,6 @@ std::vector ModListView::conflictFlags(const QModelIndex bool compact = false; if (info->isSeparator() && hasCollapsibleSeparators() - && m_core->settings().interface().collapsibleSeparatorsConflicts() && !isExpanded(index.sibling(index.row(), 0))) { // combine the child conflicts @@ -1206,7 +1204,6 @@ std::set ModListView::contents(const QModelIndex& index, bool* includeChild if (info->isSeparator() && hasCollapsibleSeparators() - && m_core->settings().interface().collapsibleSeparatorsConflicts() && !isExpanded(index.sibling(index.row(), 0))) { // combine the child contents diff --git a/src/settings.cpp b/src/settings.cpp index d1f3ef4f..4528d070 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2188,14 +2188,24 @@ void InterfaceSettings::setCollapsibleSeparators(bool ascending, bool descending set(m_Settings, "Settings", "collapsible_separators_dsc", descending); } -bool InterfaceSettings::collapsibleSeparatorsConflicts() const +bool InterfaceSettings::collapsibleSeparatorsHighlightTo() const { - return get(m_Settings, "Settings", "collapsible_separators_conflicts", true); + return get(m_Settings, "Settings", "collapsible_separators_conflicts_to", true); } -void InterfaceSettings::setCollapsibleSeparatorsConflicts(bool b) +void InterfaceSettings::setCollapsibleSeparatorsHighlightTo(bool b) { - set(m_Settings, "Settings", "collapsible_separators_conflicts", b); + set(m_Settings, "Settings", "collapsible_separators_conflicts_to", b); +} + +bool InterfaceSettings::collapsibleSeparatorsHighlightFrom() const +{ + return get(m_Settings, "Settings", "collapsible_separators_conflicts_from", true); +} + +void InterfaceSettings::setCollapsibleSeparatorsHighlightFrom(bool b) +{ + set(m_Settings, "Settings", "collapsible_separators_conflicts_from", b); } bool InterfaceSettings::collapsibleSeparatorsPerProfile() const diff --git a/src/settings.h b/src/settings.h index 484ce163..e7ad7317 100644 --- a/src/settings.h +++ b/src/settings.h @@ -626,10 +626,17 @@ public: bool collapsibleSeparators(Qt::SortOrder order) const; void setCollapsibleSeparators(bool ascending, bool descending); - // whether to display mod conflicts on separators when collapsed + // whether to highlight mod conflicts and plugins on collapsed + // separators // - bool collapsibleSeparatorsConflicts() const; - void setCollapsibleSeparatorsConflicts(bool b); + bool collapsibleSeparatorsHighlightTo() const; + void setCollapsibleSeparatorsHighlightTo(bool b); + + // whether to highlight mod conflicts and plugins from separators + // when selected but collapsed + // + bool collapsibleSeparatorsHighlightFrom() const; + void setCollapsibleSeparatorsHighlightFrom(bool b); // whether each profile should have its own expansion state // diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index b23e6d90..25978865 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -366,22 +366,6 @@ If you disable this feature, MO will only display official DLCs this way. Please - - - - Display mod conflicts on and from separator when collapsed, and show plugins from collapsed separators. - - - Display mod conflicts on and from separator when collapsed, and show plugins from collapsed separators. - - - Show conflicts and plugins on separators and from separators - - - true - - - @@ -395,6 +379,63 @@ If you disable this feature, MO will only display official DLCs this way. Please + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Show conflicts and plugins + + + + + + + Highlight collapsed separators based on conflicts and plugins from mods inside them. + + + Highlight collapsed separators based on conflicts and plugins from mods inside them. + + + on separators + + + true + + + + + + + When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator. + + + When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator. + + + from separators + + + true + + + + + + diff --git a/src/settingsdialoguserinterface.cpp b/src/settingsdialoguserinterface.cpp index cdd30f2e..783c690f 100644 --- a/src/settingsdialoguserinterface.cpp +++ b/src/settingsdialoguserinterface.cpp @@ -19,7 +19,8 @@ UserInterfaceSettingsTab::UserInterfaceSettingsTab(Settings& s, SettingsDialog& // mod list ui->displayForeignBox->setChecked(settings().interface().displayForeign()); ui->colorSeparatorsBox->setChecked(settings().colors().colorSeparatorScrollbar()); - ui->collapsibleSeparatorsConflictsBox->setChecked(settings().interface().collapsibleSeparatorsConflicts()); + ui->collapsibleSeparatorsHighlightFromBox->setChecked(settings().interface().collapsibleSeparatorsHighlightFrom()); + ui->collapsibleSeparatorsHighlightToBox->setChecked(settings().interface().collapsibleSeparatorsHighlightTo()); ui->collapsibleSeparatorsAscBox->setChecked(settings().interface().collapsibleSeparators(Qt::AscendingOrder)); ui->collapsibleSeparatorsDscBox->setChecked(settings().interface().collapsibleSeparators(Qt::DescendingOrder)); ui->collapsibleSeparatorsPerProfileBox->setChecked(settings().interface().collapsibleSeparatorsPerProfile()); @@ -43,7 +44,8 @@ void UserInterfaceSettingsTab::update() settings().interface().setDisplayForeign(ui->displayForeignBox->isChecked()); settings().interface().setCollapsibleSeparators( ui->collapsibleSeparatorsAscBox->isChecked(), ui->collapsibleSeparatorsDscBox->isChecked()); - settings().interface().setCollapsibleSeparatorsConflicts(ui->collapsibleSeparatorsConflictsBox->isChecked()); + settings().interface().setCollapsibleSeparatorsHighlightFrom(ui->collapsibleSeparatorsHighlightFromBox->isChecked()); + settings().interface().setCollapsibleSeparatorsHighlightTo(ui->collapsibleSeparatorsHighlightToBox->isChecked()); settings().interface().setCollapsibleSeparatorsPerProfile(ui->collapsibleSeparatorsPerProfileBox->isChecked()); settings().interface().setSaveFilters(ui->saveFiltersBox->isChecked()); @@ -59,6 +61,7 @@ void UserInterfaceSettingsTab::updateCollapsibleSeparatorsGroup() { const auto checked = ui->collapsibleSeparatorsAscBox->isChecked() || ui->collapsibleSeparatorsDscBox->isChecked(); - ui->collapsibleSeparatorsConflictsBox->setEnabled(checked); + ui->collapsibleSeparatorsHighlightToBox->setEnabled(checked); + ui->collapsibleSeparatorsHighlightFromBox->setEnabled(checked); ui->collapsibleSeparatorsPerProfileBox->setEnabled(checked); } -- cgit v1.3.1 From 7d027a446d61c9aa46365486f03755bf8a6db9d2 Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 14 Jan 2021 21:16:56 +0100 Subject: Add settings to enable/disable icons on collapsed separators. --- src/modlistversiondelegate.cpp | 8 +- src/modlistversiondelegate.h | 5 +- src/modlistview.cpp | 5 +- src/settings.cpp | 10 ++ src/settings.h | 5 + src/settingsdialog.ui | 236 ++++++++++++++++++++---------------- src/settingsdialoguserinterface.cpp | 27 ++++- src/settingsdialoguserinterface.h | 6 + 8 files changed, 188 insertions(+), 114 deletions(-) (limited to 'src/modlistview.cpp') diff --git a/src/modlistversiondelegate.cpp b/src/modlistversiondelegate.cpp index 657718f5..5ce574a5 100644 --- a/src/modlistversiondelegate.cpp +++ b/src/modlistversiondelegate.cpp @@ -1,10 +1,13 @@ #include "modlistversiondelegate.h" +#include "settings.h" #include "modlistview.h" #include "log.h" -ModListVersionDelegate::ModListVersionDelegate(ModListView* view) : - QItemDelegate(view), m_view(view) { } +ModListVersionDelegate::ModListVersionDelegate(ModListView* view, Settings& settings) : + QItemDelegate(view), m_view(view), m_settings(settings) +{ +} void ModListVersionDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const @@ -13,6 +16,7 @@ void ModListVersionDelegate::paint(QPainter* painter, const QStyleOptionViewItem if (m_view->hasCollapsibleSeparators() && m_view->model()->hasChildren(index) + && m_settings.interface().collapsibleSeparatorsIcons(ModList::COL_VERSION) && !m_view->isExpanded(index.sibling(index.row(), 0))) { auto* model = m_view->model(); diff --git a/src/modlistversiondelegate.h b/src/modlistversiondelegate.h index 8a51e9b4..d3d0ad3b 100644 --- a/src/modlistversiondelegate.h +++ b/src/modlistversiondelegate.h @@ -4,18 +4,19 @@ #include class ModListView; +class Settings; class ModListVersionDelegate : public QItemDelegate { public: - ModListVersionDelegate(ModListView* view); + ModListVersionDelegate(ModListView* view, Settings& settings); void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; private: - ModListView* m_view; + Settings& m_settings; }; #endif diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 9cc6d8b8..9f3a1266 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -787,7 +787,7 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo setItemDelegateForColumn(ModList::COL_FLAGS, new ModFlagIconDelegate(this, ModList::COL_FLAGS, 120)); setItemDelegateForColumn(ModList::COL_CONFLICTFLAGS, new ModConflictIconDelegate(this, ModList::COL_CONFLICTFLAGS, 80)); setItemDelegateForColumn(ModList::COL_CONTENT, new ModContentIconDelegate(this, ModList::COL_CONTENT, 150)); - setItemDelegateForColumn(ModList::COL_VERSION, new ModListVersionDelegate(this)); + setItemDelegateForColumn(ModList::COL_VERSION, new ModListVersionDelegate(this, core.settings())); if (m_core->settings().geometry().restoreState(header())) { // hack: force the resize-signal to be triggered because restoreState doesn't seem to do that @@ -1140,6 +1140,7 @@ std::vector ModListView::modFlags(const QModelIndex& index, bool bool compact = false; if (info->isSeparator() && hasCollapsibleSeparators() + && m_core->settings().interface().collapsibleSeparatorsIcons(ModList::COL_FLAGS) && !isExpanded(index.sibling(index.row(), 0))) { // combine the child conflicts @@ -1170,6 +1171,7 @@ std::vector ModListView::conflictFlags(const QModelIndex bool compact = false; if (info->isSeparator() && hasCollapsibleSeparators() + && m_core->settings().interface().collapsibleSeparatorsIcons(ModList::COL_CONFLICTFLAGS) && !isExpanded(index.sibling(index.row(), 0))) { // combine the child conflicts @@ -1204,6 +1206,7 @@ std::set ModListView::contents(const QModelIndex& index, bool* includeChild if (info->isSeparator() && hasCollapsibleSeparators() + && m_core->settings().interface().collapsibleSeparatorsIcons(ModList::COL_CONTENT) && !isExpanded(index.sibling(index.row(), 0))) { // combine the child contents diff --git a/src/settings.cpp b/src/settings.cpp index 4528d070..27108162 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2208,6 +2208,16 @@ void InterfaceSettings::setCollapsibleSeparatorsHighlightFrom(bool b) set(m_Settings, "Settings", "collapsible_separators_conflicts_from", b); } +bool InterfaceSettings::collapsibleSeparatorsIcons(int column) const +{ + return get(m_Settings, "Settings", QString("collapsible_separators_icons_%1").arg(column), true); +} + +void InterfaceSettings::setCollapsibleSeparatorsIcons(int column, bool show) +{ + set(m_Settings, "Settings", QString("collapsible_separators_icons_%1").arg(column), show); +} + bool InterfaceSettings::collapsibleSeparatorsPerProfile() const { return get(m_Settings, "Settings", "collapsible_separators_per_profile", false); diff --git a/src/settings.h b/src/settings.h index e7ad7317..384d50a2 100644 --- a/src/settings.h +++ b/src/settings.h @@ -638,6 +638,11 @@ public: bool collapsibleSeparatorsHighlightFrom() const; void setCollapsibleSeparatorsHighlightFrom(bool b); + // whether to show icons on collapsed separators + // + bool collapsibleSeparatorsIcons(int column) const; + void setCollapsibleSeparatorsIcons(int column, bool show); + // whether each profile should have its own expansion state // bool collapsibleSeparatorsPerProfile() const; diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 25978865..93934fc1 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -311,22 +311,16 @@ If you disable this feature, MO will only display official DLCs this way. Please false - - - 7 - - - 7 - - - + + + 0 - 0 + 50 - + 0 @@ -339,99 +333,135 @@ If you disable this feature, MO will only display official DLCs this way. Please 0 - - - - When sorting by - - - - - - - ascending priority - - - true - - - - - - - descending priority - - - - - - - - - - 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 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Show conflicts and plugins - - - - - - - Highlight collapsed separators based on conflicts and plugins from mods inside them. - - - Highlight collapsed separators based on conflicts and plugins from mods inside them. - - - on separators - - - true - - - - - - - When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator. - - - When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator. - - - from separators - - - true + + + + 9 - + + + + When sorting by + + + + + + + Show icons on separators + + + + + + + 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 + + + + + + + flags + + + true + + + + + + + Show conflicts and plugins + + + + + + + conflicts + + + true + + + + + + + content + + + true + + + + + + + version + + + true + + + + + + + ascending priority + + + true + + + + + + + descending priority + + + + + + + Highlight collapsed separators based on conflicts and plugins from mods inside them. + + + Highlight collapsed separators based on conflicts and plugins from mods inside them. + + + on separators + + + true + + + + + + + When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator. + + + When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator. + + + from separators + + + true + + + + diff --git a/src/settingsdialoguserinterface.cpp b/src/settingsdialoguserinterface.cpp index 783c690f..ca040315 100644 --- a/src/settingsdialoguserinterface.cpp +++ b/src/settingsdialoguserinterface.cpp @@ -3,13 +3,20 @@ #include "shared/appconfig.h" #include "categoriesdialog.h" #include "colortable.h" +#include "modlist.h" #include #include using namespace MOBase; UserInterfaceSettingsTab::UserInterfaceSettingsTab(Settings& s, SettingsDialog& d) - : SettingsTab(s, d) + : SettingsTab(s, d), + m_columnToBox{ + { ModList::COL_CONFLICTFLAGS, ui->collapsibleSeparatorsIconsConflictsBox }, + { ModList::COL_FLAGS, ui->collapsibleSeparatorsIconsFlagsBox }, + { ModList::COL_CONTENT, ui->collapsibleSeparatorsIconsContentsBox}, + { ModList::COL_VERSION, ui->collapsibleSeparatorsIconsVersionBox } + } { // connect before setting to trigger @@ -19,13 +26,17 @@ UserInterfaceSettingsTab::UserInterfaceSettingsTab(Settings& s, SettingsDialog& // mod list ui->displayForeignBox->setChecked(settings().interface().displayForeign()); ui->colorSeparatorsBox->setChecked(settings().colors().colorSeparatorScrollbar()); - ui->collapsibleSeparatorsHighlightFromBox->setChecked(settings().interface().collapsibleSeparatorsHighlightFrom()); - ui->collapsibleSeparatorsHighlightToBox->setChecked(settings().interface().collapsibleSeparatorsHighlightTo()); ui->collapsibleSeparatorsAscBox->setChecked(settings().interface().collapsibleSeparators(Qt::AscendingOrder)); ui->collapsibleSeparatorsDscBox->setChecked(settings().interface().collapsibleSeparators(Qt::DescendingOrder)); + ui->collapsibleSeparatorsHighlightFromBox->setChecked(settings().interface().collapsibleSeparatorsHighlightFrom()); + ui->collapsibleSeparatorsHighlightToBox->setChecked(settings().interface().collapsibleSeparatorsHighlightTo()); ui->collapsibleSeparatorsPerProfileBox->setChecked(settings().interface().collapsibleSeparatorsPerProfile()); ui->saveFiltersBox->setChecked(settings().interface().saveFilters()); + for (auto& p : m_columnToBox) { + p.second->setChecked(settings().interface().collapsibleSeparatorsIcons(p.first)); + } + // download list ui->compactBox->setChecked(settings().interface().compactDownloads()); ui->showMetaBox->setChecked(settings().interface().metaDownloads()); @@ -49,6 +60,10 @@ void UserInterfaceSettingsTab::update() settings().interface().setCollapsibleSeparatorsPerProfile(ui->collapsibleSeparatorsPerProfileBox->isChecked()); settings().interface().setSaveFilters(ui->saveFiltersBox->isChecked()); + for (auto& p : m_columnToBox) { + settings().interface().setCollapsibleSeparatorsIcons(p.first, p.second->isChecked()); + } + // download list settings().interface().setCompactDownloads(ui->compactBox->isChecked()); settings().interface().setMetaDownloads(ui->showMetaBox->isChecked()); @@ -61,7 +76,7 @@ void UserInterfaceSettingsTab::updateCollapsibleSeparatorsGroup() { const auto checked = ui->collapsibleSeparatorsAscBox->isChecked() || ui->collapsibleSeparatorsDscBox->isChecked(); - ui->collapsibleSeparatorsHighlightToBox->setEnabled(checked); - ui->collapsibleSeparatorsHighlightFromBox->setEnabled(checked); - ui->collapsibleSeparatorsPerProfileBox->setEnabled(checked); + for (auto* checkbox : ui->collapsibleSeparatorsBox->findChildren()) { + checkbox->setEnabled(checked); + } } diff --git a/src/settingsdialoguserinterface.h b/src/settingsdialoguserinterface.h index 4609ae54..0c3c7fb7 100644 --- a/src/settingsdialoguserinterface.h +++ b/src/settingsdialoguserinterface.h @@ -1,6 +1,8 @@ #ifndef SETTINGSDIALOGUSERINTERFACE_H #define SETTINGSDIALOGUSERINTERFACE_H +#include + #include "settingsdialog.h" #include "settings.h" @@ -16,6 +18,10 @@ protected slots: // enable/disable the collapsible separators group depending on // the checkbox states void updateCollapsibleSeparatorsGroup(); + +private: + + const std::map m_columnToBox; }; #endif // SETTINGSDIALOGGENERAL_H -- cgit v1.3.1