From 2c9a3c7de874a5edfdc6dacf2fd2fcd7f303152d Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 14 Jan 2021 19:54:13 +0100 Subject: Better context menu entries for mod/separator creation. --- src/modlistcontextmenu.cpp | 18 ++++++++++++------ src/modlistviewactions.cpp | 5 +++++ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/modlistcontextmenu.cpp b/src/modlistcontextmenu.cpp index 97eef0eb..ac5494da 100644 --- a/src/modlistcontextmenu.cpp +++ b/src/modlistcontextmenu.cpp @@ -20,17 +20,23 @@ ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core, ModListV addAction(tr("Install Mod..."), [=]() { view->actions().installMod(); }); auto modIndex = index.data(ModList::IndexRole); - if (modIndex.isValid()) { + if (modIndex.isValid() && view->sortColumn() == ModList::COL_PRIORITY) { auto info = ModInfo::getByIndex(modIndex.toInt()); if (!info->isBackup()) { - addAction(info->isSeparator() ? tr("Create empty mod inside") : tr("Create empty mod before"), - [=]() { view->actions().createEmptyMod(index); }); - addAction(tr("Create separator before"), [=]() { view->actions().createSeparator(index); }); + QString text = tr("Create empty mod above"); + if (info->isSeparator()) { + text = tr("Create empty mod inside"); + } + else if (view->sortOrder() == Qt::DescendingOrder) { + text = tr("Create empty mod below"); + } + addAction(text, [=]() { view->actions().createEmptyMod(index); }); + addAction(tr("Create separator above"), [=]() { view->actions().createSeparator(index); }); } } else { - addAction(tr("Create empty mod at the end"), [=]() { view->actions().createEmptyMod(); }); - addAction(tr("Create separator at the end"), [=]() { view->actions().createSeparator(); }); + addAction(tr("Create empty mod"), [=]() { view->actions().createEmptyMod(); }); + addAction(tr("Create separator"), [=]() { view->actions().createSeparator(); }); } if (view->hasCollapsibleSeparators()) { diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index ed26faa8..c83f2f64 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -172,6 +172,11 @@ void ModListViewActions::createSeparator(const QModelIndex& index) const int newPriority = -1; if (index.isValid() && m_view->sortColumn() == ModList::COL_PRIORITY) { newPriority = m_core.currentProfile()->getModPriority(index.data(ModList::IndexRole).toInt()); + + // descending order, we need to fix the priority + if (m_view->sortOrder() == Qt::DescendingOrder) { + newPriority++; + } } if (m_core.createMod(name) == nullptr) { -- cgit v1.3.1 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/modlistcontextmenu.cpp | 30 ++++++++++++++++++------------ src/modlistcontextmenu.h | 3 +++ src/modlistview.cpp | 15 +++++---------- src/modlistview.h | 9 ++++----- src/modlistviewactions.cpp | 12 ++++++++++++ src/modlistviewactions.h | 4 ++++ 6 files changed, 46 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/modlistcontextmenu.cpp b/src/modlistcontextmenu.cpp index ac5494da..4a3278eb 100644 --- a/src/modlistcontextmenu.cpp +++ b/src/modlistcontextmenu.cpp @@ -17,6 +17,13 @@ ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core, ModListV ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core, ModListView* view, const QModelIndex& index, QWidget* parent) : QMenu(parent) { + connect(this, &QMenu::aboutToShow, [=, &core] { populate(core, view, index); }); +} + +void ModListGlobalContextMenu::populate(OrganizerCore& core, ModListView* view, const QModelIndex& index) +{ + clear(); + addAction(tr("Install Mod..."), [=]() { view->actions().installMod(); }); auto modIndex = index.data(ModList::IndexRole); @@ -47,18 +54,17 @@ ModListGlobalContextMenu::ModListGlobalContextMenu(OrganizerCore& core, ModListV addSeparator(); - addAction(tr("Enable all visible"), [=]() { - if (QMessageBox::question(view, tr("Confirm"), tr("Really enable all visible mods?"), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - view->enableAllVisible(); - } - }); - addAction(tr("Disable all visible"), [=]() { - if (QMessageBox::question(parent, tr("Confirm"), tr("Really disable all visible mods?"), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - view->disableAllVisible(); - } - }); + QString enableTxt = tr("Enable all"), + disableTxt = tr("Disable all"); + + if (view->isFilterActive()) { + enableTxt = tr("Enable all matching mods"); + disableTxt = tr("Disable all matching mods"); + } + + addAction(enableTxt, [=] { view->actions().setAllMatchingModsEnabled(true); }); + addAction(disableTxt, [=] { view->actions().setAllMatchingModsEnabled(false); }); + addAction(tr("Check for updates"), [=]() { view->actions().checkModsForUpdates(); }); addAction(tr("Refresh"), &core, &OrganizerCore::profileRefresh); addAction(tr("Export to csv..."), [=]() { view->actions().exportModListCSV(); }); diff --git a/src/modlistcontextmenu.h b/src/modlistcontextmenu.h index 2b3f9dcd..8a6ce3df 100644 --- a/src/modlistcontextmenu.h +++ b/src/modlistcontextmenu.h @@ -25,6 +25,9 @@ protected: friend class ModListContextMenu; + // populate the menu + void populate(OrganizerCore& core, ModListView* view, const QModelIndex& index); + // creates a "All mods" context menu for the given index (can be invalid). ModListGlobalContextMenu(OrganizerCore& core, ModListView* view, const QModelIndex& index, QWidget* parent = nullptr); 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); diff --git a/src/modlistview.h b/src/modlistview.h index 13f868c6..0ae4dd76 100644 --- a/src/modlistview.h +++ b/src/modlistview.h @@ -66,6 +66,10 @@ public: int sortColumn() const; Qt::SortOrder sortOrder() const; + // check if a filter is currently active + // + bool isFilterActive() const; + // the current group mode // GroupByMode groupByMode() const; @@ -107,11 +111,6 @@ signals: public slots: - // enable/disable all visible mods - // - void enableAllVisible(); - void disableAllVisible(); - // set the filter criteria/options for mods // void setFilterCriteria(const std::vector& criteria); diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index c83f2f64..857afbdc 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -17,6 +17,7 @@ #include "modinfodialog.h" #include "modlist.h" #include "modlistview.h" +#include "modelutils.h" #include "messagedialog.h" #include "nexusinterface.h" #include "nxmaccessmanager.h" @@ -197,6 +198,17 @@ void ModListViewActions::createSeparator(const QModelIndex& index) const m_view->scrollToAndSelect(m_view->indexModelToView(m_core.modList()->index(mIndex, 0))); } +void ModListViewActions::setAllMatchingModsEnabled(bool enabled) const +{ + const auto allIndex = m_view->indexViewToModel(flatIndex(m_view->model())); + const QString message = enabled ? + tr("Really enable %1 mod(s)?") : tr("Really disable %1 mod(s)?"); + if (QMessageBox::question(m_parent, tr("Confirm"), message.arg(allIndex.size()), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + m_core.modList()->setActive(allIndex, enabled); + } +} + void ModListViewActions::checkModsForUpdates() const { bool checkingModsForUpdate = false; diff --git a/src/modlistviewactions.h b/src/modlistviewactions.h index f1215cec..c3f06a48 100644 --- a/src/modlistviewactions.h +++ b/src/modlistviewactions.h @@ -41,6 +41,10 @@ public: void createEmptyMod(const QModelIndex& index = QModelIndex()) const; void createSeparator(const QModelIndex& index = QModelIndex()) const; + // enable/disable all non-filtered mods + // + void setAllMatchingModsEnabled(bool enabled) const; + // check all mods for update // void checkModsForUpdates() const; -- 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') 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') 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 From 03f7c0ef4f16a5a89f98e3b8bed580bbe27abaff Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 14 Jan 2021 21:18:07 +0100 Subject: Move Holt59 to lead developers. Add Luca|EzioTheDeadPoet and Patchier to contributors. --- src/aboutdialog.ui | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui index e1f7aef3..16fc57aa 100644 --- a/src/aboutdialog.ui +++ b/src/aboutdialog.ui @@ -220,6 +220,11 @@ isa + + + Holt59 + + @@ -256,11 +261,6 @@ przester - - - Holt59 - - @@ -489,6 +489,11 @@ GSDFan + + + Luca|EzioTheDeadPoet + + ogrotten @@ -499,6 +504,11 @@ outdatedtv + + + Patchier + + PurpleFez -- cgit v1.3.1 From 186e96c878c432914f4f3b9e73a28b0b96103d3d Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 14 Jan 2021 21:40:36 +0100 Subject: Fix disabling of collapsible separators settings. --- src/settingsdialog.ui | 4 ++-- src/settingsdialoguserinterface.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 93934fc1..f6368ff7 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -313,7 +313,7 @@ If you disable this feature, MO will only display official DLCs this way. Please - + 0 @@ -339,7 +339,7 @@ If you disable this feature, MO will only display official DLCs this way. Please 9 - + When sorting by diff --git a/src/settingsdialoguserinterface.cpp b/src/settingsdialoguserinterface.cpp index ca040315..6ccea300 100644 --- a/src/settingsdialoguserinterface.cpp +++ b/src/settingsdialoguserinterface.cpp @@ -76,7 +76,10 @@ void UserInterfaceSettingsTab::updateCollapsibleSeparatorsGroup() { const auto checked = ui->collapsibleSeparatorsAscBox->isChecked() || ui->collapsibleSeparatorsDscBox->isChecked(); - for (auto* checkbox : ui->collapsibleSeparatorsBox->findChildren()) { - checkbox->setEnabled(checked); + for (auto* widget : ui->collapsibleSeparatorsWidget->findChildren()) { + widget->setEnabled(checked); } + ui->collapsibleSeparatorsLabel->setEnabled(true); + ui->collapsibleSeparatorsAscBox->setEnabled(true); + ui->collapsibleSeparatorsDscBox->setEnabled(true); } -- cgit v1.3.1 From 9f8ba0ea5196bccf73f2f26a3dc8a55907faa02f Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Thu, 14 Jan 2021 22:08:58 +0100 Subject: Add setting to automatically hide download after installation. --- src/organizercore.cpp | 3 +++ src/settings.cpp | 10 ++++++++++ src/settings.h | 5 +++++ src/settingsdialog.ui | 13 +++++++++++++ src/settingsdialoguserinterface.cpp | 2 ++ 5 files changed, 33 insertions(+) (limited to 'src') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index bbf6029b..e95aa565 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -808,6 +808,9 @@ ModInfo::Ptr OrganizerCore::installDownload(int index, int priority) reportError(tr("mod not found: %1").arg(qUtf8Printable(modName))); } m_DownloadManager.markInstalled(index); + if (settings().interface().hideDownloadsAfterInstallation()) { + m_DownloadManager.removeDownload(index, false); + } emit modInstalled(modName); return modInfo; } diff --git a/src/settings.cpp b/src/settings.cpp index 27108162..7047fa44 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2258,6 +2258,16 @@ void InterfaceSettings::setMetaDownloads(bool b) set(m_Settings, "Settings", "meta_downloads", b); } +bool InterfaceSettings::hideDownloadsAfterInstallation() const +{ + return get(m_Settings, "Settings", "autohide_downloads", false); +} + +void InterfaceSettings::setHideDownloadsAfterInstallation(bool b) +{ + set(m_Settings, "Settings", "autohide_downloads", b); +} + bool InterfaceSettings::hideAPICounter() const { return get(m_Settings, "Settings", "hide_api_counter", false); diff --git a/src/settings.h b/src/settings.h index 384d50a2..5f6dd37c 100644 --- a/src/settings.h +++ b/src/settings.h @@ -663,6 +663,11 @@ public: bool metaDownloads() const; void setMetaDownloads(bool b); + // whether to hide downloads after installing them + // + bool hideDownloadsAfterInstallation() const; + void setHideDownloadsAfterInstallation(bool b); + // whether the API counter should be hidden // bool hideAPICounter() const; diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index f6368ff7..bcef5d95 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -520,6 +520,19 @@ If you disable this feature, MO will only display official DLCs this way. Please + + + + Automatically hide downloads after successful installation. + + + Automatically hide downloads after successful installation. + + + Hide downloads after installation + + + diff --git a/src/settingsdialoguserinterface.cpp b/src/settingsdialoguserinterface.cpp index 6ccea300..49710771 100644 --- a/src/settingsdialoguserinterface.cpp +++ b/src/settingsdialoguserinterface.cpp @@ -40,6 +40,7 @@ UserInterfaceSettingsTab::UserInterfaceSettingsTab(Settings& s, SettingsDialog& // download list ui->compactBox->setChecked(settings().interface().compactDownloads()); ui->showMetaBox->setChecked(settings().interface().metaDownloads()); + ui->hideDownloadInstallBox->setChecked(settings().interface().hideDownloadsAfterInstallation()); // colors ui->colorTable->load(s); @@ -67,6 +68,7 @@ void UserInterfaceSettingsTab::update() // download list settings().interface().setCompactDownloads(ui->compactBox->isChecked()); settings().interface().setMetaDownloads(ui->showMetaBox->isChecked()); + settings().interface().setHideDownloadsAfterInstallation(ui->hideDownloadInstallBox->isChecked()); // colors ui->colorTable->commitColors(); -- cgit v1.3.1