X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.h;h=8c36233f8ceb9b5aabd62a0b6340dc82946450c2;hb=f9568f94f1df63d51d7862a0d0270d0b0a93f0cc;hp=5326a4b3076c953c5739d0e361065e87a9fa6039;hpb=770b7ef54b03f3ebd1e29a58b4757505e1809b2d;p=quassel.git diff --git a/src/client/networkmodel.h b/src/client/networkmodel.h index 5326a4b3..8c36233f 100644 --- a/src/client/networkmodel.h +++ b/src/client/networkmodel.h @@ -32,6 +32,8 @@ class BufferInfo; #include "selectionmodelsynchronizer.h" #include "modelpropertymapper.h" +#include "clientsettings.h" + class MappedSelectionModel; class QAbstractItemView; class Network; @@ -60,15 +62,9 @@ public: QString bufferName() const; QString topic() const; int nickCount() const; - - enum Type { - StatusType, - ChannelType, - QueryType - }; bool isStatusBuffer() const; - Type bufferType() const; + BufferInfo::Type bufferType() const; bool isActive() const; @@ -81,9 +77,13 @@ public: Q_DECLARE_FLAGS(ActivityLevel, Activity) ActivityLevel activity() const; - void setActivity(const ActivityLevel &level); + bool setActivity(const ActivityLevel &level); void updateActivity(const ActivityLevel &level); + void setLastMsgInsert(QDateTime msgDate); + bool setLastSeen(); + QDateTime lastSeen(); + public slots: void setTopic(const QString &topic); void join(IrcUser *ircUser); @@ -95,11 +95,13 @@ public slots: private slots: void ircChannelDestroyed(); + void ircUserDestroyed(); private: BufferInfo _bufferInfo; ActivityLevel _activity; - Type _type; + QDateTime _lastMsgInsert; + QDateTime _lastSeen; QPointer _ircChannel; }; @@ -132,6 +134,8 @@ public slots: void attachNetwork(Network *network); void attachIrcChannel(const QString &channelName); + + void setActive(bool connected); private: NetworkId _networkId; @@ -154,6 +158,7 @@ public: virtual QVariant data(int column, int role) const; void addUser(IrcUser *ircUser); + bool removeUser(IrcUser *ircUser); static int categoryFromModes(const QString &modes); @@ -180,6 +185,8 @@ public: IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent); QString nickName() const; + bool isActive() const; + IrcUser *ircUser(); virtual quint64 id() const; virtual QVariant data(int column, int role) const; @@ -189,7 +196,8 @@ private slots: void setNick(QString newNick); private: - IrcUser *_ircUser; + QPointer _ircUser; + quint64 _id; }; @@ -207,7 +215,8 @@ public: BufferIdRole, NetworkIdRole, BufferInfoRole, - ItemTypeRole + ItemTypeRole, + LastSeenRole }; enum itemTypes { @@ -233,10 +242,13 @@ public: //Buffer *getBufferByIndex(const QModelIndex &) const; QModelIndex bufferIndex(BufferId bufferId); + const Network *networkByIndex(const QModelIndex &index) const; + public slots: void bufferUpdated(BufferInfo bufferInfo); void updateBufferActivity(const Message &msg); - + void networkRemoved(const NetworkId &networkId); + private: QModelIndex networkIndex(NetworkId networkId); NetworkItem *networkItem(NetworkId networkId);