Changeset View
Changeset View
Standalone View
Standalone View
src/chatdlg.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
45 | ChatDlg::ChatDlg(KGame *game,QWidget *parent) | 45 | ChatDlg::ChatDlg(KGame *game,QWidget *parent) | ||
46 | : QDialog(parent),mChat(), mChatDlg() | 46 | : QDialog(parent),mChat(), mChatDlg() | ||
47 | { | 47 | { | ||
48 | setWindowTitle(i18n("Chat Dlg")); | 48 | setWindowTitle(i18n("Chat Dlg")); | ||
49 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); | 49 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); | ||
50 | QVBoxLayout *mainLayout = new QVBoxLayout; | 50 | QVBoxLayout *mainLayout = new QVBoxLayout; | ||
51 | setLayout(mainLayout); | 51 | setLayout(mainLayout); | ||
52 | QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); | 52 | QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); | ||
53 | okButton->setDefault(true); | | |||
54 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | 53 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); | ||
55 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); | 54 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); | ||
56 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); | 55 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); | ||
57 | okButton->setDefault(true); | 56 | okButton->setAutoDefault(false); | ||
58 | setModal(false); | 57 | setModal(false); | ||
59 | setMinimumSize(QSize(200,200)); | 58 | setMinimumSize(QSize(200,200)); | ||
60 | 59 | | |||
61 | QFrame* frame = new QFrame(this); | 60 | QFrame* frame = new QFrame(this); | ||
62 | 61 | | |||
63 | QGridLayout* mGridLayout = new QGridLayout(frame); | 62 | QGridLayout* mGridLayout = new QGridLayout(frame); | ||
64 | QGroupBox* b = new QGroupBox(i18n("Chat"), frame); | 63 | QGroupBox* b = new QGroupBox(i18n("Chat"), frame); | ||
65 | QVBoxLayout* gboxLay = new QVBoxLayout(b); | 64 | QVBoxLayout* gboxLay = new QVBoxLayout(b); | ||
66 | mChat = new KGameChat(game, 10000, b); | 65 | mChat = new KGameChat(game, 10000, b); | ||
67 | gboxLay->addWidget(mChat); | 66 | gboxLay->addWidget(mChat); | ||
68 | mGridLayout->addWidget(b,0,0); | 67 | mGridLayout->addWidget(b,0,0); | ||
69 | 68 | | |||
70 | QPushButton *mButton = new QPushButton(i18n("Configure..."),frame); | 69 | QPushButton *mButton = new QPushButton(i18n("Configure..."),frame); | ||
70 | mButton->setAutoDefault(false); | ||||
71 | mGridLayout->addWidget(mButton,1,1); | 71 | mGridLayout->addWidget(mButton,1,1); | ||
72 | 72 | | |||
73 | mainLayout->addWidget(frame); | 73 | mainLayout->addWidget(frame); | ||
74 | mainLayout->addWidget(buttonBox); | 74 | mainLayout->addWidget(buttonBox); | ||
75 | adjustSize(); | 75 | adjustSize(); | ||
76 | mChat->setFocus(); | ||||
76 | 77 | | |||
77 | mChatDlg = new KChatDialog(mChat,frame,true); | 78 | mChatDlg = new KChatDialog(mChat,frame,true); | ||
78 | connect(mButton, &QPushButton::clicked, mChatDlg, &KChatDialog::show); | 79 | connect(mButton, &QPushButton::clicked, mChatDlg, &KChatDialog::show); | ||
79 | } | 80 | } | ||
80 | 81 | | |||
81 | // Set the player in who does the chat. This should be the local player. | 82 | // Set the player in who does the chat. This should be the local player. | ||
82 | void ChatDlg::setPlayer(KWin4Player* p) | 83 | void ChatDlg::setPlayer(KWin4Player* p) | ||
83 | { | 84 | { | ||
Show All 14 Lines |