refactored the settings dialog

This commit is contained in:
fourtf
2018-01-12 23:09:05 +01:00
parent 4cbc3b8b61
commit e0bb061c81
39 changed files with 953 additions and 894 deletions
+2 -2
View File
@@ -49,8 +49,8 @@ public:
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages", true};
BoolSetting mentionUsersWithAt = {"/behaviour/mentionUsersWithAt", false};
FloatSetting mouseScrollMultiplier = {"/behaviour/mouseScrollMultiplier", 1.0};
StringSetting streamlinkPath = {"/behaviour/streamlink/path", ""};
StringSetting preferredQuality = {"/behaviour/streamlink/quality", "Choose"};
QStringSetting streamlinkPath = {"/behaviour/streamlink/path", ""};
QStringSetting preferredQuality = {"/behaviour/streamlink/quality", "Choose"};
BoolSetting pauseChatHover = {"/behaviour/pauseChatHover", false};
/// Commands
+11 -11
View File
@@ -11,7 +11,7 @@ namespace singletons {
namespace detail {
double getMultiplierByTheme(const std::string &themeName)
double getMultiplierByTheme(const QString &themeName)
{
if (themeName == "Light") {
return 0.8;
@@ -46,7 +46,7 @@ ThemeManager::ThemeManager()
void ThemeManager::update()
{
this->actuallyUpdate(this->themeHue, detail::getMultiplierByTheme(this->themeName));
this->actuallyUpdate(this->themeHue, detail::getMultiplierByTheme(this->themeName.getValue()));
}
// hue: theme color (0 - 1)
@@ -157,10 +157,10 @@ void ThemeManager::normalizeColor(QColor &color)
}
if (color.lightnessF() > 0.4f && color.hueF() > 0.1 && color.hueF() < 0.33333) {
color.setHslF(color.hueF(), color.saturationF(),
color.lightnessF() -
sin((color.hueF() - 0.1) / (0.3333 - 0.1) * 3.14159) *
color.saturationF() * 0.2);
color.setHslF(
color.hueF(), color.saturationF(),
color.lightnessF() - sin((color.hueF() - 0.1) / (0.3333 - 0.1) * 3.14159) *
color.saturationF() * 0.2);
}
} else {
if (color.lightnessF() < 0.5f) {
@@ -168,13 +168,13 @@ void ThemeManager::normalizeColor(QColor &color)
}
if (color.lightnessF() < 0.6f && color.hueF() > 0.54444 && color.hueF() < 0.83333) {
color.setHslF(color.hueF(), color.saturationF(),
color.lightnessF() +
sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
color.saturationF() * 0.4);
color.setHslF(
color.hueF(), color.saturationF(),
color.lightnessF() + sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
color.saturationF() * 0.4);
}
}
}
} // namespace singletons
} // namespace chatterino
}
+4 -3
View File
@@ -4,6 +4,7 @@
#include <QColor>
#include <boost/signals2.hpp>
#include <pajlada/settings/setting.hpp>
#include <util/serialize-custom.hpp>
namespace chatterino {
namespace singletons {
@@ -102,10 +103,10 @@ public:
boost::signals2::signal<void()> updated;
private:
pajlada::Settings::Setting<std::string> themeName;
pajlada::Settings::Setting<QString> themeName;
pajlada::Settings::Setting<double> themeHue;
private:
void actuallyUpdate(double hue, double multiplier);
QColor blendColors(const QColor &color1, const QColor &color2, qreal ratio);
@@ -122,5 +123,5 @@ private:
friend class WindowManager;
};
} // namespace singletons
} // namespace chatterino
}