File indexing completed on 2024-09-08 03:44:34
0001 /* 0002 This file is part of the KDE games library 0003 SPDX-FileCopyrightText: 2001 Andreas Beckermann (b_mann@gmx.de) 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef __KCHATDIALOG_H__ 0009 #define __KCHATDIALOG_H__ 0010 0011 // Qt 0012 #include <QDialog> 0013 0014 class QDialogButtonBox; 0015 class QVBoxLayout; 0016 0017 class KChatBase; 0018 class KChatDialogPrivate; 0019 0020 /** 0021 * \class KChatDialog kchatdialog.h <KChatDialog> 0022 * */ 0023 class KChatDialog : public QDialog 0024 { 0025 Q_OBJECT 0026 public: 0027 /** 0028 * Construct a KChatDialog widget 0029 */ 0030 explicit KChatDialog(QWidget *parent, bool modal = false); 0031 0032 /** 0033 * Construct a KChatDialog widget which automatically configures the 0034 * @ref KChatBase widget. You probably want to use this as you don't 0035 * have to care about the configuration stuff yourself. 0036 */ 0037 KChatDialog(KChatBase *chatWidget, QWidget *parent, bool modal = false); 0038 0039 /** 0040 * Destruct the dialog 0041 */ 0042 ~KChatDialog() override; 0043 0044 /** 0045 * @return The font that shall be used as the "name: " part of a normal 0046 * message. 0047 */ 0048 QFont nameFont() const; 0049 0050 /** 0051 * @return The font that shall be used for normal messages. 0052 */ 0053 QFont textFont() const; 0054 0055 /** 0056 * @return The font that shall be used as the "name: " part of a system 0057 * (game) message. 0058 */ 0059 QFont systemNameFont() const; 0060 0061 /** 0062 * @return The font that shall be used for a system (game) message. 0063 */ 0064 QFont systemTextFont() const; 0065 0066 /** 0067 * Set the widget that will be configured by the dialog. Use this if you 0068 * don't want to configure the widget yourself. 0069 * @param widget The chat widget that shall be configured 0070 * @param applyFonts Whether you want to have the current @ref KChatBase fonts as 0071 * defaults in the dialog 0072 */ 0073 void plugChatWidget(KChatBase *widget, bool applyFonts = true); 0074 0075 /** 0076 * Used to configure the chat widget according to the user settings. 0077 * This is called automatically if @ref plugChatWidget was called 0078 * before. 0079 * @param widget The chat widget that shall be configured 0080 */ 0081 void configureChatWidget(KChatBase *widget); 0082 0083 /** 0084 * @return The maximal allowed messages in the chat widget. -1 is 0085 * unlimited 0086 */ 0087 int maxMessages() const; 0088 0089 protected Q_SLOTS: 0090 void slotGetNameFont(); 0091 void slotGetTextFont(); 0092 void slotGetSystemNameFont(); 0093 void slotGetSystemTextFont(); 0094 0095 virtual void slotApply(); 0096 virtual void slotOk(); 0097 0098 private: 0099 void setNameFont(const QFont &); 0100 void setTextFont(const QFont &); 0101 void setSystemNameFont(const QFont &); 0102 void setSystemTextFont(const QFont &); 0103 void setMaxMessages(int max); 0104 0105 private: 0106 void init(); 0107 0108 private: 0109 KChatDialogPrivate *const d; 0110 QVBoxLayout *mainLayout; 0111 QDialogButtonBox *buttonBox; 0112 }; 0113 0114 #endif