30 |
30 |
31 QLayout * PageNetGame::bodyLayoutDefinition() |
31 QLayout * PageNetGame::bodyLayoutDefinition() |
32 { |
32 { |
33 QGridLayout * pageLayout = new QGridLayout(); |
33 QGridLayout * pageLayout = new QGridLayout(); |
34 pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
34 pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
35 //pageLayout->setSpacing(1); |
35 pageLayout->setColumnStretch(0, 1); |
36 pageLayout->setColumnStretch(0, 50); |
36 pageLayout->setColumnStretch(1, 1); |
37 pageLayout->setColumnStretch(1, 50); |
37 pageLayout->setRowStretch(0, 0); |
38 |
38 pageLayout->setRowStretch(1, 1); |
39 // chatwidget |
39 pageLayout->setRowStretch(2, 1); |
|
40 |
|
41 // Room config |
|
42 |
|
43 QHBoxLayout * roomConfigLayout = new QHBoxLayout(); |
|
44 pageLayout->addLayout(roomConfigLayout, 0, 0, 1, 2); |
|
45 roomConfigLayout->setSpacing(0); |
|
46 |
|
47 leRoomName = new HistoryLineEdit(this, 10); |
|
48 leRoomName->setMaxLength(60); |
|
49 leRoomName->setMinimumWidth(400); |
|
50 leRoomName->setMaximumWidth(600); |
|
51 leRoomName->setFixedHeight(30); |
|
52 leRoomName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
53 roomConfigLayout->addWidget(leRoomName, 100); |
|
54 |
|
55 QLabel * lblRoomName = new QLabel(tr("Room name: "), leRoomName); |
|
56 lblRoomName->setStyleSheet("font: 12px; font-weight: bold;"); |
|
57 lblRoomName->setStyleSheet(QString("font: 12px; font-weight: bold; background: none; margin-left: -%1px; margin-top: 8px;").arg(lblRoomName->width() - 20)); |
|
58 leRoomName->setStyleSheet(QString("font: 12px; border-right: 0; padding-left: %1px; padding-bottom: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px;").arg(lblRoomName->width() - 14)); |
|
59 |
|
60 BtnUpdate = new QPushButton(); |
|
61 BtnUpdate->setEnabled(false); |
|
62 BtnUpdate->setText(tr("Update")); |
|
63 BtnUpdate->setFixedHeight(leRoomName->height() - 0); |
|
64 BtnUpdate->setStyleSheet("border-top-left-radius: 0px; border-bottom-left-radius: 0px; padding: auto 4px;"); |
|
65 roomConfigLayout->addWidget(BtnUpdate, 0); |
|
66 |
|
67 lblRoomNameReadOnly = new QLabel(); |
|
68 lblRoomNameReadOnly->setMinimumWidth(400); |
|
69 lblRoomNameReadOnly->setMaximumWidth(600); |
|
70 lblRoomNameReadOnly->setFixedHeight(30); |
|
71 lblRoomNameReadOnly->setObjectName("labelLikeLineEdit"); |
|
72 lblRoomNameReadOnly->setStyleSheet("font: 12px;"); |
|
73 lblRoomNameReadOnly->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
74 lblRoomNameReadOnly->setVisible(false); |
|
75 roomConfigLayout->addWidget(lblRoomNameReadOnly, 100); |
|
76 |
|
77 roomConfigLayout->addSpacing(10); |
|
78 |
|
79 BtnMaster = new QPushButton(); |
|
80 BtnMaster->setText(tr("Room controls")); |
|
81 BtnMaster->setFixedHeight(leRoomName->height() - 0); |
|
82 BtnMaster->setStyleSheet("QPushButton { padding: auto 4px; } QPushButton:pressed { background-color: #ffcc00; border-color: #ffcc00; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; color: #11084A; }"); |
|
83 roomConfigLayout->addWidget(BtnMaster, 0); |
|
84 |
|
85 roomConfigLayout->addStretch(1); |
|
86 |
|
87 // Game config |
|
88 |
|
89 pGameCFG = new GameCFGWidget(this); |
|
90 pageLayout->addWidget(pGameCFG, 1, 0); |
|
91 |
|
92 // Teams |
|
93 |
|
94 pNetTeamsWidget = new TeamSelWidget(this); |
|
95 pNetTeamsWidget->setAcceptOuter(true); |
|
96 pNetTeamsWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); |
|
97 pageLayout->addWidget(pNetTeamsWidget, 1, 1, 1, 1); |
|
98 |
|
99 // Chat |
|
100 |
40 chatWidget = new HWChatWidget(this, true); |
101 chatWidget = new HWChatWidget(this, true); |
41 chatWidget->setShowFollow(false); // don't show follow in nicks' context menus |
102 chatWidget->setShowFollow(false); // don't show follow in nicks' context menus |
42 chatWidget->setIgnoreListKick(true); // kick ignored players automatically |
103 chatWidget->setIgnoreListKick(true); // kick ignored players automatically |
43 pageLayout->addWidget(chatWidget, 1, 0, 1, 2); |
104 pageLayout->addWidget(chatWidget, 2, 0, 1, 2); |
44 pageLayout->setRowStretch(0, 0); |
|
45 pageLayout->setRowStretch(1, 0); |
|
46 |
|
47 pGameCFG = new GameCFGWidget(this); |
|
48 pageLayout->addWidget(pGameCFG, 0, 0); |
|
49 |
|
50 pNetTeamsWidget = new TeamSelWidget(this); |
|
51 pNetTeamsWidget->setAcceptOuter(true); |
|
52 pNetTeamsWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); |
|
53 pageLayout->addWidget(pNetTeamsWidget, 0, 1, 1, 1); |
|
54 |
105 |
55 return pageLayout; |
106 return pageLayout; |
56 } |
107 } |
57 |
108 |
58 QLayout * PageNetGame::footerLayoutLeftDefinition() |
109 QLayout * PageNetGame::footerLayoutLeftDefinition() |
67 |
118 |
68 QLayout * PageNetGame::footerLayoutDefinition() |
119 QLayout * PageNetGame::footerLayoutDefinition() |
69 { |
120 { |
70 QHBoxLayout * bottomLayout = new QHBoxLayout; |
121 QHBoxLayout * bottomLayout = new QHBoxLayout; |
71 |
122 |
72 leRoomName = new HistoryLineEdit(this,10); |
123 // Ready button |
73 leRoomName->setMaxLength(60); |
124 |
74 leRoomName->setMinimumWidth(200); |
|
75 leRoomName->setMaximumWidth(400); |
|
76 |
|
77 //Button to signify whether the player is ready to start playing |
|
78 BtnGo = new QPushButton(this); |
125 BtnGo = new QPushButton(this); |
79 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
126 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
80 BtnGo->setIconSize(QSize(25, 34)); |
127 BtnGo->setIconSize(QSize(25, 34)); |
81 BtnGo->setMinimumWidth(50); |
128 BtnGo->setMinimumWidth(50); |
82 BtnGo->setMinimumHeight(50); |
129 BtnGo->setMinimumHeight(50); |
83 |
130 |
84 bottomLayout->addWidget(leRoomName); |
|
85 BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1); |
|
86 |
|
87 bottomLayout->addStretch(); |
131 bottomLayout->addStretch(); |
88 bottomLayout->addWidget(BtnGo); |
132 bottomLayout->addWidget(BtnGo); |
89 |
133 |
90 BtnMaster = addButton(tr("Control"), bottomLayout, 3); |
134 // Start button |
91 bottomLayout->insertStretch(3, 100); |
|
92 |
135 |
93 const QIcon& lp = QIcon(":/res/Start.png"); |
136 const QIcon& lp = QIcon(":/res/Start.png"); |
94 QSize sz = lp.actualSize(QSize(65535, 65535)); |
137 QSize sz = lp.actualSize(QSize(65535, 65535)); |
95 BtnStart = new QPushButton(); |
138 BtnStart = new QPushButton(); |
96 BtnStart->setText(tr("Start")); |
139 BtnStart->setText(tr("Start")); |
177 |
228 |
178 void PageNetGame::setRoomName(const QString & roomName) |
229 void PageNetGame::setRoomName(const QString & roomName) |
179 { |
230 { |
180 leRoomName->setText(roomName); |
231 leRoomName->setText(roomName); |
181 leRoomName->rememberCurrentText(); |
232 leRoomName->rememberCurrentText(); |
|
233 lblRoomNameReadOnly->setText(roomName); |
|
234 BtnUpdate->setEnabled(false); |
182 } |
235 } |
183 |
236 |
184 void PageNetGame::setMasterMode(bool isMaster) |
237 void PageNetGame::setMasterMode(bool isMaster) |
185 { |
238 { |
186 BtnMaster->setVisible(isMaster); |
239 BtnMaster->setVisible(isMaster); |
187 BtnStart->setVisible(isMaster); |
240 BtnStart->setVisible(isMaster); |
188 BtnUpdate->setVisible(isMaster); |
241 BtnUpdate->setVisible(isMaster); |
189 leRoomName->setVisible(isMaster); |
242 leRoomName->setVisible(isMaster); |
|
243 lblRoomNameReadOnly->setVisible(!isMaster); |
190 } |
244 } |
191 |
245 |
192 void PageNetGame::setUser(const QString & nickname) |
246 void PageNetGame::setUser(const QString & nickname) |
193 { |
247 { |
194 chatWidget->setUser(nickname); |
248 chatWidget->setUser(nickname); |