diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-12-11 14:47:50 -0600 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-12-11 14:47:50 -0600 |
| commit | 5335188e635c8c1b1cb2529e2a921d15c7d02058 (patch) | |
| tree | e3197f2e16c7946fbf44637e0e748202db95716a /src | |
| parent | dac716bb86a9e4ff514fe7d939f33b397dc120e5 (diff) | |
Add option to remove column colors for mod list separators
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlist.cpp | 8 | ||||
| -rw-r--r-- | src/settings.cpp | 8 | ||||
| -rw-r--r-- | src/settings.h | 7 | ||||
| -rw-r--r-- | src/settingsdialog.ui | 40 |
4 files changed, 48 insertions, 15 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index 547cc853..dfe2efd3 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -395,7 +395,6 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const return QVariant();
} else if ((role == Qt::BackgroundRole)
|| (role == ViewMarkingScrollBar::DEFAULT_ROLE)) {
- auto flags = modInfo->getFlags();
if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_PLUGIN) {
return Settings::instance().modlistContainsPluginColor();
} else if (m_Overwrite.find(modIndex) != m_Overwrite.end()) {
@@ -403,8 +402,11 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const }
else if (m_Overwritten.find(modIndex) != m_Overwritten.end()) {
return Settings::instance().modlistOverwritingLooseColor();
- } else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end() && modInfo->getColor().isValid()) {
- return modInfo->getColor();
+ } else if (modInfo->hasFlag(ModInfo::FLAG_SEPARATOR)
+ && modInfo->getColor().isValid()
+ && ((role != ViewMarkingScrollBar::DEFAULT_ROLE)
+ || Settings::instance().colorSeparatorScrollbar())) {
+ return modInfo->getColor();
} else {
return QVariant();
}
diff --git a/src/settings.cpp b/src/settings.cpp index 5db656d8..18e893cb 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -148,6 +148,11 @@ void Settings::registerAsNXMHandler(bool force) } } +bool Settings::colorSeparatorScrollbar() const +{ + return m_Settings.value("Settings/colorSeparatorScrollbars", true).toBool(); +} + void Settings::managedGameChanged(IPluginGame const *gamePlugin) { m_GamePlugin = gamePlugin; @@ -716,6 +721,7 @@ Settings::GeneralTab::GeneralTab(Settings *m_parent, SettingsDialog &m_dialog) , m_overwrittenBtn(m_dialog.findChild<QPushButton *>("overwrittenBtn")) , m_containsBtn(m_dialog.findChild<QPushButton *>("containsBtn")) , m_containedBtn(m_dialog.findChild<QPushButton *>("containedBtn")) + , m_colorSeparatorsBox(m_dialog.findChild<QCheckBox *>("colorSeparatorsBox")) { // FIXME I think 'addLanguages' lives in here not in parent m_parent->addLanguages(m_languageBox); @@ -788,6 +794,7 @@ Settings::GeneralTab::GeneralTab(Settings *m_parent, SettingsDialog &m_dialog) m_compactBox->setChecked(m_parent->compactDownloads()); m_showMetaBox->setChecked(m_parent->metaDownloads()); m_usePrereleaseBox->setChecked(m_parent->usePrereleases()); + m_colorSeparatorsBox->setChecked(m_parent->colorSeparatorScrollbar()); } void Settings::GeneralTab::update() @@ -813,6 +820,7 @@ void Settings::GeneralTab::update() m_Settings.setValue("Settings/compact_downloads", m_compactBox->isChecked()); m_Settings.setValue("Settings/meta_downloads", m_showMetaBox->isChecked()); m_Settings.setValue("Settings/use_prereleases", m_usePrereleaseBox->isChecked()); + m_Settings.setValue("Settings/colorSeparatorScrollbars", m_colorSeparatorsBox->isChecked()); } Settings::PathsTab::PathsTab(Settings *parent, SettingsDialog &dialog) diff --git a/src/settings.h b/src/settings.h index 4009d4a3..912864e2 100644 --- a/src/settings.h +++ b/src/settings.h @@ -365,6 +365,12 @@ public: */ void registerAsNXMHandler(bool force); + /** + * @brief color the scrollbar of the mod list for custom separator colors? + * @return the state of the setting + */ + bool colorSeparatorScrollbar() const; + public slots: void managedGameChanged(MOBase::IPluginGame const *gamePlugin); @@ -414,6 +420,7 @@ private: QPushButton *m_overwrittenBtn; QPushButton *m_containsBtn; QPushButton *m_containedBtn; + QCheckBox *m_colorSeparatorsBox; }; class PathsTab : public SettingsTab diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 80a6a0e7..6557bbcc 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -99,31 +99,31 @@ If you use pre-releases, never contact me directly by e-mail or via private mess <string>Colors</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
- <item row="2" column="0" colspan="2">
- <widget class="QPushButton" name="containsBtn">
+ <item row="4" column="0" colspan="2">
+ <widget class="QPushButton" name="resetColorsBtn">
<property name="text">
- <string>Mod Contains selected Plugin</string>
+ <string>Reset Colors</string>
</property>
</widget>
</item>
- <item row="3" column="0" colspan="2">
- <widget class="QPushButton" name="containedBtn">
+ <item row="1" column="0">
+ <widget class="QPushButton" name="overwrittenBtn">
<property name="text">
- <string>Plugin is Contained in selected Mod</string>
+ <string>Is overwritten (loose files)</string>
</property>
</widget>
</item>
- <item row="4" column="0" colspan="2">
- <widget class="QPushButton" name="resetColorsBtn">
+ <item row="2" column="0" colspan="2">
+ <widget class="QPushButton" name="containsBtn">
<property name="text">
- <string>Reset Colors</string>
+ <string>Mod Contains selected Plugin</string>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QPushButton" name="overwrittenBtn">
+ <item row="3" column="0" colspan="2">
+ <widget class="QPushButton" name="containedBtn">
<property name="text">
- <string>Is overwritten (loose files)</string>
+ <string>Plugin is Contained in selected Mod</string>
</property>
</widget>
</item>
@@ -134,6 +134,22 @@ If you use pre-releases, never contact me directly by e-mail or via private mess </property>
</widget>
</item>
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="colorSeparatorsBox">
+ <property name="toolTip">
+ <string>When this is enabled, the color defined for a separator will be shown on the mod list scrollbar at the location of the separator. This can be useful for quick navigation between separator sections or to a specific separator section.</string>
+ </property>
+ <property name="whatsThis">
+ <string>When this is enabled, the color defined for a separator will be shown on the mod list scrollbar at the location of the separator. This can be useful for quick navigation between separator sections or to a specific separator section.</string>
+ </property>
+ <property name="text">
+ <string>Show mod list separator colors on the scrollbar</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
|
