Ejemplo n.º 1
0
void ChatDialog::setupEventHandler()
{
    QObject::connect(mBtnSend, SIGNAL(clicked()), this, SLOT(sendMsg()));
    QObject::connect(mBtnClose, SIGNAL(clicked()), this, SLOT(closeDialog()));
    QObject::connect(mChannel, SIGNAL(readyRead()), this, SLOT(recvMsg()));
    QObject::connect(mTxtSend, SIGNAL(textChanged()), this, SLOT(enableSendButton()));
//    QObject::
}
Ejemplo n.º 2
0
void Client::sessionOpened()
{
    // Save the used configuration
    QNetworkConfiguration config = networkSession->configuration();
    QString id;
    if (config.type() == QNetworkConfiguration::UserChoice)
        id = networkSession->sessionProperty(QLatin1String("UserChoiceConfiguration")).toString();
    else
        id = config.identifier();

    enableSendButton();
}
Ejemplo n.º 3
0
void Client::connectServer()
{
    tcpSocket->abort();
    messageLineEdit->setEnabled(true);
    tcpSocket->connectToHost(hostCombo->currentText(), portLineEdit->text().toInt());

    if (tcpSocket->waitForConnected(3000))
    {
        enableSendButton();
        messageLineEdit->setEnabled(true);
        statusLabel->setText("Connected");
    }
    else
    {
        chatBox->textCursor().insertText("Connection timed out");
        messageLineEdit->setEnabled(false);
    }
}