diff -r 90969608255c -r b1e3a4d88f13 settings.cpp --- a/settings.cpp Tue Jan 24 15:09:48 2006 +0000 +++ b/settings.cpp Tue Sep 05 10:03:29 2006 +0000 @@ -61,6 +61,7 @@ qWarning ("SimpleSettings::writeSettings() Couldn't write "+path); } +/* QString SimpleSettings::readEntry (const QString &key) { QStringList::Iterator itk=keylist.begin(); @@ -77,6 +78,46 @@ qWarning ("SimpleSettings::readEntry() Couldn't find key "+key); return ""; } +*/ + +QString SimpleSettings::readEntry (const QString &key, const QString &def) +{ + QStringList::Iterator itk=keylist.begin(); + QStringList::Iterator itv=valuelist.begin(); + + // First search for value in settings saved in map + while (itk !=keylist.end() ) + { + if (*itk == key) + return *itv; + itk++; + itv++; + } + return def; +} + +int SimpleSettings::readNumEntry (const QString &key, int def) +{ + QStringList::Iterator itk=keylist.begin(); + QStringList::Iterator itv=valuelist.begin(); + + // First search for value in settings saved in map + while (itk !=keylist.end() ) + { + if (*itk == key) + { + bool ok; + int i=(*itv).toInt(&ok,10); + if (ok) + return i; + else + return def; + } + itk++; + itv++; + } + return def; +} void SimpleSettings::setEntry (const QString &key, const QString &value) { @@ -117,6 +158,11 @@ clear(); } +Settings::Settings(const QString & organization, const QString & application ):QSettings (organization,application) +{ + clear(); +} + Settings::~Settings() { }