60 |
60 |
61 QLayout * PageNetGame::footerLayoutDefinition() |
61 QLayout * PageNetGame::footerLayoutDefinition() |
62 { |
62 { |
63 QHBoxLayout * bottomLayout = new QHBoxLayout; |
63 QHBoxLayout * bottomLayout = new QHBoxLayout; |
64 |
64 |
65 btnDLC = addButton(tr("DLC"), bottomLayout, 0); |
|
66 btnDLC->setWhatsThis(tr("Downloadable Content")); |
|
67 |
|
68 leRoomName = new HistoryLineEdit(this,10); |
65 leRoomName = new HistoryLineEdit(this,10); |
69 leRoomName->setMaxLength(60); |
66 leRoomName->setMaxLength(60); |
70 leRoomName->setMinimumWidth(200); |
67 leRoomName->setMinimumWidth(200); |
71 leRoomName->setMaximumWidth(400); |
68 leRoomName->setMaximumWidth(400); |
72 |
69 |
77 BtnGo->setIconSize(QSize(25, 34)); |
74 BtnGo->setIconSize(QSize(25, 34)); |
78 BtnGo->setMinimumWidth(50); |
75 BtnGo->setMinimumWidth(50); |
79 BtnGo->setMinimumHeight(50); |
76 BtnGo->setMinimumHeight(50); |
80 |
77 |
81 bottomLayout->addWidget(leRoomName); |
78 bottomLayout->addWidget(leRoomName); |
82 BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 2); |
79 BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1); |
83 |
80 |
84 bottomLayout->addStretch(); |
81 bottomLayout->addStretch(); |
85 bottomLayout->addWidget(BtnGo); |
82 bottomLayout->addWidget(BtnGo); |
86 |
83 |
87 BtnMaster = addButton(tr("Control"), bottomLayout, 4); |
84 BtnMaster = addButton(tr("Control"), bottomLayout, 3); |
88 bottomLayout->insertStretch(3, 100); |
85 bottomLayout->insertStretch(3, 100); |
89 |
86 |
90 BtnStart = addButton(QAction::tr("Start"), bottomLayout, 4); |
87 BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); |
91 |
88 |
92 return bottomLayout; |
89 return bottomLayout; |
93 } |
90 } |
94 |
91 |
95 void PageNetGame::connectSignals() |
92 void PageNetGame::connectSignals() |
96 { |
93 { |
97 connect(btnDLC, SIGNAL(clicked()), this, SIGNAL(DLCClicked())); |
|
98 |
|
99 connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); |
94 connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); |
100 |
95 |
101 connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick())); |
96 connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick())); |
102 } |
97 } |
103 |
98 |
155 leRoomName->rememberCurrentText(); |
150 leRoomName->rememberCurrentText(); |
156 } |
151 } |
157 else |
152 else |
158 { |
153 { |
159 leRoomName->clear(); |
154 leRoomName->clear(); |
160 QMessageBox::critical(this, |
155 QMessageBox roomMsg(this); |
161 tr("Error"), |
156 roomMsg.setIcon(QMessageBox::Warning); |
162 tr("Please enter room name"), |
157 roomMsg.setWindowTitle(QMessageBox::tr("Netgame - Error")); |
163 tr("OK")); |
158 roomMsg.setText(QMessageBox::tr("Please enter room name")); |
|
159 roomMsg.setWindowModality(Qt::WindowModal); |
|
160 roomMsg.exec(); |
164 } |
161 } |
165 } |
162 } |
166 |
163 |
167 |
164 |
168 void PageNetGame::setRoomName(const QString & roomName) |
165 void PageNetGame::setRoomName(const QString & roomName) |
175 { |
172 { |
176 BtnMaster->setVisible(isMaster); |
173 BtnMaster->setVisible(isMaster); |
177 BtnStart->setVisible(isMaster); |
174 BtnStart->setVisible(isMaster); |
178 BtnUpdate->setVisible(isMaster); |
175 BtnUpdate->setVisible(isMaster); |
179 leRoomName->setVisible(isMaster); |
176 leRoomName->setVisible(isMaster); |
180 |
|
181 //disable the `toggle ready` button, because the start button does the same |
|
182 //job when the user is chief |
|
183 BtnGo->setVisible(!isMaster); |
|
184 } |
177 } |
185 |
178 |
186 void PageNetGame::setUser(const QString & nickname) |
179 void PageNetGame::setUser(const QString & nickname) |
187 { |
180 { |
188 pChatWidget->setUser(nickname); |
181 pChatWidget->setUser(nickname); |