// implemented upstream - user apps void ColorScheme::read(KConfig& config) { KConfigGroup configGroup = config.group("General"); QString description = configGroup.readEntry("Description", QObject::tr("Un-named Color Scheme")); _description = tr(description.toUtf8()); _opacity = configGroup.readEntry("Opacity",qreal(1.0)); for (int i=0 ; i < TABLE_COLORS ; i++) { readColorEntry(config,i); } }
void ColorScheme::read(const QString & fileName) { QSettings s(fileName, QSettings::IniFormat); s.beginGroup("General"); _description = s.value("Description", QObject::tr("Un-named Color Scheme")).toString(); _opacity = s.value("Opacity",qreal(1.0)).toDouble(); s.endGroup(); for (int i=0 ; i < TABLE_COLORS ; i++) { readColorEntry(&s, i); } }
QColor ValueMap::readEntry(const QString& s, const QColor defaultVal ){ return readColorEntry(s,&defaultVal); }
QColor KConfigBase::readColorEntry(const QString &pKey, const QColor *pDefault) const { return readColorEntry(pKey.utf8().data(), pDefault); }
QVariant KConfigBase::readPropertyEntry(const char *pKey, const QVariant &aDefault) const { if(!hasKey(pKey)) return aDefault; QVariant tmp = aDefault; switch(aDefault.type()) { case QVariant::Invalid: return QVariant(); case QVariant::String: return QVariant(readEntry(pKey, aDefault.toString())); case QVariant::StringList: return QVariant(readListEntry(pKey)); case QVariant::List: { QStringList strList = readListEntry(pKey); QStringList::ConstIterator it = strList.begin(); QStringList::ConstIterator end = strList.end(); QValueList< QVariant > list; for(; it != end; ++it) { tmp = *it; list.append(tmp); } return QVariant(list); } case QVariant::Font: return QVariant(readFontEntry(pKey, &tmp.asFont())); case QVariant::Point: return QVariant(readPointEntry(pKey, &tmp.asPoint())); case QVariant::Rect: return QVariant(readRectEntry(pKey, &tmp.asRect())); case QVariant::Size: return QVariant(readSizeEntry(pKey, &tmp.asSize())); case QVariant::Color: return QVariant(readColorEntry(pKey, &tmp.asColor())); case QVariant::Int: return QVariant(readNumEntry(pKey, aDefault.toInt())); case QVariant::UInt: return QVariant(readUnsignedNumEntry(pKey, aDefault.toUInt())); case QVariant::LongLong: return QVariant(readNum64Entry(pKey, aDefault.toLongLong())); case QVariant::ULongLong: return QVariant(readUnsignedNum64Entry(pKey, aDefault.toULongLong())); case QVariant::Bool: return QVariant(readBoolEntry(pKey, aDefault.toBool()), 0); case QVariant::Double: return QVariant(readDoubleNumEntry(pKey, aDefault.toDouble())); case QVariant::DateTime: return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime())); case QVariant::Date: return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime()).date()); case QVariant::Pixmap: case QVariant::Image: case QVariant::Brush: case QVariant::Palette: case QVariant::ColorGroup: case QVariant::Map: case QVariant::IconSet: case QVariant::CString: case QVariant::PointArray: case QVariant::Region: case QVariant::Bitmap: case QVariant::Cursor: case QVariant::SizePolicy: case QVariant::Time: case QVariant::ByteArray: case QVariant::BitArray: case QVariant::KeySequence: case QVariant::Pen: break; } Q_ASSERT(0); return QVariant(); }