Fixed a bug that prevented our custom Message type to be used with QDataStream,
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 24 Oct 2006 11:29:19 +0000 (11:29 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 24 Oct 2006 11:29:19 +0000 (11:29 +0000)
causing havoc when trying to use gui and core separately.
Apparently you have to separately register the stream operators with the QMetaObject
system.

gui/channelwidget.ui
main/CMakeLists.txt
main/global.cpp
main/message.cpp [moved from network/message.cpp with 100% similarity]
main/message.h [moved from network/message.h with 94% similarity]
network/CMakeLists.txt

index ffea438..a821979 100644 (file)
        <bool>false</bool>
       </property>
       <property name="animated" >
-       <bool>true</bool>
+       <bool>false</bool>
       </property>
       <property name="columnCount" >
        <number>1</number>
index 4f38f8c..bfdb7af 100644 (file)
@@ -1,5 +1,5 @@
-SET(main_SRCS global.cpp logger.cpp util.cpp)
-SET(main_HDRS util.h)
+SET(main_SRCS global.cpp logger.cpp util.cpp message.cpp)
+SET(main_HDRS util.h message.h)
 SET(main_MOCS global.h logger.h)
 
 QT4_WRAP_CPP(_MOC ${main_MOCS})
index 25eba7e..962ac41 100644 (file)
@@ -32,6 +32,7 @@ Global::Global() {
   if(global) qFatal("Trying to instantiate more than one Global object!");
   qInstallMsgHandler(messageHandler);
   qRegisterMetaType<Message>("Message");
+  qRegisterMetaTypeStreamOperators<Message>("Message");
   //initIconMap();
 }
 
similarity index 100%
rename from network/message.cpp
rename to main/message.cpp
similarity index 94%
rename from network/message.h
rename to main/message.h
index c9f55a4..9eb182a 100644 (file)
@@ -39,6 +39,9 @@ struct Message {
 
 };
 
+QDataStream &operator<<(QDataStream &out, const Message &msg);
+QDataStream &operator>>(QDataStream &in, Message &msg);
+
 Q_DECLARE_METATYPE(Message)
 
 #endif
index 20b0c90..0ce6c67 100644 (file)
@@ -1,5 +1,5 @@
-SET(network_SRCS server.cpp buffer.cpp message.cpp)
-SET(network_HDRS message.h)
+SET(network_SRCS server.cpp buffer.cpp)
+SET(network_HDRS)
 SET(network_MOCS server.h buffer.h)
 
 QT4_WRAP_CPP(_MOC ${network_MOCS})