From bb01a52daa651c906bb793f5cf991f6a3e4cf12b Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Tue, 12 Feb 2019 09:29:23 +0500 Subject: [PATCH] Settings: Store colors in hex. --- src/ui/fortsettings.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ui/fortsettings.cpp b/src/ui/fortsettings.cpp index 8784c874..a29b039d 100644 --- a/src/ui/fortsettings.cpp +++ b/src/ui/fortsettings.cpp @@ -377,13 +377,21 @@ QStringList FortSettings::iniList(const QString &key) const QColor FortSettings::iniColor(const QString &key, const QColor &defaultValue) const { - return QColor::fromRgba(iniUInt(key, defaultValue.rgba())); + const QString text = iniText(key); + if (text.isEmpty()) + return defaultValue; + + if (text.at(0).isDigit()) + return QColor::fromRgba(text.toUInt()); + + return QColor(text); } void FortSettings::setIniColor(const QString &key, const QColor &value, const QColor &defaultValue) { - setIniValue(key, value.rgba(), defaultValue.rgba()); + setIniValue(key, value.name(), + defaultValue.isValid() ? defaultValue.name() : QString()); } QVariant FortSettings::iniValue(const QString &key,