QAbstractSocket: Resolve remaining Qt6 TODOs
Change-Id: Id257f0721c1cd5fcbafa9297bae0251a2d68e366 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
081207dc37
commit
0011a45102
@ -397,12 +397,11 @@ bool PeerWireClient::canTransferMore() const
|
|||||||
|| !outgoingBuffer.isEmpty() || !pendingBlocks.isEmpty();
|
|| !outgoingBuffer.isEmpty() || !pendingBlocks.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerWireClient::connectToHost(const QHostAddress &address,
|
void PeerWireClient::connectToHost(const QString &address, quint16 port, OpenMode openMode,
|
||||||
quint16 port, OpenMode openMode)
|
NetworkLayerProtocol protocol)
|
||||||
|
|
||||||
{
|
{
|
||||||
setOpenMode(openMode);
|
setOpenMode(openMode);
|
||||||
socket.connectToHost(address, port, openMode);
|
socket.connectToHost(address, port, openMode, protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerWireClient::diconnectFromHost()
|
void PeerWireClient::diconnectFromHost()
|
||||||
|
@ -128,8 +128,9 @@ public:
|
|||||||
|
|
||||||
void setReadBufferSize(qint64 size) override;
|
void setReadBufferSize(qint64 size) override;
|
||||||
|
|
||||||
void connectToHost(const QHostAddress &address,
|
using QTcpSocket::connectToHost;
|
||||||
quint16 port, OpenMode openMode = ReadWrite) override;
|
void connectToHost(const QString &address, quint16 port, OpenMode openMode = ReadWrite,
|
||||||
|
NetworkLayerProtocol protocol = AnyIPProtocol) override;
|
||||||
void diconnectFromHost();
|
void diconnectFromHost();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -65,17 +65,5 @@ if (socket->state() == QAbstractSocket::UnconnectedState
|
|||||||
|
|
||||||
|
|
||||||
//! [2]
|
//! [2]
|
||||||
// This slot is connected to QAbstractSocket::readyRead()
|
|
||||||
void SocketClass::readyReadSlot()
|
|
||||||
{
|
|
||||||
while (!socket.atEnd()) {
|
|
||||||
QByteArray data = socket.read(100);
|
|
||||||
....
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//! [2]
|
|
||||||
|
|
||||||
|
|
||||||
//! [3]
|
|
||||||
socket->setProxy(QNetworkProxy::NoProxy);
|
socket->setProxy(QNetworkProxy::NoProxy);
|
||||||
//! [3]
|
//! [2]
|
||||||
|
@ -1864,22 +1864,6 @@ QString QAbstractSocket::peerName() const
|
|||||||
return d->peerName.isEmpty() ? d->hostName : d->peerName;
|
return d->peerName.isEmpty() ? d->hostName : d->peerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns \c true if a line of data can be read from the socket;
|
|
||||||
otherwise returns \c false.
|
|
||||||
|
|
||||||
\sa readLine()
|
|
||||||
*/
|
|
||||||
bool QAbstractSocket::canReadLine() const
|
|
||||||
{
|
|
||||||
bool hasLine = QIODevice::canReadLine();
|
|
||||||
#if defined (QABSTRACTSOCKET_DEBUG)
|
|
||||||
qDebug("QAbstractSocket::canReadLine() == %s, buffer size = %lld, size = %lld",
|
|
||||||
hasLine ? "true" : "false", d_func()->buffer.size(), d_func()->buffer.size());
|
|
||||||
#endif
|
|
||||||
return hasLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the native socket descriptor of the QAbstractSocket object
|
Returns the native socket descriptor of the QAbstractSocket object
|
||||||
if this is available; otherwise returns -1.
|
if this is available; otherwise returns -1.
|
||||||
@ -2413,23 +2397,6 @@ bool QAbstractSocket::isSequential() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \reimp
|
|
||||||
|
|
||||||
Returns \c true if no more data is currently
|
|
||||||
available for reading; otherwise returns \c false.
|
|
||||||
|
|
||||||
This function is most commonly used when reading data from the
|
|
||||||
socket in a loop. For example:
|
|
||||||
|
|
||||||
\snippet code/src_network_socket_qabstractsocket.cpp 2
|
|
||||||
|
|
||||||
\sa bytesAvailable(), readyRead()
|
|
||||||
*/
|
|
||||||
bool QAbstractSocket::atEnd() const
|
|
||||||
{
|
|
||||||
return QIODevice::atEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
This function writes as much as possible from the internal write buffer to
|
This function writes as much as possible from the internal write buffer to
|
||||||
the underlying network socket, without blocking. If any data was written,
|
the underlying network socket, without blocking. If any data was written,
|
||||||
@ -2882,7 +2849,7 @@ void QAbstractSocket::setSocketError(SocketError socketError)
|
|||||||
To disable the use of a proxy for this socket, use the
|
To disable the use of a proxy for this socket, use the
|
||||||
QNetworkProxy::NoProxy proxy type:
|
QNetworkProxy::NoProxy proxy type:
|
||||||
|
|
||||||
\snippet code/src_network_socket_qabstractsocket.cpp 3
|
\snippet code/src_network_socket_qabstractsocket.cpp 2
|
||||||
|
|
||||||
The default value for the proxy is QNetworkProxy::DefaultProxy,
|
The default value for the proxy is QNetworkProxy::DefaultProxy,
|
||||||
which means the socket will use the application settings: if a
|
which means the socket will use the application settings: if a
|
||||||
|
@ -146,13 +146,12 @@ public:
|
|||||||
PauseModes pauseMode() const;
|
PauseModes pauseMode() const;
|
||||||
void setPauseMode(PauseModes pauseMode);
|
void setPauseMode(PauseModes pauseMode);
|
||||||
|
|
||||||
// ### Qt6: make the first one virtual
|
virtual bool bind(const QHostAddress &address, quint16 port = 0,
|
||||||
bool bind(const QHostAddress &address, quint16 port = 0, BindMode mode = DefaultForPlatform);
|
BindMode mode = DefaultForPlatform);
|
||||||
bool bind(quint16 port = 0, BindMode mode = DefaultForPlatform);
|
bool bind(quint16 port = 0, BindMode mode = DefaultForPlatform);
|
||||||
|
|
||||||
// ### Qt6: de-virtualize connectToHost(QHostAddress) overload
|
|
||||||
virtual void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
|
virtual void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
|
||||||
virtual void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite);
|
void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite);
|
||||||
virtual void disconnectFromHost();
|
virtual void disconnectFromHost();
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
@ -160,8 +159,6 @@ public:
|
|||||||
qint64 bytesAvailable() const override;
|
qint64 bytesAvailable() const override;
|
||||||
qint64 bytesToWrite() const override;
|
qint64 bytesToWrite() const override;
|
||||||
|
|
||||||
bool canReadLine() const override; // ### Qt6: remove me
|
|
||||||
|
|
||||||
quint16 localPort() const;
|
quint16 localPort() const;
|
||||||
QHostAddress localAddress() const;
|
QHostAddress localAddress() const;
|
||||||
quint16 peerPort() const;
|
quint16 peerPort() const;
|
||||||
@ -187,7 +184,6 @@ public:
|
|||||||
// from QIODevice
|
// from QIODevice
|
||||||
void close() override;
|
void close() override;
|
||||||
bool isSequential() const override;
|
bool isSequential() const override;
|
||||||
bool atEnd() const override; // ### Qt6: remove me
|
|
||||||
bool flush();
|
bool flush();
|
||||||
|
|
||||||
// for synchronous access
|
// for synchronous access
|
||||||
|
Loading…
x
Reference in New Issue
Block a user