Commit 51fb280b authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Remove prefix code from Persistentsettings.

Reviewed-by: dt
parent f923a561
...@@ -46,9 +46,8 @@ PersistentSettingsReader::PersistentSettingsReader() ...@@ -46,9 +46,8 @@ PersistentSettingsReader::PersistentSettingsReader()
QVariant PersistentSettingsReader::restoreValue(const QString & variable) const QVariant PersistentSettingsReader::restoreValue(const QString & variable) const
{ {
const QString &name = m_prefix + variable; if (m_valueMap.contains(variable))
if (m_valueMap.contains(name)) return m_valueMap.value(variable);
return m_valueMap.value(name);
return QVariant(); return QVariant();
} }
...@@ -83,16 +82,6 @@ bool PersistentSettingsReader::load(const QString & fileName) ...@@ -83,16 +82,6 @@ bool PersistentSettingsReader::load(const QString & fileName)
return true; return true;
} }
void PersistentSettingsReader::setPrefix(const QString &prefix)
{
m_prefix = prefix;
}
QString PersistentSettingsReader::prefix() const
{
return m_prefix;
}
QVariant PersistentSettingsReader::readValue(const QDomElement &valElement) const QVariant PersistentSettingsReader::readValue(const QDomElement &valElement) const
{ {
QString name = valElement.nodeName(); QString name = valElement.nodeName();
...@@ -184,7 +173,7 @@ void PersistentSettingsWriter::writeValue(QDomElement &ps, const QVariant &varia ...@@ -184,7 +173,7 @@ void PersistentSettingsWriter::writeValue(QDomElement &ps, const QVariant &varia
void PersistentSettingsWriter::saveValue(const QString & variable, const QVariant &value) void PersistentSettingsWriter::saveValue(const QString & variable, const QVariant &value)
{ {
m_valueMap[m_prefix + variable] = value; m_valueMap[variable] = value;
} }
bool PersistentSettingsWriter::save(const QString & fileName, const QString & docType) bool PersistentSettingsWriter::save(const QString & fileName, const QString & docType)
...@@ -216,13 +205,3 @@ bool PersistentSettingsWriter::save(const QString & fileName, const QString & do ...@@ -216,13 +205,3 @@ bool PersistentSettingsWriter::save(const QString & fileName, const QString & do
file.close(); file.close();
return true; return true;
} }
void PersistentSettingsWriter::setPrefix(const QString &prefix)
{
m_prefix = prefix;
}
QString PersistentSettingsWriter::prefix() const
{
return m_prefix;
}
...@@ -48,10 +48,8 @@ public: ...@@ -48,10 +48,8 @@ public:
QVariant restoreValue(const QString & variable) const; QVariant restoreValue(const QString & variable) const;
QVariantMap restoreValues() const; QVariantMap restoreValues() const;
bool load(const QString & fileName); bool load(const QString & fileName);
void setPrefix(const QString &prefix);
QString prefix() const;
private: private:
QString m_prefix;
QVariant readValue(const QDomElement &valElement) const; QVariant readValue(const QDomElement &valElement) const;
void readValues(const QDomElement &data); void readValues(const QDomElement &data);
QMap<QString, QVariant> m_valueMap; QMap<QString, QVariant> m_valueMap;
...@@ -63,10 +61,8 @@ public: ...@@ -63,10 +61,8 @@ public:
PersistentSettingsWriter(); PersistentSettingsWriter();
void saveValue(const QString & variable, const QVariant &value); void saveValue(const QString & variable, const QVariant &value);
bool save(const QString & fileName, const QString & docType); bool save(const QString & fileName, const QString & docType);
void setPrefix(const QString &prefix);
QString prefix() const;
private: private:
QString m_prefix;
void writeValue(QDomElement &ps, const QVariant &value); void writeValue(QDomElement &ps, const QVariant &value);
QMap<QString, QVariant> m_valueMap; QMap<QString, QVariant> m_valueMap;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment