qtbindings 4.8.5.2 → 4.8.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.txt +41 -20
- data/Rakefile +10 -0
- data/bin/rbrcc +1 -5
- data/bin/rbuic4 +1 -5
- data/bin/smokeapi +1 -5
- data/bin/smokedeptool +1 -5
- data/examples/threading/main_thread.rb +19 -0
- data/ext/CMakeLists.txt +3 -0
- data/ext/cmake/modules/FindQt4.cmake +4 -1
- data/ext/cmake/modules/FindRuby.cmake +23 -5
- data/ext/ruby/qtruby/src/CMakeLists.txt +2 -2
- data/ext/ruby/qtruby/src/qtruby.cpp +505 -437
- data/ext/smoke/CMakeLists.txt +3 -1
- data/extconf.rb +21 -67
- data/lib/Qt/qtruby4.rb +2 -1
- data/lib/Qt4.rb +20 -13
- data/lib/qtbindings_version.rb +2 -2
- data/lib/qtdeclarative/qtdeclarative.rb +17 -0
- metadata +49 -53
- data/CMakeLists.txt +0 -22
- data/examples/base/kicons.rb +0 -54
- data/examples/base/rui.rb +0 -21
- data/examples/textedit/textedit.rb +0 -150
- data/qtbindings-qt.gemspec +0 -17
- data/qtbindingsnative.gemspec +0 -19
data/CMakeLists.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
project(qtbind)
|
2
|
-
|
3
|
-
add_subdirectory(generator)
|
4
|
-
|
5
|
-
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
6
|
-
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
|
7
|
-
|
8
|
-
include(MacroOptionalFindPackage)
|
9
|
-
include(MacroOptionalAddBindings)
|
10
|
-
include(MacroLogFeature)
|
11
|
-
include(CheckCXXSourceCompiles)
|
12
|
-
|
13
|
-
FIND_PACKAGE (Qt4 REQUIRED)
|
14
|
-
|
15
|
-
add_definitions (${QT_DEFINITIONS} -DHAVE_CONFIG_H=1)
|
16
|
-
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${QT_INCLUDES} )
|
17
|
-
|
18
|
-
FIND_PACKAGE (RUBY REQUIRED)
|
19
|
-
FIND_PACKAGE (OpenGL REQUIRED)
|
20
|
-
|
21
|
-
add_subdirectory(smoke)
|
22
|
-
add_subdirectory(ruby)
|
data/examples/base/kicons.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
class KIconCollection
|
2
|
-
IconInfo = Struct.new(:collection, :id, :filetype)
|
3
|
-
def initialize(icon_collections)
|
4
|
-
@icon_info = {}
|
5
|
-
icon_collections.each_pair {
|
6
|
-
|collection_name, collection|
|
7
|
-
collection.each_pair {
|
8
|
-
|key, value|
|
9
|
-
info = IconInfo.new(collection_name, value, "png")
|
10
|
-
@icon_info[key] = info
|
11
|
-
}
|
12
|
-
}
|
13
|
-
end
|
14
|
-
def dims
|
15
|
-
"32x32"
|
16
|
-
end
|
17
|
-
def kdedir
|
18
|
-
ENV["KDEDIR"]
|
19
|
-
end
|
20
|
-
def get_icon_path(icon_type)
|
21
|
-
info = @icon_info[icon_type]
|
22
|
-
"#{kdedir}/share/icons/default.kde/#{dims}/#{info.collection}/#{info.id}.#{info.filetype}"
|
23
|
-
end
|
24
|
-
def get_icon_set(icon_type)
|
25
|
-
path = get_icon_path(icon_type)
|
26
|
-
pixmap = Qt::Pixmap.new(path)
|
27
|
-
icon_set = Qt::IconSet.new
|
28
|
-
icon_set.setPixmap(pixmap, Qt::IconSet.Small)
|
29
|
-
icon_set
|
30
|
-
end
|
31
|
-
def make_qt_action(parent, text_with_accel, icon_type)
|
32
|
-
act = Qt::Action.new(parent)
|
33
|
-
act.setIconSet(get_icon_set(icon_type))
|
34
|
-
act.setMenuText(text_with_accel)
|
35
|
-
act
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module Icons
|
40
|
-
FILE_NEW, FILE_OPEN, FILE_CLOSE, FILE_SAVE, FILE_SAVE_AS, EXIT = 1,2,3,4,5,6
|
41
|
-
end
|
42
|
-
|
43
|
-
icon_collections = {
|
44
|
-
"actions" => {
|
45
|
-
Icons::FILE_NEW => "filenew",
|
46
|
-
Icons::FILE_OPEN => "fileopen",
|
47
|
-
Icons::FILE_CLOSE => "fileclose",
|
48
|
-
Icons::FILE_SAVE => "filesave",
|
49
|
-
Icons::FILE_SAVE_AS => "filesaveas",
|
50
|
-
Icons::EXIT => "exit"
|
51
|
-
}
|
52
|
-
}
|
53
|
-
$kIcons = KIconCollection.new(icon_collections)
|
54
|
-
print "Using KDEDIR == ", $kIcons.kdedir, "\n"
|
data/examples/base/rui.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require '../base/kicons.rb'
|
2
|
-
|
3
|
-
RAction = Struct.new(:text_with_accel, :icon_type, :rec, :slot, :included_in, :action)
|
4
|
-
RSeperator = Struct.new(:included_in, :id)
|
5
|
-
|
6
|
-
def build_actions(actions)
|
7
|
-
actions.each { |a|
|
8
|
-
if a.is_a? RSeperator
|
9
|
-
a.included_in.each {
|
10
|
-
|to| a.id = to.insertSeparator()
|
11
|
-
}
|
12
|
-
else
|
13
|
-
qt_action = $kIcons.make_qt_action(self, a.text_with_accel, a.icon_type)
|
14
|
-
connect(qt_action, SIGNAL('activated()'), a.rec, a.slot)
|
15
|
-
a.included_in.each {
|
16
|
-
|to| qt_action.addTo(to)
|
17
|
-
}
|
18
|
-
a.action = qt_action
|
19
|
-
end
|
20
|
-
}
|
21
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
|
3
|
-
require 'Qt'
|
4
|
-
require 'rexml/document'
|
5
|
-
|
6
|
-
require '../base/rui.rb'
|
7
|
-
|
8
|
-
class MyTextEditor < Qt::TextEdit
|
9
|
-
signals 'saved()'
|
10
|
-
slots 'insert_icon()', 'new()', 'open()', 'save_as()'
|
11
|
-
def initialize(w = nil)
|
12
|
-
@images = {}
|
13
|
-
@@next_image_id = 0
|
14
|
-
super(w)
|
15
|
-
self.setTextFormat(Qt::RichText)
|
16
|
-
end
|
17
|
-
def insert_richtext(richtext)
|
18
|
-
# todo, use a rand string
|
19
|
-
unique_string = '000___xxx123456789xxx___xxx123456789xxx___000'
|
20
|
-
insert(unique_string)
|
21
|
-
txt = self.text().gsub(unique_string, richtext)
|
22
|
-
self.setText(txt)
|
23
|
-
end
|
24
|
-
def next_image_id
|
25
|
-
@@next_image_id += 1
|
26
|
-
end
|
27
|
-
def load_image(fname, image_id)
|
28
|
-
pixmap = Qt::Pixmap.new(fname)
|
29
|
-
msfactory = Qt::MimeSourceFactory.defaultFactory
|
30
|
-
msfactory.setPixmap(image_id, pixmap)
|
31
|
-
@images[image_id] = fname
|
32
|
-
image_id
|
33
|
-
end
|
34
|
-
def insert_icon
|
35
|
-
fname = Qt::FileDialog.getOpenFileName
|
36
|
-
return if fname.nil?
|
37
|
-
image_id = "image_#{next_image_id}"
|
38
|
-
load_image(fname, image_id)
|
39
|
-
insert_richtext('<qt><img source="'+image_id+'"></qt>')
|
40
|
-
end
|
41
|
-
def createPopupMenu(pos) # virtual
|
42
|
-
pm = Qt::PopupMenu.new
|
43
|
-
pm.insertItem("Insert Image!", self, SLOT('insert_icon()'))
|
44
|
-
pm
|
45
|
-
end
|
46
|
-
def has_metadata
|
47
|
-
!@images.empty?
|
48
|
-
end
|
49
|
-
def metadata_fname(fname)
|
50
|
-
"#{fname}.metadata.xml"
|
51
|
-
end
|
52
|
-
def attempt_metadata_load(fname)
|
53
|
-
return unless File.exists?(metadata_fname(fname))
|
54
|
-
file = File.open(metadata_fname(fname))
|
55
|
-
@xmldoc = REXML::Document.new file
|
56
|
-
@xmldoc.root.elements.each("image") {
|
57
|
-
|image|
|
58
|
-
image_id = image.attributes["ident"]
|
59
|
-
img_fname = image.attributes["filename"]
|
60
|
-
load_image(img_fname, image_id)
|
61
|
-
}
|
62
|
-
end
|
63
|
-
def metadata_save_if_has(fname)
|
64
|
-
return if not has_metadata
|
65
|
-
metadata_doc = REXML::Document.new '<metadata/>'
|
66
|
-
@images.each {
|
67
|
-
|id, img_fname|
|
68
|
-
metadata_doc.root.add_element("image", {"filename"=>img_fname, "ident"=>id})
|
69
|
-
}
|
70
|
-
file = File.new(metadata_fname(fname), "w")
|
71
|
-
file.puts(metadata_doc)
|
72
|
-
file.close
|
73
|
-
end
|
74
|
-
def metadata_clear
|
75
|
-
@images = {}
|
76
|
-
end
|
77
|
-
def new(txt = "")
|
78
|
-
metadata_clear
|
79
|
-
self.setText(txt)
|
80
|
-
end
|
81
|
-
def open
|
82
|
-
fname = Qt::FileDialog.getOpenFileName
|
83
|
-
return if fname.nil?
|
84
|
-
unless File.exists?(fname)
|
85
|
-
Qt::MessageBox.critical(self, "File Does Not Exist", "Sorry, unable to find the requested file!")
|
86
|
-
return
|
87
|
-
end
|
88
|
-
return if fname.nil?
|
89
|
-
txt = File.open(fname).gets(nil)
|
90
|
-
metadata_clear
|
91
|
-
attempt_metadata_load(fname)
|
92
|
-
self.setText(txt)
|
93
|
-
end
|
94
|
-
def save_as
|
95
|
-
fname = Qt::FileDialog.getSaveFileName
|
96
|
-
return if fname.nil?
|
97
|
-
if File.exists?(fname)
|
98
|
-
Qt::MessageBox.critical(self, "File Already Exists", "Sorry, file already exists. Please choose a non-existing filename!")
|
99
|
-
return save_as
|
100
|
-
end
|
101
|
-
file = File.new(fname, "w")
|
102
|
-
file.puts(text())
|
103
|
-
file.close
|
104
|
-
metadata_save_if_has(fname)
|
105
|
-
emit saved()
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
class MyWidget < Qt::MainWindow
|
110
|
-
slots 'text_changed()', 'saved()'
|
111
|
-
def initialize()
|
112
|
-
super
|
113
|
-
@editor = MyTextEditor.new(self)
|
114
|
-
connect(@editor, SIGNAL('textChanged()'), self, SLOT('text_changed()'))
|
115
|
-
connect(@editor, SIGNAL('saved()'), self, SLOT('saved()'))
|
116
|
-
|
117
|
-
fileTools = Qt::ToolBar.new(self, "file operations")
|
118
|
-
fileMenu = Qt::PopupMenu.new(self)
|
119
|
-
|
120
|
-
actions = [
|
121
|
-
RAction.new("&New", Icons::FILE_NEW, @editor, SLOT('new()'), [fileTools, fileMenu]),
|
122
|
-
RAction.new("&Open...", Icons::FILE_OPEN, @editor, SLOT('open()'), [fileTools, fileMenu]),
|
123
|
-
@save = RAction.new("Save &As...", Icons::FILE_SAVE_AS, @editor, SLOT('save_as()'), [fileTools, fileMenu]),
|
124
|
-
RSeperator.new([fileMenu]),
|
125
|
-
RAction.new("E&xit", Icons::EXIT, $qApp, SLOT('quit()'), [fileMenu])
|
126
|
-
]
|
127
|
-
|
128
|
-
build_actions(actions)
|
129
|
-
|
130
|
-
menubar = Qt::MenuBar.new(self)
|
131
|
-
menubar.insertItem("&File", fileMenu)
|
132
|
-
|
133
|
-
self.setCentralWidget(@editor)
|
134
|
-
end
|
135
|
-
def saved
|
136
|
-
@save.action.setEnabled(false)
|
137
|
-
end
|
138
|
-
def text_changed
|
139
|
-
@save.action.setEnabled(true)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
a = Qt::Application.new(ARGV)
|
144
|
-
|
145
|
-
w = MyWidget.new
|
146
|
-
w.show
|
147
|
-
|
148
|
-
a.setMainWidget(w)
|
149
|
-
a.exec()
|
150
|
-
exit
|
data/qtbindings-qt.gemspec
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require './qtlib/qtbindings_qt_version'
|
2
|
-
|
3
|
-
spec = Gem::Specification.new do |s|
|
4
|
-
s.authors = ['Ryan Melton', 'Jason Thomas']
|
5
|
-
s.email = 'kde-bindings@kde.org'
|
6
|
-
s.rubyforge_project = 'qtbindings-qt'
|
7
|
-
s.platform = Gem::Platform::CURRENT
|
8
|
-
s.summary = "Qt bindings for ruby - Qt Dlls"
|
9
|
-
s.homepage = "http://github.com/ryanmelt/qtbindings"
|
10
|
-
s.name = 'qtbindings-qt'
|
11
|
-
s.version = QTBINDINGS_QT_VERSION
|
12
|
-
s.requirements << 'none'
|
13
|
-
s.require_path = 'qtlib'
|
14
|
-
s.files = Dir['qtlib/**/*', 'qtbin/**/*'].to_a
|
15
|
-
s.description = 'qtbindings-qt contains the compiled qt dlls'
|
16
|
-
s.licenses = ['LGPLv2.1']
|
17
|
-
end
|
data/qtbindingsnative.gemspec
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require './lib/qtbindings_version'
|
2
|
-
|
3
|
-
spec = Gem::Specification.new do |s|
|
4
|
-
s.authors = ['Ryan Melton', 'Jason Thomas', 'Richard Dale', 'Arno Rehn']
|
5
|
-
s.email = 'kde-bindings@kde.org'
|
6
|
-
s.rubyforge_project = 'qtbindings'
|
7
|
-
s.platform = Gem::Platform::CURRENT
|
8
|
-
s.summary = "Qt bindings for ruby"
|
9
|
-
s.homepage = "http://github.com/ryanmelt/qtbindings"
|
10
|
-
s.name = 'qtbindings'
|
11
|
-
s.version = QTBINDINGS_VERSION
|
12
|
-
s.required_ruby_version = '>= 1.9.3'
|
13
|
-
s.add_dependency 'qtbindings-qt', QTBINDINGS_VERSION.split('.')[0..-2].join('.')
|
14
|
-
s.require_path = 'lib'
|
15
|
-
s.files = Dir['lib/**/*', 'bin/**/*', 'examples/**/*', '*.txt', 'extconf.rb', '*.gemspec', 'Rakefile'].to_a
|
16
|
-
s.executables = ['smokeapi', 'smokedeptool', 'rbrcc', 'rbuic4', 'rbqtapi']
|
17
|
-
s.description = 'qtbindings provides ruby bindings to QT4.x. It is derived from the kdebindings project.'
|
18
|
-
s.licenses = ['LGPLv2.1']
|
19
|
-
end
|