summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/network/clientserver/server/server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qtruby/rubylib/examples/network/clientserver/server/server.rb')
-rw-r--r--qtruby/rubylib/examples/network/clientserver/server/server.rb34
1 files changed, 17 insertions, 17 deletions
diff --git a/qtruby/rubylib/examples/network/clientserver/server/server.rb b/qtruby/rubylib/examples/network/clientserver/server/server.rb
index d8a937f4..a8248d63 100644
--- a/qtruby/rubylib/examples/network/clientserver/server/server.rb
+++ b/qtruby/rubylib/examples/network/clientserver/server/server.rb
@@ -1,11 +1,11 @@
-require 'Qt'
+retquire 'Qt'
=begin
The ClientSocket class provides a socket that is connected with a client.
For every client that connects to the server, the server creates a new
instance of this class.
=end
-class ClientSocket < Qt::Socket
+class ClientSocket < TQt::Socket
def initialize(sock, parent=nil, name=nil)
super( parent, name )
@line = 0
@@ -16,12 +16,12 @@ class ClientSocket < Qt::Socket
setSocket( sock )
end
- signals 'logText(const QString&)'
+ signals 'logText(const TQString&)'
slots 'readClient()'
def readClient()
- ts = Qt::TextStream.new( self )
+ ts = TQt::TextStream.new( self )
while canReadLine() do
str = ts.readLine()
emit logText( tr("Read: '%s'\n" % str) )
@@ -43,7 +43,7 @@ end
client that connects, it creates a new ClientSocket -- that instance is now
responsible for the communication with that client.
=end
-class SimpleServer < Qt::ServerSocket
+class SimpleServer < TQt::ServerSocket
def initialize( parent=nil )
super( 4242, 1, parent )
if !ok()
@@ -57,10 +57,10 @@ class SimpleServer < Qt::ServerSocket
emit newConnect( s )
end
- # The type of the argument is 'QSocket*', not
+ # The type of the argument is 'TQSocket*', not
# 'ClientSocket*' as only types in the Smoke
# library can be used for types in Signals
- signals 'newConnect(QSocket*)'
+ signals 'newConnect(TQSocket*)'
end
@@ -68,7 +68,7 @@ end
The ServerInfo class provides a small GUI for the server. It also creates the
SimpleServer and as a result the server.
=end
-class ServerInfo < Qt::VBox
+class ServerInfo < TQt::VBox
def initialize()
super
@server = SimpleServer.new( self )
@@ -77,25 +77,25 @@ class ServerInfo < Qt::VBox
"This is a small server example.\n" +
"Connect with the client now."
)
- lb = Qt::Label.new( itext, self )
+ lb = TQt::Label.new( itext, self )
lb.setAlignment( AlignHCenter )
- @infoText = Qt::TextView.new( self )
- quit = Qt::PushButton.new( tr("Quit") , self )
+ @infoText = TQt::TextView.new( self )
+ quit = TQt::PushButton.new( tr("Quit") , self )
# See the comment above about why the 'ClientSocket*'
# type cannot be used
- connect( @server, SIGNAL('newConnect(QSocket*)'),
- SLOT('newConnect(QSocket*)') )
+ connect( @server, SIGNAL('newConnect(TQSocket*)'),
+ SLOT('newConnect(TQSocket*)') )
connect( quit, SIGNAL('clicked()'), $qApp,
SLOT('quit()') )
end
- slots 'newConnect(QSocket*)', 'connectionClosed()'
+ slots 'newConnect(TQSocket*)', 'connectionClosed()'
def newConnect( s )
@infoText.append( tr("New connection\n") )
- connect( s, SIGNAL('logText(const QString&)'),
- @infoText, SLOT('append(const QString&)') )
+ connect( s, SIGNAL('logText(const TQString&)'),
+ @infoText, SLOT('append(const TQString&)') )
connect( s, SIGNAL('connectionClosed()'),
SLOT('connectionClosed()') )
end
@@ -106,7 +106,7 @@ class ServerInfo < Qt::VBox
end
-app = Qt::Application.new( ARGV )
+app = TQt::Application.new( ARGV )
info = ServerInfo.new
app.mainWidget = info
info.show