QTfrontend/ui/widget/frameTeam.cpp
changeset 7130 fcab1fd02bc6
parent 7005 19cddb42326f
child 7258 722e8a0d89dc
--- a/QTfrontend/ui/widget/frameTeam.cpp	Sat May 26 16:50:51 2012 -0400
+++ b/QTfrontend/ui/widget/frameTeam.cpp	Sun May 27 23:42:43 2012 +0400
@@ -20,6 +20,7 @@
 #include <QResizeEvent>
 #include <QCoreApplication>
 #include <QPalette>
+#include <QStandardItemModel>
 
 #include "frameTeam.h"
 #include "teamselhelper.h"
@@ -36,10 +37,6 @@
     mainLayout.setSpacing(1);
     mainLayout.setContentsMargins(4, 4, 4, 4);
 
-    int i = 0;
-    while(colors[i] != 0)
-        availableColors.push_back(QColor(colors[i++]));
-
     resetColors();
     this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
 }
@@ -57,19 +54,13 @@
 
 void FrameTeams::resetColors()
 {
-    currentColor = availableColors.last(); // ensure next color is the first one
+    currentColor = colorsModel->rowCount() - 1; // ensure next color is the first one
 }
 
-QColor FrameTeams::getNextColor() const
+int FrameTeams::getNextColor()
 {
-    int idx = availableColors.indexOf(currentColor);
-
-    idx++;
-
-    if (idx >= availableColors.size())
-        idx = 0;
-
-    return availableColors.at(idx);
+    currentColor = (currentColor + 1) % colorsModel->rowCount();
+    return currentColor;
 }
 
 void FrameTeams::addTeam(HWTeam team, bool willPlay)