- return false;
-}
-
-void CoreConnection::socketStateChanged(QAbstractSocket::SocketState socketState) {
- QString text;
-
- switch(socketState) {
- case QAbstractSocket::UnconnectedState:
- text = tr("Disconnected");
- break;
- case QAbstractSocket::HostLookupState:
- text = tr("Looking up %1...").arg(currentAccount().hostName());
- break;
- case QAbstractSocket::ConnectingState:
- text = tr("Connecting to %1...").arg(currentAccount().hostName());
- break;
- case QAbstractSocket::ConnectedState:
- text = tr("Connected to %1").arg(currentAccount().hostName());
- break;
- case QAbstractSocket::ClosingState:
- text = tr("Disconnecting from %1...").arg(currentAccount().hostName());
- break;
- default:
- break;
- }
-
- if(!text.isEmpty())
- emit progressTextChanged(text);
-
- setState(socketState);
-}
-
-void CoreConnection::setState(QAbstractSocket::SocketState socketState) {
- ConnectionState state;
-
- switch(socketState) {
- case QAbstractSocket::UnconnectedState:
- state = Disconnected;
- break;
- case QAbstractSocket::HostLookupState:
- case QAbstractSocket::ConnectingState:
- case QAbstractSocket::ConnectedState: // we'll set it to Connected in connectionReady()
- state = Connecting;
- break;
- default:
- state = Disconnected;
- }
-
- setState(state);
-}
-
-void CoreConnection::setState(ConnectionState state) {
- if(state != _state) {
- _state = state;
- emit stateChanged(state);
- if(state == Disconnected)
- emit disconnected();
- }
-}
-
-void CoreConnection::coreSocketError(QAbstractSocket::SocketError) {
- qDebug() << "coreSocketError" << _socket << _socket->errorString();
- disconnectFromCore(_socket->errorString(), true);
-}
-
-void CoreConnection::coreSocketDisconnected() {
- qDebug() << Q_FUNC_INFO;
- resetConnection(true);
- // FIXME handle disconnects gracefully
-}
-
-void CoreConnection::coreHasData() {
- QVariant item;
- while(SignalProxy::readDataFromDevice(_socket, _blockSize, item)) {
- QVariantMap msg = item.toMap();
- if(!msg.contains("MsgType")) {
- // This core is way too old and does not even speak our init protocol...
- emit connectionErrorPopup(tr("The Quassel Core you try to connect to is too old! Please consider upgrading."));
- disconnectFromCore(QString(), false);
- return;
+void CoreConnection::socketStateChanged(QAbstractSocket::SocketState socketState)
+{
+ QString text;
+
+ switch (socketState) {
+ case QAbstractSocket::UnconnectedState:
+ text = tr("Disconnected");
+ break;
+ case QAbstractSocket::HostLookupState:
+ text = tr("Looking up %1...").arg(currentAccount().hostName());
+ break;
+ case QAbstractSocket::ConnectingState:
+ text = tr("Connecting to %1...").arg(currentAccount().hostName());
+ break;
+ case QAbstractSocket::ConnectedState:
+ text = tr("Connected to %1").arg(currentAccount().hostName());
+ break;
+ case QAbstractSocket::ClosingState:
+ text = tr("Disconnecting from %1...").arg(currentAccount().hostName());
+ break;
+ default:
+ break;