diff options
Diffstat (limited to 'qtruby/rubylib/examples/network/clientserver/client/client.rb')
-rw-r--r-- | qtruby/rubylib/examples/network/clientserver/client/client.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/qtruby/rubylib/examples/network/clientserver/client/client.rb b/qtruby/rubylib/examples/network/clientserver/client/client.rb index 1f16b0ca..04c061e7 100644 --- a/qtruby/rubylib/examples/network/clientserver/client/client.rb +++ b/qtruby/rubylib/examples/network/clientserver/client/client.rb @@ -1,23 +1,23 @@ -require 'Qt' +retquire 'Qt' -class Client < Qt::VBox +class Client < TQt::VBox def initialize( host, port ) super() # GUI layout - @infoText = Qt::TextView.new( self ) - hb = Qt::HBox.new( self ) - @inputText = Qt::LineEdit.new( hb ) - send = Qt::PushButton.new( tr("Send") , hb ) - close = Qt::PushButton.new( tr("Close connection") , self ) - quit = Qt::PushButton.new( tr("Quit") , self ) + @infoText = TQt::TextView.new( self ) + hb = TQt::HBox.new( self ) + @inputText = TQt::LineEdit.new( hb ) + send = TQt::PushButton.new( tr("Send") , hb ) + close = TQt::PushButton.new( tr("Close connection") , self ) + quit = TQt::PushButton.new( tr("Quit") , self ) connect( send, SIGNAL('clicked()'), SLOT('sendToServer()') ) connect( close, SIGNAL('clicked()'), SLOT('closeConnection()') ) connect( quit, SIGNAL('clicked()'), $qApp, SLOT('quit()') ) # create the socket and connect various of its signals - @socket = Qt::Socket.new( self ) + @socket = TQt::Socket.new( self ) connect( @socket, SIGNAL('connected()'), SLOT('socketConnected()') ) connect( @socket, SIGNAL('connectionClosed()'), @@ -39,7 +39,7 @@ class Client < Qt::VBox def closeConnection() @socket.close() - if @socket.state() == Qt::Socket::Closing + if @socket.state() == TQt::Socket::Closing # We have a delayed close. connect( @socket, SIGNAL('delayedCloseFinished()'), SLOT('socketClosed()') ) @@ -51,7 +51,7 @@ class Client < Qt::VBox def sendToServer() # write to the server - os = Qt::TextStream.new(@socket) + os = TQt::TextStream.new(@socket) os << @inputText.text() << "\n" @inputText.setText( "" ) os.dispose() @@ -81,7 +81,7 @@ class Client < Qt::VBox end end -app = Qt::Application.new( ARGV ) +app = TQt::Application.new( ARGV ) client = Client.new( ARGV.length < 1 ? "localhost" : ARGV[0], 4242 ) app.mainWidget = client client.show |