From 630f45719a527f8ee739b03bc62f886badea6df3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 13 Dec 2016 16:24:31 +0100 Subject: Revamp of composercontroller to use actions more. Instead of setting all properties individually we directly assign all properties to a context that we assign to the actions. This way actions can automatically update themselves as new data becomes available, and we avoid the setter/getter boilerplate, at the cost of a less explicit interface (But that could be improved by allowing to define the required properties of a context in c++). By relying on prehandler/posthandler to execute certain actions we simplify the control flow and enable the future extension with handlers that i.e. do encryption etc. --- framework/actions/context.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'framework/actions/context.cpp') diff --git a/framework/actions/context.cpp b/framework/actions/context.cpp index a7f87d16..205b1606 100644 --- a/framework/actions/context.cpp +++ b/framework/actions/context.cpp @@ -19,6 +19,7 @@ #include "context.h" #include +#include using namespace Kube; @@ -27,3 +28,18 @@ Context::Context(QObject *parent) { } + +QDebug operator<<(QDebug dbg, const Kube::Context &context) +{ + dbg << "Kube::Context {\n"; + auto metaObject = context.QObject::metaObject(); + for (auto i = metaObject->propertyOffset(); i < metaObject->propertyCount(); i++) { + auto property = metaObject->property(i); + dbg << property.name() << context.property(property.name()) << "\n"; + } + for (const auto &p : context.dynamicPropertyNames()) { + dbg << p << context.property(p) << "\n"; + } + dbg << "\n}"; + return dbg; +} -- cgit v1.2.3