Fix a bug with wrong state of teams list when color isn't changed manually
authorunc0rr
Mon, 28 May 2012 22:42:59 +0400
changeset 7145 1d1a14b39400
parent 7144 6e3974128631
child 7146 a822413207c9
child 7147 11b7b12e2b85
Fix a bug with wrong state of teams list when color isn't changed manually
QTfrontend/team.cpp
QTfrontend/ui/widget/teamselect.cpp
QTfrontend/ui/widget/teamselhelper.cpp
QTfrontend/ui/widget/teamselhelper.h
--- a/QTfrontend/team.cpp	Mon May 28 14:20:51 2012 -0400
+++ b/QTfrontend/team.cpp	Mon May 28 22:42:59 2012 +0400
@@ -54,6 +54,7 @@
     m_rounds = 0;
     m_wins = 0;
     m_campaignProgress = 0;
+    m_color = 0;
 }
 
 HWTeam::HWTeam(const QStringList& strLst) :
@@ -82,6 +83,7 @@
     m_rounds = 0;
     m_wins = 0;
     m_campaignProgress = 0;
+    m_color = 0;
 }
 
 HWTeam::HWTeam() :
@@ -112,6 +114,7 @@
     m_rounds = 0;
     m_wins = 0;
     m_campaignProgress = 0;
+    m_color = 0;
 }
 
 HWTeam::HWTeam(const HWTeam & other) :
@@ -157,6 +160,7 @@
         m_campaignProgress = other.m_campaignProgress;
         m_rounds = other.m_rounds;
         m_wins = other.m_wins;
+        m_color = other.m_color;
     }
 
     return *this;
--- a/QTfrontend/ui/widget/teamselect.cpp	Mon May 28 14:20:51 2012 -0400
+++ b/QTfrontend/ui/widget/teamselect.cpp	Mon May 28 22:42:59 2012 +0400
@@ -169,8 +169,8 @@
         // return if max playing teams reached
         if(framePlaying->isFullTeams()) return;
         // dont playing team => playing
+        itDontPlay->setColor(framePlaying->getNextColor());
         team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network)
-        itDontPlay->setColor(framePlaying->getNextColor());
         curPlayingTeams.push_back(*itDontPlay);
         if(!m_acceptOuter) emit teamWillPlay(*itDontPlay);
         m_curNotPlayingTeams.erase(itDontPlay);
@@ -295,6 +295,6 @@
 
 void TeamSelWidget::pre_changeTeamStatus(HWTeam team)
 {
-    team.setColor(framePlaying->getNextColor());
+    //team.setColor(framePlaying->getNextColor());
     emit acceptRequested(team);
 }
--- a/QTfrontend/ui/widget/teamselhelper.cpp	Mon May 28 14:20:51 2012 -0400
+++ b/QTfrontend/ui/widget/teamselhelper.cpp	Mon May 28 22:42:59 2012 +0400
@@ -20,6 +20,7 @@
 #include <QPixmap>
 #include <QPainter>
 #include <QStyleFactory>
+#include <QDebug>
 
 #include <algorithm>
 
@@ -33,7 +34,7 @@
     emit teamActivated(text());
 }
 
-TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, FrameTeams * parent) :
+TeamShowWidget::TeamShowWidget(const HWTeam & team, bool isPlaying, FrameTeams * parent) :
     QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0),
     colorWidget(0)
 {
@@ -73,9 +74,8 @@
         colorWidget->setMaximumWidth(26);
         colorWidget->setMinimumHeight(26);
         colorWidget->setMaximumHeight(26);
-        //colorWidget->setGeometry(0, 0, 26, 26);
+        colorWidget->setColor(team.color());
         connect(colorWidget, SIGNAL(colorChanged(int)), this, SLOT(onColorChanged(int)));
-        colorWidget->setColor(m_parentFrameTeams->getNextColor());
         mainLayout.addWidget(colorWidget);
 
         phhoger = new CHedgehogerWidget(QImage(":/res/hh25x25.png"), QImage(":/res/hh25x25grey.png"), this);
--- a/QTfrontend/ui/widget/teamselhelper.h	Mon May 28 14:20:51 2012 -0400
+++ b/QTfrontend/ui/widget/teamselhelper.h	Mon May 28 22:42:59 2012 +0400
@@ -58,7 +58,7 @@
         void onColorChanged(int color);
 
     public:
-        TeamShowWidget(HWTeam team, bool isPlaying, FrameTeams * parent);
+        TeamShowWidget(const HWTeam &team, bool isPlaying, FrameTeams * parent);
         void setPlaying(bool isPlaying);
         void setHHNum(unsigned int num);
         void setInteractivity(bool interactive);