Settings: Store colors in hex.

This commit is contained in:
Nodir Temirkhodjaev 2019-02-12 09:29:23 +05:00
parent c5f87a5fe4
commit bb01a52daa

View File

@ -377,13 +377,21 @@ QStringList FortSettings::iniList(const QString &key) const
QColor FortSettings::iniColor(const QString &key, const QColor &defaultValue) 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, void FortSettings::setIniColor(const QString &key, const QColor &value,
const QColor &defaultValue) const QColor &defaultValue)
{ {
setIniValue(key, value.rgba(), defaultValue.rgba()); setIniValue(key, value.name(),
defaultValue.isValid() ? defaultValue.name() : QString());
} }
QVariant FortSettings::iniValue(const QString &key, QVariant FortSettings::iniValue(const QString &key,