Top Level Namespace

Includes:
GL, Math

Defined Under Namespace

Modules: Icons, Qt, QtScript, QtTest, QtUiTools, QtWebKit Classes: ActiveItemModel, ActiveTableModel, Adjustor, AnalogClock, ApplicationsTab, Boid, BoidView, BorderLayout, Bubble, CalcButton, Calculator, CalculatorForm, Camera, CameraDialog, CannonField, Canvas, Car, CarAdaptor, CharacterWidget, ChatAdaptor, CircleWidget, Cloud, CloudView, ColorItem, ComTrolltechChatInterface, ComplexWizard, ConfigDialog, ConfigurationPage, Controller, ControllerWindow, DetailsDialog, DetailsPage, Dialog, DigitalClock, DomItem, DragLabel, DragWidget, DropArea, DropSiteWindow, EvaluatePage, FindDialog, FinishPage, Flock, FlowLayout, FtpWindow, GLWidget, GameBoard, GeneralTab, Graphics, Highlighter, HttpWindow, IconPreviewArea, IconSizeSpinBox, ImageComposer, ImageDelegate, ImageModel, ImageViewer, KIconCollection, KillerFilter, LCDRange, LicenseWizard, LicenseWizardPage, MainWindow, MdiChild, Module, Mouse, MouseTimer, MoviePlayer, MyFirstTest, MyTextEditor, MyWidget, Object, Params, PassiveWindow, PermissionsTab, PiecesList, PiecesModel, Ping, PixelDelegate, Point, Pong, PreviewDialog, PreviewLabel, PreviewWindow, Proc, PuzzleWidget, QueryPage, RAction, RSeperator, Receiver, RegisterPage, RenderArea, Robot, RobotHead, RobotLimb, RobotPart, RobotTorso, Screenshot, ScribbleArea, ScribbleWindow, Sender, Server, ShapeItem, SimpleWizard, SlidersGroup, SortingBox, SpinBoxDelegate, SvgGLView, SvgNativeView, SvgRasterView, SvgWindow, TabDialog, TestQtRuby, TetrixPiece, TetrixWindow, Thing, TitlePage, TreeItem, TreeModel, Triangle, Ui_ChatMainWindow, Ui_NicknameDialog, UpdatePage, View, WigglyWidget, Window, WizardPage, World, WorldWindow, XbelGenerator, XbelHandler, XbelTree

Constant Summary collapse

QTBINDINGS_VERSION =
'4.6.3.0'
QTBINDINGS_RELEASE_DATE =
'Fri Aug 06 07:26:07 -0600 2010'
FILE_PERMISSION =
0644
DIR_PERMISSION =
0755
PUBLISH_FLAG =
'-p'
RUBOIDS_DIR =
'ruboids'
DOCS_DIR =
'.'
RUBOIDS_DIR_WITH_VERSION =

DOCS_HTML_DIR = “#DOCS_DIR/README”

"#{RUBOIDS_DIR}-#{Version}"
RELEASE_DIR =
"/tmp/#{RUBOIDS_DIR_WITH_VERSION}_release"
DOWNLOAD_FILE =

RELEASE_HTML_DIR = “#RELEASE_DIR/README”

"#{DOCS_DIR}/index.html"
WEB_SITE =

DOCBOOK_FILE = “#DOCS_DIR/README.sgml”

'io.com'
WEB_DIR =
'public-web/downloads/ruboids'
VERSION_MAJOR =

Copyright © 2001 by Jim Menard <[email protected]>

Released under the same license as Ruby. See www.ruby-lang.org/en/LICENSE.txt.

0
VERSION_MINOR =
0
VERSION_TWEAK =
1
Version =
"#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_TWEAK}"
'Copyright (c) 2001 by Jim Menard <[email protected]>'
SERVICE_NAME =
"com.trolltech.QtDBus.PingExample"
MouseCount =
7

Instance Method Summary collapse

Instance Method Details

#build_actions(actions) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'ext/ruby/qtruby/examples/base/rui.rb', line 6

def build_actions(actions)
   actions.each { |a|
      if a.is_a? RSeperator
         a.included_in.each {
            |to| a.id = to.insertSeparator() 
         }
      else
         qt_action = $kIcons.make_qt_action(self, a.text_with_accel, a.icon_type)
         connect(qt_action, SIGNAL('activated()'), a.rec, a.slot)
         a.included_in.each {
            |to| qt_action.addTo(to)
         }
         a.action = qt_action
      end
   }
end

#copyFiles(fromDir, toDir, match = nil) ⇒ Object

Copies all files from ‘fromDir’ into the release directory. Sets the permissions of all files to 0644.



50
51
52
53
54
55
# File 'ext/ruby/qtruby/examples/ruboids/release.rb', line 50

def copyFiles(fromDir, toDir, match=nil)
    Dir.foreach(fromDir) { | f |
	next if f =~ /^\.\.?/ || (!match.nil? && !(f =~ match))
	File.install("#{fromDir}/#{f}", toDir, FILE_PERMISSION)
    }
end

#ensureVersionInFile(fileName, regex) ⇒ Object



89
90
91
92
93
94
95
96
# File 'ext/ruby/qtruby/examples/ruboids/release.rb', line 89

def ensureVersionInFile(fileName, regex)
    lines = File.open(fileName).grep(regex)
    found = lines.detect { | line | line =~ /#{Version}/o }
    if !found
	$stderr.puts "Warning: it looks like the #{fileName} version number" +
	    " is incorrect"
    end
end

#generateManifestObject



26
27
28
29
30
31
32
33
34
# File 'ext/ruby/qtruby/examples/ruboids/generateManifest.rb', line 26

def generateManifest
    io = nil
    begin
	io = File.open('Manifest', 'w')
	recurseDirectory(io, '.', 0)
    ensure
	io.close() if io
    end
end

#method1Object



29
30
31
32
33
34
35
36
37
38
# File 'ext/ruby/qtruby/examples/qdbus/listnames/listnames.rb', line 29

def method1()
    qDebug("Method 1:")
    
    reply = Qt::DBusConnection.sessionBus.interface.registeredServiceNames
    if !reply.valid?
            qDebug("Error:" + reply.error.message)
            exit 1
    end
    reply.value.each {|name| qDebug(name)}
end

#method2Object



40
41
42
43
44
45
46
47
48
# File 'ext/ruby/qtruby/examples/qdbus/listnames/listnames.rb', line 40

def method2()
    qDebug("Method 2:")
    
    bus = Qt::DBusConnection.sessionBus
    dbus_iface = Qt::DBusInterface.new("org.freedesktop.DBus", "/org/freedesktop/DBus", 
                                       "org.freedesktop.DBus", bus)
        
    qDebug(dbus_iface.call("ListNames").arguments[0].value.inspect)
end

#method3Object



50
51
52
53
# File 'ext/ruby/qtruby/examples/qdbus/listnames/listnames.rb', line 50

def method3()
    qDebug("Method 3:")
    qDebug(Qt::DBusConnection.sessionBus.interface.registeredServiceNames.value.inspect)
end

#recurseDirectory(io, dirName, indentLevel) ⇒ Object

! /usr/bin/env ruby

Copyright © 2001 by Jim Menard <[email protected]>

Released under the same license as Ruby. See www.ruby-lang.org/en/LICENSE.txt.

This script builds the Manifest file. It can be run stand-alone, but is normally used from within release.rb.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'ext/ruby/qtruby/examples/ruboids/generateManifest.rb', line 12

def recurseDirectory(io, dirName, indentLevel)
    Dir.entries(dirName).sort.each { | f |
	next if f =~ /^\.\.?/
	fileName = "#{dirName}/#{f}"
	fileName.sub!(/^\.\//, '')
	if File.directory?(fileName)
	    io.puts "\t" * indentLevel + fileName + '/'
	    recurseDirectory(io, fileName, indentLevel + 1)
	else
	    io.puts "\t" * indentLevel + f
	end
    }
end

#rmDirectory(dirName) ⇒ Object

Recursively removes the contents of a directory.



58
59
60
61
62
63
64
65
66
67
# File 'ext/ruby/qtruby/examples/ruboids/release.rb', line 58

def rmDirectory(dirName)
    return unless File.exists?(dirName)
    Dir.foreach(dirName) { | f |
	next if f =~ /^\.\.?/
	path = "#{dirName}/#{f}"
	rmDirectory(path) if File.directory?(path)
	File.delete(path) if !File.directory?(path)
    }
    
end

#sendToWebSite(ftp, releaseDir, webDir) ⇒ Object

Recursively sends files and directories.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'ext/ruby/qtruby/examples/ruboids/release.rb', line 70

def sendToWebSite(ftp, releaseDir, webDir)
    ftp.chdir(webDir)
    Dir.foreach(releaseDir) { | f |
	next if f =~ /^\.\.?/
	path = "#{releaseDir}/#{f}"
	if File.directory?(path)
	    begin
		ftp.mkdir(f)
	    rescue Net::FTPPermError
		# ignore; it's OK if the directory already exists
	    end
	    sendToWebSite(ftp, path, f)
	    ftp.chdir('..')
	else
	    ftp.putbinaryfile(path, f)
	end
    }
end

#test(str) ⇒ Object



10
11
12
# File 'ext/ruby/qtruby/test/opoverloading.rb', line 10

def test(str)
   puts "#{str.ljust 25} => #{eval(str, $t)}"
end