qtbindings 4.8.6.3-x86-mingw32 → 4.8.6.4-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/bin/2.4/rbrcc.exe +0 -0
- data/bin/2.4/rbuic4.exe +0 -0
- data/bin/2.4/smokeapi.exe +0 -0
- data/bin/2.4/smokedeptool.exe +0 -0
- data/examples/tutorial/t10/cannon.rb +72 -72
- data/examples/tutorial/t10/lcdrange.rb +45 -45
- data/examples/tutorial/t10/t10.rb +55 -55
- data/examples/tutorial/t11/cannon.rb +123 -124
- data/examples/tutorial/t11/lcdrange.rb +45 -45
- data/examples/tutorial/t11/t11.rb +65 -65
- data/examples/tutorial/t12/cannon.rb +157 -158
- data/examples/tutorial/t12/lcdrange.rb +58 -59
- data/examples/tutorial/t12/t12.rb +65 -66
- data/examples/tutorial/t13/cannon.rb +206 -208
- data/examples/tutorial/t13/gamebrd.rb +112 -113
- data/examples/tutorial/t13/lcdrange.rb +59 -60
- data/examples/tutorial/t13/t13.rb +11 -11
- data/examples/tutorial/t14/cannon.rb +262 -263
- data/examples/tutorial/t14/gamebrd.rb +122 -123
- data/examples/tutorial/t14/lcdrange.rb +61 -63
- data/examples/tutorial/t14/t14.rb +11 -11
- data/examples/tutorial/t3/t3.rb +17 -18
- data/examples/tutorial/t4/t4.rb +23 -25
- data/examples/tutorial/t5/t5.rb +35 -37
- data/examples/tutorial/t6/t6.rb +48 -52
- data/examples/tutorial/t7/lcdrange.rb +32 -32
- data/examples/tutorial/t7/t7.rb +40 -42
- data/examples/tutorial/t8/cannon.rb +37 -38
- data/examples/tutorial/t8/lcdrange.rb +45 -45
- data/examples/tutorial/t8/t8.rb +43 -43
- data/examples/tutorial/t9/cannon.rb +44 -45
- data/examples/tutorial/t9/lcdrange.rb +46 -46
- data/examples/tutorial/t9/t9.rb +43 -43
- data/lib/2.4/libqtruby4shared.dll +0 -0
- data/lib/2.4/libsmokebase.dll +0 -0
- data/lib/2.4/libsmokeqtcore.dll +0 -0
- data/lib/2.4/libsmokeqtdeclarative.dll +0 -0
- data/lib/{2.1 → 2.4}/libsmokeqtgui.dll +0 -0
- data/lib/2.4/libsmokeqthelp.dll +0 -0
- data/lib/2.4/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.4/libsmokeqtnetwork.dll +0 -0
- data/lib/2.4/libsmokeqtopengl.dll +0 -0
- data/lib/2.4/libsmokeqtscript.dll +0 -0
- data/lib/2.4/libsmokeqtsql.dll +0 -0
- data/lib/2.4/libsmokeqtsvg.dll +0 -0
- data/lib/2.4/libsmokeqttest.dll +0 -0
- data/lib/2.4/libsmokeqtuitools.dll +0 -0
- data/lib/2.4/libsmokeqtwebkit.dll +0 -0
- data/lib/2.4/libsmokeqtxml.dll +0 -0
- data/lib/2.4/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.4/qtdeclarative.so +0 -0
- data/lib/2.4/qtruby4.so +0 -0
- data/lib/2.4/qtscript.so +0 -0
- data/lib/2.4/qttest.so +0 -0
- data/lib/2.4/qtuitools.so +0 -0
- data/lib/2.4/qtwebkit.so +0 -0
- data/lib/Qt4.rb +119 -111
- data/lib/qtbindings_version.rb +2 -2
- data/qtbindings.gemspec +18 -18
- data/qtbindingsnative.gemspec +19 -19
- metadata +38 -115
- data/bin/2.0/rbrcc.exe +0 -0
- data/bin/2.0/rbuic4.exe +0 -0
- data/bin/2.0/smokeapi.exe +0 -0
- data/bin/2.0/smokedeptool.exe +0 -0
- data/bin/2.1/rbrcc.exe +0 -0
- data/bin/2.1/rbuic4.exe +0 -0
- data/bin/2.1/smokeapi.exe +0 -0
- data/bin/2.1/smokedeptool.exe +0 -0
- data/bin/2.2/rbrcc.exe +0 -0
- data/bin/2.2/rbuic4.exe +0 -0
- data/bin/2.2/smokeapi.exe +0 -0
- data/bin/2.2/smokedeptool.exe +0 -0
- data/bin/2.3/rbrcc.exe +0 -0
- data/bin/2.3/rbuic4.exe +0 -0
- data/bin/2.3/smokeapi.exe +0 -0
- data/bin/2.3/smokedeptool.exe +0 -0
- data/lib/2.0/libqtruby4shared.dll +0 -0
- data/lib/2.0/libsmokebase.dll +0 -0
- data/lib/2.0/libsmokeqtcore.dll +0 -0
- data/lib/2.0/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.0/libsmokeqtgui.dll +0 -0
- data/lib/2.0/libsmokeqthelp.dll +0 -0
- data/lib/2.0/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.0/libsmokeqtnetwork.dll +0 -0
- data/lib/2.0/libsmokeqtopengl.dll +0 -0
- data/lib/2.0/libsmokeqtscript.dll +0 -0
- data/lib/2.0/libsmokeqtsql.dll +0 -0
- data/lib/2.0/libsmokeqtsvg.dll +0 -0
- data/lib/2.0/libsmokeqttest.dll +0 -0
- data/lib/2.0/libsmokeqtuitools.dll +0 -0
- data/lib/2.0/libsmokeqtwebkit.dll +0 -0
- data/lib/2.0/libsmokeqtxml.dll +0 -0
- data/lib/2.0/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.0/qtdeclarative.so +0 -0
- data/lib/2.0/qtruby4.so +0 -0
- data/lib/2.0/qtscript.so +0 -0
- data/lib/2.0/qttest.so +0 -0
- data/lib/2.0/qtuitools.so +0 -0
- data/lib/2.0/qtwebkit.so +0 -0
- data/lib/2.1/libqtruby4shared.dll +0 -0
- data/lib/2.1/libsmokebase.dll +0 -0
- data/lib/2.1/libsmokeqtcore.dll +0 -0
- data/lib/2.1/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.1/libsmokeqthelp.dll +0 -0
- data/lib/2.1/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.1/libsmokeqtnetwork.dll +0 -0
- data/lib/2.1/libsmokeqtopengl.dll +0 -0
- data/lib/2.1/libsmokeqtscript.dll +0 -0
- data/lib/2.1/libsmokeqtsql.dll +0 -0
- data/lib/2.1/libsmokeqtsvg.dll +0 -0
- data/lib/2.1/libsmokeqttest.dll +0 -0
- data/lib/2.1/libsmokeqtuitools.dll +0 -0
- data/lib/2.1/libsmokeqtwebkit.dll +0 -0
- data/lib/2.1/libsmokeqtxml.dll +0 -0
- data/lib/2.1/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.1/qtdeclarative.so +0 -0
- data/lib/2.1/qtruby4.so +0 -0
- data/lib/2.1/qtscript.so +0 -0
- data/lib/2.1/qttest.so +0 -0
- data/lib/2.1/qtuitools.so +0 -0
- data/lib/2.1/qtwebkit.so +0 -0
- data/lib/2.2/libqtruby4shared.dll +0 -0
- data/lib/2.2/libsmokebase.dll +0 -0
- data/lib/2.2/libsmokeqtcore.dll +0 -0
- data/lib/2.2/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.2/libsmokeqtgui.dll +0 -0
- data/lib/2.2/libsmokeqthelp.dll +0 -0
- data/lib/2.2/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.2/libsmokeqtnetwork.dll +0 -0
- data/lib/2.2/libsmokeqtopengl.dll +0 -0
- data/lib/2.2/libsmokeqtscript.dll +0 -0
- data/lib/2.2/libsmokeqtsql.dll +0 -0
- data/lib/2.2/libsmokeqtsvg.dll +0 -0
- data/lib/2.2/libsmokeqttest.dll +0 -0
- data/lib/2.2/libsmokeqtuitools.dll +0 -0
- data/lib/2.2/libsmokeqtwebkit.dll +0 -0
- data/lib/2.2/libsmokeqtxml.dll +0 -0
- data/lib/2.2/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.2/qtdeclarative.so +0 -0
- data/lib/2.2/qtruby4.so +0 -0
- data/lib/2.2/qtscript.so +0 -0
- data/lib/2.2/qttest.so +0 -0
- data/lib/2.2/qtuitools.so +0 -0
- data/lib/2.2/qtwebkit.so +0 -0
- data/lib/2.3/libqtruby4shared.dll +0 -0
- data/lib/2.3/libsmokebase.dll +0 -0
- data/lib/2.3/libsmokeqtcore.dll +0 -0
- data/lib/2.3/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.3/libsmokeqtgui.dll +0 -0
- data/lib/2.3/libsmokeqthelp.dll +0 -0
- data/lib/2.3/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.3/libsmokeqtnetwork.dll +0 -0
- data/lib/2.3/libsmokeqtopengl.dll +0 -0
- data/lib/2.3/libsmokeqtscript.dll +0 -0
- data/lib/2.3/libsmokeqtsql.dll +0 -0
- data/lib/2.3/libsmokeqtsvg.dll +0 -0
- data/lib/2.3/libsmokeqttest.dll +0 -0
- data/lib/2.3/libsmokeqtuitools.dll +0 -0
- data/lib/2.3/libsmokeqtwebkit.dll +0 -0
- data/lib/2.3/libsmokeqtxml.dll +0 -0
- data/lib/2.3/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.3/qtdeclarative.so +0 -0
- data/lib/2.3/qtruby4.so +0 -0
- data/lib/2.3/qtscript.so +0 -0
- data/lib/2.3/qttest.so +0 -0
- data/lib/2.3/qtuitools.so +0 -0
- data/lib/2.3/qtwebkit.so +0 -0
- data/lib/qtbindings_qt_version.rb +0 -2
data/examples/tutorial/t8/t8.rb
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
-
|
4
|
-
require 'Qt'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
class MyWidget < Qt::Widget
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
a = Qt::Application.new(ARGV)
|
39
|
-
|
40
|
-
w = MyWidget.new
|
41
|
-
w.setGeometry(
|
42
|
-
w.show
|
43
|
-
a.exec
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
+
|
4
|
+
require 'Qt'
|
5
|
+
require_relative 'lcdrange.rb'
|
6
|
+
require_relative 'cannon.rb'
|
7
|
+
|
8
|
+
class MyWidget < Qt::Widget
|
9
|
+
def initialize(parent = nil)
|
10
|
+
super
|
11
|
+
quit = Qt::PushButton.new('Quit')
|
12
|
+
quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold))
|
13
|
+
|
14
|
+
connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
|
15
|
+
|
16
|
+
angle = LCDRange.new(self)
|
17
|
+
angle.range = 5..70
|
18
|
+
|
19
|
+
cannonField = CannonField.new(self)
|
20
|
+
|
21
|
+
connect(angle, SIGNAL('valueChanged(int)'),
|
22
|
+
cannonField, SLOT('setAngle(int)'))
|
23
|
+
connect(cannonField, SIGNAL('angleChanged(int)'),
|
24
|
+
angle, SLOT('setValue(int)'))
|
25
|
+
|
26
|
+
gridLayout = Qt::GridLayout.new
|
27
|
+
gridLayout.addWidget(quit, 0, 0)
|
28
|
+
gridLayout.addWidget(angle, 1, 0)
|
29
|
+
gridLayout.addWidget(cannonField, 1, 1, 2, 1)
|
30
|
+
gridLayout.setColumnStretch(1, 10)
|
31
|
+
setLayout(gridLayout)
|
32
|
+
|
33
|
+
angle.setValue(60)
|
34
|
+
angle.setFocus()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
a = Qt::Application.new(ARGV)
|
39
|
+
|
40
|
+
w = MyWidget.new
|
41
|
+
w.setGeometry(100, 100, 500, 355)
|
42
|
+
w.show
|
43
|
+
a.exec
|
@@ -1,45 +1,44 @@
|
|
1
|
-
require 'Qt'
|
2
|
-
|
3
|
-
class CannonField < Qt::Widget
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
1
|
+
require 'Qt'
|
2
|
+
|
3
|
+
class CannonField < Qt::Widget
|
4
|
+
signals 'angleChanged(int)'
|
5
|
+
slots 'setAngle(int)'
|
6
|
+
|
7
|
+
def initialize(parent = nil)
|
8
|
+
super
|
9
|
+
@currentAngle = 45
|
10
|
+
setPalette(Qt::Palette.new(Qt::Color.new(250, 250, 200)))
|
11
|
+
setAutoFillBackground(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def setAngle(degrees)
|
15
|
+
if degrees < 5
|
16
|
+
degrees = 5
|
17
|
+
elsif degrees > 70
|
18
|
+
degrees = 70
|
19
|
+
end
|
20
|
+
if @currentAngle == degrees
|
21
|
+
return
|
22
|
+
end
|
23
|
+
@currentAngle = degrees
|
24
|
+
repaint()
|
25
|
+
emit angleChanged(@currentAngle)
|
26
|
+
end
|
27
|
+
|
28
|
+
def paintEvent(event)
|
29
|
+
painter = Qt::Painter.new(self)
|
30
|
+
|
31
|
+
painter.setPen(Qt::NoPen)
|
32
|
+
painter.setBrush(Qt::Brush.new(Qt::blue))
|
33
|
+
|
34
|
+
painter.translate(0, rect().bottom())
|
35
|
+
painter.drawPie(Qt::Rect.new(-35, -35, 70, 70), 0, 90 * 16)
|
36
|
+
painter.rotate(- @currentAngle)
|
37
|
+
painter.drawRect(Qt::Rect.new(33, -4, 15, 8))
|
38
|
+
painter.end()
|
39
|
+
end
|
40
|
+
|
41
|
+
def sizePolicy()
|
42
|
+
return Qt::SizePolicy.new(Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding)
|
43
|
+
end
|
44
|
+
end
|
@@ -1,46 +1,46 @@
|
|
1
|
-
require 'Qt'
|
2
|
-
|
3
|
-
class LCDRange < Qt::Widget
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
1
|
+
require 'Qt'
|
2
|
+
|
3
|
+
class LCDRange < Qt::Widget
|
4
|
+
signals 'valueChanged(int)'
|
5
|
+
slots 'setValue(int)', 'setRange(int, int)'
|
6
|
+
|
7
|
+
def initialize(parent = nil)
|
8
|
+
super
|
9
|
+
lcd = Qt::LCDNumber.new(2)
|
10
|
+
@slider = Qt::Slider.new(Qt::Horizontal)
|
11
|
+
@slider.range = 0..99
|
12
|
+
@slider.setValue(0)
|
13
|
+
connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)'))
|
14
|
+
connect(@slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'))
|
15
|
+
|
16
|
+
layout = Qt::VBoxLayout.new
|
17
|
+
layout.addWidget(lcd)
|
18
|
+
layout.addWidget(@slider)
|
19
|
+
setLayout(layout)
|
20
|
+
|
21
|
+
setFocusProxy(@slider)
|
22
|
+
end
|
23
|
+
|
24
|
+
def value()
|
25
|
+
@slider.value()
|
26
|
+
end
|
27
|
+
|
28
|
+
def setValue(value)
|
29
|
+
@slider.setValue(value)
|
30
|
+
end
|
31
|
+
|
32
|
+
def range=(r)
|
33
|
+
setRange(r.begin, r.end)
|
34
|
+
end
|
35
|
+
|
36
|
+
def setRange(minVal, maxVal)
|
37
|
+
if minVal < 0 || maxVal > 99 || minVal > maxVal
|
38
|
+
printf("LCDRange::setRange(%d,%d)\n" +
|
39
|
+
"\tRange must be 0..99\n" +
|
40
|
+
"\tand minVal must not be greater than maxVal",
|
41
|
+
minVal, maxVal)
|
42
|
+
return
|
43
|
+
end
|
44
|
+
@slider.setRange(minVal, maxVal)
|
45
|
+
end
|
46
|
+
end
|
data/examples/tutorial/t9/t9.rb
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
-
|
4
|
-
require 'Qt'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
class MyWidget < Qt::Widget
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
a = Qt::Application.new(ARGV)
|
39
|
-
|
40
|
-
w = MyWidget.new
|
41
|
-
w.setGeometry(
|
42
|
-
w.show
|
43
|
-
a.exec
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
+
|
4
|
+
require 'Qt'
|
5
|
+
require_relative 'lcdrange.rb'
|
6
|
+
require_relative 'cannon.rb'
|
7
|
+
|
8
|
+
class MyWidget < Qt::Widget
|
9
|
+
def initialize(parent = nil)
|
10
|
+
super
|
11
|
+
quit = Qt::PushButton.new('Quit')
|
12
|
+
quit.font = Qt::Font.new('Times', 18, Qt::Font::Bold)
|
13
|
+
|
14
|
+
connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
|
15
|
+
|
16
|
+
angle = LCDRange.new(self)
|
17
|
+
angle.range = 5..70
|
18
|
+
|
19
|
+
cannonField = CannonField.new(self)
|
20
|
+
|
21
|
+
connect(angle, SIGNAL('valueChanged(int)'),
|
22
|
+
cannonField, SLOT('setAngle(int)'))
|
23
|
+
connect(cannonField, SIGNAL('angleChanged(int)'),
|
24
|
+
angle, SLOT('setValue(int)'))
|
25
|
+
gridLayout = Qt::GridLayout.new
|
26
|
+
|
27
|
+
gridLayout.addWidget(quit, 0, 0)
|
28
|
+
gridLayout.addWidget(angle, 1, 0)
|
29
|
+
gridLayout.addWidget(cannonField, 1, 1, 2, 1)
|
30
|
+
gridLayout.setColumnStretch(1, 10)
|
31
|
+
setLayout(gridLayout)
|
32
|
+
|
33
|
+
angle.setValue(60)
|
34
|
+
angle.setFocus()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
a = Qt::Application.new(ARGV)
|
39
|
+
|
40
|
+
w = MyWidget.new
|
41
|
+
w.setGeometry(100, 100, 500, 355)
|
42
|
+
w.show
|
43
|
+
a.exec
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/2.4/qtruby4.so
ADDED
Binary file
|
data/lib/2.4/qtscript.so
ADDED
Binary file
|
data/lib/2.4/qttest.so
ADDED
Binary file
|
Binary file
|
data/lib/2.4/qtwebkit.so
ADDED
Binary file
|
data/lib/Qt4.rb
CHANGED
@@ -1,111 +1,119 @@
|
|
1
|
-
windows = false
|
2
|
-
platform = RUBY_PLATFORM.split("-")[1]
|
3
|
-
windows = true if platform =~ /mswin32/ or platform =~ /mingw32/
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'thread'
|
7
|
-
require 'qtbindings-qt'
|
8
|
-
rescue LoadError
|
9
|
-
# Oh well - Hopefully not using the Windows binary gem
|
10
|
-
end
|
11
|
-
|
12
|
-
ruby_version = RUBY_VERSION.split('.')[0..1].join('.')
|
13
|
-
if windows
|
14
|
-
ENV['PATH'] = File.join(File.dirname(__FILE__), '../bin') + ';' + File.join(File.dirname(__FILE__), "../lib/#{ruby_version}") + ';' + File.join(File.dirname(__FILE__), "../bin/#{ruby_version}") + ';' + ENV['PATH']
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
@
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
@
|
75
|
-
@
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
1
|
+
windows = false
|
2
|
+
platform = RUBY_PLATFORM.split("-")[1]
|
3
|
+
windows = true if platform =~ /mswin32/ or platform =~ /mingw32/
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'thread'
|
7
|
+
require 'qtbindings-qt'
|
8
|
+
rescue LoadError
|
9
|
+
# Oh well - Hopefully not using the Windows binary gem
|
10
|
+
end
|
11
|
+
|
12
|
+
ruby_version = RUBY_VERSION.split('.')[0..1].join('.')
|
13
|
+
if windows
|
14
|
+
ENV['PATH'] = File.join(File.dirname(__FILE__), '../bin') + ';' + File.join(File.dirname(__FILE__), "../lib/#{ruby_version}") + ';' + File.join(File.dirname(__FILE__), "../bin/#{ruby_version}") + ';' + ENV['PATH']
|
15
|
+
begin
|
16
|
+
require 'ruby_installer'
|
17
|
+
RubyInstaller::Runtime.add_dll_directory(File.join(File.dirname(__FILE__), '../bin'))
|
18
|
+
RubyInstaller::Runtime.add_dll_directory(File.join(File.dirname(__FILE__), "../lib/#{ruby_version}"))
|
19
|
+
RubyInstaller::Runtime.add_dll_directory(File.join(File.dirname(__FILE__), "../bin/#{ruby_version}"))
|
20
|
+
rescue
|
21
|
+
# Oh well - Hopefully not Ruby 2.4+ on windows
|
22
|
+
end
|
23
|
+
end
|
24
|
+
$: << File.join(File.dirname(__FILE__), "../lib/#{ruby_version}")
|
25
|
+
require "#{ruby_version}/qtruby4"
|
26
|
+
|
27
|
+
module Qt
|
28
|
+
class RubyThreadFix < Qt::Object
|
29
|
+
slots 'ruby_thread_timeout()'
|
30
|
+
slots 'callback_timeout()'
|
31
|
+
slots 'callback_timeout2()'
|
32
|
+
@@queue = Queue.new
|
33
|
+
|
34
|
+
def initialize
|
35
|
+
super()
|
36
|
+
# Enable threading
|
37
|
+
@ruby_thread_sleep_period = 0.01
|
38
|
+
@ruby_thread_timer = Qt::Timer.new(self)
|
39
|
+
connect(@ruby_thread_timer, SIGNAL('timeout()'), SLOT('ruby_thread_timeout()'))
|
40
|
+
@ruby_thread_timer.start(0)
|
41
|
+
@callback_timer = Qt::Timer.new(self)
|
42
|
+
connect(@callback_timer, SIGNAL('timeout()'), SLOT('callback_timeout()'))
|
43
|
+
@callback_timer.start(1)
|
44
|
+
@callback_timer2 = Qt::Timer.new(self)
|
45
|
+
connect(@callback_timer2, SIGNAL('timeout()'), SLOT('callback_timeout2()'))
|
46
|
+
@running = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def ruby_thread_timeout
|
50
|
+
sleep(@ruby_thread_sleep_period)
|
51
|
+
end
|
52
|
+
|
53
|
+
def callback_timeout
|
54
|
+
if !@@queue.empty?
|
55
|
+
# Start a backup timer in case this one goes modal.
|
56
|
+
@callback_timer2.start(100)
|
57
|
+
@@queue.pop.call until @@queue.empty?
|
58
|
+
# Cancel the backup timer
|
59
|
+
@callback_timer2.stop if @callback_timer2
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def callback_timeout2
|
64
|
+
@callback_timer2.interval = 10
|
65
|
+
@@queue.pop.call until @@queue.empty?
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.queue
|
69
|
+
@@queue
|
70
|
+
end
|
71
|
+
|
72
|
+
def stop
|
73
|
+
if @running
|
74
|
+
@running = false
|
75
|
+
@ruby_thread_timer.stop
|
76
|
+
@callback_timer.stop
|
77
|
+
@callback_timer2.stop
|
78
|
+
@ruby_thread_timer.dispose
|
79
|
+
@callback_timer.dispose
|
80
|
+
@callback_timer2.dispose
|
81
|
+
@ruby_thread_timer = nil
|
82
|
+
@callback_timer = nil
|
83
|
+
@callback_timer2 = nil
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Code which accesses the GUI must be executed in the main QT GUI thread.
|
89
|
+
# This method allows code in another thread to execute safely in the main GUI
|
90
|
+
# thread. By default it will block the main GUI thread until the code in the
|
91
|
+
# block completes althought this can be changed by passing false for the
|
92
|
+
# first parameter.
|
93
|
+
#
|
94
|
+
# @param blocking [Boolean] Whether to block the main thread until the code
|
95
|
+
# in the block finishing executing. If false the main thread will be
|
96
|
+
# allowed to continue and the block code will execute in parallel.
|
97
|
+
# @param sleep_period [Float] The amount of time to sleep between checking
|
98
|
+
# whether the code in the block has finished executing
|
99
|
+
# @param delay_execution [Boolean] Only used if called from the main GUI
|
100
|
+
# thread. Allows the block to be executed in parallel with the main thread.
|
101
|
+
def self.execute_in_main_thread (blocking = true, sleep_period = 0.001, delay_execution = false)
|
102
|
+
if Thread.current != Thread.main
|
103
|
+
complete = false
|
104
|
+
RubyThreadFix.queue << lambda {|| yield; complete = true}
|
105
|
+
if blocking
|
106
|
+
until complete
|
107
|
+
sleep(sleep_period)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
else
|
111
|
+
if delay_execution
|
112
|
+
RubyThreadFix.queue << lambda {|| yield; complete = true}
|
113
|
+
else
|
114
|
+
yield
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end # module Qt
|