qtbindings 4.6.3.4 → 4.8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/KNOWN_ISSUES.txt +19 -5
- data/README.txt +119 -93
- data/Rakefile +28 -27
- data/examples/desktop/systray/window.rb +43 -47
- data/examples/draganddrop/dropsite/dropsitewidget.rb +10 -9
- data/examples/mainwindows/mdi/mainwindow.rb +4 -4
- data/examples/network/broadcastsender/sender.rb +3 -1
- data/examples/qtscribble/scribble.rb +270 -0
- data/examples/ruboids/LICENSE.txt +58 -0
- data/examples/run_all.rb +1 -0
- data/examples/textedit/textedit.rb +150 -0
- data/examples/widgets/scribble/scribblearea.rb +19 -19
- data/ext/cmake/modules/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/cmake/modules/FindLibraryWithDebug.cmake +113 -0
- data/ext/cmake/modules/FindPhonon.cmake +71 -0
- data/ext/cmake/modules/FindQImageBlitz.cmake +51 -0
- data/ext/cmake/modules/FindRuby.cmake +17 -17
- data/ext/cmake/modules/MacroOptionalFindPackage.cmake +6 -26
- data/ext/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/cmake/modules/SmokeConfig.cmake.in +109 -0
- data/ext/generator/cmake/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/generator/cmake/CMakeLists.txt +24 -0
- data/ext/generator/cmake/FindLibraryWithDebug.cmake +113 -0
- data/ext/generator/cmake/FindPhonon.cmake +71 -0
- data/ext/generator/cmake/FindQImageBlitz.cmake +51 -0
- data/ext/generator/cmake/FindQScintilla.cmake +57 -0
- data/ext/generator/cmake/FindQwt5.cmake +104 -0
- data/ext/generator/cmake/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
- data/ext/generator/cmake/MacroLogFeature.cmake +146 -0
- data/ext/generator/cmake/MacroOptionalAddBindings.cmake +47 -0
- data/ext/generator/cmake/MacroOptionalFindPackage.cmake +28 -0
- data/ext/generator/cmake/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/generator/cmake/SmokeConfig.cmake.in +109 -0
- data/ext/generator/config.h +25 -0
- data/ext/generator/generatorpreprocessor.cpp +60 -41
- data/ext/generator/generators/dump/CMakeLists.txt +5 -0
- data/ext/generator/generators/smoke/CMakeLists.txt +5 -0
- data/ext/generator/generators/smoke/globals.h +3 -1
- data/ext/generator/generators/smoke/helpers.cpp +21 -2
- data/ext/generator/generators/smoke/writeSmokeDataFile.cpp +26 -1
- data/ext/generator/main.cpp +5 -1
- data/ext/generator/options.cpp +1 -0
- data/ext/generator/options.h +1 -0
- data/ext/generator/parser/CMakeLists.txt +10 -1
- data/ext/generator/parser/parser.cpp +6 -6
- data/ext/generator/parser/parser.h +2 -12
- data/ext/generator/parser/parsesession.cpp +1 -0
- data/ext/generator/parser/rpp/CMakeLists.txt +6 -0
- data/ext/generator/parser/rpp/chartools.cpp +3 -3
- data/ext/generator/parser/rpp/chartools.h +3 -1
- data/ext/generator/parser/rpp/pp-scanner.cpp +2 -1
- data/ext/generator/parser/rpp/tests/CMakeLists.txt +4 -0
- data/ext/generator/parser/tests/CMakeLists.txt +16 -0
- data/ext/generator/smoke.h +557 -0
- data/ext/generator/smokegen_string.h +43 -0
- data/ext/generator/type.cpp +15 -6
- data/ext/generator/type_compiler.cpp +2 -0
- data/ext/ruby/qtruby/src/qtruby.cpp +147 -143
- data/ext/ruby/qttest/qttesthandlers.cpp +1 -0
- data/ext/smoke/qtcore/QtGuess.txt +23 -25
- data/ext/smoke/qtcore/smokeconfig.xml +1 -0
- data/ext/smoke/qtdbus/smokeconfig.xml +2 -0
- data/ext/smoke/qtgui/smokeconfig.xml +14 -4
- data/ext/smoke/qthelp/smokeconfig.xml +1 -0
- data/ext/smoke/qtmultimedia/smokeconfig.xml +1 -0
- data/ext/smoke/qtnetwork/smokeconfig.xml +2 -0
- data/ext/smoke/qtopengl/smokeconfig.xml +1 -0
- data/ext/smoke/qtsql/smokeconfig.xml +1 -0
- data/ext/smoke/qtsvg/smokeconfig.xml +1 -0
- data/ext/smoke/qtwebkit/smokeconfig.xml +3 -0
- data/extconf.rb +37 -23
- data/lib/Qt/qtruby4.rb +4 -4
- data/lib/Qt4.rb +1 -1
- data/lib/qtbindings_version.rb +2 -2
- metadata +50 -40
data/KNOWN_ISSUES.txt
CHANGED
@@ -1,5 +1,19 @@
|
|
1
|
-
1.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
1. To run the OpenGL examples install opengl (doesn't work on Ubuntu)
|
2
|
+
gem install opengl --pre
|
3
|
+
2. The qRgb macro doesn't appear to work correctly
|
4
|
+
3. The following examples fail on Windows:
|
5
|
+
opengl/textures -> Segfault
|
6
|
+
itemview/dirview -> Hangs
|
7
|
+
network/broadcastsender -> writeDatagram(const char* data, ...) fails
|
8
|
+
network/broadcastreceiver -> readDatagram(char* data, ...) fails
|
9
|
+
4. The following examples fail on Ubuntu:
|
10
|
+
opengl/* -> opengl doesn't install
|
11
|
+
network/broadcastsender -> writeDatagram(const char* data, ...) fails
|
12
|
+
network/broadcastreceiver -> readDatagram(char* data, ...) fails
|
13
|
+
5. The following examples fail on Mac OS X:
|
14
|
+
desktop/screenshot -> QPixmap::scaled: Pixmap is a null pixmap
|
15
|
+
opengl/textures -> glwidget.rb:137
|
16
|
+
network/broadcastsender -> writeDatagram(const char* data, ...) fails
|
17
|
+
network/broadcastreceiver -> readDatagram(char* data, ...) fails
|
18
|
+
|
19
|
+
NOTE: The QDBus examples don't work on Windows because QtDBus is Unix only.
|
data/README.txt
CHANGED
@@ -1,93 +1,119 @@
|
|
1
|
-
qtbindings
|
2
|
-
----------
|
3
|
-
This project provides bindings that allow the QT Gui toolkit to be used from the
|
4
|
-
Ruby Programming language. Overall it is a repackaging of a subset of the KDE
|
5
|
-
bindings ruby and smoke systems into a format that lends itself well to
|
6
|
-
packaging into a Ruby gem.
|
7
|
-
|
8
|
-
Goals
|
9
|
-
-----
|
10
|
-
1. To make it easy to install a Qt binding for Ruby on all platforms using
|
11
|
-
RubyGems
|
12
|
-
2. To maintain an up-to-date binary gem for Windows that is bundled with
|
13
|
-
the latest version of Qt from http://qt.nokia.com
|
14
|
-
3. To reduce the scope and maintenance of the bindings to only bind to the
|
15
|
-
libraries provided by the Qt SDK.
|
16
|
-
4. To increase compatibility with non-linux platforms
|
17
|
-
|
18
|
-
Tested Environments
|
19
|
-
--------------------
|
20
|
-
Mac OSX 10.6.
|
21
|
-
XCode 3.2.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Cmake 2.
|
29
|
-
Ruby 1.8.
|
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
|
-
|
1
|
+
qtbindings
|
2
|
+
----------
|
3
|
+
This project provides bindings that allow the QT Gui toolkit to be used from the
|
4
|
+
Ruby Programming language. Overall it is a repackaging of a subset of the KDE
|
5
|
+
bindings ruby and smoke systems into a format that lends itself well to
|
6
|
+
packaging into a Ruby gem.
|
7
|
+
|
8
|
+
Goals
|
9
|
+
-----
|
10
|
+
1. To make it easy to install a Qt binding for Ruby on all platforms using
|
11
|
+
RubyGems
|
12
|
+
2. To maintain an up-to-date binary gem for Windows that is bundled with
|
13
|
+
the latest version of Qt from http://qt.nokia.com
|
14
|
+
3. To reduce the scope and maintenance of the bindings to only bind to the
|
15
|
+
libraries provided by the Qt SDK.
|
16
|
+
4. To increase compatibility with non-linux platforms
|
17
|
+
|
18
|
+
Tested Environments
|
19
|
+
--------------------
|
20
|
+
Mac OSX 10.6.8 (Snow Leopard)
|
21
|
+
XCode 3.2.6
|
22
|
+
Brew - QT 4.8.2
|
23
|
+
Cmake 2.8.6
|
24
|
+
|
25
|
+
Windows XP SP3
|
26
|
+
QT Libraries 4.8.3
|
27
|
+
Mingw 4.4
|
28
|
+
Cmake 2.6.4
|
29
|
+
Ruby 1.8.7p370 and 1.9.3p0 installed from rubyinstaller.org
|
30
|
+
|
31
|
+
Note: Ruby 1.9.3 patch levels 125 and 194 on Windows have a bug in the I/O
|
32
|
+
system which prevent the usage of the pos method. That is why I'm using 1.9.3p0.
|
33
|
+
See http://bugs.ruby-lang.org/issues/6179 and http://bugs.ruby-lang.org/issues/6401
|
34
|
+
|
35
|
+
Ubuntu Linux 11.10
|
36
|
+
QT SDK 4.8.1
|
37
|
+
Cmake 2.8.5
|
38
|
+
|
39
|
+
Compiling
|
40
|
+
---------
|
41
|
+
Compiling qtbindings requires the following prerequisites:
|
42
|
+
1. cmake 2.8.x installed and in your path
|
43
|
+
2. QT 4.8.x installed and in your path
|
44
|
+
3. Ruby installed and in your path
|
45
|
+
4. gcc 4.x
|
46
|
+
|
47
|
+
Additionally: all of the operating system prequisites for compiling,
|
48
|
+
window system development, opengl, etc must be installed.
|
49
|
+
|
50
|
+
Rakefile
|
51
|
+
--------
|
52
|
+
Perform the following steps to build the gem on Unix or Mac:
|
53
|
+
1. rake VERSION=4.8.x.y gem
|
54
|
+
Where the x is the subversion of QT and y is the patch level of qtbindings
|
55
|
+
|
56
|
+
Perform the following steps to build the gem on Windows:
|
57
|
+
1. Ensure you are running Ruby 1.8.7
|
58
|
+
ruby -v #=> ruby 1.8.7
|
59
|
+
2. rake distclean
|
60
|
+
3. rake build
|
61
|
+
4. Switch to Ruby 1.9.3
|
62
|
+
ruby -v #=> ruby 1.9.3
|
63
|
+
5. rake build
|
64
|
+
6. rake VERSION=4.8.x.y gemnative
|
65
|
+
Where the x is the subversion of QT and y is the patch level of qtbindings
|
66
|
+
|
67
|
+
Note: The gem is built twice to create the FAT binary which will work
|
68
|
+
on both Ruby 1.8 and 1.9. The Windows utility called pik is useful for
|
69
|
+
switching between Ruby versions.
|
70
|
+
|
71
|
+
After building the gem, verify the examples work by running:
|
72
|
+
1. rake examples
|
73
|
+
|
74
|
+
Operating Systems Notes:
|
75
|
+
|
76
|
+
Debian Linux
|
77
|
+
------------
|
78
|
+
1. The following should get you the packages you need:
|
79
|
+
sudo aptitude install build-essential bison openssl libreadline5
|
80
|
+
libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim
|
81
|
+
libsqlite3-0 libsqlite3-dev sqlite3 libreadline5-dev libreadline6-dev
|
82
|
+
libxml2-dev git-core subversion autoconf xorg-dev libgl1-mesa-dev
|
83
|
+
libglu1-mesa-dev
|
84
|
+
|
85
|
+
Mac OSX Snow Leopard
|
86
|
+
-----------------------
|
87
|
+
1. XCode
|
88
|
+
2. Brew (http://mxcl.github.com/homebrew/)
|
89
|
+
Install qt with 'brew install qt'
|
90
|
+
|
91
|
+
Windows - Note: Only necessary for debugging (binary gem available)
|
92
|
+
--------
|
93
|
+
1. mingw from the Qt SDK in your path: ie C:\Qt\2010.04\mingw\bin
|
94
|
+
|
95
|
+
Install
|
96
|
+
------
|
97
|
+
On linux/MacOSX you must make sure you have all the necessary prerequisites
|
98
|
+
installed or the compile will fail.
|
99
|
+
|
100
|
+
gem install qtbindings
|
101
|
+
|
102
|
+
This should always work flawlessly on Windows because everything is nicely
|
103
|
+
packaged into a binary gem. However, the gem is very large ~90MB, so please
|
104
|
+
be patient while gem downloads the file.
|
105
|
+
|
106
|
+
To get help:
|
107
|
+
Sign up to the kdebindings mailing list at:
|
108
|
+
https://mail.kde.org/mailman/listinfo/kde-bindings
|
109
|
+
You can also file tickets here at github for issues specific to the
|
110
|
+
qtbindings gem.
|
111
|
+
|
112
|
+
License:
|
113
|
+
This library is released under the LGPL Version 2.1.
|
114
|
+
See COPYING.LIB.txt
|
115
|
+
|
116
|
+
Disclaimer:
|
117
|
+
Almost all of this code was written by the great guys who work on the KDE
|
118
|
+
bindings project, particurly Arno Rehn and Richard Dale. I hope to increase
|
119
|
+
the adoption and use of the code that they have written.
|
data/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'rake'
|
3
2
|
|
4
3
|
windows = false
|
@@ -17,20 +16,35 @@ end
|
|
17
16
|
|
18
17
|
def set_version
|
19
18
|
if ENV['VERSION']
|
20
|
-
File.open('lib/qtbindings_version.rb', 'w') do |file|
|
19
|
+
File.open('lib/qtbindings_version.rb', 'w') do |file|
|
21
20
|
file.write("QTBINDINGS_VERSION = '#{ENV['VERSION']}'\n")
|
22
21
|
file.write("QTBINDINGS_RELEASE_DATE = '#{Time.now}'\n")
|
23
22
|
end
|
24
|
-
end
|
23
|
+
end
|
25
24
|
end
|
26
25
|
|
27
26
|
def clear_version
|
28
27
|
if ENV['VERSION']
|
29
|
-
File.open('lib/qtbindings_version.rb', 'w') do |file|
|
28
|
+
File.open('lib/qtbindings_version.rb', 'w') do |file|
|
30
29
|
file.write("QTBINDINGS_VERSION = '0.0.0.0'\n")
|
31
30
|
file.write("QTBINDINGS_RELEASE_DATE = ''\n")
|
32
31
|
end
|
33
|
-
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
task :build_examples do
|
36
|
+
# Go into the examples directory and look for all the makefiles and build them
|
37
|
+
Dir['examples/**/makefile'].each do |file|
|
38
|
+
if windows
|
39
|
+
system("cd #{File.dirname(file).gsub('/', '\\')} && #{MAKE}")
|
40
|
+
else
|
41
|
+
system("cd #{File.dirname(file)} && #{MAKE}")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
task :examples => [:build_examples] do
|
47
|
+
system('cd examples && ruby run_all.rb')
|
34
48
|
end
|
35
49
|
|
36
50
|
task :default => [:all]
|
@@ -39,30 +53,27 @@ task :extconf do
|
|
39
53
|
system('ruby extconf.rb')
|
40
54
|
end
|
41
55
|
|
42
|
-
|
56
|
+
# All calls 'make clean' and 'make build'
|
57
|
+
task :all => [:extconf] do
|
43
58
|
system("#{MAKE} all")
|
44
59
|
end
|
45
60
|
|
46
|
-
task :clean => [:extconf] do
|
61
|
+
task :clean => [:extconf] do
|
47
62
|
system("#{MAKE} clean")
|
48
63
|
end
|
49
64
|
|
50
|
-
task :distclean => [:extconf] do
|
65
|
+
task :distclean => [:extconf] do
|
51
66
|
system("#{MAKE} distclean")
|
52
67
|
end
|
53
68
|
|
54
|
-
task :
|
69
|
+
task :make_build => [:extconf] do
|
55
70
|
system("#{MAKE} build")
|
56
71
|
end
|
57
72
|
|
58
|
-
task :install => [:extconf] do
|
73
|
+
task :install => [:extconf] do
|
59
74
|
system("#{MAKE} install")
|
60
75
|
end
|
61
76
|
|
62
|
-
task :installqt => [:extconf] do
|
63
|
-
system("#{MAKE} installqt")
|
64
|
-
end
|
65
|
-
|
66
77
|
task :gem => [:distclean] do
|
67
78
|
warn_version()
|
68
79
|
set_version()
|
@@ -70,27 +81,17 @@ task :gem => [:distclean] do
|
|
70
81
|
clear_version()
|
71
82
|
end
|
72
83
|
|
73
|
-
task :gemnative
|
84
|
+
task :gemnative do
|
74
85
|
warn_version()
|
75
86
|
set_version()
|
87
|
+
system("#{MAKE} installqt")
|
76
88
|
system("gem build qtbindingsnative.gemspec")
|
77
89
|
clear_version()
|
78
90
|
end
|
79
91
|
|
80
|
-
task :
|
81
|
-
|
82
|
-
task :ryanbuildwindows do
|
83
|
-
if RUBY_VERSION.split('.')[1].to_i == 9
|
84
|
-
system("move C:\\Ruby C:\\Ruby191 && move C:\\Ruby187 C:\\Ruby")
|
85
|
-
end
|
86
|
-
Rake::Task[:extconf].execute
|
87
|
-
Rake::Task[:all].execute
|
88
|
-
Rake::Task[:install].execute
|
89
|
-
system("move C:\\Ruby C:\\Ruby187 && move C:\\Ruby191 C:\\Ruby")
|
92
|
+
task :build do
|
90
93
|
Rake::Task[:extconf].execute
|
91
94
|
Rake::Task[:all].execute
|
92
95
|
Rake::Task[:install].execute
|
93
|
-
system("move C:\\Ruby C:\\Ruby191 && move C:\\Ruby187 C:\\Ruby")
|
94
96
|
end
|
95
97
|
|
96
|
-
task :ryangemwindows => [:ryanbuildwindows, :gemwindows]
|
@@ -22,24 +22,24 @@
|
|
22
22
|
|
23
23
|
** Translated to QtRuby by Richard Dale
|
24
24
|
=end
|
25
|
-
|
25
|
+
|
26
26
|
class Window < Qt::Widget
|
27
|
-
|
27
|
+
|
28
28
|
slots 'setIcon(int)',
|
29
29
|
'iconActivated(QSystemTrayIcon::ActivationReason)',
|
30
30
|
:showMessage,
|
31
31
|
:messageClicked
|
32
|
-
|
32
|
+
|
33
33
|
def initialize(parent = nil)
|
34
34
|
super(parent)
|
35
35
|
createIconGroupBox()
|
36
36
|
createMessageGroupBox()
|
37
|
-
|
37
|
+
|
38
38
|
@iconLabel.minimumWidth = @durationLabel.sizeHint.width
|
39
|
-
|
39
|
+
|
40
40
|
createActions()
|
41
41
|
createTrayIcon()
|
42
|
-
|
42
|
+
|
43
43
|
connect(@showMessageButton, SIGNAL(:clicked), self, SLOT(:showMessage))
|
44
44
|
connect(@showIconCheckBox, SIGNAL('toggled(bool)'),
|
45
45
|
@trayIcon, SLOT('setVisible(bool)'))
|
@@ -48,26 +48,26 @@ class Window < Qt::Widget
|
|
48
48
|
connect(@trayIcon, SIGNAL(:messageClicked), self, SLOT(:messageClicked))
|
49
49
|
connect(@trayIcon, SIGNAL('activated(QSystemTrayIcon::ActivationReason)'),
|
50
50
|
self, SLOT('iconActivated(QSystemTrayIcon::ActivationReason)'))
|
51
|
-
|
51
|
+
|
52
52
|
self.layout = Qt::VBoxLayout.new do |m|
|
53
53
|
m.addWidget(@iconGroupBox)
|
54
54
|
m.addWidget(@messageGroupBox)
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
@iconComboBox.currentIndex = 1
|
58
58
|
@trayIcon.show
|
59
|
-
|
59
|
+
|
60
60
|
setWindowTitle(tr("Systray"))
|
61
61
|
resize(400, 300)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def setVisible(visible)
|
65
65
|
@minimizeAction.enabled = visible
|
66
66
|
@maximizeAction.enabled = !visible
|
67
67
|
@restoreAction.enabled = !visible
|
68
68
|
super(visible)
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def closeEvent(event)
|
72
72
|
if @trayIcon.visible?
|
73
73
|
Qt::MessageBox.information(self, tr("Systray"),
|
@@ -80,54 +80,50 @@ class Window < Qt::Widget
|
|
80
80
|
event.ignore()
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
def setIcon(index)
|
85
85
|
icon = @iconComboBox.itemIcon(index)
|
86
86
|
@trayIcon.icon = icon
|
87
87
|
setWindowIcon(icon)
|
88
|
-
|
88
|
+
|
89
89
|
@trayIcon.toolTip = @iconComboBox.itemText(index)
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def iconActivated(reason)
|
93
93
|
case reason
|
94
|
-
when Qt::SystemTrayIcon::Trigger
|
95
|
-
when Qt::SystemTrayIcon::DoubleClick
|
94
|
+
when Qt::SystemTrayIcon::Trigger
|
95
|
+
when Qt::SystemTrayIcon::DoubleClick
|
96
96
|
@iconComboBox.currentIndex = (iconComboBox.currentIndex + 1) % @iconComboBox.length
|
97
|
-
|
98
|
-
when Qt::SystemTrayIcon::MiddleClick:
|
97
|
+
when Qt::SystemTrayIcon::MiddleClick
|
99
98
|
showMessage()
|
100
|
-
break
|
101
|
-
else
|
102
|
-
|
103
99
|
end
|
104
100
|
end
|
105
|
-
|
101
|
+
|
106
102
|
def showMessage()
|
107
103
|
icon = @typeComboBox.itemData(@typeComboBox.currentIndex).to_i
|
108
104
|
@trayIcon.showMessage(@titleEdit.text, @bodyEdit.toPlainText, icon,
|
109
105
|
@durationSpinBox.value() * 1000)
|
110
106
|
end
|
111
|
-
|
107
|
+
|
112
108
|
def messageClicked()
|
113
109
|
Qt::MessageBox.information(nil, tr("Systray"),
|
114
110
|
tr("Sorry, I already gave what help I could.\n" \
|
115
111
|
"Maybe you should try asking a human?"))
|
116
112
|
end
|
117
|
-
|
113
|
+
|
118
114
|
def createIconGroupBox()
|
119
115
|
@iconGroupBox = Qt::GroupBox.new(tr("Tray Icon"))
|
120
|
-
|
116
|
+
|
121
117
|
@iconLabel = Qt::Label.new("Icon:")
|
122
|
-
|
118
|
+
|
123
119
|
@iconComboBox = Qt::ComboBox.new
|
124
120
|
@iconComboBox.addItem(Qt::Icon.new(":/images/bad.svg"), tr("Bad"))
|
125
121
|
@iconComboBox.addItem(Qt::Icon.new(":/images/heart.svg"), tr("Heart"))
|
126
122
|
@iconComboBox.addItem(Qt::Icon.new(":/images/trash.svg"), tr("Trash"))
|
127
|
-
|
123
|
+
|
128
124
|
@showIconCheckBox = Qt::CheckBox.new(tr("Show icon"))
|
129
125
|
@showIconCheckBox.checked = true
|
130
|
-
|
126
|
+
|
131
127
|
@iconGroupBox.layout = Qt::HBoxLayout.new do |l|
|
132
128
|
l.addWidget(@iconLabel)
|
133
129
|
l.addWidget(@iconComboBox)
|
@@ -135,27 +131,27 @@ class Window < Qt::Widget
|
|
135
131
|
l.addWidget(@showIconCheckBox)
|
136
132
|
end
|
137
133
|
end
|
138
|
-
|
134
|
+
|
139
135
|
def createMessageGroupBox()
|
140
136
|
@messageGroupBox = Qt::GroupBox.new(tr("Balloon Message"))
|
141
|
-
|
137
|
+
|
142
138
|
@typeLabel = Qt::Label.new(tr("Type:"))
|
143
|
-
|
139
|
+
|
144
140
|
@typeComboBox = Qt::ComboBox.new
|
145
141
|
@typeComboBox.addItem(tr("None"), Qt::Variant.new(Qt::SystemTrayIcon::NoIcon.to_i))
|
146
|
-
@typeComboBox.addItem(style().standardIcon(Qt::Style::SP_MessageBoxInformation),
|
142
|
+
@typeComboBox.addItem(style().standardIcon(Qt::Style::SP_MessageBoxInformation),
|
147
143
|
tr("Information"),
|
148
144
|
Qt::Variant.new(Qt::SystemTrayIcon::Information.to_i))
|
149
|
-
@typeComboBox.addItem(style().standardIcon(Qt::Style::SP_MessageBoxWarning),
|
145
|
+
@typeComboBox.addItem(style().standardIcon(Qt::Style::SP_MessageBoxWarning),
|
150
146
|
tr("Warning"),
|
151
147
|
Qt::Variant.new(Qt::SystemTrayIcon::Warning.to_i))
|
152
|
-
@typeComboBox.addItem(style().standardIcon(Qt::Style::SP_MessageBoxCritical),
|
148
|
+
@typeComboBox.addItem(style().standardIcon(Qt::Style::SP_MessageBoxCritical),
|
153
149
|
tr("Critical"),
|
154
150
|
Qt::Variant.new(Qt::SystemTrayIcon::Critical.to_i))
|
155
151
|
@typeComboBox.currentIndex = 1
|
156
|
-
|
152
|
+
|
157
153
|
@durationLabel = Qt::Label.new(tr("Duration:"))
|
158
|
-
|
154
|
+
|
159
155
|
@durationSpinBox = Qt::SpinBox.new do |s|
|
160
156
|
s.range = 5..60
|
161
157
|
s.suffix = " s"
|
@@ -165,20 +161,20 @@ class Window < Qt::Widget
|
|
165
161
|
@durationWarningLabel = Qt::Label.new(tr("(some systems might ignore self " \
|
166
162
|
"hint)"))
|
167
163
|
@durationWarningLabel.indent = 10
|
168
|
-
|
164
|
+
|
169
165
|
@titleLabel = Qt::Label.new(tr("Title:"))
|
170
|
-
|
166
|
+
|
171
167
|
@titleEdit = Qt::LineEdit.new(tr("Cannot connect to network"))
|
172
|
-
|
168
|
+
|
173
169
|
@bodyLabel = Qt::Label.new(tr("Body:"))
|
174
|
-
|
170
|
+
|
175
171
|
@bodyEdit = Qt::TextEdit.new
|
176
172
|
@bodyEdit.setPlainText(tr("Don't believe me. Honestly, I don't have a " \
|
177
173
|
"clue.\nClick self balloon for details."))
|
178
|
-
|
174
|
+
|
179
175
|
@showMessageButton = Qt::PushButton.new(tr("Show Message"))
|
180
176
|
@showMessageButton.default = true
|
181
|
-
|
177
|
+
|
182
178
|
@messageGroupBox.layout = Qt::GridLayout.new do |m|
|
183
179
|
m.addWidget(@typeLabel, 0, 0)
|
184
180
|
m.addWidget(@typeComboBox, 0, 1, 1, 2)
|
@@ -194,21 +190,21 @@ class Window < Qt::Widget
|
|
194
190
|
m.setRowStretch(4, 1)
|
195
191
|
end
|
196
192
|
end
|
197
|
-
|
193
|
+
|
198
194
|
def createActions()
|
199
195
|
@minimizeAction = Qt::Action.new(tr("Mi&nimize"), self)
|
200
196
|
connect(@minimizeAction, SIGNAL(:triggered), self, SLOT(:hide))
|
201
|
-
|
197
|
+
|
202
198
|
@maximizeAction = Qt::Action.new(tr("Ma&ximize"), self)
|
203
199
|
connect(@maximizeAction, SIGNAL(:triggered), self, SLOT(:showMaximized))
|
204
|
-
|
200
|
+
|
205
201
|
@restoreAction = Qt::Action.new(tr("&Restore"), self)
|
206
202
|
connect(@restoreAction, SIGNAL(:triggered), self, SLOT(:show))
|
207
|
-
|
203
|
+
|
208
204
|
@quitAction = Qt::Action.new(tr("&Quit"), self)
|
209
205
|
connect(@quitAction, SIGNAL(:triggered), $qApp, SLOT(:quit))
|
210
206
|
end
|
211
|
-
|
207
|
+
|
212
208
|
def createTrayIcon()
|
213
209
|
@trayIconMenu = Qt::Menu.new(self) do |t|
|
214
210
|
t.addAction(@minimizeAction)
|