00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <QPushButton>
00023 #include <QLayout>
00024 #include <QGroupBox>
00025
00026
00027 #include <klocale.h>
00028 #include <kdebug.h>
00029 #include <kchatdialog.h>
00030 #include <kgamechat.h>
00031 #include <dialogs/kgamedialog.h>
00032
00033
00034
00035 #include "chatdlg.h"
00036 #include "kwin4player.h"
00037
00038
00039
00040
00041 ChatDlg::ChatDlg(KGame *game,QWidget *parent)
00042 : KDialog(parent),mChat(0), mChatDlg(0)
00043 {
00044 setCaption(i18n("Chat Dlg"));
00045 setButtons(Ok);
00046 setDefaultButton(Ok);
00047 showButtonSeparator(true);
00048 setModal(false);
00049 setMinimumSize(QSize(200,200));
00050
00051 QFrame* frame = new QFrame(this);
00052 QGridLayout* mGridLayout = new QGridLayout(frame);
00053 QGroupBox* b = new QGroupBox(i18n("Chat"), frame);
00054 QVBoxLayout* gboxLay = new QVBoxLayout(b);
00055 mChat = new KGameChat(game, 10000, b);
00056 gboxLay->addWidget(mChat);
00057 mGridLayout->addWidget(b,0,0);
00058
00059 QPushButton *mButton = new QPushButton(i18n("Configure..."),frame);
00060 mGridLayout->addWidget(mButton,1,1);
00061
00062 setMainWidget(frame);
00063
00064 adjustSize();
00065
00066 mChatDlg = new KChatDialog(mChat,frame,true);
00067 connect(mButton,SIGNAL(clicked()),mChatDlg,SLOT(show()));
00068 }
00069
00070
00071 void ChatDlg::setPlayer(KWin4Player* p)
00072 {
00073 if (!mChat)
00074 {
00075 kError() << "ChatDlg::setPlayer::Chat not defined can't set player" << endl;
00076 return ;
00077 }
00078 if (!p)
00079 {
00080 kError() << "ChatDlg::setPlayer::Player not defined can't set player" << endl;
00081 return ;
00082 }
00083 mChat->setFromPlayer(p);
00084 }
00085
00086 #include "chatdlg.moc"