colors added to teamselwidget
authordisplacer
Sun, 05 Feb 2006 12:48:35 +0000
changeset 61 505691a09dee
parent 60 7fbfa2f13f6f
child 62 c3eda0c68cd6
colors added to teamselwidget
QTfrontend/teamselect.cpp
QTfrontend/teamselect.h
QTfrontend/teamselhelper.cpp
QTfrontend/teamselhelper.h
--- a/QTfrontend/teamselect.cpp	Sun Feb 05 12:48:02 2006 +0000
+++ b/QTfrontend/teamselect.cpp	Sun Feb 05 12:48:35 2006 +0000
@@ -11,7 +11,7 @@
 {
   curDontPlayingTeams.push_back(team);
   TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team);
-  dontPlayingLayout.addWidget(pTeamShowWidget);
+  dontPlayingLayout->addWidget(pTeamShowWidget);
 
   teamToWidget.insert(make_pair(team, pTeamShowWidget));
 
@@ -38,20 +38,38 @@
     curDontPlayingTeams.erase(itDontPlay);
   }
 
-  QGridLayout* pRemoveGrid = itDontPlay==curDontPlayingTeams.end() ? &playingLayout : &dontPlayingLayout;
-  QGridLayout* pAddGrid = itDontPlay==curDontPlayingTeams.end() ? &dontPlayingLayout : &playingLayout;
+  QGridLayout* pRemoveGrid;
+  QGridLayout* pAddGrid;
+  QWidget* newParent;
+  if(itDontPlay==curDontPlayingTeams.end()) {
+    pRemoveGrid=playingLayout;
+    pAddGrid=dontPlayingLayout;
+    newParent=dontPlayingColorFrame;
+  } else {
+    pRemoveGrid=dontPlayingLayout;
+    pAddGrid=playingLayout;
+    newParent=playingColorFrame;
+  }
 
   pRemoveGrid->removeWidget(teamToWidget[team]);
+  teamToWidget[team]->setParent(newParent);
   pAddGrid->addWidget(teamToWidget[team]);
 }
 
-TeamSelWidget::TeamSelWidget(const vector<QString>& teams, QWidget* parent) :
+TeamSelWidget::TeamSelWidget(QWidget* parent) :
   QWidget(parent), mainLayout(this)
 {
-  mainLayout.addLayout(&playingLayout);
-  mainLayout.addLayout(&dontPlayingLayout);
+  playingColorFrame = new QFrame;
+  QPalette newPalette = palette();
+  newPalette.setColor(QPalette::Background, QColor("DarkTurquoise"));
+  playingColorFrame->setPalette(newPalette);
+  mainLayout.addWidget(playingColorFrame);
 
-  for(vector<QString>::const_iterator it=teams.begin(); it!=teams.end(); ++it) {
-    addTeam(*it);
-  }
+  dontPlayingColorFrame = new QFrame;
+  newPalette.setColor(QPalette::Background, QColor("LightGoldenrodYellow")); //BlanchedAlmond MistyRose honeydew PeachPuff LightCoral
+  dontPlayingColorFrame->setPalette(newPalette);
+  mainLayout.addWidget(dontPlayingColorFrame);
+  
+  playingLayout = new QGridLayout(playingColorFrame);
+  dontPlayingLayout = new QGridLayout(dontPlayingColorFrame);
 }
--- a/QTfrontend/teamselect.h	Sun Feb 05 12:48:02 2006 +0000
+++ b/QTfrontend/teamselect.h	Sun Feb 05 12:48:35 2006 +0000
@@ -3,6 +3,7 @@
 
 #include <QWidget>
 #include <QVBoxLayout>
+#include <QFrame>
 
 #include <list>
 #include <map>
@@ -27,7 +28,7 @@
   Q_OBJECT
  
  public:
-  TeamSelWidget(const vector<QString>& teams, QWidget* parent=0);
+  TeamSelWidget(QWidget* parent=0);
   void addTeam(tmprop team);
   void removeTeam(tmprop team);
 
@@ -36,8 +37,11 @@
 
  private:
   QVBoxLayout mainLayout;
-  QGridLayout playingLayout;
-  QGridLayout dontPlayingLayout;
+
+  QFrame* playingColorFrame;
+  QFrame* dontPlayingColorFrame;
+  QGridLayout* playingLayout;
+  QGridLayout* dontPlayingLayout;
 
   list<tmprop> curPlayingTeams;
   list<tmprop> curDontPlayingTeams;
--- a/QTfrontend/teamselhelper.cpp	Sun Feb 05 12:48:02 2006 +0000
+++ b/QTfrontend/teamselhelper.cpp	Sun Feb 05 12:48:35 2006 +0000
@@ -8,8 +8,8 @@
   emit teamActivated(text());
 }
 
-TeamShowWidget::TeamShowWidget(tmprop team) :
-  mainLayout(this), m_team(team)
+TeamShowWidget::TeamShowWidget(tmprop team, QWidget * parent) :
+  QWidget(parent), mainLayout(this), m_team(team)
 {
   QLabel* pixlbl=new QLabel();
   pixlbl->setPixmap(QPixmap("./Data/Graphics/thinking.png"));
--- a/QTfrontend/teamselhelper.h	Sun Feb 05 12:48:02 2006 +0000
+++ b/QTfrontend/teamselhelper.h	Sun Feb 05 12:48:35 2006 +0000
@@ -30,7 +30,7 @@
  void activateTeam();
 
  public:
- TeamShowWidget(tmprop team);
+ TeamShowWidget(tmprop team, QWidget * parent = 0);
  
  private:
  QHBoxLayout mainLayout;