OutputIceCast::OutputIceCast() : _shout(0), _state(INVALID), _timer(new QTimer(this)) { _timer->setInterval(5000); _timer->setSingleShot(false); connect(_timer, SIGNAL(timeout()), this, SLOT(connectStream())); connect(this, SIGNAL(requestReconnect()), this, SLOT(reconnectStream()), Qt::QueuedConnection); shout_init(); }
void WSChat::initiateLoginDlg() { login = new LoginDlg(this); QObject::connect(login,SIGNAL(sendUserName(QString)),this, SLOT(sendUserName(QString))); QObject::connect(login,SIGNAL(requestReconnect()),this, SLOT(reconnectSocket())); QObject::connect(this,SIGNAL(setDlgSocketState(QString)),login, SLOT(setDlgSocketState(QString))); //can not close the process when close the login dialog setDlgSocketState(currentSocketState(websocket->state())); login->show(); }
void OutputIceCast::output(const char* buffer, uint32_t size) { if (getState() != CONNECTED) return; if (size != 0) { int r = shout_send(_shout, ( const unsigned char* )buffer, size); if (r != SHOUTERR_SUCCESS) { emit warn(QString("send error: ") + shout_get_error(_shout)); _state = DISCONNECTED; emit stateChanged(DISCONNECTED); emit stateChanged("offline"); emit requestReconnect(); _trial = 0; } shout_sync(_shout); } }
void ConnectionManager::handleConnectionStateChange(Server* server, Konversation::ConnectionState state) { emit connectionChangedState(server, state); int identityId = server->getIdentity()->id(); if (state == Konversation::SSConnected) { m_overrideAutoReconnect = false; if (!m_activeIdentities.contains(identityId)) { m_activeIdentities.insert(identityId); emit identityOnline(identityId); } } else if (state != Konversation::SSConnecting) { if (m_activeIdentities.contains(identityId)) { m_activeIdentities.remove(identityId); emit identityOffline(identityId); } } if (state == Konversation::SSInvoluntarilyDisconnected && !m_overrideAutoReconnect) { // The asynchronous invocation of handleReconnect() makes sure that // connectionChangedState() is emitted and delivered before it runs // (and causes the next connection state change to occur). emit requestReconnect(server); } else if (state == Konversation::SSInvoluntarilyDisconnected && m_overrideAutoReconnect) { server->getStatusView()->appendServerMessage(i18n("Info"), i18n ("Network is down, will reconnect automatically when it is back up.")); } }