diff options
author | Alexander Akulich <akulichalexander@gmail.com> | 2020-02-07 16:31:55 +0300 |
---|---|---|
committer | Alexander Akulich <akulichalexander@gmail.com> | 2020-02-11 16:54:33 +0300 |
commit | c034f92fc2e377f47a0f45efeb66905a0f45d0ae (patch) | |
tree | b0f99e6d9de8e80a0e799fea815ed9ba3abe4de9 | |
parent | 11dc7b35c8c3957bd19087a5e3ae7cfc4f1a3343 (diff) |
Revert "QLocalSocket - deprecate ambiguous 'error' overloads"
This reverts commit 0de6c26ac17c90f513329fdbe87ef036fc25925a.
The patch fixes ambiguity between a getter and a signal by changing the
getter name, but we still have to rename the signal to follow the signals
naming convention.
Revert the commit to keep the getter as is and change the signal name instead.
Change-Id: I67dbb5cada25da473bdd02e71b1e2d9bd03f039e
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r-- | src/network/socket/qlocalsocket.cpp | 24 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket.h | 7 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket_tcp.cpp | 7 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket_unix.cpp | 7 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket_win.cpp | 7 | ||||
-rw-r--r-- | tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp | 8 | ||||
-rw-r--r-- | tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 8 |
7 files changed, 14 insertions, 54 deletions
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index d517f91aad..d35f838af5 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -220,25 +220,11 @@ QT_BEGIN_NAMESPACE /*! \fn QLocalSocket::LocalSocketError QLocalSocket::error() const - \deprecated - - Use socketError() instead. - - Returns the type of error that last occurred. - - \sa state(), errorString(), socketError() -*/ - -/*! - \fn QLocalSocket::LocalSocketError QLocalSocket::socketError() const - \since 5.15 - Returns the type of error that last occurred. \sa state(), errorString() */ - /*! \fn bool QLocalSocket::isValid() const @@ -286,7 +272,7 @@ QT_BEGIN_NAMESPACE Waits until the socket is connected, up to \a msecs milliseconds. If the connection has been established, this function returns \c true; otherwise it returns \c false. In the case where it returns \c false, you can call - socketError() to determine the cause of the error. + error() to determine the cause of the error. The following example waits up to one second for a connection to be established: @@ -305,7 +291,7 @@ QT_BEGIN_NAMESPACE connection was successfully disconnected, this function returns \c true; otherwise it returns \c false (if the operation timed out, if an error occurred, or if this QLocalSocket is already disconnected). In the case - where it returns \c false, you can call socketError() to determine the cause of + where it returns \c false, you can call error() to determine the cause of the error. The following example waits up to one second for a connection @@ -351,7 +337,7 @@ QT_BEGIN_NAMESPACE connections, you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType(). - \sa socketError(), errorString(), {Creating Custom Qt Types} + \sa error(), errorString(), {Creating Custom Qt Types} */ /*! @@ -460,7 +446,7 @@ QString QLocalSocket::fullServerName() const /*! Returns the state of the socket. - \sa socketError() + \sa error() */ QLocalSocket::LocalSocketState QLocalSocket::state() const { @@ -480,7 +466,7 @@ bool QLocalSocket::isSequential() const The LocalServerError enumeration represents the errors that can occur. The most recent error can be retrieved through a call to - \l QLocalSocket::socketError(). + \l QLocalSocket::error(). \value ConnectionRefusedError The connection was refused by the peer (or timed out). diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h index 9cf76d1022..1876a6ac0d 100644 --- a/src/network/socket/qlocalsocket.h +++ b/src/network/socket/qlocalsocket.h @@ -97,12 +97,7 @@ public: virtual bool canReadLine() const override; virtual bool open(OpenMode openMode = ReadWrite) override; virtual void close() override; - -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_X("Use socketError()") LocalSocketError error() const; -#endif // QT_DEPRECATED_SINCE(5, 15) - - LocalSocketError socketError() const; + LocalSocketError error() const; bool flush(); bool isValid() const; qint64 readBufferSize() const; diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index 74d3d547b9..41e5b47627 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -363,15 +363,8 @@ void QLocalSocket::disconnectFromServer() d->tcpSocket->disconnectFromHost(); } -#if QT_DEPRECATED_SINCE(5, 15) QLocalSocket::LocalSocketError QLocalSocket::error() const { - return socketError(); -} -#endif // QT_DEPRECATED_SINCE(5, 15) - -QLocalSocket::LocalSocketError QLocalSocket::socketError() const -{ Q_D(const QLocalSocket); switch (d->tcpSocket->error()) { case QAbstractSocket::ConnectionRefusedError: diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 2e2eb7dee9..55bdd12748 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -461,15 +461,8 @@ void QLocalSocket::disconnectFromServer() d->unixSocket.disconnectFromHost(); } -#if QT_DEPRECATED_SINCE(5, 15) QLocalSocket::LocalSocketError QLocalSocket::error() const { - return socketError(); -} -#endif // QT_DEPRECATED_SINCE(5, 15) - -QLocalSocket::LocalSocketError QLocalSocket::socketError() const -{ Q_D(const QLocalSocket); switch (d->unixSocket.socketError()) { case QAbstractSocket::ConnectionRefusedError: diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 657790519b..4decbd5ded 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -330,15 +330,8 @@ void QLocalSocket::disconnectFromServer() } } -#if QT_DEPRECATED_SINCE(5, 15) QLocalSocket::LocalSocketError QLocalSocket::error() const { - return socketError(); -} -#endif // QT_DEPRECATED_SINCE(5, 15) - -QLocalSocket::LocalSocketError QLocalSocket::socketError() const -{ Q_D(const QLocalSocket); return d->error; } diff --git a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp index 6355fea6ab..272e837ac5 100644 --- a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp +++ b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp @@ -65,8 +65,8 @@ bool runServer(int numberOfConnections) return false; } printf("server: data written\n"); - if (socket->socketError() != QLocalSocket::UnknownSocketError) { - fprintf(stderr, "server: socket error %d\n", socket->socketError()); + if (socket->error() != QLocalSocket::UnknownSocketError) { + fprintf(stderr, "server: socket error %d\n", socket->error()); return false; } } @@ -83,8 +83,8 @@ bool runClient() socket.connectToServer(serverName, QLocalSocket::ReadWrite); if (socket.waitForConnected()) break; - if (socket.socketError() == QLocalSocket::ServerNotFoundError - || socket.socketError() == QLocalSocket::ConnectionRefusedError) { + if (socket.error() == QLocalSocket::ServerNotFoundError + || socket.error() == QLocalSocket::ConnectionRefusedError) { if (connectTimer.elapsed() > 5000) { fprintf(stderr, "client: server not found or connection refused. Giving up.\n"); return false; diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 0c1536bd59..732f7eef00 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -195,7 +195,7 @@ private slots: void slotError(QLocalSocket::LocalSocketError newError) { QVERIFY(errorString() != QLatin1String("Unknown error")); - QCOMPARE(socketError(), newError); + QCOMPARE(error(), newError); } void slotStateChanged(QLocalSocket::LocalSocketState newState) { @@ -256,7 +256,7 @@ void tst_QLocalSocket::socket_basic() QCOMPARE(socket.canReadLine(), false); socket.close(); socket.disconnectFromServer(); - QCOMPARE(QLocalSocket::UnknownSocketError, socket.socketError()); + QCOMPARE(QLocalSocket::UnknownSocketError, socket.error()); QVERIFY(!socket.errorString().isEmpty()); QCOMPARE(socket.flush(), false); QCOMPARE(socket.isValid(), false); @@ -375,13 +375,13 @@ void tst_QLocalSocket::listenAndConnect() QVERIFY(socket->waitForConnected()); QVERIFY(socket->isValid()); QCOMPARE(socket->errorString(), QString("Unknown error")); - QCOMPARE(socket->socketError(), QLocalSocket::UnknownSocketError); + QCOMPARE(socket->error(), QLocalSocket::UnknownSocketError); QCOMPARE(socket->state(), QLocalSocket::ConnectedState); //QVERIFY(socket->socketDescriptor() != -1); QCOMPARE(spyError.count(), 0); } else { QVERIFY(!socket->errorString().isEmpty()); - QVERIFY(socket->socketError() != QLocalSocket::UnknownSocketError); + QVERIFY(socket->error() != QLocalSocket::UnknownSocketError); QCOMPARE(socket->state(), QLocalSocket::UnconnectedState); //QCOMPARE(socket->socketDescriptor(), -1); QCOMPARE(qvariant_cast<QLocalSocket::LocalSocketError>(spyError.first()[0]), |