25 #include "pagenetgame.h" |
25 #include "pagenetgame.h" |
26 #include "gamecfgwidget.h" |
26 #include "gamecfgwidget.h" |
27 #include "teamselect.h" |
27 #include "teamselect.h" |
28 #include "chatwidget.h" |
28 #include "chatwidget.h" |
29 |
29 |
30 PageNetGame::PageNetGame(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : AbstractPage(parent) |
30 QLayout * PageNetGame::bodyLayoutDefinition() |
31 { |
31 { |
32 QGridLayout * pageLayout = new QGridLayout(this); |
32 QGridLayout * pageLayout = new QGridLayout(); |
33 pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
33 pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
34 //pageLayout->setSpacing(1); |
34 //pageLayout->setSpacing(1); |
35 pageLayout->setColumnStretch(0, 50); |
35 pageLayout->setColumnStretch(0, 50); |
36 pageLayout->setColumnStretch(1, 50); |
36 pageLayout->setColumnStretch(1, 50); |
37 |
37 |
38 // chatwidget |
38 // chatwidget |
39 pChatWidget = new HWChatWidget(this, gameSettings, sdli, true); |
39 pChatWidget = new HWChatWidget(this, m_gameSettings, m_sdli, true); |
40 pChatWidget->setShowReady(true); // show status bulbs by default |
40 pChatWidget->setShowReady(true); // show status bulbs by default |
41 pChatWidget->setShowFollow(false); // don't show follow in nicks' context menus |
41 pChatWidget->setShowFollow(false); // don't show follow in nicks' context menus |
42 pageLayout->addWidget(pChatWidget, 2, 0, 1, 2); |
42 pageLayout->addWidget(pChatWidget, 2, 0, 1, 2); |
43 pageLayout->setRowStretch(1, 100); |
43 pageLayout->setRowStretch(1, 100); |
44 pageLayout->setRowStretch(2, 100); |
44 pageLayout->setRowStretch(2, 100); |
45 |
45 |
46 pGameCFG = new GameCFGWidget(this); |
46 pGameCFG = new GameCFGWidget(this); |
47 pageLayout->addWidget(pGameCFG, 0, 0); |
47 pageLayout->addWidget(pGameCFG, 0, 0); |
48 |
48 |
49 QPushButton * btnSetup = new QPushButton(this); |
49 btnSetup = new QPushButton(this); |
50 btnSetup->setText(QPushButton::tr("Setup")); |
50 btnSetup->setText(QPushButton::tr("Setup")); |
51 connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); |
|
52 pageLayout->addWidget(btnSetup, 1, 0); |
51 pageLayout->addWidget(btnSetup, 1, 0); |
53 |
52 |
54 pNetTeamsWidget = new TeamSelWidget(this); |
53 pNetTeamsWidget = new TeamSelWidget(this); |
55 pNetTeamsWidget->setAcceptOuter(true); |
54 pNetTeamsWidget->setAcceptOuter(true); |
56 pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
55 pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
57 |
56 |
|
57 return pageLayout; |
|
58 } |
58 |
59 |
|
60 QLayout * PageNetGame::footerLayoutDefinition() |
|
61 { |
59 QHBoxLayout * bottomLayout = new QHBoxLayout; |
62 QHBoxLayout * bottomLayout = new QHBoxLayout; |
60 pageLayout->addLayout(bottomLayout, 4, 0, 1, 2); |
|
61 |
|
62 |
|
63 BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true); |
|
64 connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); |
|
65 |
|
66 |
63 |
67 leRoomName = new QLineEdit(this); |
64 leRoomName = new QLineEdit(this); |
68 leRoomName->setMaxLength(60); |
65 leRoomName->setMaxLength(60); |
69 leRoomName->setMinimumWidth(200); |
66 leRoomName->setMinimumWidth(200); |
70 leRoomName->setMaximumWidth(400); |
67 leRoomName->setMaximumWidth(400); |
71 bottomLayout->addWidget(leRoomName, 8,0); |
|
72 BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1, false); |
|
73 |
68 |
74 BtnGo = new QPushButton(this); |
69 BtnGo = new QPushButton(this); |
75 BtnGo->setToolTip(QPushButton::tr("Ready")); |
70 BtnGo->setToolTip(QPushButton::tr("Ready")); |
76 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
71 BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
77 BtnGo->setIconSize(QSize(25, 34)); |
72 BtnGo->setIconSize(QSize(25, 34)); |
78 BtnGo->setMinimumWidth(50); |
73 BtnGo->setMinimumWidth(50); |
79 BtnGo->setMinimumHeight(50); |
74 BtnGo->setMinimumHeight(50); |
80 bottomLayout->addWidget(BtnGo, 4); |
|
81 |
75 |
82 |
76 |
83 BtnMaster = addButton(tr("Control"), bottomLayout, 2); |
77 bottomLayout->addWidget(leRoomName); |
|
78 BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1, false); |
|
79 bottomLayout->addWidget(BtnGo); |
|
80 |
|
81 BtnMaster = addButton(tr("Control"), bottomLayout, 3); |
|
82 bottomLayout->insertStretch(3, 100); |
|
83 |
|
84 BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); |
|
85 |
|
86 return bottomLayout; |
|
87 } |
|
88 |
|
89 void PageNetGame::connectSignals() |
|
90 { |
|
91 connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); |
|
92 |
|
93 connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick())); |
|
94 } |
|
95 |
|
96 PageNetGame::PageNetGame(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : AbstractPage(parent) |
|
97 { |
|
98 m_gameSettings = gameSettings; |
|
99 m_sdli = sdli; |
|
100 |
|
101 initPage(); |
|
102 |
84 QMenu * menu = new QMenu(BtnMaster); |
103 QMenu * menu = new QMenu(BtnMaster); |
|
104 |
85 restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
105 restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
86 restrictJoins->setCheckable(true); |
106 restrictJoins->setCheckable(true); |
87 restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
107 restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
88 restrictTeamAdds->setCheckable(true); |
108 restrictTeamAdds->setCheckable(true); |
89 //menu->addAction(startGame); |
109 //menu->addAction(startGame); |
90 menu->addAction(restrictJoins); |
110 menu->addAction(restrictJoins); |
91 menu->addAction(restrictTeamAdds); |
111 menu->addAction(restrictTeamAdds); |
92 |
112 |
93 BtnMaster->setMenu(menu); |
113 BtnMaster->setMenu(menu); |
94 |
114 |
95 BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); |
|
96 |
|
97 bottomLayout->insertStretch(3, 100); |
|
98 |
|
99 connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick())); |
|
100 } |
115 } |
101 |
116 |
102 void PageNetGame::setReadyStatus(bool isReady) |
117 void PageNetGame::setReadyStatus(bool isReady) |
103 { |
118 { |
104 if(isReady) |
119 if(isReady) |