summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/base-value.cpp11
-rw-r--r--options/base-value.hpp8
-rw-r--r--options/bundle.cpp4
-rw-r--r--options/group.cpp10
4 files changed, 11 insertions, 22 deletions
diff --git a/options/base-value.cpp b/options/base-value.cpp
index 39453a09..d4ec4b6c 100644
--- a/options/base-value.cpp
+++ b/options/base-value.cpp
@@ -12,14 +12,3 @@ value_::~value_()
{
b->on_value_destructed(this);
}
-
-namespace options::detail {
-
-// necessary due to circular dependency
-void set_value_to_default(value_* val)
-{
- val->set_to_default();
-}
-
-} // ns options::detail
-
diff --git a/options/base-value.hpp b/options/base-value.hpp
index 7a3ac420..240cc6b7 100644
--- a/options/base-value.hpp
+++ b/options/base-value.hpp
@@ -63,7 +63,8 @@ protected:
bundle b;
QString self_name;
- virtual void store_variant(const QVariant& x) noexcept = 0;
+ virtual void store_variant(QVariant&&) noexcept = 0;
+ virtual void store_variant(const QVariant&) noexcept = 0;
template<typename t>
void store_(const t& datum)
@@ -89,10 +90,9 @@ public slots:
OTR_OPTIONS_SLOT(const QList<slider_value>&)
OTR_OPTIONS_SLOT(const QList<QPointF>&)
- virtual void set_to_default() = 0;
+ virtual void set_to_default() noexcept = 0;
virtual void notify() const = 0;
-
- friend void ::options::detail::set_value_to_default(value_* val);
+ virtual QVariant get_variant() const noexcept = 0;
};
} //ns options
diff --git a/options/bundle.cpp b/options/bundle.cpp
index 938639b3..6b7ccce1 100644
--- a/options/bundle.cpp
+++ b/options/bundle.cpp
@@ -35,10 +35,6 @@ void bundle::reload()
{
QMutexLocker l(&mtx);
- // XXX what do we do when values are and aren't equal?
- // see QPointF -sh 20180830
-
- // XXX we could probably skip assigning to `saved' -sh 20180830
saved = group(group_name);
transient = saved;
diff --git a/options/group.cpp b/options/group.cpp
index af66aaf2..8a0eeb03 100644
--- a/options/group.cpp
+++ b/options/group.cpp
@@ -22,7 +22,11 @@ using namespace options::globals;
group::group(const QString& name) : name(name)
{
- if (name == "")
+ constexpr unsigned reserved_buckets = 64;
+ kvs.reserve(reserved_buckets);
+ kvs.max_load_factor(0.4375);
+
+ if (name.isEmpty())
return;
with_settings_object([&](QSettings& conf) {
@@ -35,7 +39,7 @@ group::group(const QString& name) : name(name)
void group::save() const
{
- if (name == "")
+ if (name.isEmpty())
return;
with_settings_object([&](QSettings& s) {
@@ -63,7 +67,7 @@ QVariant group::get_variant(const QString& name) const
if (it != kvs.cend())
return it->second;
- return QVariant();
+ return {};
}
} // ns options::detail