Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/modlistviewactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,10 @@ void ModListViewActions::setColor(const QModelIndexList& indices,
return;

settings.colors().setPreviousSeparatorColor(currentColor);
for (int i = 0; i < QColorDialog::customCount(); ++i) {
const auto customColor = dialog.customColor(i);
settings.colors().setCustomColor(i, customColor);
}

for (auto& idx : indices) {
ModInfo::Ptr info = ModInfo::getByIndex(idx.data(ModList::IndexRole).toInt());
Expand Down
19 changes: 18 additions & 1 deletion src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,13 @@ void WidgetSettings::resetQuestionButtons()
removeSection(m_Settings, "DialogChoices");
}

ColorSettings::ColorSettings(QSettings& s) : m_Settings(s) {}
ColorSettings::ColorSettings(QSettings& s) : m_Settings(s)
{
for (int i = 0; i < QColorDialog::customCount(); ++i) {
const auto color = customColor(i);
QColorDialog::setCustomColor(i, color);
}
}

QColor ColorSettings::modlistOverwrittenLoose() const
{
Expand Down Expand Up @@ -1356,6 +1362,17 @@ void ColorSettings::removePreviousSeparatorColor()
remove(m_Settings, "General", "previousSeparatorColor");
}

QColor ColorSettings::customColor(const int index) const
{
return get<QColor>(m_Settings, "Settings", QString("customColor%1").arg(index),
QColor(255, 255, 255));
}

void ColorSettings::setCustomColor(const int index, const QColor& c)
{
set(m_Settings, "Settings", QString("customColor%1").arg(index), c);
}

bool ColorSettings::colorSeparatorScrollbar() const
{
return get<bool>(m_Settings, "Settings", "colorSeparatorScrollbars", true);
Expand Down
4 changes: 4 additions & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ class ColorSettings
void setPreviousSeparatorColor(const QColor& c) const;
void removePreviousSeparatorColor();

// custom colors set in QColorDialog (e.g. for separators)
QColor customColor(const int index) const;
void setCustomColor(const int index, const QColor& c);

// whether the scrollbar of the mod list should have colors for custom
// separator colors
//
Expand Down
Loading