/*! Constructs an assistant client object. The \a path specifies the path to the Qt Assistant executable. If \a path is an empty string the system path (\c{%PATH%} or \c $PATH) is used. The assistant client object is a child of \a parent and is called \a name. */ QAssistantClient::QAssistantClient( const QString &path, QObject *parent, const char *name ) : QObject( parent, name ), host ( "localhost" ) { if ( path.isEmpty() ) assistantCommand = "assistant"; else { QFileInfo fi( path ); if ( fi.isDir() ) assistantCommand = path + "/assistant"; else assistantCommand = path; } #if defined(Q_OS_MACX) assistantCommand += ".app/Contents/MacOS/assistant"; #elif defined(Q_WS_WIN) if (!assistantCommand.endsWith(".exe")) assistantCommand += ".exe"; #endif socket = new QSocket( this ); connect( socket, SIGNAL( connected() ), SLOT( socketConnected() ) ); connect( socket, SIGNAL( connectionClosed() ), SLOT( socketConnectionClosed() ) ); connect( socket, SIGNAL( error( int ) ), SLOT( socketError( int ) ) ); opened = FALSE; proc = new QProcess( this ); port = 0; pageBuffer = ""; connect( proc, SIGNAL( readyReadStderr() ), this, SLOT( readStdError() ) ); }
/*! Constructs an assistant client with the given \a parent. The \a path specifies the path to the Qt Assistant executable. If \a path is an empty string the system path (\c{%PATH%} or \c $PATH) is used. */ QAssistantClient::QAssistantClient( const QString &path, QObject *parent ) : QObject( parent ), host ( QLatin1String("localhost") ) { if ( path.isEmpty() ) assistantCommand = QLatin1String("assistant"); else { QFileInfo fi( path ); if ( fi.isDir() ) assistantCommand = path + QLatin1String("/assistant"); else assistantCommand = path; } #if defined(Q_OS_MAC) assistantCommand += QLatin1String(".app/Contents/MacOS/assistant"); #endif socket = new QTcpSocket( this ); connect( socket, SIGNAL(connected()), SLOT(socketConnected()) ); connect( socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed()) ); connect( socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError()) ); opened = false; proc = new QProcess( this ); port = 0; pageBuffer = QLatin1String(""); connect( proc, SIGNAL(readyReadStandardError()), this, SLOT(readStdError()) ); connect( proc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(procError(QProcess::ProcessError)) ); }
Qip::Qip() { state = Start; socket = new QSocket( this ); connect( socket, SIGNAL(connected()), SLOT(socketConnected()) ); connect( socket, SIGNAL(connectionClosed()), SLOT(socketConnectionClosed()) ); connect( socket, SIGNAL(readyRead()), SLOT(socketReadyRead()) ); connect( socket, SIGNAL(error(int)), SLOT(socketError(int)) ); }
void ClientInfo::connectToServer() { delete socket; socket = new QSocket( this ); connect( socket, SIGNAL(connected()), SLOT(socketConnected()) ); connect( socket, SIGNAL(connectionClosed()), SLOT(socketConnectionClosed()) ); connect( socket, SIGNAL(readyRead()), SLOT(socketReadyRead()) ); connect( socket, SIGNAL(error(int)), SLOT(socketError(int)) ); socket->connectToHost( edHost->text(), edPort->text().toInt() ); }
c_client::c_client(const QString &host, Q_UINT16 port, MyDialog1 *mdlg) { socket = new QSocket(this); connect(socket, SIGNAL(connected()), SLOT(socketConnected())); connect(socket, SIGNAL(connectionClosed()), SLOT(socketConnectionClosed())); connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead())); connect(socket, SIGNAL(error(int)), SLOT(socketError(int))); mydlg = mdlg; // mydlg->statusEdit->append("Michon: Trying to connect to the server\n"); socket->connectToHost(host, port); }
TCClientSocket::TCClientSocket( int port, QObject *parent ) : QTcpSocket( parent ) , miBlockSize(0) { line = 0; mConnectPort = port; connect( this, SIGNAL(connected()), this,SLOT(socketConnected()) ); connect( this, SIGNAL(disconnected()),this,SLOT(socketConnectionClosed()) ); connect( this, SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(socketError(QAbstractSocket::SocketError)) ); connect( this, SIGNAL(delayedCloseFinished()), SLOT(socketClosed()) ); connect( this, SIGNAL(readyRead()), this, SLOT(readyRead()) ); connect( this, SIGNAL(readyRead(TCClientSocket*)), parent, SLOT(readyRead(TCClientSocket*)) ); connect(this, SIGNAL(sendText(const QString&)),parent, SLOT(rcvSocketText(const QString&))); }
bool QAssistantClient::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: openAssistant(); break; case 1: closeAssistant(); break; case 2: showPage((const QString&)static_QUType_QString.get(_o+1)); break; case 3: socketConnected(); break; case 4: socketConnectionClosed(); break; case 5: readPort(); break; case 6: socketError((int)static_QUType_int.get(_o+1)); break; case 7: readStdError(); break; default: return QObject::qt_invoke( _id, _o ); } return TRUE; }
void QtTelnetPrivate::setSocket(QTcpSocket *s) { if (socket) { q->logout(); socket->flush(); } delete socket; socket = s; connected = false; if (socket) { connect(socket, SIGNAL(connected()), this, SLOT(socketConnected())); connect(socket, SIGNAL(disconnected()), this, SLOT(socketConnectionClosed())); connect(socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); } }
ShoutCastIODevice::ShoutCastIODevice(void) : m_redirects (0), m_scratchpad_pos (0), m_state (NOT_CONNECTED) { m_socket = new QTcpSocket; m_response = new ShoutCastResponse; connect(m_socket, SIGNAL(hostFound()), SLOT(socketHostFound())); connect(m_socket, SIGNAL(connected()), SLOT(socketConnected())); connect(m_socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed())); connect(m_socket, SIGNAL(readyRead()), SLOT(socketReadyRead())); connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError))); switchToState(NOT_CONNECTED); setOpenMode(ReadWrite); }
TCPClient::TCPClient( const QString &host, Q_UINT16 port ) { socket = new QSocket( this ); connect( socket, SIGNAL(connected()),SLOT(socketConnected()) ); connect( socket, SIGNAL(connectionClosed()),SLOT(socketConnectionClosed()) ); connect( socket, SIGNAL(readyRead()),SLOT(socketReadyRead()) ); connect( socket, SIGNAL(error(int)),SLOT(socketError(int)) ); // connect to the server printf("Trying to connect to the server %s:%d\n",(const char*)host,port); socket->connectToHost( host, port ); ds=NULL; ds=new QDataStream ( socket ); lostSum=0; go=false; iWin=false; error=false; }