X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fnetworkmodel.h;h=b2d3a3b8db8f6f56f2c85c3f9c7aee8726d4272c;hb=a113f73e5f8ce89c3df5c42d55528404fc7a2294;hp=8c4597d896849e9963e36615ae02cd7e4154f2e2;hpb=ce26c3770b254362c7bd1e094ba8f8bf22133653;p=quassel.git diff --git a/src/client/networkmodel.h b/src/client/networkmodel.h index 8c4597d8..b2d3a3b8 100644 --- a/src/client/networkmodel.h +++ b/src/client/networkmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2014 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; } @@ -200,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); @@ -266,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); }