diff options
| author | Al <26797547+Al12rs@users.noreply.github.com> | 2021-01-16 23:02:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-16 23:02:42 +0100 |
| commit | c48791a8a105d89cdbb8f4ac39557ed9cfd81800 (patch) | |
| tree | fb9aeb6aa05474dcad1a5fc9b21eb1af04f23778 /src | |
| parent | 8ee1f94b0f695be46abce2f76ee96035e1d79df7 (diff) | |
| parent | 9f8ba0ea5196bccf73f2f26a3dc8a55907faa02f (diff) | |
Merge pull request #1361 from Holt59/ui-fixes-and-others
UI fixes and others.
Diffstat (limited to 'src')
| -rw-r--r-- | src/aboutdialog.ui | 20 | ||||
| -rw-r--r-- | src/modlistcontextmenu.cpp | 48 | ||||
| -rw-r--r-- | src/modlistcontextmenu.h | 3 | ||||
| -rw-r--r-- | src/modlistversiondelegate.cpp | 8 | ||||
| -rw-r--r-- | src/modlistversiondelegate.h | 5 | ||||
| -rw-r--r-- | src/modlistview.cpp | 27 | ||||
| -rw-r--r-- | src/modlistview.h | 9 | ||||
| -rw-r--r-- | src/modlistviewactions.cpp | 17 | ||||
| -rw-r--r-- | src/modlistviewactions.h | 4 | ||||
| -rw-r--r-- | src/organizercore.cpp | 3 | ||||
| -rw-r--r-- | src/settings.cpp | 38 | ||||
| -rw-r--r-- | src/settings.h | 23 | ||||
| -rw-r--r-- | src/settingsdialog.ui | 208 | ||||
| -rw-r--r-- | src/settingsdialoguserinterface.cpp | 33 | ||||
| -rw-r--r-- | src/settingsdialoguserinterface.h | 6 |
15 files changed, 330 insertions, 122 deletions
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 @@ <string notr="true">isa</string>
</property>
</item>
+ <item>
+ <property name="text">
+ <string>Holt59</string>
+ </property>
+ </item>
</widget>
</item>
</layout>
@@ -256,11 +261,6 @@ <string notr="true">przester</string>
</property>
</item>
- <item>
- <property name="text">
- <string notr="true">Holt59</string>
- </property>
- </item>
</widget>
</item>
</layout>
@@ -491,6 +491,11 @@ </item>
<item>
<property name="text">
+ <string>Luca|EzioTheDeadPoet</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
<string notr="true">ogrotten</string>
</property>
</item>
@@ -501,6 +506,11 @@ </item>
<item>
<property name="text">
+ <string>Patchier</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
<string notr="true">PurpleFez</string>
</property>
</item>
diff --git a/src/modlistcontextmenu.cpp b/src/modlistcontextmenu.cpp index 97eef0eb..4a3278eb 100644 --- a/src/modlistcontextmenu.cpp +++ b/src/modlistcontextmenu.cpp @@ -17,20 +17,33 @@ 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); - 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()) { @@ -41,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/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 <QStyledItemDelegate> 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 ae905a6e..9f3a1266 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<unsigned int> 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<ModListSortProxy::Criteria>& criteria)
{
m_sortProxy->setCriteria(criteria);
@@ -792,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
@@ -1034,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)
@@ -1108,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<QColor> colors;
@@ -1145,7 +1140,7 @@ std::vector<ModInfo::EFlag> ModListView::modFlags(const QModelIndex& index, bool bool compact = false;
if (info->isSeparator()
&& hasCollapsibleSeparators()
- && m_core->settings().interface().collapsibleSeparatorsConflicts()
+ && m_core->settings().interface().collapsibleSeparatorsIcons(ModList::COL_FLAGS)
&& !isExpanded(index.sibling(index.row(), 0))) {
// combine the child conflicts
@@ -1176,7 +1171,7 @@ std::vector<ModInfo::EConflictFlag> ModListView::conflictFlags(const QModelIndex bool compact = false;
if (info->isSeparator()
&& hasCollapsibleSeparators()
- && m_core->settings().interface().collapsibleSeparatorsConflicts()
+ && m_core->settings().interface().collapsibleSeparatorsIcons(ModList::COL_CONFLICTFLAGS)
&& !isExpanded(index.sibling(index.row(), 0))) {
// combine the child conflicts
@@ -1211,7 +1206,7 @@ std::set<int> ModListView::contents(const QModelIndex& index, bool* includeChild if (info->isSeparator()
&& hasCollapsibleSeparators()
- && m_core->settings().interface().collapsibleSeparatorsConflicts()
+ && m_core->settings().interface().collapsibleSeparatorsIcons(ModList::COL_CONTENT)
&& !isExpanded(index.sibling(index.row(), 0))) {
// combine the child contents
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<ModListSortProxy::Criteria>& criteria);
diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index ed26faa8..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" @@ -172,6 +173,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) { @@ -192,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; 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 d1f3ef4f..7047fa44 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2188,14 +2188,34 @@ 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<bool>(m_Settings, "Settings", "collapsible_separators_conflicts", true); + return get<bool>(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<bool>(m_Settings, "Settings", "collapsible_separators_conflicts_from", true); +} + +void InterfaceSettings::setCollapsibleSeparatorsHighlightFrom(bool b) +{ + set(m_Settings, "Settings", "collapsible_separators_conflicts_from", b); +} + +bool InterfaceSettings::collapsibleSeparatorsIcons(int column) const +{ + return get<bool>(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 @@ -2238,6 +2258,16 @@ void InterfaceSettings::setMetaDownloads(bool b) set(m_Settings, "Settings", "meta_downloads", b); } +bool InterfaceSettings::hideDownloadsAfterInstallation() const +{ + return get<bool>(m_Settings, "Settings", "autohide_downloads", false); +} + +void InterfaceSettings::setHideDownloadsAfterInstallation(bool b) +{ + set(m_Settings, "Settings", "autohide_downloads", b); +} + bool InterfaceSettings::hideAPICounter() const { return get<bool>(m_Settings, "Settings", "hide_api_counter", false); diff --git a/src/settings.h b/src/settings.h index 484ce163..5f6dd37c 100644 --- a/src/settings.h +++ b/src/settings.h @@ -626,10 +626,22 @@ 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 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 // @@ -651,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 b23e6d90..bcef5d95 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 <property name="checked"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout_20"> - <property name="leftMargin"> - <number>7</number> - </property> - <property name="rightMargin"> - <number>7</number> - </property> - <item> - <widget class="QWidget" name="widget_8" native="true"> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0"> + <widget class="QWidget" name="collapsibleSeparatorsWidget" native="true"> <property name="minimumSize"> <size> <width>0</width> - <height>0</height> + <height>50</height> </size> </property> - <layout class="QHBoxLayout" name="horizontalLayout_13"> + <layout class="QGridLayout" name="gridLayout_10"> <property name="leftMargin"> <number>0</number> </property> @@ -339,62 +333,139 @@ If you disable this feature, MO will only display official DLCs this way. Please <property name="bottomMargin"> <number>0</number> </property> - <item> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>When sorting by</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="collapsibleSeparatorsAscBox"> - <property name="text"> - <string>ascending priority</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="collapsibleSeparatorsDscBox"> - <property name="text"> - <string>descending priority</string> + <item row="0" column="0"> + <layout class="QGridLayout" name="gridLayout_9"> + <property name="verticalSpacing"> + <number>9</number> </property> - </widget> + <item row="0" column="0"> + <widget class="QLabel" name="collapsibleSeparatorsLabel"> + <property name="text"> + <string>When sorting by</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_35"> + <property name="text"> + <string>Show icons on separators</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="3"> + <widget class="QCheckBox" name="collapsibleSeparatorsPerProfileBox"> + <property name="toolTip"> + <string>Do not share the collapse/expanded state of separators between profiles.</string> + </property> + <property name="whatsThis"> + <string>Do not share the collapse/expanded state of separators between profiles.</string> + </property> + <property name="text"> + <string>Profile-specific collapse states for separators</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QCheckBox" name="collapsibleSeparatorsIconsFlagsBox"> + <property name="text"> + <string>flags</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_34"> + <property name="text"> + <string>Show conflicts and plugins </string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QCheckBox" name="collapsibleSeparatorsIconsConflictsBox"> + <property name="text"> + <string>conflicts</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QCheckBox" name="collapsibleSeparatorsIconsContentsBox"> + <property name="text"> + <string>content</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="4"> + <widget class="QCheckBox" name="collapsibleSeparatorsIconsVersionBox"> + <property name="text"> + <string>version</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1" colspan="2"> + <widget class="QCheckBox" name="collapsibleSeparatorsAscBox"> + <property name="text"> + <string>ascending priority</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="3" colspan="2"> + <widget class="QCheckBox" name="collapsibleSeparatorsDscBox"> + <property name="text"> + <string>descending priority</string> + </property> + </widget> + </item> + <item row="2" column="1" colspan="2"> + <widget class="QCheckBox" name="collapsibleSeparatorsHighlightToBox"> + <property name="toolTip"> + <string>Highlight collapsed separators based on conflicts and plugins from mods inside them.</string> + </property> + <property name="whatsThis"> + <string>Highlight collapsed separators based on conflicts and plugins from mods inside them.</string> + </property> + <property name="text"> + <string>on separators</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="3" colspan="2"> + <widget class="QCheckBox" name="collapsibleSeparatorsHighlightFromBox"> + <property name="toolTip"> + <string>When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator.</string> + </property> + <property name="whatsThis"> + <string>When selecting a collapsed separator, highlight conflicting mods and plugins from mods inside the separator.</string> + </property> + <property name="text"> + <string>from separators</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> </item> </layout> </widget> </item> - <item> - <widget class="QCheckBox" name="collapsibleSeparatorsConflictsBox"> - <property name="toolTip"> - <string>Display mod conflicts on and from separator when collapsed, and show plugins from collapsed separators.</string> - </property> - <property name="whatsThis"> - <string>Display mod conflicts on and from separator when collapsed, and show plugins from collapsed separators.</string> - </property> - <property name="text"> - <string>Show conflicts and plugins on separators and from separators</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="collapsibleSeparatorsPerProfileBox"> - <property name="toolTip"> - <string>Do not share the collapse/expanded state of separators between profiles.</string> - </property> - <property name="whatsThis"> - <string>Do not share the collapse/expanded state of separators between profiles.</string> - </property> - <property name="text"> - <string>Profile-specific collapse states for separators</string> - </property> - </widget> - </item> </layout> </widget> </item> @@ -450,6 +521,19 @@ If you disable this feature, MO will only display official DLCs this way. Please </widget> </item> <item> + <widget class="QCheckBox" name="hideDownloadInstallBox"> + <property name="toolTip"> + <string>Automatically hide downloads after successful installation.</string> + </property> + <property name="whatsThis"> + <string>Automatically hide downloads after successful installation.</string> + </property> + <property name="text"> + <string>Hide downloads after installation</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer_5"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/src/settingsdialoguserinterface.cpp b/src/settingsdialoguserinterface.cpp index cdd30f2e..49710771 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 <utility.h> #include <questionboxmemory.h> 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,15 +26,21 @@ 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->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()); + ui->hideDownloadInstallBox->setChecked(settings().interface().hideDownloadsAfterInstallation()); // colors ui->colorTable->load(s); @@ -43,13 +56,19 @@ 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()); + 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()); + settings().interface().setHideDownloadsAfterInstallation(ui->hideDownloadInstallBox->isChecked()); // colors ui->colorTable->commitColors(); @@ -59,6 +78,10 @@ void UserInterfaceSettingsTab::updateCollapsibleSeparatorsGroup() { const auto checked = ui->collapsibleSeparatorsAscBox->isChecked() || ui->collapsibleSeparatorsDscBox->isChecked(); - ui->collapsibleSeparatorsConflictsBox->setEnabled(checked); - ui->collapsibleSeparatorsPerProfileBox->setEnabled(checked); + for (auto* widget : ui->collapsibleSeparatorsWidget->findChildren<QWidget*>()) { + widget->setEnabled(checked); + } + ui->collapsibleSeparatorsLabel->setEnabled(true); + ui->collapsibleSeparatorsAscBox->setEnabled(true); + ui->collapsibleSeparatorsDscBox->setEnabled(true); } 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 <QCheckBox> + #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<int, QCheckBox*> m_columnToBox; }; #endif // SETTINGSDIALOGGENERAL_H |
