summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--options/bundle.cpp12
-rw-r--r--options/bundle.hpp4
-rw-r--r--options/group.cpp7
-rw-r--r--options/group.hpp1
4 files changed, 19 insertions, 5 deletions
diff --git a/options/bundle.cpp b/options/bundle.cpp
index a17b04fb..20cc5d90 100644
--- a/options/bundle.cpp
+++ b/options/bundle.cpp
@@ -67,7 +67,7 @@ void bundle::set_all_to_default()
connector::set_all_to_default_();
}
-void bundle::store_kv(const QString& name, const QVariant& new_value)
+void bundle::store_kv(const QString& name, QVariant&& value)
{
if (group_name.isEmpty())
return;
@@ -75,13 +75,21 @@ void bundle::store_kv(const QString& name, const QVariant& new_value)
{
mark_ini_modified();
QMutexLocker l{&mtx};
- transient.put(name, new_value);
+ transient.put(name, value);
connector::notify_values(name);
}
emit changed();
}
+void bundle::store_kv(const QString& name, const QVariant& value)
+{
+ if (group_name.isEmpty())
+ return;
+
+ store_kv(name, QVariant{value});
+}
+
QVariant bundle::get_variant(const QString& name) const
{
QMutexLocker l{&mtx};
diff --git a/options/bundle.hpp b/options/bundle.hpp
index c1bb716d..dec7c340 100644
--- a/options/bundle.hpp
+++ b/options/bundle.hpp
@@ -69,6 +69,7 @@ public:
explicit bundle(const QString& group_name);
~bundle() override;
+ void store_kv(const QString& name, QVariant&& datum);
void store_kv(const QString& name, const QVariant& datum);
bool contains(const QString& name) const;
@@ -90,8 +91,7 @@ struct OTR_OPTIONS_EXPORT bundler final
static void notify();
static void reload_no_notify();
-
- void reload();
+ static void reload();
private:
QMutex implsgl_mtx { QMutex::Recursive };
diff --git a/options/group.cpp b/options/group.cpp
index 41655d5e..d5829008 100644
--- a/options/group.cpp
+++ b/options/group.cpp
@@ -50,7 +50,7 @@ void group::save() const
});
}
-void group::put(const QString& s, const QVariant& d)
+void group::put(const QString& s, QVariant&& d)
{
if (d.isNull())
kvs.erase(s);
@@ -58,6 +58,11 @@ void group::put(const QString& s, const QVariant& d)
kvs[s] = d;
}
+void group::put(const QString& s, const QVariant& d)
+{
+ put(s, QVariant{d});
+}
+
bool group::contains(const QString& s) const
{
const auto it = kvs.find(s);
diff --git a/options/group.hpp b/options/group.hpp
index 45e9353c..93299b6e 100644
--- a/options/group.hpp
+++ b/options/group.hpp
@@ -29,6 +29,7 @@ namespace options::detail {
explicit group(const QString& name);
void save() const;
void put(const QString& s, const QVariant& d);
+ void put(const QString& s, QVariant&& d);
bool contains(const QString& s) const;
never_inline QVariant get_variant(const QString& name) const;