00001 #ifndef __QMLCHATWIDGET_H__ 00002 #define __QMLCHATWIDGET_H__ 00003 00004 /* 00005 * Copyright 2011 00006 * 'MedCenter' is an interactive application for hospitals. 00007 * (c) Copyright 2011 - Abdelhafid Hafidi <std.abdel[at]gmail.com> 00008 * - Alexandre Laurent <lw.demoscene[at]gmail.com> 00009 * 00010 * [GPL] 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License along 00023 * with this program; if not, write to the Free Software Foundation, Inc., 00024 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00025 * 00026 */ 00027 00028 #include "QMLWidget.h" 00029 00030 #include "Types/User.h" 00031 00032 class QMLChatWidget : public QMLWidget 00033 { 00034 Q_OBJECT 00035 00036 private: 00037 static const int MESSAGES_BUFFER_SIZE = 2048; 00039 QList<QObject*> m_messageList; 00040 QList<QObject*> m_users; 00042 void deleteList(); 00043 void updateUsersList(); 00044 00045 protected: 00046 bool updateQML(); 00047 00048 public: 00049 QMLChatWidget(QWidget* parent=0); 00050 ~QMLChatWidget(); 00051 00052 Q_SLOT void setUsersList(const QList<User>& namesList); 00053 00054 Q_SLOT void addMessage(QString message); 00055 00056 Q_SIGNAL void sendMessage(QString message); 00057 }; 00058 00093 #endif