X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fnetworkevent.h;h=b55a9251d594e5c9151e2aa0c61f907185998eb0;hp=7e46984a61716d7b2df1e0379c4da04ef38ef50d;hb=a4568e36edde5b86feeaae740a396f1bcaca1967;hpb=6f38b6fdeb73e726c24b26a97b98c9cfe0fc8a0e diff --git a/src/common/networkevent.h b/src/common/networkevent.h index 7e46984a..b55a9251 100644 --- a/src/common/networkevent.h +++ b/src/common/networkevent.h @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef NETWORKEVENT_H @@ -27,122 +27,131 @@ #include "event.h" #include "network.h" -class NetworkEvent : public Event { - +class NetworkEvent : public Event +{ public: - explicit NetworkEvent(EventManager::EventType type, Network *network) - : Event(type), - _network(network) - {} + explicit NetworkEvent(EventManager::EventType type, Network *network) + : Event(type), + _network(network) + {} - inline NetworkId networkId() const { return network()? network()->networkId() : NetworkId(); } - inline Network *network() const { return _network; } + inline NetworkId networkId() const { return network() ? network()->networkId() : NetworkId(); } + inline Network *network() const { return _network; } - static Event *create(EventManager::EventType type, QVariantMap &map, Network *network); + static Event *create(EventManager::EventType type, QVariantMap &map, Network *network); protected: - explicit NetworkEvent(EventManager::EventType type, QVariantMap &map, Network *network); - void toVariantMap(QVariantMap &map) const; + explicit NetworkEvent(EventManager::EventType type, QVariantMap &map, Network *network); + void toVariantMap(QVariantMap &map) const; - virtual inline QString className() const { return "NetworkEvent"; } - virtual inline void debugInfo(QDebug &dbg) const { dbg.nospace() << ", net = " << qPrintable(_network->networkName()); } + virtual inline QString className() const { return "NetworkEvent"; } + virtual inline void debugInfo(QDebug &dbg) const { dbg.nospace() << ", net = " << qPrintable(_network->networkName()); } private: - Network *_network; + Network *_network; }; -/*****************************************************************************/ -class NetworkConnectionEvent : public NetworkEvent { +/*****************************************************************************/ +class NetworkConnectionEvent : public NetworkEvent +{ public: - explicit NetworkConnectionEvent(EventManager::EventType type, Network *network, Network::ConnectionState state) - : NetworkEvent(type, network), - _state(state) - {} + explicit NetworkConnectionEvent(EventManager::EventType type, Network *network, Network::ConnectionState state) + : NetworkEvent(type, network), + _state(state) + {} - inline Network::ConnectionState connectionState() const { return _state; } - inline void setConnectionState(Network::ConnectionState state) { _state = state; } + inline Network::ConnectionState connectionState() const { return _state; } + inline void setConnectionState(Network::ConnectionState state) { _state = state; } protected: - explicit NetworkConnectionEvent(EventManager::EventType type, QVariantMap &map, Network *network); - void toVariantMap(QVariantMap &map) const; + explicit NetworkConnectionEvent(EventManager::EventType type, QVariantMap &map, Network *network); + void toVariantMap(QVariantMap &map) const; + + virtual inline QString className() const { return "NetworkConnectionEvent"; } + virtual inline void debugInfo(QDebug &dbg) const + { + NetworkEvent::debugInfo(dbg); + dbg.nospace() << ", state = " << qPrintable(QString::number(_state)); + } - virtual inline QString className() const { return "NetworkConnectionEvent"; } - virtual inline void debugInfo(QDebug &dbg) const { - NetworkEvent::debugInfo(dbg); - dbg.nospace() << ", state = " << qPrintable(QString::number(_state)); - } private: - Network::ConnectionState _state; + Network::ConnectionState _state; - friend class NetworkEvent; + friend class NetworkEvent; }; -class NetworkDataEvent : public NetworkEvent { +class NetworkDataEvent : public NetworkEvent +{ public: - explicit NetworkDataEvent(EventManager::EventType type, Network *network, const QByteArray &data) - : NetworkEvent(type, network), - _data(data) - {} + explicit NetworkDataEvent(EventManager::EventType type, Network *network, const QByteArray &data) + : NetworkEvent(type, network), + _data(data) + {} - inline QByteArray data() const { return _data; } - inline void setData(const QByteArray &data) { _data = data; } + inline QByteArray data() const { return _data; } + inline void setData(const QByteArray &data) { _data = data; } protected: - explicit NetworkDataEvent(EventManager::EventType type, QVariantMap &map, Network *network); - void toVariantMap(QVariantMap &map) const; + explicit NetworkDataEvent(EventManager::EventType type, QVariantMap &map, Network *network); + void toVariantMap(QVariantMap &map) const; + + virtual inline QString className() const { return "NetworkDataEvent"; } + virtual inline void debugInfo(QDebug &dbg) const + { + NetworkEvent::debugInfo(dbg); + dbg.nospace() << ", data = " << data(); + } - virtual inline QString className() const { return "NetworkDataEvent"; } - virtual inline void debugInfo(QDebug &dbg) const { - NetworkEvent::debugInfo(dbg); - dbg.nospace() << ", data = " << data(); - } private: - QByteArray _data; + QByteArray _data; - friend class NetworkEvent; + friend class NetworkEvent; }; -class NetworkSplitEvent : public NetworkEvent { +class NetworkSplitEvent : public NetworkEvent +{ public: - explicit NetworkSplitEvent(EventManager::EventType type, - Network *network, - const QString &channel, - const QStringList &users, - const QString &quitMsg) - : NetworkEvent(type, network), - _channel(channel), - _users(users), - _quitMsg(quitMsg) - {} - - inline QString channel() const { return _channel; } - inline QStringList users() const { return _users; } - inline QString quitMessage() const { return _quitMsg; } + explicit NetworkSplitEvent(EventManager::EventType type, + Network *network, + const QString &channel, + const QStringList &users, + const QString &quitMsg) + : NetworkEvent(type, network), + _channel(channel), + _users(users), + _quitMsg(quitMsg) + {} + + inline QString channel() const { return _channel; } + inline QStringList users() const { return _users; } + inline QString quitMessage() const { return _quitMsg; } protected: - explicit NetworkSplitEvent(EventManager::EventType type, QVariantMap &map, Network *network); - void toVariantMap(QVariantMap &map) const; + explicit NetworkSplitEvent(EventManager::EventType type, QVariantMap &map, Network *network); + void toVariantMap(QVariantMap &map) const; + + virtual inline QString className() const { return "NetworkSplitEvent"; } + virtual inline void debugInfo(QDebug &dbg) const + { + NetworkEvent::debugInfo(dbg); + dbg.nospace() << ", channel = " << qPrintable(channel()) + << ", users = " << users() + << ", quitmsg = " << quitMessage(); + } - virtual inline QString className() const { return "NetworkSplitEvent"; } - virtual inline void debugInfo(QDebug &dbg) const { - NetworkEvent::debugInfo(dbg); - dbg.nospace() << ", channel = " << qPrintable(channel()) - << ", users = " << users() - << ", quitmsg = " << quitMessage(); - } private: - QString _channel; - QStringList _users; - QString _quitMsg; + QString _channel; + QStringList _users; + QString _quitMsg; - friend class NetworkEvent; + friend class NetworkEvent; };