qtbindings 4.8.3.0 → 4.8.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +1 -2
- data/bin/rbrcc +5 -5
- data/bin/rbuic4 +5 -5
- data/bin/smokeapi +5 -5
- data/bin/smokedeptool +5 -5
- data/{CHANGELOG.txt → changelog.txt} +15 -0
- data/examples/desktop/screenshot/screenshot.rb +10 -9
- data/ext/cmake/modules/FindRuby.cmake +1 -1
- data/ext/ruby/qtruby/src/handlers.cpp +186 -176
- data/ext/ruby/qtruby/src/{Qt.cpp → qt.cpp} +135 -114
- data/ext/ruby/qtruby/src/qtruby.cpp +4 -1
- data/extconf.rb +20 -12
- data/{KNOWN_ISSUES.txt → known_issues.txt} +0 -2
- data/lib/Qt/qtruby4.rb +261 -237
- data/lib/qt4.rb +101 -0
- data/lib/qtbindings_version.rb +2 -2
- data/qtbindings.gemspec +1 -1
- data/qtbindingsnative.gemspec +1 -1
- data/{README.txt → readme.txt} +127 -119
- data/{TODO.txt → todo.txt} +0 -1
- metadata +13 -14
- data/lib/Qt4.rb +0 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f348539daf6e1d67d26387cb381ba18fce4aec32
|
4
|
+
data.tar.gz: 0228e1ed9a0e6c7b1d702ddbf2925b526912524f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9b1f269750afab53c65782a2b05a777bad2b61550858afee66b0396f9fdcfacb7f196374de1eec86fe616f4f59115fab7a4e2d7df1cbbb0777c1f9b7bdfaa60
|
7
|
+
data.tar.gz: 51309454b29166d80891eb0862fa763fec22c1bfb55e8553fe7cadeb2b2de3646b9bd1bfd1309476799692873e957cddcb92d8119166ffd7ae02146bd1c6daa8
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rake'
|
|
2
2
|
|
3
3
|
windows = false
|
4
4
|
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
5
|
-
windows = true if platform
|
5
|
+
windows = true if platform =~ /mswin32/ or platform =~ /mingw32/
|
6
6
|
|
7
7
|
if windows
|
8
8
|
MAKE = 'mingw32-make'
|
@@ -94,4 +94,3 @@ task :build do
|
|
94
94
|
Rake::Task[:all].execute
|
95
95
|
Rake::Task[:install].execute
|
96
96
|
end
|
97
|
-
|
data/bin/rbrcc
CHANGED
@@ -5,14 +5,14 @@ require 'Qt'
|
|
5
5
|
|
6
6
|
windows = false
|
7
7
|
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
8
|
-
windows = true if platform
|
8
|
+
windows = true if platform =~ /mswin32/ or platform =~ /mingw32/
|
9
9
|
|
10
10
|
extension = ''
|
11
11
|
extension = '.exe' if windows
|
12
12
|
|
13
|
-
if RUBY_VERSION.split('.')[
|
14
|
-
path = File.expand_path(File.join(File.dirname(__FILE__), '1.8', "rbrcc#{extension}"))
|
15
|
-
else
|
13
|
+
if RUBY_VERSION.split('.')[0].to_i == 1
|
16
14
|
path = File.expand_path(File.join(File.dirname(__FILE__), '1.9', "rbrcc#{extension}"))
|
15
|
+
else
|
16
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), '2.0', "rbrcc#{extension}"))
|
17
17
|
end
|
18
|
-
exec(path, *ARGV)
|
18
|
+
exec(path, *ARGV)
|
data/bin/rbuic4
CHANGED
@@ -5,14 +5,14 @@ require 'Qt'
|
|
5
5
|
|
6
6
|
windows = false
|
7
7
|
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
8
|
-
windows = true if platform
|
8
|
+
windows = true if platform =~ /mswin32/ or platform =~ /mingw32/
|
9
9
|
|
10
10
|
extension = ''
|
11
11
|
extension = '.exe' if windows
|
12
12
|
|
13
|
-
if RUBY_VERSION.split('.')[
|
14
|
-
path = File.expand_path(File.join(File.dirname(__FILE__), '1.8', "rbuic4#{extension}"))
|
15
|
-
else
|
13
|
+
if RUBY_VERSION.split('.')[0].to_i == 1
|
16
14
|
path = File.expand_path(File.join(File.dirname(__FILE__), '1.9', "rbuic4#{extension}"))
|
15
|
+
else
|
16
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), '2.0', "rbuic4#{extension}"))
|
17
17
|
end
|
18
|
-
exec(path, *ARGV)
|
18
|
+
exec(path, *ARGV)
|
data/bin/smokeapi
CHANGED
@@ -5,14 +5,14 @@ require 'Qt'
|
|
5
5
|
|
6
6
|
windows = false
|
7
7
|
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
8
|
-
windows = true if platform
|
8
|
+
windows = true if platform =~ /mswin32/ or platform =~ /mingw32/
|
9
9
|
|
10
10
|
extension = ''
|
11
11
|
extension = '.exe' if windows
|
12
12
|
|
13
|
-
if RUBY_VERSION.split('.')[
|
14
|
-
path = File.expand_path(File.join(File.dirname(__FILE__), '1.8', "smokeapi#{extension}"))
|
15
|
-
else
|
13
|
+
if RUBY_VERSION.split('.')[0].to_i == 1
|
16
14
|
path = File.expand_path(File.join(File.dirname(__FILE__), '1.9', "smokeapi#{extension}"))
|
15
|
+
else
|
16
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), '2.0', "smokeapi#{extension}"))
|
17
17
|
end
|
18
|
-
exec(path, *ARGV)
|
18
|
+
exec(path, *ARGV)
|
data/bin/smokedeptool
CHANGED
@@ -5,14 +5,14 @@ require 'Qt'
|
|
5
5
|
|
6
6
|
windows = false
|
7
7
|
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
8
|
-
windows = true if platform
|
8
|
+
windows = true if platform =~ /mswin32/ or platform =~ /mingw32/
|
9
9
|
|
10
10
|
extension = ''
|
11
11
|
extension = '.exe' if windows
|
12
12
|
|
13
|
-
if RUBY_VERSION.split('.')[
|
14
|
-
path = File.expand_path(File.join(File.dirname(__FILE__), '1.8', "smokedeptool#{extension}"))
|
15
|
-
else
|
13
|
+
if RUBY_VERSION.split('.')[0].to_i == 1
|
16
14
|
path = File.expand_path(File.join(File.dirname(__FILE__), '1.9', "smokedeptool#{extension}"))
|
15
|
+
else
|
16
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), '2.0', "smokedeptool#{extension}"))
|
17
17
|
end
|
18
|
-
exec(path, *ARGV)
|
18
|
+
exec(path, *ARGV)
|
@@ -31,3 +31,18 @@ v4.6.3.3
|
|
31
31
|
v4.6.3.4
|
32
32
|
2011/08/06 - Accidently checked in ruby_check_stack instead of ruby_stack_check
|
33
33
|
|
34
|
+
v4.8.3.0
|
35
|
+
2012/03/28 - Fixed a bug when calling constants/methods and dealing with anonymous classes - Thanks Mon-Ouie!
|
36
|
+
2012/06/20 - Updated to support Qt 4.8.x including plugins
|
37
|
+
2012/06/21 - Update examples, known issues, and sync with latest smoke
|
38
|
+
2012/07/13 - Fix additional examples
|
39
|
+
2012/09/10 - Avoid warning on unused variable - Thanks stomar!
|
40
|
+
2012/10/01 - Update to Qt 4.8.3
|
41
|
+
|
42
|
+
v4.8.5.0
|
43
|
+
2013/04/27 - Update FindRuby.cmake to support Gentoo - Thanks michalzielanski!
|
44
|
+
2012/09/09 - Update to work with Ruby 2.0 - Thanks hur1can3!
|
45
|
+
2013/09/27 - Fix OpenGL texture issue
|
46
|
+
2013/12/03 - Changed garbage collection philosophy to not automatically destruct any Qt object. Must call dispose manually.
|
47
|
+
2013/12/03 - Officially add support for Ruby 2.0 and remove support for Ruby 1.8.x
|
48
|
+
2013/12/03 - Enable Ruby Threading
|
@@ -41,7 +41,7 @@ class Screenshot < Qt::Widget
|
|
41
41
|
createOptionsGroupBox()
|
42
42
|
createButtonsLayout()
|
43
43
|
|
44
|
-
|
44
|
+
self.layout = Qt::VBoxLayout.new do |m|
|
45
45
|
m.addWidget(@screenshotLabel)
|
46
46
|
m.addWidget(@optionsGroupBox)
|
47
47
|
m.addLayout(@buttonsLayout)
|
@@ -81,20 +81,21 @@ class Screenshot < Qt::Widget
|
|
81
81
|
tr("%s Files (*.%s);;All Files (*)" % [format.upcase, format]))
|
82
82
|
if !fileName.nil?
|
83
83
|
@originalPixmap.save(fileName, format)
|
84
|
-
|
84
|
+
end
|
85
85
|
end
|
86
86
|
|
87
87
|
def shootScreen()
|
88
88
|
if @delaySpinBox.value() != 0
|
89
89
|
$qApp.beep
|
90
|
-
|
91
|
-
|
90
|
+
end
|
91
|
+
Qt::Application.processEvents()
|
92
|
+
@originalPixmap = Qt::Pixmap.grabWindow(Qt::Application.desktop.winId)
|
92
93
|
updateScreenshotLabel()
|
93
94
|
|
94
95
|
@newScreenshotButton.disabled = false
|
95
96
|
if @hideThisWindowCheckBox.checked?
|
96
97
|
show()
|
97
|
-
|
98
|
+
end
|
98
99
|
end
|
99
100
|
|
100
101
|
def updateCheckBox()
|
@@ -102,7 +103,7 @@ class Screenshot < Qt::Widget
|
|
102
103
|
@hideThisWindowCheckBox.disabled = true
|
103
104
|
else
|
104
105
|
@hideThisWindowCheckBox.disabled = false
|
105
|
-
|
106
|
+
end
|
106
107
|
end
|
107
108
|
|
108
109
|
def createOptionsGroupBox()
|
@@ -111,14 +112,14 @@ class Screenshot < Qt::Widget
|
|
111
112
|
@delaySpinBox = Qt::SpinBox.new do |s|
|
112
113
|
s.suffix = tr(" s")
|
113
114
|
s.maximum = 60
|
114
|
-
|
115
|
+
end
|
115
116
|
connect(@delaySpinBox, SIGNAL('valueChanged(int)'), self, SLOT(:updateCheckBox))
|
116
117
|
|
117
118
|
@delaySpinBoxLabel = Qt::Label.new(tr("Screenshot Delay:"))
|
118
119
|
|
119
120
|
@hideThisWindowCheckBox = Qt::CheckBox.new(tr("Hide This Window"))
|
120
121
|
|
121
|
-
|
122
|
+
@optionsGroupBox.layout = Qt::GridLayout.new do |g|
|
122
123
|
g.addWidget(@delaySpinBoxLabel, 0, 0)
|
123
124
|
g.addWidget(@delaySpinBox, 0, 1)
|
124
125
|
g.addWidget(@hideThisWindowCheckBox, 1, 0, 1, 2)
|
@@ -134,7 +135,7 @@ class Screenshot < Qt::Widget
|
|
134
135
|
|
135
136
|
@quitScreenshotButton = createButton(tr("Quit"), self, SLOT(:close))
|
136
137
|
|
137
|
-
|
138
|
+
@buttonsLayout = Qt::HBoxLayout.new do |b|
|
138
139
|
b.addStretch()
|
139
140
|
b.addWidget(@newScreenshotButton)
|
140
141
|
b.addWidget(@saveScreenshotButton)
|
@@ -197,7 +197,7 @@ ENDIF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NO
|
|
197
197
|
|
198
198
|
|
199
199
|
# Determine the list of possible names for the ruby library
|
200
|
-
SET(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby-${RUBY_VERSION})
|
200
|
+
SET(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby${_RUBY_VERSION_SHORT_NODOT} ruby-${RUBY_VERSION})
|
201
201
|
|
202
202
|
IF(WIN32)
|
203
203
|
SET( _RUBY_MSVC_RUNTIME "" )
|
@@ -101,9 +101,9 @@ void
|
|
101
101
|
mark_qobject_children(QObject * qobject)
|
102
102
|
{
|
103
103
|
VALUE obj;
|
104
|
-
|
104
|
+
|
105
105
|
const QList<QObject*> l = qobject->children();
|
106
|
-
|
106
|
+
|
107
107
|
if (l.count() == 0) {
|
108
108
|
return;
|
109
109
|
}
|
@@ -117,7 +117,7 @@ mark_qobject_children(QObject * qobject)
|
|
117
117
|
if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", child->metaObject()->className(), child, (void*)obj);
|
118
118
|
rb_gc_mark(obj);
|
119
119
|
}
|
120
|
-
|
120
|
+
|
121
121
|
mark_qobject_children(child);
|
122
122
|
}
|
123
123
|
}
|
@@ -126,9 +126,9 @@ void
|
|
126
126
|
mark_qgraphicsitem_children(QGraphicsItem * item)
|
127
127
|
{
|
128
128
|
VALUE obj;
|
129
|
-
|
129
|
+
|
130
130
|
const QList<QGraphicsItem*> l = item->childItems();
|
131
|
-
|
131
|
+
|
132
132
|
if (l.count() == 0) {
|
133
133
|
return;
|
134
134
|
}
|
@@ -142,7 +142,7 @@ mark_qgraphicsitem_children(QGraphicsItem * item)
|
|
142
142
|
if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QGraphicsItem", child, (void*)obj);
|
143
143
|
rb_gc_mark(obj);
|
144
144
|
}
|
145
|
-
|
145
|
+
|
146
146
|
mark_qgraphicsitem_children(child);
|
147
147
|
}
|
148
148
|
}
|
@@ -160,7 +160,7 @@ mark_qtreewidgetitem_children(QTreeWidgetItem * item)
|
|
160
160
|
if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QTreeWidgetItem", child, (void*)obj);
|
161
161
|
rb_gc_mark(obj);
|
162
162
|
}
|
163
|
-
|
163
|
+
|
164
164
|
mark_qtreewidgetitem_children(child);
|
165
165
|
}
|
166
166
|
}
|
@@ -193,7 +193,7 @@ smokeruby_mark(void * p)
|
|
193
193
|
VALUE obj;
|
194
194
|
smokeruby_object * o = (smokeruby_object *) p;
|
195
195
|
const char *className = o->smoke->classes[o->classId].className;
|
196
|
-
|
196
|
+
|
197
197
|
if (do_debug & qtdb_gc) qWarning("Checking for mark (%s*)%p", className, o->ptr);
|
198
198
|
|
199
199
|
if (o->ptr && o->allocated) {
|
@@ -220,7 +220,7 @@ smokeruby_mark(void * p)
|
|
220
220
|
|
221
221
|
if (o->smoke->isDerivedFrom(className, "QListWidget")) {
|
222
222
|
QListWidget * listwidget = (QListWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QListWidget", true).index);
|
223
|
-
|
223
|
+
|
224
224
|
for (int i = 0; i < listwidget->count(); i++) {
|
225
225
|
QListWidgetItem * item = listwidget->item(i);
|
226
226
|
obj = getPointerObject(item);
|
@@ -231,7 +231,7 @@ smokeruby_mark(void * p)
|
|
231
231
|
}
|
232
232
|
return;
|
233
233
|
}
|
234
|
-
|
234
|
+
|
235
235
|
if (o->smoke->isDerivedFrom(className, "QTableWidget")) {
|
236
236
|
QTableWidget * table = (QTableWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QTableWidget", true).index);
|
237
237
|
QTableWidgetItem *item;
|
@@ -246,7 +246,7 @@ smokeruby_mark(void * p)
|
|
246
246
|
}
|
247
247
|
}
|
248
248
|
}
|
249
|
-
return;
|
249
|
+
return;
|
250
250
|
}
|
251
251
|
|
252
252
|
if (o->smoke->isDerivedFrom(className, "QTreeWidget")) {
|
@@ -266,14 +266,24 @@ smokeruby_mark(void * p)
|
|
266
266
|
|
267
267
|
if (o->smoke->isDerivedFrom(className, "QLayout")) {
|
268
268
|
QLayout * qlayout = (QLayout *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QLayout", true).index);
|
269
|
+
obj = getPointerObject(qlayout);
|
269
270
|
for (int i = 0; i < qlayout->count(); ++i) {
|
270
271
|
QLayoutItem * item = qlayout->itemAt(i);
|
272
|
+
if (do_debug & qtdb_gc) qWarning("Checking QLayoutItem %p", item);
|
271
273
|
if (item != 0) {
|
272
274
|
obj = getPointerObject(item);
|
273
275
|
if (obj != Qnil) {
|
274
276
|
if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QLayoutItem", item, (void*)obj);
|
275
277
|
rb_gc_mark(obj);
|
276
278
|
}
|
279
|
+
QWidget * widget = item->widget();
|
280
|
+
if (widget != 0) {
|
281
|
+
obj = getPointerObject(widget);
|
282
|
+
if (obj != Qnil) {
|
283
|
+
if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QLayoutItem->widget", widget, (void*)obj);
|
284
|
+
rb_gc_mark(obj);
|
285
|
+
}
|
286
|
+
}
|
277
287
|
}
|
278
288
|
}
|
279
289
|
return;
|
@@ -336,7 +346,7 @@ smokeruby_mark(void * p)
|
|
336
346
|
if (QGraphicsEffect* effect = item->graphicsEffect()) {
|
337
347
|
obj = getPointerObject(effect);
|
338
348
|
if (obj != Qnil) {
|
339
|
-
if (do_debug & qtdb_gc)
|
349
|
+
if (do_debug & qtdb_gc)
|
340
350
|
qWarning("Marking (%s*)%p -> %p", "QGraphicsEffect", effect, (void*)obj);
|
341
351
|
rb_gc_mark(obj);
|
342
352
|
}
|
@@ -355,7 +365,7 @@ smokeruby_mark(void * p)
|
|
355
365
|
rb_gc_mark(obj);
|
356
366
|
}
|
357
367
|
}
|
358
|
-
}
|
368
|
+
}
|
359
369
|
return;
|
360
370
|
}
|
361
371
|
|
@@ -365,7 +375,7 @@ smokeruby_mark(void * p)
|
|
365
375
|
obj = getPointerObject(ptr);
|
366
376
|
if (obj != Qnil) {
|
367
377
|
if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QModelIndex", ptr, (void*)obj);
|
368
|
-
|
378
|
+
|
369
379
|
rb_gc_mark(obj);
|
370
380
|
}
|
371
381
|
|
@@ -379,17 +389,17 @@ smokeruby_free(void * p)
|
|
379
389
|
{
|
380
390
|
smokeruby_object *o = (smokeruby_object*)p;
|
381
391
|
const char *className = o->smoke->classes[o->classId].className;
|
382
|
-
|
392
|
+
|
383
393
|
if(do_debug & qtdb_gc) qWarning("Checking for delete (%s*)%p allocated: %s", className, o->ptr, o->allocated ? "true" : "false");
|
384
|
-
|
394
|
+
|
385
395
|
if(application_terminated || !o->allocated || o->ptr == 0) {
|
386
396
|
free_smokeruby_object(o);
|
387
397
|
return;
|
388
398
|
}
|
389
|
-
|
399
|
+
|
390
400
|
unmapPointer(o, o->classId, 0);
|
391
401
|
object_count --;
|
392
|
-
|
402
|
+
|
393
403
|
if (o->smoke->isDerivedFrom(className, "QGraphicsLayoutItem")) {
|
394
404
|
QGraphicsLayoutItem * item = (QGraphicsLayoutItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QGraphicsLayoutItem", true).index);
|
395
405
|
if (item->graphicsItem() != 0 || item->parentLayoutItem() != 0) {
|
@@ -439,24 +449,24 @@ smokeruby_free(void * p)
|
|
439
449
|
return;
|
440
450
|
}
|
441
451
|
}
|
442
|
-
|
452
|
+
|
443
453
|
if(do_debug & qtdb_gc) qWarning("Deleting (%s*)%p", className, o->ptr);
|
444
454
|
|
445
|
-
char *methodName = new char[strlen(className) + 2];
|
446
|
-
methodName[0] = '~';
|
447
|
-
strcpy(methodName + 1, className);
|
448
|
-
Smoke::ModuleIndex nameId = o->smoke->findMethodName(className, methodName);
|
449
|
-
Smoke::ModuleIndex classIdx(o->smoke, o->classId);
|
450
|
-
Smoke::ModuleIndex meth = o->smoke->findMethod(classIdx, nameId);
|
451
|
-
if(meth.index > 0) {
|
452
|
-
Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
|
453
|
-
Smoke::ClassFn fn = meth.smoke->classes[m.classId].classFn;
|
454
|
-
Smoke::StackItem i[1];
|
455
|
-
(*fn)(m.method, o->ptr, i);
|
456
|
-
}
|
457
|
-
delete[] methodName;
|
455
|
+
//~ char *methodName = new char[strlen(className) + 2];
|
456
|
+
//~ methodName[0] = '~';
|
457
|
+
//~ strcpy(methodName + 1, className);
|
458
|
+
//~ Smoke::ModuleIndex nameId = o->smoke->findMethodName(className, methodName);
|
459
|
+
//~ Smoke::ModuleIndex classIdx(o->smoke, o->classId);
|
460
|
+
//~ Smoke::ModuleIndex meth = o->smoke->findMethod(classIdx, nameId);
|
461
|
+
//~ if(meth.index > 0) {
|
462
|
+
//~ Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
|
463
|
+
//~ Smoke::ClassFn fn = meth.smoke->classes[m.classId].classFn;
|
464
|
+
//~ Smoke::StackItem i[1];
|
465
|
+
//~ (*fn)(m.method, o->ptr, i);
|
466
|
+
//~ }
|
467
|
+
//~ delete[] methodName;
|
458
468
|
free_smokeruby_object(o);
|
459
|
-
|
469
|
+
|
460
470
|
return;
|
461
471
|
}
|
462
472
|
|
@@ -738,7 +748,7 @@ resolve_classname_qt(smokeruby_object * o)
|
|
738
748
|
SET_SMOKERUBY_OBJECT("QSpacerItem")
|
739
749
|
}
|
740
750
|
}
|
741
|
-
|
751
|
+
|
742
752
|
return qtruby_modules[o->smoke].binding->className(o->classId);
|
743
753
|
|
744
754
|
#undef SET_SMOKERUBY_OBJECT
|
@@ -830,11 +840,11 @@ static void marshall_it(Marshall *m)
|
|
830
840
|
case Marshall::FromVALUE:
|
831
841
|
marshall_from_ruby<T>(m);
|
832
842
|
break;
|
833
|
-
|
843
|
+
|
834
844
|
case Marshall::ToVALUE:
|
835
845
|
marshall_to_ruby<T>( m );
|
836
846
|
break;
|
837
|
-
|
847
|
+
|
838
848
|
default:
|
839
849
|
m->unsupported();
|
840
850
|
break;
|
@@ -853,15 +863,15 @@ marshall_basetype(Marshall *m)
|
|
853
863
|
case Smoke::t_char:
|
854
864
|
marshall_it<signed char>(m);
|
855
865
|
break;
|
856
|
-
|
866
|
+
|
857
867
|
case Smoke::t_uchar:
|
858
868
|
marshall_it<unsigned char>(m);
|
859
869
|
break;
|
860
|
-
|
870
|
+
|
861
871
|
case Smoke::t_short:
|
862
872
|
marshall_it<short>(m);
|
863
873
|
break;
|
864
|
-
|
874
|
+
|
865
875
|
case Smoke::t_ushort:
|
866
876
|
marshall_it<unsigned short>(m);
|
867
877
|
break;
|
@@ -869,11 +879,11 @@ marshall_basetype(Marshall *m)
|
|
869
879
|
case Smoke::t_int:
|
870
880
|
marshall_it<int>(m);
|
871
881
|
break;
|
872
|
-
|
882
|
+
|
873
883
|
case Smoke::t_uint:
|
874
884
|
marshall_it<unsigned int>(m);
|
875
885
|
break;
|
876
|
-
|
886
|
+
|
877
887
|
case Smoke::t_long:
|
878
888
|
marshall_it<long>(m);
|
879
889
|
break;
|
@@ -881,7 +891,7 @@ marshall_basetype(Marshall *m)
|
|
881
891
|
case Smoke::t_ulong:
|
882
892
|
marshall_it<unsigned long>(m);
|
883
893
|
break;
|
884
|
-
|
894
|
+
|
885
895
|
case Smoke::t_float:
|
886
896
|
marshall_it<float>(m);
|
887
897
|
break;
|
@@ -893,14 +903,14 @@ marshall_basetype(Marshall *m)
|
|
893
903
|
case Smoke::t_enum:
|
894
904
|
marshall_it<SmokeEnumWrapper>(m);
|
895
905
|
break;
|
896
|
-
|
906
|
+
|
897
907
|
case Smoke::t_class:
|
898
908
|
marshall_it<SmokeClassWrapper>(m);
|
899
909
|
break;
|
900
910
|
|
901
911
|
default:
|
902
912
|
m->unsupported();
|
903
|
-
break;
|
913
|
+
break;
|
904
914
|
}
|
905
915
|
|
906
916
|
}
|
@@ -956,7 +966,7 @@ static QTextCodec *codec = 0;
|
|
956
966
|
#if RUBY_VERSION < 0x10900
|
957
967
|
static const char * KCODE = 0;
|
958
968
|
|
959
|
-
static void
|
969
|
+
static void
|
960
970
|
init_codec() {
|
961
971
|
VALUE temp = rb_gv_get("$KCODE");
|
962
972
|
KCODE = StringValuePtr(temp);
|
@@ -967,12 +977,12 @@ init_codec() {
|
|
967
977
|
}
|
968
978
|
}
|
969
979
|
|
970
|
-
QString*
|
980
|
+
QString*
|
971
981
|
qstringFromRString(VALUE rstring) {
|
972
982
|
if (KCODE == 0) {
|
973
983
|
init_codec();
|
974
984
|
}
|
975
|
-
|
985
|
+
|
976
986
|
if (qstrcmp(KCODE, "UTF8") == 0)
|
977
987
|
return new QString(QString::fromUtf8(StringValuePtr(rstring), RSTRING_LEN(rstring)));
|
978
988
|
else if (qstrcmp(KCODE, "EUC") == 0)
|
@@ -985,12 +995,12 @@ qstringFromRString(VALUE rstring) {
|
|
985
995
|
return new QString(QString::fromLocal8Bit(StringValuePtr(rstring), RSTRING_LEN(rstring)));
|
986
996
|
}
|
987
997
|
|
988
|
-
VALUE
|
998
|
+
VALUE
|
989
999
|
rstringFromQString(QString * s) {
|
990
1000
|
if (KCODE == 0) {
|
991
1001
|
init_codec();
|
992
1002
|
}
|
993
|
-
|
1003
|
+
|
994
1004
|
if (qstrcmp(KCODE, "UTF8") == 0)
|
995
1005
|
return rb_str_new2(s->toUtf8());
|
996
1006
|
else if (qstrcmp(KCODE, "EUC") == 0)
|
@@ -1005,7 +1015,7 @@ rstringFromQString(QString * s) {
|
|
1005
1015
|
|
1006
1016
|
#else
|
1007
1017
|
|
1008
|
-
QString*
|
1018
|
+
QString*
|
1009
1019
|
qstringFromRString(VALUE rstring) {
|
1010
1020
|
VALUE encoding = rb_funcall(rstring, rb_intern("encoding"), 0);
|
1011
1021
|
encoding = rb_funcall(encoding, rb_intern("to_s"), 0);
|
@@ -1026,7 +1036,7 @@ qstringFromRString(VALUE rstring) {
|
|
1026
1036
|
return new QString(QString::fromLocal8Bit(StringValuePtr(rstring), RSTRING_LEN(rstring)));
|
1027
1037
|
}
|
1028
1038
|
|
1029
|
-
VALUE
|
1039
|
+
VALUE
|
1030
1040
|
rstringFromQString(QString * s) {
|
1031
1041
|
return rb_str_new2(s->toUtf8());
|
1032
1042
|
}
|
@@ -1055,13 +1065,13 @@ static void marshall_QString(Marshall *m) {
|
|
1055
1065
|
|
1056
1066
|
m->item().s_voidp = s;
|
1057
1067
|
m->next();
|
1058
|
-
|
1068
|
+
|
1059
1069
|
if (!m->type().isConst() && *(m->var()) != Qnil && s != 0 && !s->isNull()) {
|
1060
1070
|
rb_str_resize(*(m->var()), 0);
|
1061
1071
|
VALUE temp = rstringFromQString(s);
|
1062
1072
|
rb_str_cat2(*(m->var()), StringValuePtr(temp));
|
1063
1073
|
}
|
1064
|
-
|
1074
|
+
|
1065
1075
|
if (s != 0 && m->cleanup()) {
|
1066
1076
|
delete s;
|
1067
1077
|
}
|
@@ -1085,7 +1095,7 @@ static void marshall_QString(Marshall *m) {
|
|
1085
1095
|
}
|
1086
1096
|
}
|
1087
1097
|
break;
|
1088
|
-
|
1098
|
+
|
1089
1099
|
default:
|
1090
1100
|
m->unsupported();
|
1091
1101
|
break;
|
@@ -1162,7 +1172,7 @@ qchar_to_s(VALUE self)
|
|
1162
1172
|
|
1163
1173
|
void marshall_QDBusVariant(Marshall *m) {
|
1164
1174
|
switch(m->action()) {
|
1165
|
-
case Marshall::FromVALUE:
|
1175
|
+
case Marshall::FromVALUE:
|
1166
1176
|
{
|
1167
1177
|
VALUE v = *(m->var());
|
1168
1178
|
if (v == Qnil) {
|
@@ -1182,7 +1192,7 @@ void marshall_QDBusVariant(Marshall *m) {
|
|
1182
1192
|
break;
|
1183
1193
|
}
|
1184
1194
|
|
1185
|
-
case Marshall::ToVALUE:
|
1195
|
+
case Marshall::ToVALUE:
|
1186
1196
|
{
|
1187
1197
|
if (m->item().s_voidp == 0) {
|
1188
1198
|
*(m->var()) = Qnil;
|
@@ -1196,7 +1206,7 @@ void marshall_QDBusVariant(Marshall *m) {
|
|
1196
1206
|
break;
|
1197
1207
|
}
|
1198
1208
|
smokeruby_object * o = alloc_smokeruby_object(false, m->smoke(), m->smoke()->findClass("QVariant").index, p);
|
1199
|
-
|
1209
|
+
|
1200
1210
|
obj = set_obj_info("Qt::DBusVariant", o);
|
1201
1211
|
if (do_debug & qtdb_calls) {
|
1202
1212
|
printf("allocating %s %p -> %p\n", "Qt::DBusVariant", o->ptr, (void*)obj);
|
@@ -1207,11 +1217,11 @@ void marshall_QDBusVariant(Marshall *m) {
|
|
1207
1217
|
// Keep a mapping of the pointer so that it is only wrapped once
|
1208
1218
|
mapPointer(obj, o, o->classId, 0);
|
1209
1219
|
}
|
1210
|
-
|
1220
|
+
|
1211
1221
|
*(m->var()) = obj;
|
1212
1222
|
break;
|
1213
1223
|
}
|
1214
|
-
|
1224
|
+
|
1215
1225
|
default:
|
1216
1226
|
m->unsupported();
|
1217
1227
|
break;
|
@@ -1257,7 +1267,7 @@ static void marshall_charP_array(Marshall *m) {
|
|
1257
1267
|
|
1258
1268
|
void marshall_QStringList(Marshall *m) {
|
1259
1269
|
switch(m->action()) {
|
1260
|
-
case Marshall::FromVALUE:
|
1270
|
+
case Marshall::FromVALUE:
|
1261
1271
|
{
|
1262
1272
|
VALUE list = *(m->var());
|
1263
1273
|
if (TYPE(list) != T_ARRAY) {
|
@@ -1286,15 +1296,15 @@ void marshall_QStringList(Marshall *m) {
|
|
1286
1296
|
for(QStringList::Iterator it = stringlist->begin(); it != stringlist->end(); ++it)
|
1287
1297
|
rb_ary_push(list, rstringFromQString(&(*it)));
|
1288
1298
|
}
|
1289
|
-
|
1299
|
+
|
1290
1300
|
if (m->cleanup()) {
|
1291
1301
|
delete stringlist;
|
1292
1302
|
}
|
1293
|
-
|
1303
|
+
|
1294
1304
|
break;
|
1295
1305
|
}
|
1296
1306
|
|
1297
|
-
case Marshall::ToVALUE:
|
1307
|
+
case Marshall::ToVALUE:
|
1298
1308
|
{
|
1299
1309
|
QStringList *stringlist = static_cast<QStringList *>(m->item().s_voidp);
|
1300
1310
|
if (!stringlist) {
|
@@ -1325,7 +1335,7 @@ void marshall_QStringList(Marshall *m) {
|
|
1325
1335
|
|
1326
1336
|
void marshall_QByteArrayList(Marshall *m) {
|
1327
1337
|
switch(m->action()) {
|
1328
|
-
case Marshall::FromVALUE:
|
1338
|
+
case Marshall::FromVALUE:
|
1329
1339
|
{
|
1330
1340
|
VALUE list = *(m->var());
|
1331
1341
|
if (TYPE(list) != T_ARRAY) {
|
@@ -1360,7 +1370,7 @@ void marshall_QByteArrayList(Marshall *m) {
|
|
1360
1370
|
}
|
1361
1371
|
break;
|
1362
1372
|
}
|
1363
|
-
case Marshall::ToVALUE:
|
1373
|
+
case Marshall::ToVALUE:
|
1364
1374
|
{
|
1365
1375
|
QList<QByteArray> *stringlist = static_cast<QList<QByteArray>*>(m->item().s_voidp);
|
1366
1376
|
if(!stringlist) {
|
@@ -1422,13 +1432,13 @@ void marshall_QListCharStar(Marshall *m) {
|
|
1422
1432
|
|
1423
1433
|
VALUE av = rb_ary_new();
|
1424
1434
|
|
1425
|
-
for ( QList<const char*>::iterator i = list->begin();
|
1426
|
-
i != list->end();
|
1427
|
-
++i )
|
1435
|
+
for ( QList<const char*>::iterator i = list->begin();
|
1436
|
+
i != list->end();
|
1437
|
+
++i )
|
1428
1438
|
{
|
1429
1439
|
rb_ary_push(av, rb_str_new2((const char *)*i));
|
1430
1440
|
}
|
1431
|
-
|
1441
|
+
|
1432
1442
|
*(m->var()) = av;
|
1433
1443
|
m->next();
|
1434
1444
|
}
|
@@ -1465,10 +1475,10 @@ void marshall_QListInt(Marshall *m) {
|
|
1465
1475
|
|
1466
1476
|
if (!m->type().isConst()) {
|
1467
1477
|
rb_ary_clear(list);
|
1468
|
-
|
1469
|
-
for ( QList<int>::iterator i = valuelist->begin();
|
1470
|
-
i != valuelist->end();
|
1471
|
-
++i )
|
1478
|
+
|
1479
|
+
for ( QList<int>::iterator i = valuelist->begin();
|
1480
|
+
i != valuelist->end();
|
1481
|
+
++i )
|
1472
1482
|
{
|
1473
1483
|
rb_ary_push(list, INT2NUM((int)*i));
|
1474
1484
|
}
|
@@ -1489,13 +1499,13 @@ void marshall_QListInt(Marshall *m) {
|
|
1489
1499
|
|
1490
1500
|
VALUE av = rb_ary_new();
|
1491
1501
|
|
1492
|
-
for ( QList<int>::iterator i = valuelist->begin();
|
1493
|
-
i != valuelist->end();
|
1494
|
-
++i )
|
1502
|
+
for ( QList<int>::iterator i = valuelist->begin();
|
1503
|
+
i != valuelist->end();
|
1504
|
+
++i )
|
1495
1505
|
{
|
1496
1506
|
rb_ary_push(av, INT2NUM((int)*i));
|
1497
1507
|
}
|
1498
|
-
|
1508
|
+
|
1499
1509
|
*(m->var()) = av;
|
1500
1510
|
m->next();
|
1501
1511
|
|
@@ -1537,10 +1547,10 @@ void marshall_QListUInt(Marshall *m) {
|
|
1537
1547
|
|
1538
1548
|
if (!m->type().isConst()) {
|
1539
1549
|
rb_ary_clear(list);
|
1540
|
-
|
1541
|
-
for ( QList<uint>::iterator i = valuelist->begin();
|
1542
|
-
i != valuelist->end();
|
1543
|
-
++i )
|
1550
|
+
|
1551
|
+
for ( QList<uint>::iterator i = valuelist->begin();
|
1552
|
+
i != valuelist->end();
|
1553
|
+
++i )
|
1544
1554
|
{
|
1545
1555
|
rb_ary_push(list, UINT2NUM((int)*i));
|
1546
1556
|
}
|
@@ -1561,13 +1571,13 @@ void marshall_QListUInt(Marshall *m) {
|
|
1561
1571
|
|
1562
1572
|
VALUE av = rb_ary_new();
|
1563
1573
|
|
1564
|
-
for ( QList<uint>::iterator i = valuelist->begin();
|
1565
|
-
i != valuelist->end();
|
1566
|
-
++i )
|
1574
|
+
for ( QList<uint>::iterator i = valuelist->begin();
|
1575
|
+
i != valuelist->end();
|
1576
|
+
++i )
|
1567
1577
|
{
|
1568
1578
|
rb_ary_push(av, UINT2NUM((int)*i));
|
1569
1579
|
}
|
1570
|
-
|
1580
|
+
|
1571
1581
|
*(m->var()) = av;
|
1572
1582
|
m->next();
|
1573
1583
|
|
@@ -1608,10 +1618,10 @@ void marshall_QListqreal(Marshall *m) {
|
|
1608
1618
|
|
1609
1619
|
if (!m->type().isConst()) {
|
1610
1620
|
rb_ary_clear(list);
|
1611
|
-
|
1612
|
-
for ( QList<qreal>::iterator i = valuelist->begin();
|
1613
|
-
i != valuelist->end();
|
1614
|
-
++i )
|
1621
|
+
|
1622
|
+
for ( QList<qreal>::iterator i = valuelist->begin();
|
1623
|
+
i != valuelist->end();
|
1624
|
+
++i )
|
1615
1625
|
{
|
1616
1626
|
rb_ary_push(list, rb_float_new((qreal)*i));
|
1617
1627
|
}
|
@@ -1632,13 +1642,13 @@ void marshall_QListqreal(Marshall *m) {
|
|
1632
1642
|
|
1633
1643
|
VALUE av = rb_ary_new();
|
1634
1644
|
|
1635
|
-
for ( QList<qreal>::iterator i = valuelist->begin();
|
1636
|
-
i != valuelist->end();
|
1637
|
-
++i )
|
1645
|
+
for ( QList<qreal>::iterator i = valuelist->begin();
|
1646
|
+
i != valuelist->end();
|
1647
|
+
++i )
|
1638
1648
|
{
|
1639
1649
|
rb_ary_push(av, rb_float_new((qreal)*i));
|
1640
1650
|
}
|
1641
|
-
|
1651
|
+
|
1642
1652
|
*(m->var()) = av;
|
1643
1653
|
m->next();
|
1644
1654
|
|
@@ -1677,10 +1687,10 @@ void marshall_QVectorqreal(Marshall *m) {
|
|
1677
1687
|
|
1678
1688
|
if (!m->type().isConst()) {
|
1679
1689
|
rb_ary_clear(list);
|
1680
|
-
|
1681
|
-
for ( QVector<qreal>::iterator i = valuelist->begin();
|
1682
|
-
i != valuelist->end();
|
1683
|
-
++i )
|
1690
|
+
|
1691
|
+
for ( QVector<qreal>::iterator i = valuelist->begin();
|
1692
|
+
i != valuelist->end();
|
1693
|
+
++i )
|
1684
1694
|
{
|
1685
1695
|
rb_ary_push(list, rb_float_new((qreal)*i));
|
1686
1696
|
}
|
@@ -1701,13 +1711,13 @@ void marshall_QVectorqreal(Marshall *m) {
|
|
1701
1711
|
|
1702
1712
|
VALUE av = rb_ary_new();
|
1703
1713
|
|
1704
|
-
for ( QVector<qreal>::iterator i = valuelist->begin();
|
1705
|
-
i != valuelist->end();
|
1706
|
-
++i )
|
1714
|
+
for ( QVector<qreal>::iterator i = valuelist->begin();
|
1715
|
+
i != valuelist->end();
|
1716
|
+
++i )
|
1707
1717
|
{
|
1708
1718
|
rb_ary_push(av, rb_float_new((qreal)*i));
|
1709
1719
|
}
|
1710
|
-
|
1720
|
+
|
1711
1721
|
*(m->var()) = av;
|
1712
1722
|
m->next();
|
1713
1723
|
|
@@ -1746,10 +1756,10 @@ void marshall_QVectorint(Marshall *m) {
|
|
1746
1756
|
|
1747
1757
|
if (!m->type().isConst()) {
|
1748
1758
|
rb_ary_clear(list);
|
1749
|
-
|
1750
|
-
for ( QVector<int>::iterator i = valuelist->begin();
|
1751
|
-
i != valuelist->end();
|
1752
|
-
++i )
|
1759
|
+
|
1760
|
+
for ( QVector<int>::iterator i = valuelist->begin();
|
1761
|
+
i != valuelist->end();
|
1762
|
+
++i )
|
1753
1763
|
{
|
1754
1764
|
rb_ary_push(list, INT2NUM((int)*i));
|
1755
1765
|
}
|
@@ -1770,13 +1780,13 @@ void marshall_QVectorint(Marshall *m) {
|
|
1770
1780
|
|
1771
1781
|
VALUE av = rb_ary_new();
|
1772
1782
|
|
1773
|
-
for ( QVector<int>::iterator i = valuelist->begin();
|
1774
|
-
i != valuelist->end();
|
1775
|
-
++i )
|
1783
|
+
for ( QVector<int>::iterator i = valuelist->begin();
|
1784
|
+
i != valuelist->end();
|
1785
|
+
++i )
|
1776
1786
|
{
|
1777
1787
|
rb_ary_push(av, INT2NUM((int)*i));
|
1778
1788
|
}
|
1779
|
-
|
1789
|
+
|
1780
1790
|
*(m->var()) = av;
|
1781
1791
|
m->next();
|
1782
1792
|
|
@@ -1822,9 +1832,9 @@ void marshall_QMapQStringQString(Marshall *m) {
|
|
1822
1832
|
m->item().s_voidp = 0;
|
1823
1833
|
break;
|
1824
1834
|
}
|
1825
|
-
|
1835
|
+
|
1826
1836
|
QMap<QString,QString> * map = new QMap<QString,QString>;
|
1827
|
-
|
1837
|
+
|
1828
1838
|
// Convert the ruby hash to an array of key/value arrays
|
1829
1839
|
VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0);
|
1830
1840
|
|
@@ -1833,10 +1843,10 @@ void marshall_QMapQStringQString(Marshall *m) {
|
|
1833
1843
|
VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1);
|
1834
1844
|
(*map)[QString(StringValuePtr(key))] = QString(StringValuePtr(value));
|
1835
1845
|
}
|
1836
|
-
|
1846
|
+
|
1837
1847
|
m->item().s_voidp = map;
|
1838
1848
|
m->next();
|
1839
|
-
|
1849
|
+
|
1840
1850
|
if(m->cleanup())
|
1841
1851
|
delete map;
|
1842
1852
|
}
|
@@ -1848,17 +1858,17 @@ void marshall_QMapQStringQString(Marshall *m) {
|
|
1848
1858
|
*(m->var()) = Qnil;
|
1849
1859
|
break;
|
1850
1860
|
}
|
1851
|
-
|
1861
|
+
|
1852
1862
|
VALUE hv = rb_hash_new();
|
1853
|
-
|
1863
|
+
|
1854
1864
|
QMap<QString,QString>::Iterator it;
|
1855
1865
|
for (it = map->begin(); it != map->end(); ++it) {
|
1856
1866
|
rb_hash_aset(hv, rstringFromQString((QString*)&(it.key())), rstringFromQString((QString*) &(it.value())));
|
1857
1867
|
}
|
1858
|
-
|
1868
|
+
|
1859
1869
|
*(m->var()) = hv;
|
1860
1870
|
m->next();
|
1861
|
-
|
1871
|
+
|
1862
1872
|
if(m->cleanup())
|
1863
1873
|
delete map;
|
1864
1874
|
}
|
@@ -1878,16 +1888,16 @@ void marshall_QMapQStringQVariant(Marshall *m) {
|
|
1878
1888
|
m->item().s_voidp = 0;
|
1879
1889
|
break;
|
1880
1890
|
}
|
1881
|
-
|
1891
|
+
|
1882
1892
|
QMap<QString,QVariant> * map = new QMap<QString,QVariant>;
|
1883
|
-
|
1893
|
+
|
1884
1894
|
// Convert the ruby hash to an array of key/value arrays
|
1885
1895
|
VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0);
|
1886
1896
|
|
1887
1897
|
for (long i = 0; i < RARRAY_LEN(temp); i++) {
|
1888
1898
|
VALUE key = rb_ary_entry(rb_ary_entry(temp, i), 0);
|
1889
1899
|
VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1);
|
1890
|
-
|
1900
|
+
|
1891
1901
|
smokeruby_object *o = value_obj_info(value);
|
1892
1902
|
if (!o || !o->ptr || o->classId != o->smoke->findClass("QVariant").index) {
|
1893
1903
|
// If the value isn't a Qt::Variant, then try and construct
|
@@ -1898,13 +1908,13 @@ void marshall_QMapQStringQVariant(Marshall *m) {
|
|
1898
1908
|
}
|
1899
1909
|
o = value_obj_info(value);
|
1900
1910
|
}
|
1901
|
-
|
1911
|
+
|
1902
1912
|
(*map)[QString(StringValuePtr(key))] = (QVariant)*(QVariant*)o->ptr;
|
1903
1913
|
}
|
1904
|
-
|
1914
|
+
|
1905
1915
|
m->item().s_voidp = map;
|
1906
1916
|
m->next();
|
1907
|
-
|
1917
|
+
|
1908
1918
|
if(m->cleanup())
|
1909
1919
|
delete map;
|
1910
1920
|
}
|
@@ -1916,28 +1926,28 @@ void marshall_QMapQStringQVariant(Marshall *m) {
|
|
1916
1926
|
*(m->var()) = Qnil;
|
1917
1927
|
break;
|
1918
1928
|
}
|
1919
|
-
|
1929
|
+
|
1920
1930
|
VALUE hv = rb_hash_new();
|
1921
|
-
|
1931
|
+
|
1922
1932
|
QMap<QString,QVariant>::Iterator it;
|
1923
1933
|
for (it = map->begin(); it != map->end(); ++it) {
|
1924
1934
|
void *p = new QVariant(it.value());
|
1925
1935
|
VALUE obj = getPointerObject(p);
|
1926
|
-
|
1936
|
+
|
1927
1937
|
if (obj == Qnil) {
|
1928
|
-
smokeruby_object * o = alloc_smokeruby_object( true,
|
1929
|
-
m->smoke(),
|
1930
|
-
m->smoke()->idClass("QVariant").index,
|
1938
|
+
smokeruby_object * o = alloc_smokeruby_object( true,
|
1939
|
+
m->smoke(),
|
1940
|
+
m->smoke()->idClass("QVariant").index,
|
1931
1941
|
p );
|
1932
1942
|
obj = set_obj_info("Qt::Variant", o);
|
1933
1943
|
}
|
1934
|
-
|
1944
|
+
|
1935
1945
|
rb_hash_aset(hv, rstringFromQString((QString*)&(it.key())), obj);
|
1936
1946
|
}
|
1937
|
-
|
1947
|
+
|
1938
1948
|
*(m->var()) = hv;
|
1939
1949
|
m->next();
|
1940
|
-
|
1950
|
+
|
1941
1951
|
if(m->cleanup())
|
1942
1952
|
delete map;
|
1943
1953
|
}
|
@@ -1957,16 +1967,16 @@ void marshall_QMapIntQVariant(Marshall *m) {
|
|
1957
1967
|
m->item().s_voidp = 0;
|
1958
1968
|
break;
|
1959
1969
|
}
|
1960
|
-
|
1970
|
+
|
1961
1971
|
QMap<int,QVariant> * map = new QMap<int,QVariant>;
|
1962
|
-
|
1972
|
+
|
1963
1973
|
// Convert the ruby hash to an array of key/value arrays
|
1964
1974
|
VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0);
|
1965
1975
|
|
1966
1976
|
for (long i = 0; i < RARRAY_LEN(temp); i++) {
|
1967
1977
|
VALUE key = rb_ary_entry(rb_ary_entry(temp, i), 0);
|
1968
1978
|
VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1);
|
1969
|
-
|
1979
|
+
|
1970
1980
|
smokeruby_object *o = value_obj_info(value);
|
1971
1981
|
if (!o || !o->ptr || o->classId != o->smoke->idClass("QVariant").index) {
|
1972
1982
|
// If the value isn't a Qt::Variant, then try and construct
|
@@ -1977,13 +1987,13 @@ void marshall_QMapIntQVariant(Marshall *m) {
|
|
1977
1987
|
}
|
1978
1988
|
o = value_obj_info(value);
|
1979
1989
|
}
|
1980
|
-
|
1990
|
+
|
1981
1991
|
(*map)[NUM2INT(key)] = (QVariant)*(QVariant*)o->ptr;
|
1982
1992
|
}
|
1983
|
-
|
1993
|
+
|
1984
1994
|
m->item().s_voidp = map;
|
1985
1995
|
m->next();
|
1986
|
-
|
1996
|
+
|
1987
1997
|
if(m->cleanup())
|
1988
1998
|
delete map;
|
1989
1999
|
}
|
@@ -1995,28 +2005,28 @@ void marshall_QMapIntQVariant(Marshall *m) {
|
|
1995
2005
|
*(m->var()) = Qnil;
|
1996
2006
|
break;
|
1997
2007
|
}
|
1998
|
-
|
2008
|
+
|
1999
2009
|
VALUE hv = rb_hash_new();
|
2000
|
-
|
2010
|
+
|
2001
2011
|
QMap<int,QVariant>::Iterator it;
|
2002
2012
|
for (it = map->begin(); it != map->end(); ++it) {
|
2003
2013
|
void *p = new QVariant(it.value());
|
2004
2014
|
VALUE obj = getPointerObject(p);
|
2005
|
-
|
2015
|
+
|
2006
2016
|
if (obj == Qnil) {
|
2007
|
-
smokeruby_object * o = alloc_smokeruby_object( true,
|
2008
|
-
m->smoke(),
|
2009
|
-
m->smoke()->idClass("QVariant").index,
|
2017
|
+
smokeruby_object * o = alloc_smokeruby_object( true,
|
2018
|
+
m->smoke(),
|
2019
|
+
m->smoke()->idClass("QVariant").index,
|
2010
2020
|
p );
|
2011
2021
|
obj = set_obj_info("Qt::Variant", o);
|
2012
2022
|
}
|
2013
|
-
|
2023
|
+
|
2014
2024
|
rb_hash_aset(hv, INT2NUM(it.key()), obj);
|
2015
2025
|
}
|
2016
|
-
|
2026
|
+
|
2017
2027
|
*(m->var()) = hv;
|
2018
2028
|
m->next();
|
2019
|
-
|
2029
|
+
|
2020
2030
|
if(m->cleanup())
|
2021
2031
|
delete map;
|
2022
2032
|
}
|
@@ -2036,28 +2046,28 @@ void marshall_QMapintQVariant(Marshall *m) {
|
|
2036
2046
|
m->item().s_voidp = 0;
|
2037
2047
|
break;
|
2038
2048
|
}
|
2039
|
-
|
2049
|
+
|
2040
2050
|
QMap<int,QVariant> * map = new QMap<int,QVariant>;
|
2041
|
-
|
2051
|
+
|
2042
2052
|
// Convert the ruby hash to an array of key/value arrays
|
2043
2053
|
VALUE temp = rb_funcall(hash, rb_intern("to_a"), 0);
|
2044
2054
|
|
2045
2055
|
for (long i = 0; i < RARRAY_LEN(temp); i++) {
|
2046
2056
|
VALUE key = rb_ary_entry(rb_ary_entry(temp, i), 0);
|
2047
2057
|
VALUE value = rb_ary_entry(rb_ary_entry(temp, i), 1);
|
2048
|
-
|
2058
|
+
|
2049
2059
|
smokeruby_object *o = value_obj_info(value);
|
2050
2060
|
if( !o || !o->ptr)
|
2051
2061
|
continue;
|
2052
2062
|
void * ptr = o->ptr;
|
2053
2063
|
ptr = o->smoke->cast(ptr, o->classId, o->smoke->idClass("QVariant").index);
|
2054
|
-
|
2064
|
+
|
2055
2065
|
(*map)[NUM2INT(key)] = (QVariant)*(QVariant*)ptr;
|
2056
2066
|
}
|
2057
|
-
|
2067
|
+
|
2058
2068
|
m->item().s_voidp = map;
|
2059
2069
|
m->next();
|
2060
|
-
|
2070
|
+
|
2061
2071
|
if(m->cleanup())
|
2062
2072
|
delete map;
|
2063
2073
|
}
|
@@ -2069,28 +2079,28 @@ void marshall_QMapintQVariant(Marshall *m) {
|
|
2069
2079
|
*(m->var()) = Qnil;
|
2070
2080
|
break;
|
2071
2081
|
}
|
2072
|
-
|
2082
|
+
|
2073
2083
|
VALUE hv = rb_hash_new();
|
2074
|
-
|
2084
|
+
|
2075
2085
|
QMap<int,QVariant>::Iterator it;
|
2076
2086
|
for (it = map->begin(); it != map->end(); ++it) {
|
2077
2087
|
void *p = new QVariant(it.value());
|
2078
2088
|
VALUE obj = getPointerObject(p);
|
2079
|
-
|
2089
|
+
|
2080
2090
|
if (obj == Qnil) {
|
2081
|
-
smokeruby_object * o = alloc_smokeruby_object( true,
|
2082
|
-
m->smoke(),
|
2083
|
-
m->smoke()->idClass("QVariant").index,
|
2091
|
+
smokeruby_object * o = alloc_smokeruby_object( true,
|
2092
|
+
m->smoke(),
|
2093
|
+
m->smoke()->idClass("QVariant").index,
|
2084
2094
|
p );
|
2085
2095
|
obj = set_obj_info("Qt::Variant", o);
|
2086
2096
|
}
|
2087
|
-
|
2097
|
+
|
2088
2098
|
rb_hash_aset(hv, INT2NUM((int)(it.key())), obj);
|
2089
2099
|
}
|
2090
|
-
|
2100
|
+
|
2091
2101
|
*(m->var()) = hv;
|
2092
2102
|
m->next();
|
2093
|
-
|
2103
|
+
|
2094
2104
|
if(m->cleanup())
|
2095
2105
|
delete map;
|
2096
2106
|
}
|
@@ -2160,7 +2170,7 @@ void marshall_QRgb_array(Marshall *m) {
|
|
2160
2170
|
|
2161
2171
|
void marshall_QPairQStringQStringList(Marshall *m) {
|
2162
2172
|
switch(m->action()) {
|
2163
|
-
case Marshall::FromVALUE:
|
2173
|
+
case Marshall::FromVALUE:
|
2164
2174
|
{
|
2165
2175
|
VALUE list = *(m->var());
|
2166
2176
|
if (TYPE(list) != T_ARRAY) {
|
@@ -2184,15 +2194,15 @@ void marshall_QPairQStringQStringList(Marshall *m) {
|
|
2184
2194
|
|
2185
2195
|
m->item().s_voidp = pairlist;
|
2186
2196
|
m->next();
|
2187
|
-
|
2197
|
+
|
2188
2198
|
if (m->cleanup()) {
|
2189
2199
|
delete pairlist;
|
2190
2200
|
}
|
2191
|
-
|
2201
|
+
|
2192
2202
|
break;
|
2193
2203
|
}
|
2194
2204
|
|
2195
|
-
case Marshall::ToVALUE:
|
2205
|
+
case Marshall::ToVALUE:
|
2196
2206
|
{
|
2197
2207
|
QList<QPair<QString,QString> > *pairlist = static_cast<QList<QPair<QString,QString> > * >(m->item().s_voidp);
|
2198
2208
|
if (pairlist == 0) {
|
@@ -2242,7 +2252,7 @@ void marshall_QPairqrealQColor(Marshall *m) {
|
|
2242
2252
|
} else {
|
2243
2253
|
real = NUM2DBL(item1);
|
2244
2254
|
}
|
2245
|
-
|
2255
|
+
|
2246
2256
|
VALUE item2 = rb_ary_entry(list, 1);
|
2247
2257
|
|
2248
2258
|
smokeruby_object *o = value_obj_info(item2);
|
@@ -2250,7 +2260,7 @@ void marshall_QPairqrealQColor(Marshall *m) {
|
|
2250
2260
|
m->item().s_voidp = 0;
|
2251
2261
|
break;
|
2252
2262
|
}
|
2253
|
-
|
2263
|
+
|
2254
2264
|
QPair<qreal,QColor> * qpair = new QPair<qreal,QColor>(real, *((QColor *) o->ptr));
|
2255
2265
|
m->item().s_voidp = qpair;
|
2256
2266
|
m->next();
|
@@ -2262,7 +2272,7 @@ void marshall_QPairqrealQColor(Marshall *m) {
|
|
2262
2272
|
break;
|
2263
2273
|
case Marshall::ToVALUE:
|
2264
2274
|
{
|
2265
|
-
QPair<qreal,QColor> * qpair = static_cast<QPair<qreal,QColor> * >(m->item().s_voidp);
|
2275
|
+
QPair<qreal,QColor> * qpair = static_cast<QPair<qreal,QColor> * >(m->item().s_voidp);
|
2266
2276
|
if (qpair == 0) {
|
2267
2277
|
*(m->var()) = Qnil;
|
2268
2278
|
break;
|
@@ -2273,9 +2283,9 @@ void marshall_QPairqrealQColor(Marshall *m) {
|
|
2273
2283
|
void *p = (void *) &(qpair->second);
|
2274
2284
|
VALUE rv2 = getPointerObject(p);
|
2275
2285
|
if (rv2 == Qnil) {
|
2276
|
-
smokeruby_object * o = alloc_smokeruby_object( false,
|
2277
|
-
m->smoke(),
|
2278
|
-
m->smoke()->idClass("QColor").index,
|
2286
|
+
smokeruby_object * o = alloc_smokeruby_object( false,
|
2287
|
+
m->smoke(),
|
2288
|
+
m->smoke()->idClass("QColor").index,
|
2279
2289
|
p );
|
2280
2290
|
rv2 = set_obj_info("Qt::Color", o);
|
2281
2291
|
}
|
@@ -2313,7 +2323,7 @@ void marshall_QPairintint(Marshall *m) {
|
|
2313
2323
|
} else {
|
2314
2324
|
int0 = NUM2INT(item);
|
2315
2325
|
}
|
2316
|
-
|
2326
|
+
|
2317
2327
|
item = rb_ary_entry(list, 1);
|
2318
2328
|
|
2319
2329
|
if (TYPE(item) != T_FIXNUM && TYPE(item) != T_BIGNUM) {
|
@@ -2321,7 +2331,7 @@ void marshall_QPairintint(Marshall *m) {
|
|
2321
2331
|
} else {
|
2322
2332
|
int1 = NUM2INT(item);
|
2323
2333
|
}
|
2324
|
-
|
2334
|
+
|
2325
2335
|
QPair<int,int> * qpair = new QPair<int,int>(int0,int1);
|
2326
2336
|
m->item().s_voidp = qpair;
|
2327
2337
|
m->next();
|
@@ -2613,7 +2623,7 @@ Marshall::HandlerFn getMarshallFn(const SmokeType &type) {
|
|
2613
2623
|
return marshall_void;
|
2614
2624
|
|
2615
2625
|
TypeHandler *h = type_handlers[type.name()];
|
2616
|
-
|
2626
|
+
|
2617
2627
|
if (h == 0 && type.isConst() && strlen(type.name()) > strlen("const ")) {
|
2618
2628
|
h = type_handlers[type.name() + strlen("const ")];
|
2619
2629
|
}
|
@@ -2623,7 +2633,7 @@ Marshall::HandlerFn getMarshallFn(const SmokeType &type) {
|
|
2623
2633
|
{
|
2624
2634
|
h = type_handlers["QFlags&"];
|
2625
2635
|
}
|
2626
|
-
|
2636
|
+
|
2627
2637
|
if (h != 0) {
|
2628
2638
|
return h->fn;
|
2629
2639
|
}
|