Class: Pong

Inherits:
Qt::DBusAbstractAdaptor
  • Object
show all
Defined in:
ext/ruby/qtruby/examples/qdbus/pingpong/pong.rb,
ext/ruby/qtruby/examples/qdbus/complexpingpong/complexpong.rb

Instance Method Summary collapse

Instance Method Details

#ping(arg) ⇒ Object



32
33
34
35
# File 'ext/ruby/qtruby/examples/qdbus/pingpong/pong.rb', line 32

def ping(arg)
    Qt::MetaObject.invokeMethod(Qt::CoreApplication.instance(), "quit")
    return 'ping("' + arg +'") got called'
end

#query(query) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'ext/ruby/qtruby/examples/qdbus/complexpingpong/complexpong.rb', line 51

def query(query)
    q = query.downcase
    if q == "hello"
        return Qt::DBusVariant.new("World")
    elsif q == "ping"
        return Qt::DBusVariant.new("Pong")
    elsif q == "the answer to life, the universe and everything"
        return Qt::DBusVariant.new(42)
    elsif !q.index("unladen swallow").nil?
        if !q.index("european").nil?
            return Qt::DBusVariant.new(11.0)
        end
        return Qt::DBusVariant.new(Qt::ByteArray.new("african or european?"))
    end

    return Qt::DBusVariant.new("Sorry, I don't know the answer")
end

#quitObject



47
48
49
# File 'ext/ruby/qtruby/examples/qdbus/complexpingpong/complexpong.rb', line 47

def quit
    Qt::Timer.singleShot(0, Qt::CoreApplication.instance, SLOT(:quit))
end

#setValue(newValue) ⇒ Object



43
44
45
# File 'ext/ruby/qtruby/examples/qdbus/complexpingpong/complexpong.rb', line 43

def setValue(newValue)
    @m_value = newValue
end

#valueObject

the property



39
40
41
# File 'ext/ruby/qtruby/examples/qdbus/complexpingpong/complexpong.rb', line 39

def value()
    return @m_value
end