X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.h;h=b2d3a3b8db8f6f56f2c85c3f9c7aee8726d4272c;hb=ccd09eb6ca7377f51d57c546f99c9b1c30ef97c1;hp=0cd97cdd9dc52dcdea4cf319ddd8f47703325c21;hpb=5b686746c880e5cda6d5de3e08180ea4332ff222;p=quassel.git diff --git a/src/client/networkmodel.h b/src/client/networkmodel.h index 0cd97cdd..b2d3a3b8 100644 --- a/src/client/networkmodel.h +++ b/src/client/networkmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -45,6 +45,19 @@ public : virtual QVariant data(int column, int row) const; + /** + * Escapes a string as HTML, ready for Qt markup. + * + * Implementation depends on Qt version - Qt4 uses Qt::escape, while Qt5 uses .toHtmlEscaped(). + * + * @param[in] string QString to escape + * @param[in] useNonbreakingSpaces + * @parblock + * If true, replace spaces with non-breaking spaces (i.e. ' '), otherwise only HTML escape. + * @endparblock + */ + static QString escapeHTML(const QString &string, bool useNonbreakingSpaces = false); + inline bool isActive() const { return (bool)_network ? _network->isConnected() : false; } inline const NetworkId &networkId() const { return _networkId; } @@ -72,6 +85,7 @@ signals: private slots: void onBeginRemoveChilds(int start, int end); + void onNetworkDestroyed(); private: NetworkId _networkId; @@ -125,6 +139,7 @@ public : public slots: virtual inline void setTopic(const QString &) { emit dataChanged(1); } + virtual inline void setEncrypted(bool) { emit dataChanged(); } private: BufferInfo _bufferInfo; @@ -198,6 +213,14 @@ public: void attachIrcChannel(IrcChannel *ircChannel); + /** + * Gets the list of channel modes for a given nick. + * + * @param[in] nick IrcUser nickname to check + * @returns Channel modes as a string if any, otherwise empty string + */ + QString nickChannelModes(const QString &nick) const; + public slots: void join(const QList &ircUsers); void part(IrcUser *ircUser); @@ -210,6 +233,7 @@ public slots: private slots: void ircChannelParted(); + void ircChannelDestroyed(); private: IrcChannel *_ircChannel; @@ -263,6 +287,13 @@ public : virtual QVariant data(int column, int role) const; virtual QString toolTip(int column) const; + /** + * Gets the list of channel modes for this nick if parented to channel. + * + * @returns Channel modes as a string if any, otherwise empty string + */ + QString channelModes() const; + private slots: inline void ircUserQuited() { parent()->removeChild(this); }