summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-12-29 21:40:22 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2021-01-02 15:38:16 +0100
commit095348c16f58d757f2d9549d06fd12d5ed14a1d2 (patch)
treeeeb2e1641508f00aed0a7df8df3a9fe02fec14c9
parent44e846cf18d2e46b471183fd1d5ba81a4b7a312d (diff)
Add option to disable collapsible separators.
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/modlistview.cpp7
-rw-r--r--src/modlistview.h5
-rw-r--r--src/settings.cpp10
-rw-r--r--src/settings.h5
-rw-r--r--src/settingsdialog.ui37
-rw-r--r--src/settingsdialoggeneral.cpp2
7 files changed, 62 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e54c24e1..63c9a8be 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -692,7 +692,6 @@ void MainWindow::allowListResize()
void MainWindow::updateStyle(const QString&)
{
resetActionIcons();
- ui->modList->refreshStyle();
}
void MainWindow::resizeEvent(QResizeEvent *event)
@@ -4619,6 +4618,7 @@ void MainWindow::on_actionSettings_triggered()
fixCategories();
refreshFilters();
+ ui->modList->refresh();
if (settings.paths().profiles() != oldProfilesDirectory) {
refreshProfiles();
diff --git a/src/modlistview.cpp b/src/modlistview.cpp
index 643b1971..dbd09884 100644
--- a/src/modlistview.cpp
+++ b/src/modlistview.cpp
@@ -76,8 +76,10 @@ ModListView::ModListView(QWidget* parent)
setItemDelegate(new ModListStyledItemDelegated(this));
}
-void ModListView::refreshStyle()
+void ModListView::refresh()
{
+ updateGroupByProxy(-1);
+
// maybe there is a better way but I did not find one
QString sheet = styleSheet();
setStyleSheet("QTreeView { }");
@@ -496,7 +498,8 @@ void ModListView::updateGroupByProxy(int groupIndex)
m_byNexusIdProxy->setGroupedColumn(ModList::COL_MODID);
m_sortProxy->setSourceModel(m_byNexusIdProxy);
}
- else if (m_sortProxy->sortColumn() == ModList::COL_PRIORITY
+ else if (m_core->settings().interface().collapsibleSeparators()
+ && m_sortProxy->sortColumn() == ModList::COL_PRIORITY
&& m_sortProxy->sortOrder() == Qt::AscendingOrder) {
m_sortProxy->setSourceModel(m_byPriorityProxy);
m_byPriorityProxy->refresh();
diff --git a/src/modlistview.h b/src/modlistview.h
index 3520bfc4..2ea5891c 100644
--- a/src/modlistview.h
+++ b/src/modlistview.h
@@ -65,10 +65,9 @@ public:
//
QRect visualRect(const QModelIndex& index) const override;
- // refresh the style of the mod list, this needs to be called when the
- // stylesheet is changed
+ // refresh the view (to call when settings have been changed)
//
- void refreshStyle();
+ void refresh();
signals:
diff --git a/src/settings.cpp b/src/settings.cpp
index 04cfafc9..b6961807 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -2162,6 +2162,16 @@ void InterfaceSettings::setStyleName(const QString& name)
set(m_Settings, "Settings", "style", name);
}
+bool InterfaceSettings::collapsibleSeparators() const
+{
+ return get<bool>(m_Settings, "Settings", "collapsible_separators", true);
+}
+
+void InterfaceSettings::setCollapsibleSeparators(bool b)
+{
+ set(m_Settings, "Settings", "collapsible_separators", b);
+}
+
bool InterfaceSettings::compactDownloads() const
{
return get<bool>(m_Settings, "Settings", "compact_downloads", false);
diff --git a/src/settings.h b/src/settings.h
index 3f60fc7b..5506bbf8 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -617,6 +617,11 @@ public:
std::optional<QString> styleName() const;
void setStyleName(const QString& name);
+ // whether to use collapsible separators when possible
+ //
+ bool collapsibleSeparators() const;
+ void setCollapsibleSeparators(bool b);
+
// whether to show compact downloads
//
bool compactDownloads() const;
diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui
index 43af5e9f..6d62228d 100644
--- a/src/settingsdialog.ui
+++ b/src/settingsdialog.ui
@@ -338,6 +338,43 @@
</layout>
</widget>
</item>
+ <item>
+ <widget class="QWidget" name="widget_8" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="collapsibleSeparatorsBox">
+ <property name="text">
+ <string>Use collapsible separators</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="tristate">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/settingsdialoggeneral.cpp b/src/settingsdialoggeneral.cpp
index f29e1d24..47388c96 100644
--- a/src/settingsdialoggeneral.cpp
+++ b/src/settingsdialoggeneral.cpp
@@ -27,6 +27,7 @@ GeneralSettingsTab::GeneralSettingsTab(Settings& s, SettingsDialog& d)
ui->checkForUpdates->setChecked(settings().checkForUpdates());
ui->usePrereleaseBox->setChecked(settings().usePrereleases());
ui->colorSeparatorsBox->setChecked(settings().colors().colorSeparatorScrollbar());
+ ui->collapsibleSeparatorsBox->setChecked(settings().interface().collapsibleSeparators());
QObject::connect(ui->exploreStyles, &QPushButton::clicked, [&]{ onExploreStyles(); });
@@ -70,6 +71,7 @@ void GeneralSettingsTab::update()
settings().setCheckForUpdates(ui->checkForUpdates->isChecked());
settings().setUsePrereleases(ui->usePrereleaseBox->isChecked());
settings().colors().setColorSeparatorScrollbar(ui->colorSeparatorsBox->isChecked());
+ settings().interface().setCollapsibleSeparators(ui->collapsibleSeparatorsBox->isChecked());
}
void GeneralSettingsTab::addLanguages()