diff options
-rw-r--r-- | src/webchannel/qwebchannel.cpp | 12 | ||||
-rw-r--r-- | src/webchannel/qwebchannel.h | 3 | ||||
-rw-r--r-- | src/webchannel/qwebchannelsocket.cpp | 1 | ||||
-rw-r--r-- | src/webchannel/qwebchannelsocket_p.h | 1 |
4 files changed, 5 insertions, 12 deletions
diff --git a/src/webchannel/qwebchannel.cpp b/src/webchannel/qwebchannel.cpp index 026b31e..f7a2c5f 100644 --- a/src/webchannel/qwebchannel.cpp +++ b/src/webchannel/qwebchannel.cpp @@ -73,7 +73,9 @@ QWebChannel::QWebChannel(QObject *parent) connect(d->socket, SIGNAL(failed(QString)), SIGNAL(failed(QString))); connect(d->socket, SIGNAL(initialized()), - SLOT(onInitialized())); + SIGNAL(initialized())); + connect(d->socket, SIGNAL(baseUrlChanged(QString)), + SIGNAL(baseUrlChanged(QString))); connect(d->socket, SIGNAL(pongReceived()), SIGNAL(pongReceived())); @@ -131,12 +133,6 @@ void QWebChannel::setBlockUpdates(bool block) d->publisher->setBlockUpdates(block); } -void QWebChannel::onInitialized() -{ - emit initialized(); - emit baseUrlChanged(d->socket->m_baseUrl); -} - void QWebChannel::respond(const QJsonValue& messageId, const QJsonValue& data) const { d->sendJSONMessage(messageId, data, true); @@ -156,5 +152,3 @@ void QWebChannel::ping() const { d->socket->ping(); } - -#include "qwebchannel.moc" diff --git a/src/webchannel/qwebchannel.h b/src/webchannel/qwebchannel.h index ec62208..5c64d6d 100644 --- a/src/webchannel/qwebchannel.h +++ b/src/webchannel/qwebchannel.h @@ -109,9 +109,6 @@ public slots: void sendRawMessage(const QString& rawMessage) const; void ping() const; -private slots: - void onInitialized(); - private: QScopedPointer<QWebChannelPrivate> d; friend class QmlWebChannel; diff --git a/src/webchannel/qwebchannelsocket.cpp b/src/webchannel/qwebchannelsocket.cpp index c5275d0..c94efc0 100644 --- a/src/webchannel/qwebchannelsocket.cpp +++ b/src/webchannel/qwebchannelsocket.cpp @@ -91,6 +91,7 @@ void QWebChannelSocket::init() m_baseUrl = QStringLiteral("127.0.0.1:%1%2").arg(port()).arg(QString::fromLatin1(m_secret)); emit initialized(); + emit baseUrlChanged(m_baseUrl); } void QWebChannelSocket::socketError() diff --git a/src/webchannel/qwebchannelsocket_p.h b/src/webchannel/qwebchannelsocket_p.h index 234c200..1de73d7 100644 --- a/src/webchannel/qwebchannelsocket_p.h +++ b/src/webchannel/qwebchannelsocket_p.h @@ -62,6 +62,7 @@ public: signals: void failed(const QString &reason); void initialized(); + void baseUrlChanged(const QString &baseUrl); protected: bool isValid(const HeaderData &connection) Q_DECL_OVERRIDE; |