• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames/libkdegamesprivate

  • sources
  • kde-4.14
  • kdegames
  • libkdegames
  • libkdegamesprivate
kchatbasemodel.h
Go to the documentation of this file.
1 /*
2  This file is part of the KDE games library
3  Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
4  Copyright (C) 2007 Gael de Chalendar (aka Kleag) <kleag@free.fr>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 #ifndef __KCHATBASEMODEL_H__
21 #define __KCHATBASEMODEL_H__
22 
23 #include <QtCore/QAbstractListModel>
24 #include <QtCore/QPair>
25 
26 #include "libkdegamesprivate_export.h"
27 
28 class KChatBaseModelPrivate;
29 class KChatBaseMessagePrivate;
30 class KConfig;
31 
41 class KDEGAMESPRIVATE_EXPORT KChatBaseMessage : public QPair< QString, QString >
42 {
43  public:
45  enum MessageType
46  {
47  Normal,
48  System
49  };
50 
52  KChatBaseMessage();
53 
55  KChatBaseMessage(const QString& sender, const QString& message,
56  MessageType type=Normal);
57 
59  KChatBaseMessage(const KChatBaseMessage& m);
60 
62  virtual ~KChatBaseMessage();
63 
64  private:
65  KChatBaseMessagePrivate* d;
66 };
67 Q_DECLARE_METATYPE(KChatBaseMessage)
68 
69 
76 class KDEGAMESPRIVATE_EXPORT KChatBaseModel : public QAbstractListModel
77 {
78  Q_OBJECT
79 
80 public:
82  KChatBaseModel(QObject *parent = 0);
83 
85  virtual ~KChatBaseModel();
86 
91  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
92 
93 
98  virtual QVariant data(const QModelIndex &index, int role) const;
99 
104  void setNameFont(const QFont& font);
105 
110  void setMessageFont(const QFont& font);
111 
118  void setBothFont(const QFont& font);
119 
123  void setSystemNameFont(const QFont& font);
124 
128  void setSystemMessageFont(const QFont& font);
129 
133  void setSystemBothFont(const QFont& font);
134 
142  const QFont& nameFont() const;
143 
151  const QFont& messageFont() const;
152 
156  const QFont& systemNameFont() const;
157 
161  const QFont& systemMessageFont() const;
162 
172  virtual void saveConfig(KConfig* conf = 0);
173 
179  virtual void readConfig(KConfig* conf = 0);
180 
188  void setMaxItems(int maxItems);
189 
193  void clear();
194 
199  int maxItems() const;
200 
201 public Q_SLOTS:
213  virtual void addMessage(const QString& fromName, const QString& text);
214 
221  virtual void addSystemMessage(const QString& fromName, const QString& text);
222 
227  void slotClear();
228 
229  private:
230  KChatBaseModelPrivate* d;
231 };
232 
233 #endif
QModelIndex
KChatBaseMessage
The class of the elements stored in the chat list model.
Definition: kchatbasemodel.h:41
KChatBaseMessage::MessageType
MessageType
The different types of messages.
Definition: kchatbasemodel.h:45
KDEGAMESPRIVATE_EXPORT
#define KDEGAMESPRIVATE_EXPORT
Definition: libkdegamesprivate_export.h:46
QFont
libkdegamesprivate_export.h
QObject
QAbstractListModel
KChatBaseMessage::Normal
Definition: kchatbasemodel.h:47
QString
QPair
KChatBaseModel
The model used to store messages displayed in the chat dialog messages list.
Definition: kchatbasemodel.h:76
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames/libkdegamesprivate

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

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal