From: Marcus Eggenberger Date: Tue, 28 Oct 2008 12:05:27 +0000 (+0100) Subject: cleanup X-Git-Tag: 0.3.1~108 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=5d05ab030c24ff57b0e5d00d9d66869c2f934a49 cleanup --- diff --git a/src/common/identity.cpp b/src/common/identity.cpp index dcec2d92..eff50215 100644 --- a/src/common/identity.cpp +++ b/src/common/identity.cpp @@ -23,32 +23,35 @@ #include "identity.h" -Identity::Identity(IdentityId id, QObject *parent) : SyncableObject(parent), _identityId(id) { +Identity::Identity(IdentityId id, QObject *parent) + : SyncableObject(parent), + _identityId(id) +{ init(); setToDefaults(); } -Identity::Identity(const Identity &other, QObject *parent) : SyncableObject(parent), - _identityId(other.id()), - _identityName(other.identityName()), - _realName(other.realName()), - _nicks(other.nicks()), - _awayNick(other.awayNick()), - _awayNickEnabled(other.awayNickEnabled()), - _awayReason(other.awayReason()), - _awayReasonEnabled(other.awayReasonEnabled()), - _autoAwayEnabled(other.autoAwayEnabled()), - _autoAwayTime(other.autoAwayTime()), - _autoAwayReason(other.autoAwayReason()), - _autoAwayReasonEnabled(other.autoAwayReasonEnabled()), - _detachAwayEnabled(other.detachAwayEnabled()), - _detachAwayReason(other.detachAwayReason()), - _detachAwayReasonEnabled(other.detachAwayReasonEnabled()), - _ident(other.ident()), - _kickReason(other.kickReason()), - _partReason(other.partReason()), - _quitReason(other.quitReason()) - +Identity::Identity(const Identity &other, QObject *parent) + : SyncableObject(parent), + _identityId(other.id()), + _identityName(other.identityName()), + _realName(other.realName()), + _nicks(other.nicks()), + _awayNick(other.awayNick()), + _awayNickEnabled(other.awayNickEnabled()), + _awayReason(other.awayReason()), + _awayReasonEnabled(other.awayReasonEnabled()), + _autoAwayEnabled(other.autoAwayEnabled()), + _autoAwayTime(other.autoAwayTime()), + _autoAwayReason(other.autoAwayReason()), + _autoAwayReasonEnabled(other.autoAwayReasonEnabled()), + _detachAwayEnabled(other.detachAwayEnabled()), + _detachAwayReason(other.detachAwayReason()), + _detachAwayReasonEnabled(other.detachAwayReasonEnabled()), + _ident(other.ident()), + _kickReason(other.kickReason()), + _partReason(other.partReason()), + _quitReason(other.quitReason()) { init(); } @@ -81,92 +84,12 @@ void Identity::setToDefaults() { setQuitReason(tr("http://quassel-irc.org - Chat comfortably. Anywhere.")); } -bool Identity::isValid() const { - return (id().toInt() > 0); -} - -IdentityId Identity::id() const { - return _identityId; -} - -QString Identity::identityName() const { - return _identityName; -} - -QString Identity::realName() const { - return _realName; -} - -QStringList Identity::nicks() const { - return _nicks; -} - -QString Identity::awayNick() const { - return _awayNick; -} - -bool Identity::awayNickEnabled() const { - return _awayNickEnabled; -} - -QString Identity::awayReason() const { - return _awayReason; -} - -bool Identity::awayReasonEnabled() const { - return _awayReasonEnabled; -} - -bool Identity::autoAwayEnabled() const { - return _autoAwayEnabled; -} - -int Identity::autoAwayTime() const { - return _autoAwayTime; -} - -QString Identity::autoAwayReason() const { - return _autoAwayReason; -} - -bool Identity::autoAwayReasonEnabled() const { - return _autoAwayReasonEnabled; -} - -bool Identity::detachAwayEnabled() const { - return _detachAwayEnabled; -} - -QString Identity::detachAwayReason() const { - return _detachAwayReason; -} - -bool Identity::detachAwayReasonEnabled() const { - return _detachAwayReasonEnabled; -} - -QString Identity::ident() const { - return _ident; -} - -QString Identity::kickReason() const { - return _kickReason; -} - -QString Identity::partReason() const -{return _partReason;} - -QString Identity::quitReason() const { - return _quitReason; -} - /*** setters ***/ // NOTE: DO NOT USE ON SYNCHRONIZED OBJECTS! void Identity::setId(IdentityId _id) { _identityId = _id; setObjectName(QString::number(id().toInt())); - //emit idSet(id); } void Identity::setIdentityName(const QString &identityName) { @@ -214,7 +137,7 @@ void Identity::setAutoAwayTime(int time) { emit autoAwayTimeSet(time); } -void Identity::setAutoAwayReason(const QString & reason) { +void Identity::setAutoAwayReason(const QString &reason) { _autoAwayReason = reason; emit autoAwayReasonSet(reason); } @@ -229,7 +152,7 @@ void Identity::setDetachAwayEnabled(bool enabled) { emit detachAwayEnabledSet(enabled); } -void Identity::setDetachAwayReason(const QString & reason) { +void Identity::setDetachAwayReason(const QString &reason) { _detachAwayReason = reason; emit detachAwayReasonSet(reason); } @@ -239,22 +162,22 @@ void Identity::setDetachAwayReasonEnabled(bool enabled) { emit detachAwayReasonEnabledSet(enabled); } -void Identity::setIdent(const QString & ident) { +void Identity::setIdent(const QString &ident) { _ident = ident; emit identSet(ident); } -void Identity::setKickReason(const QString & reason) { +void Identity::setKickReason(const QString &reason) { _kickReason = reason; emit kickReasonSet(reason); } -void Identity::setPartReason(const QString & reason) { +void Identity::setPartReason(const QString &reason) { _partReason = reason; emit partReasonSet(reason); } -void Identity::setQuitReason(const QString & reason) { +void Identity::setQuitReason(const QString &reason) { _quitReason = reason; emit quitReasonSet(reason); } diff --git a/src/common/identity.h b/src/common/identity.h index 8ffc7da2..bd1eaa50 100644 --- a/src/common/identity.h +++ b/src/common/identity.h @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _IDENTITY_H_ -#define _IDENTITY_H_ +#ifndef IDENTITY_H +#define IDENTITY_H #include #include @@ -52,100 +52,100 @@ class Identity : public SyncableObject { Q_PROPERTY(QString partReason READ partReason WRITE setPartReason STORED false) Q_PROPERTY(QString quitReason READ quitReason WRITE setQuitReason STORED false) - public: - Identity(IdentityId id = 0, QObject *parent = 0); - Identity(const Identity &other, QObject *parent = 0); - void setToDefaults(); - - bool operator==(const Identity &other); - bool operator!=(const Identity &other); - - bool isValid() const; - - IdentityId id() const; - QString identityName() const; - QString realName() const; - QStringList nicks() const; - QString awayNick() const; - bool awayNickEnabled() const; - QString awayReason() const; - bool awayReasonEnabled() const; - bool autoAwayEnabled() const; - int autoAwayTime() const; - QString autoAwayReason() const; - bool autoAwayReasonEnabled() const; - bool detachAwayEnabled() const; - QString detachAwayReason() const; - bool detachAwayReasonEnabled() const; - QString ident() const; - QString kickReason() const; - QString partReason() const; - QString quitReason() const; - - public slots: - void setId(IdentityId id); - void setIdentityName(const QString &name); - void setRealName(const QString &realName); - void setNicks(const QStringList &nicks); - void setAwayNick(const QString &awayNick); - void setAwayNickEnabled(bool enabled); - void setAwayReason(const QString &awayReason); - void setAwayReasonEnabled(bool enabled); - void setAutoAwayEnabled(bool enabled); - void setAutoAwayTime(int time); - void setAutoAwayReason(const QString &reason); - void setAutoAwayReasonEnabled(bool enabled); - void setDetachAwayEnabled(bool enabled); - void setDetachAwayReason(const QString &reason); - void setDetachAwayReasonEnabled(bool enabled); - void setIdent(const QString &ident); - void setKickReason(const QString &reason); - void setPartReason(const QString &reason); - void setQuitReason(const QString &reason); - - void update(const Identity &other); - - signals: - void idSet(IdentityId id); - void identityNameSet(const QString &name); - void realNameSet(const QString &realName); - void nicksSet(const QStringList &nicks); - void awayNickSet(const QString &awayNick); - void awayNickEnabledSet(bool); - void awayReasonSet(const QString &awayReason); - void awayReasonEnabledSet(bool); - void autoAwayEnabledSet(bool); - void autoAwayTimeSet(int); - void autoAwayReasonSet(const QString &); - void autoAwayReasonEnabledSet(bool); - void detachAwayEnabledSet(bool); - void detachAwayReasonSet(const QString &); - void detachAwayReasonEnabledSet(bool); - void identSet(const QString &); - void kickReasonSet(const QString &); - void partReasonSet(const QString &); - void quitReasonSet(const QString &); - - private: - IdentityId _identityId; - QString _identityName, _realName; - QStringList _nicks; - QString _awayNick; - bool _awayNickEnabled; - QString _awayReason; - bool _awayReasonEnabled; - bool _autoAwayEnabled; - int _autoAwayTime; - QString _autoAwayReason; - bool _autoAwayReasonEnabled; - bool _detachAwayEnabled; - QString _detachAwayReason; - bool _detachAwayReasonEnabled; - QString _ident, _kickReason, _partReason, _quitReason; - - void init(); - - friend QDataStream &operator>>(QDataStream &in, Identity &identity); +public: + Identity(IdentityId id = 0, QObject *parent = 0); + Identity(const Identity &other, QObject *parent = 0); + void setToDefaults(); + + bool operator==(const Identity &other); + bool operator!=(const Identity &other); + + inline bool isValid() const { return id().isValid(); } + + inline IdentityId id() const { return _identityId; } + inline const QString &identityName() const { return _identityName; } + inline const QString &realName() const { return _realName; } + inline const QStringList &nicks() const { return _nicks; } + inline const QString &awayNick() const { return _awayNick; } + inline bool awayNickEnabled() const { return _awayNickEnabled; } + inline const QString &awayReason() const { return _awayReason; } + inline bool awayReasonEnabled() const { return _awayReasonEnabled; } + inline bool autoAwayEnabled() const { return _autoAwayEnabled; } + inline int autoAwayTime() const { return _autoAwayTime; } + inline const QString &autoAwayReason() const { return _autoAwayReason; } + inline bool autoAwayReasonEnabled() const { return _autoAwayReasonEnabled; } + inline bool detachAwayEnabled() const { return _detachAwayEnabled; } + inline const QString &detachAwayReason() const { return _detachAwayReason; } + inline bool detachAwayReasonEnabled() const { return _detachAwayReasonEnabled; } + inline const QString &ident() const { return _ident; } + inline const QString &kickReason() const { return _kickReason; } + inline const QString &partReason() const { return _partReason; } + inline const QString &quitReason() const { return _quitReason; } + +public slots: + void setId(IdentityId id); + void setIdentityName(const QString &name); + void setRealName(const QString &realName); + void setNicks(const QStringList &nicks); + void setAwayNick(const QString &awayNick); + void setAwayNickEnabled(bool enabled); + void setAwayReason(const QString &awayReason); + void setAwayReasonEnabled(bool enabled); + void setAutoAwayEnabled(bool enabled); + void setAutoAwayTime(int time); + void setAutoAwayReason(const QString &reason); + void setAutoAwayReasonEnabled(bool enabled); + void setDetachAwayEnabled(bool enabled); + void setDetachAwayReason(const QString &reason); + void setDetachAwayReasonEnabled(bool enabled); + void setIdent(const QString &ident); + void setKickReason(const QString &reason); + void setPartReason(const QString &reason); + void setQuitReason(const QString &reason); + + void update(const Identity &other); + +signals: + void idSet(IdentityId id); + void identityNameSet(const QString &name); + void realNameSet(const QString &realName); + void nicksSet(const QStringList &nicks); + void awayNickSet(const QString &awayNick); + void awayNickEnabledSet(bool); + void awayReasonSet(const QString &awayReason); + void awayReasonEnabledSet(bool); + void autoAwayEnabledSet(bool); + void autoAwayTimeSet(int); + void autoAwayReasonSet(const QString &); + void autoAwayReasonEnabledSet(bool); + void detachAwayEnabledSet(bool); + void detachAwayReasonSet(const QString &); + void detachAwayReasonEnabledSet(bool); + void identSet(const QString &); + void kickReasonSet(const QString &); + void partReasonSet(const QString &); + void quitReasonSet(const QString &); + +private: + IdentityId _identityId; + QString _identityName, _realName; + QStringList _nicks; + QString _awayNick; + bool _awayNickEnabled; + QString _awayReason; + bool _awayReasonEnabled; + bool _autoAwayEnabled; + int _autoAwayTime; + QString _autoAwayReason; + bool _autoAwayReasonEnabled; + bool _detachAwayEnabled; + QString _detachAwayReason; + bool _detachAwayReasonEnabled; + QString _ident, _kickReason, _partReason, _quitReason; + + void init(); + + friend QDataStream &operator>>(QDataStream &in, Identity &identity); }; QDataStream &operator<<(QDataStream &out, Identity identity);