summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/bundle.cpp9
-rw-r--r--options/bundle.hpp1
-rw-r--r--options/group.cpp12
-rw-r--r--options/group.hpp2
4 files changed, 18 insertions, 6 deletions
diff --git a/options/bundle.cpp b/options/bundle.cpp
index a60810c5..fa1a214c 100644
--- a/options/bundle.cpp
+++ b/options/bundle.cpp
@@ -37,7 +37,7 @@ bool bundle::contains(const QString &name) const
return transient.contains(name);
}
-void bundle::save()
+void bundle::save_deferred(QSettings& s)
{
if (group_name == "")
return;
@@ -51,7 +51,7 @@ void bundle::save()
qDebug() << "bundle" << group_name << "changed, saving";
modified_ = true;
saved = transient;
- saved.save();
+ saved.save_deferred(s);
}
}
@@ -59,6 +59,11 @@ void bundle::save()
emit saving();
}
+void bundle::save()
+{
+ save_deferred(*group::ini_file());
+}
+
bool bundle::modifiedp() const // XXX unused
{
QMutexLocker l(const_cast<QMutex*>(&mtx));
diff --git a/options/bundle.hpp b/options/bundle.hpp
index 56d48f60..0283c911 100644
--- a/options/bundle.hpp
+++ b/options/bundle.hpp
@@ -41,6 +41,7 @@ public:
void store_kv(const QString& name, const QVariant& datum);
bool contains(const QString& name) const;
void save();
+ void save_deferred(QSettings& s);
bool modifiedp() const;
template<typename t>
diff --git a/options/group.cpp b/options/group.cpp
index 8aa381fc..d710afad 100644
--- a/options/group.cpp
+++ b/options/group.cpp
@@ -24,14 +24,18 @@ group::group(const QString& name) : name(name)
void group::save() const
{
+ save_deferred(*ini_file());
+}
+
+void group::save_deferred(QSettings& s) const
+{
if (name == "")
return;
- auto s = ini_file();
- s->beginGroup(name);
+ s.beginGroup(name);
for (auto& i : kvs)
- s->setValue(i.first, i.second);
- s->endGroup();
+ s.setValue(i.first, i.second);
+ s.endGroup();
}
void group::put(const QString &s, const QVariant &d)
diff --git a/options/group.hpp b/options/group.hpp
index 0deddfa8..05ef3b4b 100644
--- a/options/group.hpp
+++ b/options/group.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "export.hpp"
+#include "compat/util.hpp"
#include <map>
#include <memory>
#include <QString>
@@ -19,6 +20,7 @@ private:
public:
group(const QString& name);
void save() const;
+ void save_deferred(QSettings& s) const;
void put(const QString& s, const QVariant& d);
bool contains(const QString& s) const;
static QString ini_directory();