X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fglobal.cpp;h=95f43e7b8fb750e512914b0a7ecf3e25706b7950;hp=cbde79cd4c9cffced532979280ae60a08785b8e5;hb=ee6e4f90ce63d7eb3a54937cffb33510398d2349;hpb=2039f5e28eeb431e394f1c2468a26218bd926538 diff --git a/src/common/global.cpp b/src/common/global.cpp index cbde79cd..95f43e7b 100644 --- a/src/common/global.cpp +++ b/src/common/global.cpp @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel IRC Development Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -18,12 +18,16 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include -#include +#include #include "global.h" #include "logger.h" #include "message.h" -#include "util.h" +#include "identity.h" +#include "network.h" +#include "bufferinfo.h" +#include "types.h" +#include "syncableobject.h" extern void messageHandler(QtMsgType type, const char *msg); @@ -46,35 +50,6 @@ void Global::initIconMap() { } */ -/**************************************************************************************/ - -BufferId::BufferId(uint _id, QString _net, QString _buf, uint _gid) : id(_id), gid(_gid), net(_net), buf(_buf) { - - -} - -QString BufferId::buffer() const { - if(isChannelName(buf)) return buf; - else return nickFromMask(buf); -} - -QDataStream &operator<<(QDataStream &out, const BufferId &bufferId) { - out << bufferId.id << bufferId.gid << bufferId.net.toUtf8() << bufferId.buf.toUtf8(); - return out; -} - -QDataStream &operator>>(QDataStream &in, BufferId &bufferId) { - QByteArray n, b; - in >> bufferId.id >> bufferId.gid >> n >> b; - bufferId.net = QString::fromUtf8(n); - bufferId.buf = QString::fromUtf8(b); - return in; -} - -uint qHash(const BufferId &bid) { - return qHash(bid.id); -} - /** * Retrieves an icon determined by its symbolic name. The mapping shall later * be performed by a theme manager or something like that. @@ -88,5 +63,49 @@ uint qHash(const BufferId &bid) { // return 0; //} +//! 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"); + qRegisterMetaType("Message"); + qRegisterMetaType("BufferInfo"); + qRegisterMetaType("NetworkInfo"); + qRegisterMetaType("Identity"); + qRegisterMetaType("Network::ConnectionState"); + + qRegisterMetaTypeStreamOperators("QVariant"); + qRegisterMetaTypeStreamOperators("Message"); + qRegisterMetaTypeStreamOperators("BufferInfo"); + qRegisterMetaTypeStreamOperators("NetworkInfo"); + qRegisterMetaTypeStreamOperators("Identity"); + qRegisterMetaTypeStreamOperators("Network::ConnectionState"); + + qRegisterMetaType("IdentityId"); + qRegisterMetaType("BufferId"); + qRegisterMetaType("NetworkId"); + qRegisterMetaType("UserId"); + qRegisterMetaType("AccountId"); + + qRegisterMetaTypeStreamOperators("IdentityId"); + qRegisterMetaTypeStreamOperators("BufferId"); + qRegisterMetaTypeStreamOperators("NetworkId"); + qRegisterMetaTypeStreamOperators("UserId"); + qRegisterMetaTypeStreamOperators("AccountId"); + +} + +// Static variables + +QString Global::quasselVersion; +QString Global::quasselDate; +uint Global::quasselBuild; +uint Global::clientBuildNeeded; +QString Global::clientVersionNeeded; +uint Global::coreBuildNeeded; +QString Global::coreVersionNeeded; + Global::RunMode Global::runMode; -QString Global::quasselDir; +uint Global::defaultPort;