Commit 3c4e6332 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Always save settings on exit



Task-number: QTCREATORBUG-7904

Change-Id: I1f7e1462db287cfda2d131f380c7235a94832e69
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 4a1be4d0
......@@ -376,11 +376,24 @@ PersistentSettingsWriter::PersistentSettingsWriter(const FileName &fileName, con
m_fileName(fileName), m_docType(docType)
{ }
PersistentSettingsWriter::~PersistentSettingsWriter()
{
write(m_savedData, 0);
}
bool PersistentSettingsWriter::save(const QVariantMap &data, QWidget *parent) const
{
if (data == m_savedData)
return true;
return write(data, parent);
}
FileName PersistentSettingsWriter::fileName() const
{ return m_fileName; }
bool PersistentSettingsWriter::write(const QVariantMap &data, QWidget *parent) const
{
QDir tmp;
tmp.mkpath(m_fileName.toFileInfo().path());
Utils::FileSaver saver(m_fileName.toString(), QIODevice::Text);
......@@ -412,7 +425,4 @@ bool PersistentSettingsWriter::save(const QVariantMap &data, QWidget *parent) co
return ok;
}
FileName PersistentSettingsWriter::fileName() const
{ return m_fileName; }
} // namespace Utils
......@@ -60,11 +60,15 @@ class QTCREATOR_UTILS_EXPORT PersistentSettingsWriter
{
public:
PersistentSettingsWriter(const FileName &fileName, const QString &docType);
~PersistentSettingsWriter();
bool save(const QVariantMap &data, QWidget *parent) const;
Utils::FileName fileName() const;
private:
bool write(const QVariantMap &data, QWidget *parent) const;
const Utils::FileName m_fileName;
const QString m_docType;
mutable QMap<QString, QVariant> m_savedData;
......
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