summaryrefslogtreecommitdiffstats
path: root/framework/actions/context.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-01 13:37:19 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-01-02 00:31:41 +0100
commitba7128b30850594c7efb258d1794e377eede364a (patch)
treef805d511f6d12b0799c05b414054db8b8635bfc9 /framework/actions/context.cpp
parent431c257dd29e2e3d8878db200f0de4d452bffe92 (diff)
downloadkube-ba7128b30850594c7efb258d1794e377eede364a.tar.gz
kube-ba7128b30850594c7efb258d1794e377eede364a.zip
Instead of using the action system we use controllers only.
It's simpler, and the action system was just too complex to use in a typesafe way.
Diffstat (limited to 'framework/actions/context.cpp')
-rw-r--r--framework/actions/context.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/framework/actions/context.cpp b/framework/actions/context.cpp
index 8f370a0b..45b660a9 100644
--- a/framework/actions/context.cpp
+++ b/framework/actions/context.cpp
@@ -29,6 +29,20 @@ Context::Context(QObject *parent)
29 29
30} 30}
31 31
32Context::Context(const Context &other)
33 : QObject()
34{
35 *this = other;
36}
37
38Context &Context::operator=(const Context &other)
39{
40 for (const auto &p : other.availableProperties()) {
41 setProperty(p, other.property(p));
42 }
43 return *this;
44}
45
32void Context::clear() 46void Context::clear()
33{ 47{
34 auto meta = metaObject(); 48 auto meta = metaObject();
@@ -41,6 +55,20 @@ void Context::clear()
41 } 55 }
42} 56}
43 57
58QSet<QByteArray> Context::availableProperties() const
59{
60 QSet<QByteArray> names;
61 auto meta = metaObject();
62 for (auto i = meta->propertyOffset(); i < meta->propertyCount(); i++) {
63 auto property = meta->property(i);
64 names << property.name();
65 }
66 for (const auto &p : dynamicPropertyNames()) {
67 names << p;
68 }
69 return names;
70}
71
44QDebug operator<<(QDebug dbg, const Kube::Context &context) 72QDebug operator<<(QDebug dbg, const Kube::Context &context)
45{ 73{
46 dbg << "Kube::Context {\n"; 74 dbg << "Kube::Context {\n";
@@ -55,3 +83,9 @@ QDebug operator<<(QDebug dbg, const Kube::Context &context)
55 dbg << "\n}"; 83 dbg << "\n}";
56 return dbg; 84 return dbg;
57} 85}
86
87QDebug operator<<(QDebug dbg, const Kube::ContextWrapper &context)
88{
89 dbg << context.context;
90 return dbg;
91}