+//! Register our custom types with Qt's Meta Object System.
+/** This makes them available for QVariant and in signals/slots, among other things.
+ *
+ */
+void Global::registerMetaTypes() {
+ // Complex types
+ qRegisterMetaType<QVariant>("QVariant");
+ qRegisterMetaType<Message>("Message");
+ qRegisterMetaType<BufferInfo>("BufferInfo");
+ qRegisterMetaType<NetworkInfo>("NetworkInfo");
+ qRegisterMetaType<Identity>("Identity");
+ qRegisterMetaType<Network::ConnectionState>("Network::ConnectionState");
+
+ qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
+ qRegisterMetaTypeStreamOperators<Message>("Message");
+ qRegisterMetaTypeStreamOperators<BufferInfo>("BufferInfo");
+ qRegisterMetaTypeStreamOperators<NetworkInfo>("NetworkInfo");
+ qRegisterMetaTypeStreamOperators<Identity>("Identity");
+ qRegisterMetaTypeStreamOperators<qint8>("Network::ConnectionState");
+
+ qRegisterMetaType<IdentityId>("IdentityId");
+ qRegisterMetaType<BufferId>("BufferId");
+ qRegisterMetaType<NetworkId>("NetworkId");
+ qRegisterMetaType<UserId>("UserId");
+ qRegisterMetaType<AccountId>("AccountId");
+ qRegisterMetaType<MsgId>("MsgId");
+
+ qRegisterMetaTypeStreamOperators<IdentityId>("IdentityId");
+ qRegisterMetaTypeStreamOperators<BufferId>("BufferId");
+ qRegisterMetaTypeStreamOperators<NetworkId>("NetworkId");
+ qRegisterMetaTypeStreamOperators<UserId>("UserId");
+ qRegisterMetaTypeStreamOperators<AccountId>("AccountId");
+ qRegisterMetaTypeStreamOperators<MsgId>("MsgId");
+}
+
+//! This includes version.inc and possibly version.gen and sets up our version numbers.
+void Global::setupVersion() {
+
+# include "version.inc"
+# ifdef HAVE_VERSION_GEN
+# include "version.gen"
+# endif
+
+ if(quasselGeneratedVersion.isEmpty()) {
+ quasselVersion = QString("v%1 (unknown rev)").arg(quasselBaseVersion);
+ } else {
+ QStringList parts = quasselGeneratedVersion.split(':');
+ quasselVersion = QString("v%1").arg(parts[0]);
+ if(parts.count() >= 2) quasselVersion.append(QString(" (%1)").arg(parts[1]));
+ }
+ quasselBuildDate = __DATE__;
+ quasselBuildTime = __TIME__;
+}
+
+// Static variables
+
+QString Global::quasselVersion;
+QString Global::quasselBaseVersion;
+QString Global::quasselGeneratedVersion;
+QString Global::quasselBuildDate;
+QString Global::quasselBuildTime;
+uint Global::protocolVersion;
+uint Global::clientNeedsProtocol;
+uint Global::coreNeedsProtocol;
+