+public slots:
+ void detachObject(QObject *obj);
+ void detachSignals(QObject *sender);
+ void detachSlots(QObject *receiver);
+
+protected:
+ void customEvent(QEvent *event);
+ void sync_call__(const SyncableObject *obj, ProxyMode modeType, const char *funcname, va_list ap);
+ void renameObject(const SyncableObject *obj, const QString &newname, const QString &oldname);
+
+private slots:
+ void removePeerBySender();
+ void objectRenamed(const QByteArray &classname, const QString &newname, const QString &oldname);
+ void updateSecureState();
+
+signals:
+ void peerRemoved(Peer *peer);
+ void connected();
+ void disconnected();
+ void objectInitialized(SyncableObject *);
+ void heartBeatIntervalChanged(int secs);
+ void maxHeartBeatCountChanged(int max);
+ void lagUpdated(int lag);
+ void secureStateChanged(bool);
+
+private:
+ template<class T>
+ class PeerMessageEvent;
+
+ void init();
+ void initServer();
+ void initClient();
+
+ static const QMetaObject *metaObject(const QObject *obj);
+
+ void removePeer(Peer *peer);
+ void removeAllPeers();
+
+ template<class T>
+ void dispatch(const T &protoMessage);
+ template<class T>
+ void dispatch(Peer *peer, const T &protoMessage);
+
+ void handle(Peer *peer, const Protocol::SyncMessage &syncMessage);
+ void handle(Peer *peer, const Protocol::RpcCall &rpcCall);
+ void handle(Peer *peer, const Protocol::InitRequest &initRequest);
+ void handle(Peer *peer, const Protocol::InitData &initData);
+
+ template<class T>
+ void handle(Peer *, T) { Q_ASSERT(0); }
+
+ bool invokeSlot(QObject *receiver, int methodId, const QVariantList ¶ms, QVariant &returnValue, Peer *peer = 0);
+ bool invokeSlot(QObject *receiver, int methodId, const QVariantList ¶ms = QVariantList(), Peer *peer = 0);
+
+ void requestInit(SyncableObject *obj);
+ QVariantMap initData(SyncableObject *obj) const;
+ void setInitData(SyncableObject *obj, const QVariantMap &properties);
+
+ static void disconnectDevice(QIODevice *dev, const QString &reason = QString());
+
+ QSet<Peer *> _peers;