/*! Construct a declarative camera object using \a parent object. */ QDeclarativeCamera::QDeclarativeCamera(QObject *parent) : QObject(parent), m_camera(0), m_pendingState(ActiveState), m_componentComplete(false) { m_camera = new QCamera(this); m_imageCapture = new QDeclarativeCameraCapture(m_camera, this); m_videoRecorder = new QDeclarativeCameraRecorder(m_camera, this); m_exposure = new QDeclarativeCameraExposure(m_camera, this); m_flash = new QDeclarativeCameraFlash(m_camera, this); m_focus = new QDeclarativeCameraFocus(m_camera, this); m_imageProcessing = new QDeclarativeCameraImageProcessing(m_camera, this); connect(m_camera, SIGNAL(captureModeChanged(QCamera::CaptureModes)), this, SIGNAL(captureModeChanged())); connect(m_camera, SIGNAL(lockStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)), this, SIGNAL(lockStatusChanged())); connect(m_camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(_q_updateState(QCamera::State))); connect(m_camera, SIGNAL(statusChanged(QCamera::Status)), this, SIGNAL(cameraStatusChanged())); connect(m_camera, SIGNAL(error(QCamera::Error)), this, SLOT(_q_error(QCamera::Error))); connect(m_camera, SIGNAL(availabilityChanged(QMultimedia::AvailabilityStatus)), this, SLOT(_q_availabilityChanged(QMultimedia::AvailabilityStatus))); connect(m_camera->focus(), SIGNAL(opticalZoomChanged(qreal)), this, SIGNAL(opticalZoomChanged(qreal))); connect(m_camera->focus(), SIGNAL(digitalZoomChanged(qreal)), this, SIGNAL(digitalZoomChanged(qreal))); connect(m_camera->focus(), SIGNAL(maximumOpticalZoomChanged(qreal)), this, SIGNAL(maximumOpticalZoomChanged(qreal))); connect(m_camera->focus(), SIGNAL(maximumDigitalZoomChanged(qreal)), this, SIGNAL(maximumDigitalZoomChanged(qreal))); }
QT_BEGIN_NAMESPACE // TODO: Put channel specific stuff here so it does not polute qhttpnetworkconnection.cpp void QHttpNetworkConnectionChannel::init() { #ifndef QT_NO_OPENSSL if (connection->d_func()->encrypt) socket = new QSslSocket; else socket = new QTcpSocket; #else socket = new QTcpSocket; #endif // limit the socket read buffer size. we will read everything into // the QHttpNetworkReply anyway, so let's grow only that and not // here and there. socket->setReadBufferSize(64*1024); QObject::connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64)), Qt::DirectConnection); QObject::connect(socket, SIGNAL(connected()), this, SLOT(_q_connected()), Qt::DirectConnection); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(_q_readyRead()), Qt::DirectConnection); QObject::connect(socket, SIGNAL(disconnected()), this, SLOT(_q_disconnected()), Qt::DirectConnection); QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_error(QAbstractSocket::SocketError)), Qt::DirectConnection); #ifndef QT_NO_NETWORKPROXY QObject::connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(_q_proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), Qt::DirectConnection); #endif #ifndef QT_NO_OPENSSL QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); if (sslSocket) { // won't be a sslSocket if encrypt is false QObject::connect(sslSocket, SIGNAL(encrypted()), this, SLOT(_q_encrypted()), Qt::DirectConnection); QObject::connect(sslSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(_q_sslErrors(QList<QSslError>)), Qt::DirectConnection); QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)), this, SLOT(_q_encryptedBytesWritten(qint64)), Qt::DirectConnection); } #endif }
ChatClient::ChatClient(QObject *parent) : QXmppClient(parent) , d(new ChatClientPrivate) { bool check; Q_UNUSED(check); check = connect(this, SIGNAL(connected()), this, SLOT(_q_connected())); Q_ASSERT(check); check = connect(this, SIGNAL(error(QXmppClient::Error)), this, SLOT(_q_error(QXmppClient::Error))); Q_ASSERT(check); check = connect(this, SIGNAL(messageReceived(QXmppMessage)), this, SLOT(_q_messageReceived(QXmppMessage))); Q_ASSERT(check); // DNS lookups check = connect(&d->dns, SIGNAL(finished()), this, SLOT(_q_dnsLookupFinished())); Q_ASSERT(check); // service discovery d->discoManager = findExtension<QXmppDiscoveryManager>(); check = connect(d->discoManager, SIGNAL(infoReceived(QXmppDiscoveryIq)), this, SLOT(_q_discoveryInfoReceived(QXmppDiscoveryIq))); Q_ASSERT(check); check = connect(d->discoManager, SIGNAL(itemsReceived(QXmppDiscoveryIq)), this, SLOT(_q_discoveryItemsReceived(QXmppDiscoveryIq))); Q_ASSERT(check); // server time d->timeManager = findExtension<QXmppEntityTimeManager>(); check = connect(d->timeManager, SIGNAL(timeReceived(QXmppEntityTimeIq)), this, SLOT(_q_timeReceived(QXmppEntityTimeIq))); Q_ASSERT(check); // file transfers transferManager()->setSupportedMethods(QXmppTransferJob::SocksMethod); // multimedia calls callManager(); // diagnostics diagnosticManager(); qDebug("ChatClient 0x%llx created", reinterpret_cast<qint64>(this)); chatClients.append(this); theClientObserver()->clientCreated(this); }
void QDeclarativeRadioData::connectSignals() { connect(m_radioData, SIGNAL(programTypeChanged(QRadioData::ProgramType)), this, SLOT(_q_programTypeChanged(QRadioData::ProgramType))); connect(m_radioData, SIGNAL(stationIdChanged(QString)), this, SIGNAL(stationIdChanged(QString))); connect(m_radioData, SIGNAL(programTypeNameChanged(QString)), this, SIGNAL(programTypeNameChanged(QString))); connect(m_radioData, SIGNAL(stationNameChanged(QString)), this, SIGNAL(stationNameChanged(QString))); connect(m_radioData, SIGNAL(radioTextChanged(QString)), this, SIGNAL(radioTextChanged(QString))); connect(m_radioData, SIGNAL(alternativeFrequenciesEnabledChanged(bool)), this, SIGNAL(alternativeFrequenciesEnabledChanged(bool))); // Since the radio data type depends on the service for the tuner, the availability is also dictated from the tuner connect(m_radioTuner, SIGNAL(availabilityChanged(QMultimedia::AvailabilityStatus)), this, SLOT(_q_availabilityChanged(QMultimedia::AvailabilityStatus))); connect(m_radioData, SIGNAL(error(QRadioData::Error)), this, SLOT(_q_error(QRadioData::Error))); }
void QDeclarativeAudio::classBegin() { m_player = new QMediaPlayer(this); connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(_q_statusChanged())); connect(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(_q_statusChanged())); connect(m_player, SIGNAL(mediaChanged(QMediaContent)), this, SIGNAL(sourceChanged())); connect(m_player, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged())); connect(m_player, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged())); connect(m_player, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged())); connect(m_player, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged())); connect(m_player, SIGNAL(bufferStatusChanged(int)), this, SIGNAL(bufferProgressChanged())); connect(m_player, SIGNAL(seekableChanged(bool)), this, SIGNAL(seekableChanged())); connect(m_player, SIGNAL(playbackRateChanged(qreal)), this, SIGNAL(playbackRateChanged())); connect(m_player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(_q_error(QMediaPlayer::Error))); connect(m_player, SIGNAL(audioAvailableChanged(bool)), this, SIGNAL(hasAudioChanged())); connect(m_player, SIGNAL(videoAvailableChanged(bool)), this, SIGNAL(hasVideoChanged())); m_error = m_player->availability() == QMultimedia::ServiceMissing ? QMediaPlayer::ServiceMissingError : QMediaPlayer::NoError; connect(m_player, SIGNAL(availabilityChanged(QMultimedia::AvailabilityStatus)), this, SLOT(_q_availabilityChanged(QMultimedia::AvailabilityStatus))); m_metaData.reset(new QDeclarativeMediaMetaData(m_player)); connect(m_player, SIGNAL(metaDataChanged()), m_metaData.data(), SIGNAL(metaDataChanged())); emit mediaObjectChanged(); }
void IrcSession::setSocket(QAbstractSocket* socket) { Q_D(IrcSession); if (d->socket != socket) { if (d->socket) { d->socket->disconnect(this); if (d->socket->parent() == this) d->socket->deleteLater(); } d->socket = socket; if (socket) { connect(socket, SIGNAL(connected()), this, SLOT(_q_connected())); connect(socket, SIGNAL(disconnected()), this, SLOT(_q_disconnected())); connect(socket, SIGNAL(readyRead()), this, SLOT(_q_readData())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_error(QAbstractSocket::SocketError))); connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(_q_state(QAbstractSocket::SocketState))); } } }
//private slots void QHttpNetworkConnectionChannel::_q_readyRead() { if (socket->state() == QAbstractSocket::ConnectedState && socket->bytesAvailable() == 0) { // We got a readyRead but no bytes are available.. // This happens for the Unbuffered QTcpSocket // Also check if socket is in ConnectedState since // this function may also be invoked via the event loop. char c; qint64 ret = socket->peek(&c, 1); if (ret < 0) { _q_error(socket->error()); // We still need to handle the reply so it emits its signals etc. if (reply) _q_receiveReply(); return; } } if (isSocketWaiting() || isSocketReading()) { state = QHttpNetworkConnectionChannel::ReadingState; if (reply) _q_receiveReply(); } }
void QHttpNetworkConnectionChannel::init() { #ifndef QT_NO_SSL if (connection->d_func()->encrypt) socket = new QSslSocket; else socket = new QTcpSocket; #else socket = new QTcpSocket; #endif #ifndef QT_NO_BEARERMANAGEMENT //push session down to socket if (networkSession) socket->setProperty("_q_networksession", QVariant::fromValue(networkSession)); #endif #ifndef QT_NO_NETWORKPROXY // Set by QNAM anyway, but let's be safe here socket->setProxy(QNetworkProxy::NoProxy); #endif // After some back and forth in all the last years, this is now a DirectConnection because otherwise // the state inside the *Socket classes gets messed up, also in conjunction with the socket notifiers // which behave slightly differently on Windows vs Linux QObject::connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64)), Qt::DirectConnection); QObject::connect(socket, SIGNAL(connected()), this, SLOT(_q_connected()), Qt::DirectConnection); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(_q_readyRead()), Qt::DirectConnection); // The disconnected() and error() signals may already come // while calling connectToHost(). // In case of a cached hostname or an IP this // will then emit a signal to the user of QNetworkReply // but cannot be caught because the user did not have a chance yet // to connect to QNetworkReply's signals. qRegisterMetaType<QAbstractSocket::SocketError>(); QObject::connect(socket, SIGNAL(disconnected()), this, SLOT(_q_disconnected()), Qt::DirectConnection); QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_error(QAbstractSocket::SocketError)), Qt::DirectConnection); #ifndef QT_NO_NETWORKPROXY QObject::connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(_q_proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), Qt::DirectConnection); #endif #ifndef QT_NO_SSL QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); if (sslSocket) { // won't be a sslSocket if encrypt is false QObject::connect(sslSocket, SIGNAL(encrypted()), this, SLOT(_q_encrypted()), Qt::DirectConnection); QObject::connect(sslSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(_q_sslErrors(QList<QSslError>)), Qt::DirectConnection); QObject::connect(sslSocket, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), this, SLOT(_q_preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), Qt::DirectConnection); QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)), this, SLOT(_q_encryptedBytesWritten(qint64)), Qt::DirectConnection); if (ignoreAllSslErrors) sslSocket->ignoreSslErrors(); if (!ignoreSslErrorsList.isEmpty()) sslSocket->ignoreSslErrors(ignoreSslErrorsList); if (!sslConfiguration.isNull()) sslSocket->setSslConfiguration(sslConfiguration); } else {
void QHttpNetworkConnectionChannel::init() { #ifndef QT_NO_OPENSSL if (connection->d_func()->encrypt) socket = new QSslSocket; else socket = new QTcpSocket; #else socket = new QTcpSocket; #endif #ifndef QT_NO_BEARERMANAGEMENT //push session down to socket if (networkSession) socket->setProperty("_q_networksession", QVariant::fromValue(networkSession)); #endif #ifndef QT_NO_NETWORKPROXY // Set by QNAM anyway, but let's be safe here socket->setProxy(QNetworkProxy::NoProxy); #endif QObject::connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64)), Qt::DirectConnection); QObject::connect(socket, SIGNAL(connected()), this, SLOT(_q_connected()), Qt::DirectConnection); QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(_q_readyRead()), Qt::DirectConnection); // The disconnected() and error() signals may already come // while calling connectToHost(). // In case of a cached hostname or an IP this // will then emit a signal to the user of QNetworkReply // but cannot be caught because the user did not have a chance yet // to connect to QNetworkReply's signals. qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError"); QObject::connect(socket, SIGNAL(disconnected()), this, SLOT(_q_disconnected()), Qt::QueuedConnection); QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_error(QAbstractSocket::SocketError)), Qt::QueuedConnection); #ifndef QT_NO_NETWORKPROXY QObject::connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(_q_proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), Qt::DirectConnection); #endif #ifndef QT_NO_OPENSSL QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); if (sslSocket) { // won't be a sslSocket if encrypt is false QObject::connect(sslSocket, SIGNAL(encrypted()), this, SLOT(_q_encrypted()), Qt::DirectConnection); QObject::connect(sslSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(_q_sslErrors(QList<QSslError>)), Qt::DirectConnection); QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)), this, SLOT(_q_encryptedBytesWritten(qint64)), Qt::DirectConnection); } #endif }