From 9762ccffa4df162d8574d76749d21d09b57c52ad Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 24 Jul 2017 12:47:05 +0200 Subject: Revert "options/metatype: nuke it" This was making sliders unable to save at all. --- options/metatype.cpp | 23 +++++++++++++++++++++++ options/metatype.hpp | 36 ++++++++++++++++++++++++++++++++++++ options/options.hpp | 1 + 3 files changed, 60 insertions(+) create mode 100644 options/metatype.cpp create mode 100644 options/metatype.hpp (limited to 'options') diff --git a/options/metatype.cpp b/options/metatype.cpp new file mode 100644 index 00000000..8f92f385 --- /dev/null +++ b/options/metatype.cpp @@ -0,0 +1,23 @@ +#include "slider.hpp" +#include "metatype.hpp" + +#define OPENTRACK_REGISTER_METATYPE(t) ::options::detail::custom_type_initializer::declare_for_type(#t) + +namespace options { +namespace detail { + +custom_type_initializer::custom_type_initializer() +{ + OPENTRACK_REGISTER_METATYPE(slider_value); + OPENTRACK_REGISTER_METATYPE(QList); + OPENTRACK_REGISTER_METATYPE(QList); + OPENTRACK_REGISTER_METATYPE(QList); + OPENTRACK_REGISTER_METATYPE(QList); + OPENTRACK_REGISTER_METATYPE(QList); + OPENTRACK_REGISTER_METATYPE(QList); +} + +const custom_type_initializer custom_type_initializer::singleton; + +} +} diff --git a/options/metatype.hpp b/options/metatype.hpp new file mode 100644 index 00000000..68480b55 --- /dev/null +++ b/options/metatype.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "export.hpp" + +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QList) + +namespace options { +namespace detail { + +struct custom_type_initializer final +{ + static const custom_type_initializer singleton; + + custom_type_initializer(); + + template static inline void declare_for_type(const char* str) + { + qRegisterMetaType(str); + qRegisterMetaTypeStreamOperators(); + } +}; + +} +} diff --git a/options/options.hpp b/options/options.hpp index fdeb74cd..0528b0d9 100644 --- a/options/options.hpp +++ b/options/options.hpp @@ -16,4 +16,5 @@ #include "slider.hpp" #include "value.hpp" #include "tie.hpp" +#include "metatype.hpp" #include "scoped.hpp" -- cgit v1.2.3