libqutim
0.3.2.0
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru> 00006 ** 00007 ***************************************************************************** 00008 ** 00009 ** $QUTIM_BEGIN_LICENSE$ 00010 ** This program is free software: you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation, either version 3 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 ** See the GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see http://www.gnu.org/licenses/. 00022 ** $QUTIM_END_LICENSE$ 00023 ** 00024 ****************************************************************************/ 00025 #ifndef BUDDY_H 00026 #define BUDDY_H 00027 00028 #include "chatunit.h" 00029 #include "status.h" 00030 #include <QIcon> 00031 #include <QMetaType> 00032 00033 namespace qutim_sdk_0_3 00034 { 00035 class Account; 00036 class Message; 00037 class BuddyPrivate; 00038 00039 class LIBQUTIM_EXPORT Buddy : public ChatUnit 00040 { 00041 Q_OBJECT 00042 Q_DECLARE_PRIVATE(Buddy) 00043 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) 00044 Q_PROPERTY(QString avatar READ avatar NOTIFY avatarChanged) 00045 Q_PROPERTY(qutim_sdk_0_3::Status status READ status NOTIFY statusChanged) 00046 public: 00047 Buddy(Account *account); 00048 Buddy(BuddyPrivate &d, Account *account); 00049 virtual ~Buddy(); 00053 virtual QString avatar() const; 00059 virtual QString title() const; 00060 virtual QString name() const; 00061 virtual Status status() const; 00067 virtual bool sendMessage(const Message &message) = 0; 00068 virtual void setName(const QString &name); 00069 // virtual void setStatus(const Status &); 00070 signals: 00071 void avatarChanged(const QString &path); 00072 void statusChanged(const qutim_sdk_0_3::Status ¤t, const qutim_sdk_0_3::Status &previous); 00073 void nameChanged(const QString ¤t, const QString &previous); 00074 protected: 00075 bool event(QEvent *ev); 00076 private: 00077 //TODO move to protocols 00078 Q_PRIVATE_SLOT(d_func(), void _q_status_changed(const qutim_sdk_0_3::Status &now,const qutim_sdk_0_3::Status &old)) 00079 }; 00080 } 00081 00082 Q_DECLARE_METATYPE(qutim_sdk_0_3::Buddy*) 00083 Q_DECLARE_METATYPE(QList<qutim_sdk_0_3::Buddy*>) 00084 00085 #endif // BUDDY_H 00086