qml 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 531c290e09cd315f45f4cfb07d55d9e16e16fef6
4
- data.tar.gz: 5452466222e562568f69b30771a6adc51e00e892
3
+ metadata.gz: 525fa2715a8aadc120216147318e0179a578d546
4
+ data.tar.gz: ca001300069503c335494e26bd443ef123b56179
5
5
  SHA512:
6
- metadata.gz: 297b2394051b19603dda694d5c4890a39cbeaf1c2123d9365586bc2de30c24d179c76f71c491b4671701e3f9ab6d690de87d0760bb958196874cb560e6e51aa1
7
- data.tar.gz: c6a5ef840aa64784c9eb0f4af85261c5ff92a021f1f4eb3a81ddef60f488c6873cd8a97fa3297d317dbd29bcbb3192ff16ab6eefda22ff7c7d6ebb4f4a0ce34d
6
+ metadata.gz: e6468fcf25055c17367415cca0d62b540eacf732de0028958a1337af8e9b157c85a9602e4fc07b47b9a64f130a8797e76dfdf6bcd43b2f9907c41cbfb354f627
7
+ data.tar.gz: 865173142d1e3e4ed48d52c08fc52cb77e0fa51b43188388b3fe9074d9b273e1fc9dfdf5f27667505c1b618447038be10f61c1377c82ff007c0010c039e0a291
data/README.md CHANGED
@@ -1,8 +1,11 @@
1
- # ruby-qml
1
+ ruby-qml
2
+ ================
2
3
 
3
4
  [![Gem Version](https://badge.fury.io/rb/qml.svg)](http://badge.fury.io/rb/qml)
5
+ [![Dependency Status](https://gemnasium.com/seanchas116/ruby-qml.svg)](https://gemnasium.com/seanchas116/ruby-qml)
4
6
  [![Build Status](https://travis-ci.org/seanchas116/ruby-qml.svg?branch=master)](https://travis-ci.org/seanchas116/ruby-qml)
5
7
  [![Coverage Status](https://coveralls.io/repos/seanchas116/ruby-qml/badge.png?branch=master)](https://coveralls.io/r/seanchas116/ruby-qml?branch=master)
8
+ [![Inline docs](http://inch-ci.org/github/seanchas116/ruby-qml.png?branch=master)](http://inch-ci.org/github/seanchas116/ruby-qml)
6
9
 
7
10
  ruby-qml is a QML / Qt Quick wrapper for Ruby.
8
11
  It provides bindings between QML and Ruby and enables you to use Qt Quick-based GUI from Ruby.
data/changes.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.4 (2014-07-24)
2
+
3
+ * Fix 100% CPU usage in idling
4
+
1
5
  ## 0.0.3 (2014-07-22)
2
6
 
3
7
  * Support Ruby 1.9.3
@@ -33,8 +33,7 @@ module Examples
33
33
  @streaming_client.filter(track: word) do |object|
34
34
  case object
35
35
  when ::Twitter::Tweet
36
- puts object
37
- QML.later { yield object }
36
+ yield object
38
37
  end
39
38
  end
40
39
  end
@@ -1,4 +1,4 @@
1
- #include "ext_accesssupport.h"
1
+ #include "ext_accesswrapperfactory.h"
2
2
  #include "ext_pointer.h"
3
3
  #include "rubyclass.h"
4
4
  #include "accessclass.h"
@@ -7,18 +7,17 @@
7
7
  #include "qmltyperegisterer.h"
8
8
 
9
9
  namespace RubyQml {
10
- namespace Ext {
11
10
 
12
- AccessWrapperFactory::AccessWrapperFactory(RubyValue self) :
11
+ Ext_AccessWrapperFactory::Ext_AccessWrapperFactory(RubyValue self) :
13
12
  self(self)
14
13
  {
15
14
  }
16
15
 
17
- AccessWrapperFactory::~AccessWrapperFactory()
16
+ Ext_AccessWrapperFactory::~Ext_AccessWrapperFactory()
18
17
  {
19
18
  }
20
19
 
21
- RubyValue AccessWrapperFactory::ext_initialize(RubyValue rubyClass, RubyValue className, RubyValue methodInfos, RubyValue signalInfos, RubyValue propertyInfos)
20
+ RubyValue Ext_AccessWrapperFactory::ext_initialize(RubyValue rubyClass, RubyValue className, RubyValue methodInfos, RubyValue signalInfos, RubyValue propertyInfos)
22
21
  {
23
22
  mRubyClass = rubyClass;
24
23
  mAccessClass = makeSP<AccessClass>(className, methodInfos, signalInfos, propertyInfos);
@@ -26,9 +25,9 @@ RubyValue AccessWrapperFactory::ext_initialize(RubyValue rubyClass, RubyValue cl
26
25
  return self;
27
26
  }
28
27
 
29
- RubyValue AccessWrapperFactory::ext_emitSignal(RubyValue obj, RubyValue name, RubyValue args)
28
+ RubyValue Ext_AccessWrapperFactory::ext_emitSignal(RubyValue obj, RubyValue name, RubyValue args)
30
29
  {
31
- auto accessObj = wrapperRubyClass<Pointer>().unwrap(obj.send("access_object"))->fetchQObject();
30
+ auto accessObj = wrapperRubyClass<Ext_Pointer>().unwrap(obj.send("access_object"))->fetchQObject();
32
31
  auto nameId = name.toID();
33
32
  auto argVariants = args.to<QVariantList>();
34
33
  withoutGvl([&] {
@@ -37,41 +36,40 @@ RubyValue AccessWrapperFactory::ext_emitSignal(RubyValue obj, RubyValue name, Ru
37
36
  return Qnil;
38
37
  }
39
38
 
40
- RubyValue AccessWrapperFactory::ext_registerToQml(RubyValue path, RubyValue majorVersion, RubyValue minorVersion, RubyValue name)
39
+ RubyValue Ext_AccessWrapperFactory::ext_registerToQml(RubyValue path, RubyValue majorVersion, RubyValue minorVersion, RubyValue name)
41
40
  {
42
41
  using namespace std::placeholders;
43
42
  if (!mTypeRegisterer) {
44
- mTypeRegisterer = makeSP<QmlTypeRegisterer>(mMetaObject, std::bind(&AccessWrapperFactory::newInstanceInto, this, _1));
43
+ mTypeRegisterer = makeSP<QmlTypeRegisterer>(mMetaObject, std::bind(&Ext_AccessWrapperFactory::newInstanceInto, this, _1));
45
44
  mTypeRegisterer->registerType(path.to<QByteArray>(), majorVersion.to<int>(), minorVersion.to<int>(), name.to<QByteArray>());
46
45
  }
47
46
  return self;
48
47
  }
49
48
 
50
- RubyValue AccessWrapperFactory::ext_create(RubyValue access)
49
+ RubyValue Ext_AccessWrapperFactory::ext_create(RubyValue access)
51
50
  {
52
51
  return RubyValue::fromQObject(create(access), false);
53
52
  }
54
53
 
55
- AccessWrapper *AccessWrapperFactory::create(RubyValue access)
54
+ AccessWrapper *Ext_AccessWrapperFactory::create(RubyValue access)
56
55
  {
57
56
  return new AccessWrapper(mMetaObject, access);
58
57
  }
59
58
 
60
- void AccessWrapperFactory::newInstanceInto(void *where)
59
+ void Ext_AccessWrapperFactory::newInstanceInto(void *where)
61
60
  {
62
61
  withGvl([&] {
63
62
  new(where) AccessWrapper(mMetaObject, mRubyClass.send("new"));
64
63
  });
65
64
  }
66
65
 
67
- void AccessWrapperFactory::defineClass()
66
+ void Ext_AccessWrapperFactory::defineClass()
68
67
  {
69
- WrapperRubyClass<AccessWrapperFactory> klass(RubyModule::fromPath("QML"), "AccessWrapperFactory");
70
- klass.defineMethod(MethodAccess::Protected, "initialize", RUBYQML_MEMBER_FUNCTION_INFO(&AccessWrapperFactory::ext_initialize));
71
- klass.defineMethod("emit_signal", RUBYQML_MEMBER_FUNCTION_INFO(&AccessWrapperFactory::ext_emitSignal));
72
- klass.defineMethod("register_to_qml", RUBYQML_MEMBER_FUNCTION_INFO(&AccessWrapperFactory::ext_registerToQml));
73
- klass.defineMethod("create", RUBYQML_MEMBER_FUNCTION_INFO(&AccessWrapperFactory::ext_create));
68
+ WrapperRubyClass<Ext_AccessWrapperFactory> klass(RubyModule::fromPath("QML"), "AccessWrapperFactory");
69
+ klass.defineMethod(MethodAccess::Protected, "initialize", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_AccessWrapperFactory::ext_initialize));
70
+ klass.defineMethod("emit_signal", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_AccessWrapperFactory::ext_emitSignal));
71
+ klass.defineMethod("register_to_qml", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_AccessWrapperFactory::ext_registerToQml));
72
+ klass.defineMethod("create", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_AccessWrapperFactory::ext_create));
74
73
  }
75
74
 
76
- } // namespace Ext
77
75
  } // namespace RubyQml
@@ -9,13 +9,11 @@ class ForeignMetaObject;
9
9
  class QmlTypeRegisterer;
10
10
  class AccessWrapper;
11
11
 
12
- namespace Ext {
13
-
14
- class AccessWrapperFactory
12
+ class Ext_AccessWrapperFactory
15
13
  {
16
14
  public:
17
- AccessWrapperFactory(RubyValue self);
18
- ~AccessWrapperFactory();
15
+ Ext_AccessWrapperFactory(RubyValue self);
16
+ ~Ext_AccessWrapperFactory();
19
17
 
20
18
  RubyValue ext_initialize(RubyValue rubyClass, RubyValue className, RubyValue methodInfos, RubyValue signalInfos, RubyValue propertyInfos);
21
19
  RubyValue ext_emitSignal(RubyValue obj, RubyValue name, RubyValue args);
@@ -38,5 +36,4 @@ private:
38
36
  SP<QmlTypeRegisterer> mTypeRegisterer;
39
37
  };
40
38
 
41
- } // namespace Ext
42
39
  } // namespace RubyQml
@@ -2,16 +2,15 @@
2
2
  #include "rubyclass.h"
3
3
 
4
4
  namespace RubyQml {
5
- namespace Ext {
6
5
 
7
- AnyWrapper::AnyWrapper(RubyValue self)
6
+ Ext_AnyWrapper::Ext_AnyWrapper(RubyValue self)
8
7
  {
9
8
  Q_UNUSED(self);
10
9
  }
11
10
 
12
- RubyValue AnyWrapper::create(const QVariant &value, void (*markFunction)(const QVariant &))
11
+ RubyValue Ext_AnyWrapper::create(const QVariant &value, void (*markFunction)(const QVariant &))
13
12
  {
14
- auto klass = wrapperRubyClass<AnyWrapper>();
13
+ auto klass = wrapperRubyClass<Ext_AnyWrapper>();
15
14
  auto wrapper = klass.newInstance();
16
15
  auto ptr = klass.unwrap(wrapper);
17
16
  ptr->mValue = value;
@@ -19,18 +18,17 @@ RubyValue AnyWrapper::create(const QVariant &value, void (*markFunction)(const Q
19
18
  return wrapper;
20
19
  }
21
20
 
22
- void AnyWrapper::defineClass()
21
+ void Ext_AnyWrapper::defineClass()
23
22
  {
24
- WrapperRubyClass<AnyWrapper> klass(RubyModule::fromPath("QML"), "AnyWrapper");
23
+ WrapperRubyClass<Ext_AnyWrapper> klass(RubyModule::fromPath("QML"), "AnyWrapper");
25
24
  Q_UNUSED(klass);
26
25
  }
27
26
 
28
- void AnyWrapper::gc_mark()
27
+ void Ext_AnyWrapper::gc_mark()
29
28
  {
30
29
  if (mMarkFunction) {
31
30
  mMarkFunction(mValue);
32
31
  }
33
32
  }
34
33
 
35
- } // namespace Ext
36
34
  } // namespace RubyQml
@@ -5,12 +5,10 @@ namespace RubyQml {
5
5
 
6
6
  class RubyValue;
7
7
 
8
- namespace Ext {
9
-
10
- class AnyWrapper
8
+ class Ext_AnyWrapper
11
9
  {
12
10
  public:
13
- AnyWrapper(RubyValue self);
11
+ Ext_AnyWrapper(RubyValue self);
14
12
  static RubyValue create(const QVariant &value, void (*markFunction)(const QVariant &) = nullptr);
15
13
  static void defineClass();
16
14
 
@@ -22,5 +20,4 @@ private:
22
20
  void (*mMarkFunction)(const QVariant &);
23
21
  };
24
22
 
25
- } // namespace Ext
26
23
  } // namespace RubyQml
@@ -1,24 +1,42 @@
1
1
  #include "ext_kernel.h"
2
- #include "application.h"
2
+ #include "kernel.h"
3
3
  #include "rubyvalue.h"
4
4
  #include "rubyclass.h"
5
+ #include <QTimer>
5
6
 
6
7
  namespace RubyQml {
7
- namespace Ext {
8
- namespace Kernel {
8
+ namespace Ext_Kernel {
9
9
 
10
10
  namespace {
11
11
 
12
12
  RubyValue application(RubyValue self)
13
13
  {
14
14
  Q_UNUSED(self);
15
- return RubyValue::from(Application::application());
15
+ return RubyValue::from(Kernel::instance()->application());
16
16
  }
17
17
 
18
18
  RubyValue engine(RubyValue self)
19
19
  {
20
20
  Q_UNUSED(self);
21
- return RubyValue::from(Application::engine());
21
+ return RubyValue::from(Kernel::instance()->engine());
22
+ }
23
+
24
+ RubyValue eventLoopHookTimer(RubyValue self)
25
+ {
26
+ Q_UNUSED(self);
27
+ return RubyValue::from(Kernel::instance()->eventLoopHookTimer());
28
+ }
29
+
30
+ RubyValue setEventLoopHookEnabledLater(RubyValue self, RubyValue enabled)
31
+ {
32
+ Q_UNUSED(self);
33
+ auto timer = Kernel::instance()->eventLoopHookTimer();
34
+ if (enabled) {
35
+ timer->metaObject()->invokeMethod(timer, "start", Qt::QueuedConnection);
36
+ } else {
37
+ timer->metaObject()->invokeMethod(timer, "stop", Qt::QueuedConnection);
38
+ }
39
+ return enabled;
22
40
  }
23
41
 
24
42
  RubyValue applicationMetaObject()
@@ -34,14 +52,14 @@ RubyValue engineMetaObject()
34
52
  RubyValue init(RubyValue self, RubyValue argv)
35
53
  {
36
54
  Q_UNUSED(self);
37
- Application::init(argv.to<QList<QByteArray>>());
55
+ Kernel::init(argv.to<QList<QByteArray>>());
38
56
  return Qnil;
39
57
  }
40
58
 
41
59
  RubyValue initialized(RubyValue self)
42
60
  {
43
61
  Q_UNUSED(self);
44
- return RubyValue::from(Application::initialized());
62
+ return RubyValue::from(Kernel::initialized());
45
63
  }
46
64
 
47
65
  }
@@ -51,6 +69,8 @@ void defineModule()
51
69
  RubyModule kernel(RubyModule::fromPath("QML"), "Kernel");
52
70
  kernel.defineModuleFunction("application", RUBYQML_FUNCTION_INFO(&application));
53
71
  kernel.defineModuleFunction("engine", RUBYQML_FUNCTION_INFO(&engine));
72
+ kernel.defineModuleFunction("event_loop_hook_timer", RUBYQML_FUNCTION_INFO(&eventLoopHookTimer));
73
+ kernel.defineModuleFunction("set_event_loop_hook_enabled_later", RUBYQML_FUNCTION_INFO(&setEventLoopHookEnabledLater));
54
74
  kernel.defineModuleFunction("application_meta_object", RUBYQML_FUNCTION_INFO(&applicationMetaObject));
55
75
  kernel.defineModuleFunction("engine_meta_object", RUBYQML_FUNCTION_INFO(&engineMetaObject));
56
76
  kernel.defineModuleFunction("init", RUBYQML_FUNCTION_INFO(&init));
@@ -58,5 +78,4 @@ void defineModule()
58
78
  }
59
79
 
60
80
  } // namespace Kernel
61
- } // namespace Ext
62
81
  } // namespace RubyQml
@@ -1,11 +1,9 @@
1
1
  #pragma once
2
2
 
3
3
  namespace RubyQml {
4
- namespace Ext {
5
- namespace Kernel {
4
+ namespace Ext_Kernel {
6
5
 
7
6
  void defineModule();
8
7
 
9
8
  } // namespace Kernel
10
- } // namespace Ext
11
9
  } // namespace RubyQml
@@ -13,7 +13,6 @@
13
13
  #include <QtQml/QQmlEngine>
14
14
 
15
15
  namespace RubyQml {
16
- namespace Ext {
17
16
 
18
17
  namespace {
19
18
 
@@ -30,38 +29,38 @@ RubyValue idListToArray(const QList<ID> &xs)
30
29
 
31
30
  }
32
31
 
33
- MetaObject::MetaObject(RubyValue self) :
32
+ Ext_MetaObject::Ext_MetaObject(RubyValue self) :
34
33
  self(self)
35
34
  {
36
35
  setMetaObject(&QObject::staticMetaObject);
37
36
  }
38
37
 
39
- RubyValue MetaObject::className() const
38
+ RubyValue Ext_MetaObject::className() const
40
39
  {
41
40
  return rb_str_new_cstr(mMetaObject->className());
42
41
  }
43
42
 
44
- RubyValue MetaObject::methodNames() const
43
+ RubyValue Ext_MetaObject::methodNames() const
45
44
  {
46
45
  return idListToArray(mMethodHash.keys());
47
46
  }
48
47
 
49
- RubyValue MetaObject::isPublic(RubyValue name) const
48
+ RubyValue Ext_MetaObject::isPublic(RubyValue name) const
50
49
  {
51
50
  auto methods = findMethods(name);
52
51
  return RubyValue::from(mMetaObject->method(methods.first()).access() == QMetaMethod::Public);
53
52
  }
54
- RubyValue MetaObject::isProtected(RubyValue name) const
53
+ RubyValue Ext_MetaObject::isProtected(RubyValue name) const
55
54
  {
56
55
  auto methods = findMethods(name);
57
56
  return RubyValue::from(mMetaObject->method(methods.first()).access() == QMetaMethod::Protected);
58
57
  }
59
- RubyValue MetaObject::isPrivate(RubyValue name) const
58
+ RubyValue Ext_MetaObject::isPrivate(RubyValue name) const
60
59
  {
61
60
  auto methods = findMethods(name);
62
61
  return RubyValue::from(mMetaObject->method(methods.first()).access() == QMetaMethod::Private);
63
62
  }
64
- RubyValue MetaObject::isSignal(RubyValue name) const
63
+ RubyValue Ext_MetaObject::isSignal(RubyValue name) const
65
64
  {
66
65
  auto methods = findMethods(name);
67
66
  return RubyValue::from(mMetaObject->method(methods.first()).methodType() == QMetaMethod::Signal);
@@ -132,7 +131,7 @@ public:
132
131
  auto ret = RubyValue::from(returnValue);
133
132
  static auto objectBaseClass = RubyClass::fromPath("QML::QtObjectBase");
134
133
  if (ret.isKindOf(objectBaseClass)) {
135
- auto pointer = wrapperRubyClass<Pointer>().unwrap(ret.send("pointer"));
134
+ auto pointer = wrapperRubyClass<Ext_Pointer>().unwrap(ret.send("pointer"));
136
135
  pointer->preferManaged(true);
137
136
  }
138
137
  return ret;
@@ -143,7 +142,7 @@ private:
143
142
  QMetaMethod mMethod;
144
143
  };
145
144
 
146
- RubyValue MetaObject::invokeMethod(RubyValue object, RubyValue methodName, RubyValue args) const
145
+ RubyValue Ext_MetaObject::invokeMethod(RubyValue object, RubyValue methodName, RubyValue args) const
147
146
  {
148
147
  checkThread();
149
148
 
@@ -152,7 +151,7 @@ RubyValue MetaObject::invokeMethod(RubyValue object, RubyValue methodName, RubyV
152
151
  protect([&] {
153
152
  args = rb_check_array_type(args);
154
153
  });
155
- auto obj = wrapperRubyClass<Pointer>().unwrap(object)->fetchQObject();
154
+ auto obj = wrapperRubyClass<Ext_Pointer>().unwrap(object)->fetchQObject();
156
155
  for (int i : methodIndexes) {
157
156
  MethodInvoker invoker(args, mMetaObject->method(i));
158
157
  if (invoker.isArgsCompatible()) {
@@ -173,10 +172,10 @@ RubyValue MetaObject::invokeMethod(RubyValue object, RubyValue methodName, RubyV
173
172
  return Qnil;
174
173
  }
175
174
 
176
- RubyValue MetaObject::connectSignal(RubyValue object, RubyValue signalName, RubyValue proc) const
175
+ RubyValue Ext_MetaObject::connectSignal(RubyValue object, RubyValue signalName, RubyValue proc) const
177
176
  {
178
177
  auto id = signalName.toID();
179
- auto obj = wrapperRubyClass<Pointer>().unwrap(object)->fetchQObject();
178
+ auto obj = wrapperRubyClass<Ext_Pointer>().unwrap(object)->fetchQObject();
180
179
 
181
180
  proc = proc.send("to_proc");
182
181
 
@@ -199,18 +198,18 @@ RubyValue MetaObject::connectSignal(RubyValue object, RubyValue signalName, Ruby
199
198
  return Qnil;
200
199
  }
201
200
 
202
- RubyValue MetaObject::propertyNames() const
201
+ RubyValue Ext_MetaObject::propertyNames() const
203
202
  {
204
203
  return idListToArray(mPropertyHash.keys());
205
204
  }
206
205
 
207
- RubyValue MetaObject::getProperty(RubyValue object, RubyValue name) const
206
+ RubyValue Ext_MetaObject::getProperty(RubyValue object, RubyValue name) const
208
207
  {
209
208
  checkThread();
210
209
 
211
210
  auto metaProperty = mMetaObject->property(findProperty(name));
212
211
 
213
- auto qobj = wrapperRubyClass<Pointer>().unwrap(object)->fetchQObject();
212
+ auto qobj = wrapperRubyClass<Ext_Pointer>().unwrap(object)->fetchQObject();
214
213
  QVariant result;
215
214
  withoutGvl([&] {
216
215
  result = metaProperty.read(qobj);
@@ -218,7 +217,7 @@ RubyValue MetaObject::getProperty(RubyValue object, RubyValue name) const
218
217
  return RubyValue::from(result);
219
218
  }
220
219
 
221
- RubyValue MetaObject::setProperty(RubyValue object, RubyValue name, RubyValue newValue) const
220
+ RubyValue Ext_MetaObject::setProperty(RubyValue object, RubyValue name, RubyValue newValue) const
222
221
  {
223
222
  checkThread();
224
223
 
@@ -231,7 +230,7 @@ RubyValue MetaObject::setProperty(RubyValue object, RubyValue name, RubyValue ne
231
230
  });
232
231
  }
233
232
 
234
- auto qobj = wrapperRubyClass<Pointer>().unwrap(object)->fetchQObject();
233
+ auto qobj = wrapperRubyClass<Ext_Pointer>().unwrap(object)->fetchQObject();
235
234
  auto variant = newValue.to<QVariant>();
236
235
  QVariant result;
237
236
  withoutGvl([&] {
@@ -241,7 +240,7 @@ RubyValue MetaObject::setProperty(RubyValue object, RubyValue name, RubyValue ne
241
240
  return RubyValue::from(result);
242
241
  }
243
242
 
244
- RubyValue MetaObject::notifySignal(RubyValue name) const
243
+ RubyValue Ext_MetaObject::notifySignal(RubyValue name) const
245
244
  {
246
245
  auto metaProperty = mMetaObject->property(findProperty(name));
247
246
  auto signal = metaProperty.notifySignal();
@@ -253,14 +252,14 @@ RubyValue MetaObject::notifySignal(RubyValue name) const
253
252
  }
254
253
  }
255
254
 
256
- void MetaObject::checkThread() const
255
+ void Ext_MetaObject::checkThread() const
257
256
  {
258
257
  if (rb_thread_current() != rb_thread_main()) {
259
258
  fail("QML::InvalidThreadError", "Qt object accessed from non-main thread");
260
259
  }
261
260
  }
262
261
 
263
- QList<int> MetaObject::findMethods(RubyValue name) const
262
+ QList<int> Ext_MetaObject::findMethods(RubyValue name) const
264
263
  {
265
264
  auto id = name.toID();
266
265
  auto methodIndexes = mMethodHash.values(id);
@@ -275,7 +274,7 @@ QList<int> MetaObject::findMethods(RubyValue name) const
275
274
  return methodIndexes;
276
275
  }
277
276
 
278
- int MetaObject::findProperty(RubyValue name) const
277
+ int Ext_MetaObject::findProperty(RubyValue name) const
279
278
  {
280
279
  auto id = name.toID();
281
280
  if (!mPropertyHash.contains(id)) {
@@ -288,7 +287,7 @@ int MetaObject::findProperty(RubyValue name) const
288
287
  return mPropertyHash[id];
289
288
  }
290
289
 
291
- RubyValue MetaObject::enumerators() const
290
+ RubyValue Ext_MetaObject::enumerators() const
292
291
  {
293
292
  QHash<QByteArray, QHash<QByteArray, int>> enums;
294
293
 
@@ -308,7 +307,7 @@ RubyValue MetaObject::enumerators() const
308
307
  return RubyValue::from(enums);
309
308
  }
310
309
 
311
- RubyValue MetaObject::superClass() const
310
+ RubyValue Ext_MetaObject::superClass() const
312
311
  {
313
312
  auto superclass = mMetaObject->superClass();
314
313
  if (!superclass) {
@@ -317,17 +316,17 @@ RubyValue MetaObject::superClass() const
317
316
  return fromMetaObject(superclass);
318
317
  }
319
318
 
320
- RubyValue MetaObject::isEqual(RubyValue other) const
319
+ RubyValue Ext_MetaObject::isEqual(RubyValue other) const
321
320
  {
322
- return RubyValue::from(mMetaObject == wrapperRubyClass<MetaObject>().unwrap(other)->mMetaObject);
321
+ return RubyValue::from(mMetaObject == wrapperRubyClass<Ext_MetaObject>().unwrap(other)->mMetaObject);
323
322
  }
324
323
 
325
- RubyValue MetaObject::hash() const
324
+ RubyValue Ext_MetaObject::hash() const
326
325
  {
327
326
  return RubyValue::from(reinterpret_cast<size_t>(mMetaObject)).send("hash");
328
327
  }
329
328
 
330
- void MetaObject::setMetaObject(const QMetaObject *metaObject)
329
+ void Ext_MetaObject::setMetaObject(const QMetaObject *metaObject)
331
330
  {
332
331
  int methodCount = metaObject->methodCount() - metaObject->methodOffset();
333
332
 
@@ -370,43 +369,42 @@ void MetaObject::setMetaObject(const QMetaObject *metaObject)
370
369
  mPropertyHash = propertyHash;
371
370
  }
372
371
 
373
- RubyValue MetaObject::fromMetaObject(const QMetaObject *metaObject)
372
+ RubyValue Ext_MetaObject::fromMetaObject(const QMetaObject *metaObject)
374
373
  {
375
- auto klass = wrapperRubyClass<MetaObject>();
374
+ auto klass = wrapperRubyClass<Ext_MetaObject>();
376
375
  auto value = klass.newInstance();
377
376
  klass.unwrap(value)->setMetaObject(metaObject);
378
377
  return value;
379
378
  }
380
379
 
381
- void MetaObject::defineClass()
380
+ void Ext_MetaObject::defineClass()
382
381
  {
383
- WrapperRubyClass<MetaObject> klass(RubyModule::fromPath("QML"), "MetaObject");
382
+ WrapperRubyClass<Ext_MetaObject> klass(RubyModule::fromPath("QML"), "MetaObject");
384
383
 
385
- klass.defineMethod("name", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::className));
384
+ klass.defineMethod("name", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::className));
386
385
 
387
- klass.defineMethod("method_names", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::methodNames));
388
- klass.defineMethod("public?", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::isPublic));
389
- klass.defineMethod("protected?", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::isProtected));
390
- klass.defineMethod("private?", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::isPrivate));
391
- klass.defineMethod("signal?", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::isSignal));
386
+ klass.defineMethod("method_names", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::methodNames));
387
+ klass.defineMethod("public?", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::isPublic));
388
+ klass.defineMethod("protected?", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::isProtected));
389
+ klass.defineMethod("private?", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::isPrivate));
390
+ klass.defineMethod("signal?", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::isSignal));
392
391
 
393
- klass.defineMethod("invoke_method", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::invokeMethod));
394
- klass.defineMethod("connect_signal", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::connectSignal));
392
+ klass.defineMethod("invoke_method", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::invokeMethod));
393
+ klass.defineMethod("connect_signal", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::connectSignal));
395
394
 
396
- klass.defineMethod("property_names", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::propertyNames));
397
- klass.defineMethod("get_property", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::getProperty));
398
- klass.defineMethod("set_property", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::setProperty));
399
- klass.defineMethod("notify_signal", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::notifySignal));
395
+ klass.defineMethod("property_names", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::propertyNames));
396
+ klass.defineMethod("get_property", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::getProperty));
397
+ klass.defineMethod("set_property", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::setProperty));
398
+ klass.defineMethod("notify_signal", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::notifySignal));
400
399
 
401
- klass.defineMethod("enumerators", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::enumerators));
400
+ klass.defineMethod("enumerators", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::enumerators));
402
401
 
403
- klass.defineMethod("super_class", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::superClass));
402
+ klass.defineMethod("super_class", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::superClass));
404
403
 
405
- klass.defineMethod("==", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::isEqual));
406
- klass.defineMethod("hash", RUBYQML_MEMBER_FUNCTION_INFO(&MetaObject::hash));
404
+ klass.defineMethod("==", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::isEqual));
405
+ klass.defineMethod("hash", RUBYQML_MEMBER_FUNCTION_INFO(&Ext_MetaObject::hash));
407
406
 
408
407
  klass.aliasMethod("eql?", "==");
409
408
  }
410
409
 
411
- } // namespace Ext
412
410
  } // namespace RubyQml