# HG changeset patch # User displacer # Date 1169668803 0 # Node ID b28e0dd482696f5d37b4296cfaead4ab0f1fffbb # Parent c3eebac100c0203af0d10b8e9b0aece7c703ad53 hedgehogs num modification now allowed to chief client only diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/frameTeam.cpp --- a/QTfrontend/frameTeam.cpp Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/frameTeam.cpp Wed Jan 24 20:00:03 2007 +0000 @@ -25,7 +25,7 @@ using namespace std; FrameTeams::FrameTeams(QWidget* parent) : - QWidget(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this) + QWidget(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this), nonInteractive(false) { mainLayout.setSpacing(1); @@ -39,6 +39,16 @@ resetColors(); } +void FrameTeams::setNonInteractive() +{ + nonInteractive=true; + for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ++it) { + TeamShowWidget* pts=dynamic_cast(it.value()); + if(!pts) throw; + pts->setNonInteractive(); + } +} + void FrameTeams::resetColors() { currentColor=availableColors.begin(); @@ -47,6 +57,7 @@ void FrameTeams::addTeam(HWTeam team, bool willPlay) { TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this); + if(nonInteractive) pTeamShowWidget->setNonInteractive(); // int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height(); teamToWidget.insert(team, pTeamShowWidget); mainLayout.addWidget(pTeamShowWidget); diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/frameTeam.h --- a/QTfrontend/frameTeam.h Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/frameTeam.h Wed Jan 24 20:00:03 2007 +0000 @@ -39,6 +39,7 @@ bool isFullTeams() const; void resetColors(); void setHHNum(const HWTeam& team); + void setNonInteractive(); public slots: void addTeam(HWTeam team, bool willPlay); @@ -53,6 +54,7 @@ QVBoxLayout mainLayout; typedef QMultiMap tmapTeamToWidget; tmapTeamToWidget teamToWidget; + bool nonInteractive; }; #endif // _FRAME_TAM_INCLUDED diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/hedgehogerWidget.cpp --- a/QTfrontend/hedgehogerWidget.cpp Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/hedgehogerWidget.cpp Wed Jan 24 20:00:03 2007 +0000 @@ -24,7 +24,7 @@ #include "frameTeam.h" CHedgehogerWidget::CHedgehogerWidget(QWidget * parent) : - QWidget(parent) + QWidget(parent), nonInteractive(false) { if(parent) { pOurFrameTeams=dynamic_cast(parent->parentWidget()); @@ -40,8 +40,14 @@ pOurFrameTeams->overallHedgehogs-=numHedgehogs; } +void CHedgehogerWidget::setNonInteractive() +{ + nonInteractive=true; +} + void CHedgehogerWidget::mousePressEvent ( QMouseEvent * event ) { + if(nonInteractive) return; if(event->button()==Qt::LeftButton) { event->accept(); if(numHedgehogs < 8 && pOurFrameTeams->overallHedgehogs<18) { diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/hedgehogerWidget.h --- a/QTfrontend/hedgehogerWidget.h Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/hedgehogerWidget.h Wed Jan 24 20:00:03 2007 +0000 @@ -32,6 +32,7 @@ ~CHedgehogerWidget(); unsigned char getHedgehogsNum() const; void setHHNum (unsigned int num); + void setNonInteractive(); signals: void hedgehogsNumChanged(); @@ -44,6 +45,7 @@ CHedgehogerWidget(); unsigned char numHedgehogs; FrameTeams* pOurFrameTeams; + bool nonInteractive; }; #endif // _HEDGEHOGER_WIDGET diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/newnetclient.cpp --- a/QTfrontend/newnetclient.cpp Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/newnetclient.cpp Wed Jan 24 20:00:03 2007 +0000 @@ -175,6 +175,7 @@ if(lst[0]=="SLAVE") { m_pGameCFGWidget->setEnabled(false); + m_pTeamSelWidget->setNonInteractive(); return; } @@ -237,8 +238,7 @@ } if (lst[1] == "HHNUM") { HWTeam tmptm(lst[2], lst[3].toUInt()); - QMap::iterator it=m_networkToLocalteams.find(lst[3].toUInt()); - if(it!=m_networkToLocalteams.end()) { + if(m_networkToLocalteams.find(lst[3].toUInt())!=m_networkToLocalteams.end()) { tmptm=HWTeam(lst[2]); // local team should be changed } tmptm.numHedgehogs=lst[4].toUInt(); diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/teamselect.cpp --- a/QTfrontend/teamselect.cpp Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/teamselect.cpp Wed Jan 24 20:00:03 2007 +0000 @@ -43,6 +43,11 @@ } } +void TeamSelWidget::setNonInteractive() +{ + framePlaying->setNonInteractive(); +} + void TeamSelWidget::hhNumChanged(const HWTeam& team) { QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/teamselect.h --- a/QTfrontend/teamselect.h Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/teamselect.h Wed Jan 24 20:00:03 2007 +0000 @@ -44,6 +44,7 @@ void resetPlayingTeams(const QList& teamslist); bool isPlaying(HWTeam team) const; QList getPlayingTeams() const; + void setNonInteractive(); public slots: void addTeam(HWTeam team); diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/teamselhelper.cpp --- a/QTfrontend/teamselhelper.cpp Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/teamselhelper.cpp Wed Jan 24 20:00:03 2007 +0000 @@ -31,7 +31,8 @@ } TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) : - QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0), colorButt(0) + QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0), + colorButt(0) { mainLayout.setSpacing(1); mainLayout.setMargin(2); @@ -43,7 +44,7 @@ newPalette.setColor(QPalette::Button, palette().color(backgroundRole())); // team fort - QPushButton* butt=new QPushButton(difficultyIcon, "", this); + butt=new QPushButton(difficultyIcon, "", this); butt->setFlat(true); butt->setGeometry(0, 0, 30, 30); butt->setMaximumWidth(30); @@ -52,7 +53,7 @@ butt->setIconSize(butt->size()); // team name - QPushButton* bText=new QPushButton(team.TeamName, this); + bText=new QPushButton(team.TeamName, this); bText->setPalette(newPalette); bText->setFlat(true); mainLayout.addWidget(bText); @@ -76,6 +77,15 @@ QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam())); } +void TeamShowWidget::setNonInteractive() +{ + if(m_team.isNetTeam()) { + disconnect(butt, SIGNAL(clicked())); + disconnect(bText, SIGNAL(clicked())); + } + phhoger->setNonInteractive(); +} + void TeamShowWidget::setHHNum(unsigned int num) { phhoger->setHHNum(num); diff -r c3eebac100c0 -r b28e0dd48269 QTfrontend/teamselhelper.h --- a/QTfrontend/teamselhelper.h Tue Jan 23 22:48:08 2007 +0000 +++ b/QTfrontend/teamselhelper.h Wed Jan 24 20:00:03 2007 +0000 @@ -54,6 +54,7 @@ TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent); void setPlaying(bool isPlaying); void setHHNum(unsigned int num); + void setNonInteractive(); private: TeamShowWidget(); @@ -62,6 +63,8 @@ bool m_isPlaying; CHedgehogerWidget* phhoger; QPushButton* colorButt; + QPushButton* butt; + QPushButton* bText; private slots: void hhNumChanged();