File indexing completed on 2024-10-06 06:48:48
0001 /*************************************************************************** 0002 KsirkChatItem.h - description 0003 ------------------- 0004 begin : Mon Sep 26 2006 0005 copyright : (C) 2006-2007 by Gael de Chalendar (aka Kleag) 0006 email : kleag@free.fr 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either either version 2 0014 of the License, or (at your option) any later version.of the License, or * 0015 * (at your option) any later version. * 0016 * * 0017 * You should have received a copy of the GNU General Public License 0018 * along with this program; if not, write to the Free Software 0019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0020 * 02110-1301, USA 0021 ***************************************************************************/ 0022 0023 #ifndef KSIRKCHATMODEL_H 0024 #define KSIRKCHATMODEL_H 0025 0026 #include <QWidget> 0027 #include <QListWidgetItem> 0028 #include <QPushButton> 0029 #include <QColor> 0030 0031 #define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API 0032 #include <libkdegamesprivate/kchatbasemodel.h> 0033 0034 #include "KsirkChatItem.h" 0035 #include "../kgamewin.h" 0036 namespace Ksirk 0037 { 0038 class KGameWindow; 0039 } 0040 0041 // namespace GameLogic 0042 // { 0043 0044 0045 0046 class KsirkChatModel : public KChatBaseModel 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 KsirkChatModel(QObject *parent, Ksirk::KGameWindow* game); 0052 0053 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0054 QVariant data(const QModelIndex &index, int role) const override; 0055 // QVariant headerData(int section, Qt::Orientation orientation, 0056 // int role = Qt::DisplayRole) const; 0057 void addMessage(const KsirkChatItem& message); 0058 void addMessage(const QString& fromName, const QString& text) override; 0059 0060 private: 0061 QList< KsirkChatItem > m_messages; 0062 Ksirk::KGameWindow* m_game; 0063 }; 0064 0065 // } // closing namespace GameLogic 0066 0067 // } // closing namespace Ksirk 0068 0069 0070 #endif // KSIRKCHATMODEL_H