Fix build with 'udpsocket' feature disabled

Wrap related code in QNativeSocketEngine and the tuiotouch
plugin in conditionals.

Change-Id: Ic6861b1c6a9e041fa8a50f96149f7280473a9fba
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Alex Trotsenko 2015-10-22 20:04:21 +03:00
parent 9daef8a54c
commit be2e993a9a
3 changed files with 31 additions and 23 deletions

View File

@ -651,6 +651,24 @@ int QNativeSocketEngine::accept()
return d->nativeAccept();
}
/*!
Returns the number of bytes that are currently available for
reading. On error, -1 is returned.
For UDP sockets, this function returns the accumulated size of all
pending datagrams, and it is therefore more useful for UDP sockets
to call hasPendingDatagrams() and pendingDatagramSize().
*/
qint64 QNativeSocketEngine::bytesAvailable() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
return d->nativeBytesAvailable();
}
#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE
/*!
@ -712,23 +730,6 @@ bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface)
#endif // QT_NO_NETWORKINTERFACE
/*!
Returns the number of bytes that are currently available for
reading. On error, -1 is returned.
For UDP sockets, this function returns the accumulated size of all
pending datagrams, and it is therefore more useful for UDP sockets
to call hasPendingDatagrams() and pendingDatagramSize().
*/
qint64 QNativeSocketEngine::bytesAvailable() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
return d->nativeBytesAvailable();
}
/*!
Returns \c true if there is at least one datagram pending. This
function is only called by UDP sockets, where a datagram can have
@ -810,6 +811,7 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size,
Q_CHECK_TYPE(QNativeSocketEngine::writeDatagram(), QAbstractSocket::UdpSocket, -1);
return d->nativeSendDatagram(data, size, d->adjustAddressProtocol(host), port);
}
#endif // QT_NO_UDPSOCKET
/*!
Writes a block of \a size bytes from \a data to the socket.

View File

@ -119,6 +119,12 @@ public:
int accept() Q_DECL_OVERRIDE;
void close() Q_DECL_OVERRIDE;
qint64 bytesAvailable() const Q_DECL_OVERRIDE;
qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE
bool joinMulticastGroup(const QHostAddress &groupAddress,
const QNetworkInterface &iface) Q_DECL_OVERRIDE;
@ -128,17 +134,13 @@ public:
bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
#endif
qint64 bytesAvailable() const Q_DECL_OVERRIDE;
qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0,
quint16 *port = 0) Q_DECL_OVERRIDE;
qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &addr,
quint16 port) Q_DECL_OVERRIDE;
bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
#endif // QT_NO_UDPSOCKET
qint64 bytesToWrite() const Q_DECL_OVERRIDE;

View File

@ -1,5 +1,7 @@
TEMPLATE = subdirs
load(qfeatures)
contains(QT_CONFIG, evdev) {
SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet
}
@ -8,7 +10,9 @@ contains(QT_CONFIG, tslib) {
SUBDIRS += tslib
}
SUBDIRS += tuiotouch
!contains(QT_DISABLED_FEATURES, udpsocket) {
SUBDIRS += tuiotouch
}
contains(QT_CONFIG, libinput) {
SUBDIRS += libinput