23 #include <QCoreApplication> |
23 #include <QCoreApplication> |
24 |
24 |
25 using namespace std; |
25 using namespace std; |
26 |
26 |
27 FrameTeams::FrameTeams(QWidget* parent) : |
27 FrameTeams::FrameTeams(QWidget* parent) : |
28 QWidget(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this) |
28 QWidget(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this), nonInteractive(false) |
29 { |
29 { |
30 mainLayout.setSpacing(1); |
30 mainLayout.setSpacing(1); |
31 |
31 |
32 availableColors.push_back(QColor(0, 0, 255)); |
32 availableColors.push_back(QColor(0, 0, 255)); |
33 availableColors.push_back(QColor(0, 255, 0)); |
33 availableColors.push_back(QColor(0, 255, 0)); |
37 availableColors.push_back(QColor(255, 255, 0)); |
37 availableColors.push_back(QColor(255, 255, 0)); |
38 |
38 |
39 resetColors(); |
39 resetColors(); |
40 } |
40 } |
41 |
41 |
|
42 void FrameTeams::setNonInteractive() |
|
43 { |
|
44 nonInteractive=true; |
|
45 for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ++it) { |
|
46 TeamShowWidget* pts=dynamic_cast<TeamShowWidget*>(it.value()); |
|
47 if(!pts) throw; |
|
48 pts->setNonInteractive(); |
|
49 } |
|
50 } |
|
51 |
42 void FrameTeams::resetColors() |
52 void FrameTeams::resetColors() |
43 { |
53 { |
44 currentColor=availableColors.begin(); |
54 currentColor=availableColors.begin(); |
45 } |
55 } |
46 |
56 |
47 void FrameTeams::addTeam(HWTeam team, bool willPlay) |
57 void FrameTeams::addTeam(HWTeam team, bool willPlay) |
48 { |
58 { |
49 TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this); |
59 TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this); |
|
60 if(nonInteractive) pTeamShowWidget->setNonInteractive(); |
50 // int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height(); |
61 // int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height(); |
51 teamToWidget.insert(team, pTeamShowWidget); |
62 teamToWidget.insert(team, pTeamShowWidget); |
52 mainLayout.addWidget(pTeamShowWidget); |
63 mainLayout.addWidget(pTeamShowWidget); |
53 QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size()); |
64 QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size()); |
54 QCoreApplication::postEvent(parentWidget(), pevent); |
65 QCoreApplication::postEvent(parentWidget(), pevent); |