While most of the functionality was already in place, it turns out
that we need to enable loading/saving PeerPtr from/to a QVariant in
order for SignalProxy to work properly.
I'm honestly not sure why it seemed to work without this when implementing
the TransferManager, but it's obvious it's required.
{
return _authHandler;
}
+
+
+// Note that we need to use a fixed-size integer instead of uintptr_t, in order
+// to avoid issues with different architectures for client and core.
+// In practice, we'll never really have to restore the real value of a PeerPtr from
+// a QVariant.
+QDataStream &operator<<(QDataStream &out, PeerPtr ptr)
+{
+ out << reinterpret_cast<quint64>(ptr);
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PeerPtr &ptr)
+{
+ quint64 value;
+ in >> value;
+ ptr = reinterpret_cast<PeerPtr>(value);
+ return in;
+}
typedef Peer * PeerPtr;
Q_DECLARE_METATYPE(PeerPtr)
+QDataStream &operator<<(QDataStream &out, PeerPtr ptr);
+QDataStream &operator>>(QDataStream &in, PeerPtr &ptr);
+
// Template method needed in the header
template<typename T> inline
#include "logger.h"
#include "message.h"
#include "network.h"
+#include "peer.h"
#include "protocol.h"
#include "syncableobject.h"
#include "types.h"
qRegisterMetaTypeStreamOperators<MsgId>("MsgId");
qRegisterMetaType<Protocol::SessionState>("Protocol::SessionState");
+ qRegisterMetaType<PeerPtr>("PeerPtr");
+ qRegisterMetaTypeStreamOperators<PeerPtr>("PeerPtr");
// Versions of Qt prior to 4.7 didn't define QVariant as a meta type
if (!QMetaType::type("QVariant")) {