• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames

kchatbasemodel.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
00004     Copyright (C) 2007 Gael de Chalendar (aka Kleag) <kleag@free.fr>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2 as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 #ifndef __KCHATBASEMODEL_H__
00021 #define __KCHATBASEMODEL_H__
00022 
00023 #include <QtCore/QAbstractListModel>
00024 #include <QtCore/QPair>
00025 
00026 #include <libkdegames_export.h>
00027 
00028 class KChatBaseModelPrivate;
00029 class KChatBaseMessagePrivate;
00030 class KConfig;
00031 
00041 class KDEGAMES_EXPORT KChatBaseMessage : public QPair< QString, QString >
00042 {
00043   public:
00045     enum MessageType
00046     {
00047       Normal,
00048       System
00049     };
00050     
00052     KChatBaseMessage();
00053     
00055     KChatBaseMessage(const QString& sender, const QString& message, 
00056           MessageType type=Normal);
00057 
00059     KChatBaseMessage(const KChatBaseMessage& m);
00060 
00062     virtual ~KChatBaseMessage();
00063     
00064   private:
00065     KChatBaseMessagePrivate* d;
00066 };
00067 Q_DECLARE_METATYPE(KChatBaseMessage)
00068 
00069 
00076 class KDEGAMES_EXPORT KChatBaseModel : public QAbstractListModel
00077 {
00078   Q_OBJECT
00079   
00080 public:
00082   KChatBaseModel(QObject *parent = 0);
00083 
00085   virtual ~KChatBaseModel();
00086     
00091   virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
00092   
00093   
00098   virtual QVariant data(const QModelIndex &index, int role) const;
00099 
00104   void setNameFont(const QFont& font);
00105   
00110   void setMessageFont(const QFont& font);
00111 
00118   void setBothFont(const QFont& font);
00119 
00123   void setSystemNameFont(const QFont& font);
00124 
00128   void setSystemMessageFont(const QFont& font);
00129 
00133   void setSystemBothFont(const QFont& font);
00134 
00142   const QFont& nameFont() const;
00143 
00151   const QFont& messageFont() const;
00152 
00156   const QFont& systemNameFont() const;
00157 
00161   const QFont& systemMessageFont() const;
00162 
00172   virtual void saveConfig(KConfig* conf = 0);
00173 
00179   virtual void readConfig(KConfig* conf = 0);
00180 
00188   void setMaxItems(int maxItems);
00189 
00193   void clear();
00194 
00199   int maxItems() const;
00200 
00201 public Q_SLOTS:
00213   virtual void addMessage(const QString& fromName, const QString& text);
00214 
00221   virtual void addSystemMessage(const QString& fromName, const QString& text);
00222 
00227   void slotClear();
00228 
00229   private:
00230     KChatBaseModelPrivate* d;
00231 };
00232 
00233 #endif

libkdegames

Skip menu "libkdegames"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal