summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2021-01-11 12:49:42 +0100
committerGitHub <noreply@github.com>2021-01-11 12:49:42 +0100
commit1dc2b225485a073d82e08a9820493086b2dda8b8 (patch)
tree5a4e5478d577f065c7282cb62992c2b6c735e13f /src/settings.cpp
parenta680dfa3e94b34bf6b0ebd65d29d7a9799e3183f (diff)
parent05efc74e402ca3770d9fdaa2557f4030c31ee198 (diff)
Merge pull request #1350 from Holt59/collapsible-separators
Collapsible separators - Fix & Improvements.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index e04cd0c1..488a9b01 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1326,12 +1326,12 @@ void ColorSettings::setColorSeparatorScrollbar(bool b)
QColor ColorSettings::idealTextColor(const QColor& rBackgroundColor)
{
- if (rBackgroundColor.alpha() == 0)
+ if (rBackgroundColor.alpha() < 50)
return QColor(Qt::black);
- const int THRESHOLD = 106 * 255.0f / rBackgroundColor.alpha();
- int BackgroundDelta = (rBackgroundColor.red() * 0.299) + (rBackgroundColor.green() * 0.587) + (rBackgroundColor.blue() * 0.114);
- return QColor((255 - BackgroundDelta <= THRESHOLD) ? Qt::black : Qt::white);
+ // "inverse' of luminance of the background
+ int iLuminance = (rBackgroundColor.red() * 0.299) + (rBackgroundColor.green() * 0.587) + (rBackgroundColor.blue() * 0.114);
+ return QColor(iLuminance >= 128 ? Qt::black : Qt::white);
}
@@ -2195,6 +2195,26 @@ void InterfaceSettings::setCollapsibleSeparatorsConflicts(bool b)
set(m_Settings, "Settings", "collapsible_separators_conflicts", b);
}
+bool InterfaceSettings::collapsibleSeparatorsPerProfile() const
+{
+ return get<bool>(m_Settings, "Settings", "collapsible_separators_per_profile", false);
+}
+
+void InterfaceSettings::setCollapsibleSeparatorsPerProfile(bool b)
+{
+ set(m_Settings, "Settings", "collapsible_separators_per_profile", b);
+}
+
+bool InterfaceSettings::saveFilters() const
+{
+ return get<bool>(m_Settings, "Settings", "save_filters", false);
+}
+
+void InterfaceSettings::setSaveFilters(bool b)
+{
+ set(m_Settings, "Settings", "save_filters", b);
+}
+
bool InterfaceSettings::compactDownloads() const
{
return get<bool>(m_Settings, "Settings", "compact_downloads", false);