X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fbufferinfo.h;h=f5a9f380aa10fb0aae2673bb7bdab6999007e567;hp=b74305490d742ba94cf0e7384257c69d7b462c5c;hb=b2efa6809ee09b70be19c0f66e0fcd6e57bf64bc;hpb=902c95728306e5ba115de84800fc8d5d239c9d62 diff --git a/src/common/bufferinfo.h b/src/common/bufferinfo.h index b7430549..f5a9f380 100644 --- a/src/common/bufferinfo.h +++ b/src/common/bufferinfo.h @@ -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 * @@ -17,34 +17,54 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _BUFFERINFO_H_ -#define _BUFFERINFO_H_ +#ifndef BUFFERINFO_H +#define BUFFERINFO_H #include +#include "types.h" class QString; class QDataStream; class BufferInfo { public: - BufferInfo(); - BufferInfo(uint id, uint networkid, uint gid = 0, QString net = QString(), QString buf = QString()); + enum Type { + InvalidBuffer = 0x00, + StatusBuffer = 0x01, + ChannelBuffer = 0x02, + QueryBuffer = 0x04, + GroupBuffer = 0x08 + }; - inline uint uid() const { return _id; } - inline uint networkId() const { return _netid; } - inline uint groupId() const { return _gid; } - inline QString network() const { return _networkName; } - QString buffer() const; + enum Activity { + NoActivity = 0x00, + OtherActivity = 0x01, + NewMessage = 0x02, + Highlight = 0x40 + }; + Q_DECLARE_FLAGS(ActivityLevel, Activity) + + BufferInfo(); + BufferInfo(BufferId id, NetworkId networkid, Type type, uint gid = 0, QString buf = QString()); + + static BufferInfo fakeStatusBuffer(NetworkId networkId); + + inline bool isValid() const { return _bufferId != 0; } + inline BufferId bufferId() const { return _bufferId; } + inline NetworkId networkId() const { return _netid; } + inline Type type() const { return _type; } + inline uint groupId() const { return _groupId; } + QString bufferName() const; - void setGroupId(uint gid) { _gid = gid; } + void setGroupId(uint gid) { _groupId = gid; } - inline bool operator==(const BufferInfo &other) const { return _id == other._id; } + inline bool operator==(const BufferInfo &other) const { return _bufferId == other._bufferId; } private: - uint _id; - uint _netid; - uint _gid; - QString _networkName; // WILL BE REMOVED + BufferId _bufferId; + NetworkId _netid; + Type _type; + uint _groupId; QString _bufferName; friend uint qHash(const BufferInfo &); @@ -54,8 +74,10 @@ private: QDataStream &operator<<(QDataStream &out, const BufferInfo &bufferInfo); QDataStream &operator>>(QDataStream &in, BufferInfo &bufferInfo); +QDebug operator<<(QDebug dbg, const BufferInfo &b); -Q_DECLARE_METATYPE(BufferInfo); +Q_DECLARE_METATYPE(BufferInfo) +Q_DECLARE_OPERATORS_FOR_FLAGS(BufferInfo::ActivityLevel) uint qHash(const BufferInfo &);