equal
deleted
inserted
replaced
18 */ |
18 */ |
19 |
19 |
20 #include <QResizeEvent> |
20 #include <QResizeEvent> |
21 #include <QCoreApplication> |
21 #include <QCoreApplication> |
22 #include <QPalette> |
22 #include <QPalette> |
|
23 #include <QStandardItemModel> |
23 |
24 |
24 #include "frameTeam.h" |
25 #include "frameTeam.h" |
25 #include "teamselhelper.h" |
26 #include "teamselhelper.h" |
26 #include "hwconsts.h" |
27 #include "hwconsts.h" |
27 |
28 |
33 setPalette(newPalette); |
34 setPalette(newPalette); |
34 setAutoFillBackground(true); |
35 setAutoFillBackground(true); |
35 |
36 |
36 mainLayout.setSpacing(1); |
37 mainLayout.setSpacing(1); |
37 mainLayout.setContentsMargins(4, 4, 4, 4); |
38 mainLayout.setContentsMargins(4, 4, 4, 4); |
38 |
|
39 int i = 0; |
|
40 while(colors[i] != 0) |
|
41 availableColors.push_back(QColor(colors[i++])); |
|
42 |
39 |
43 resetColors(); |
40 resetColors(); |
44 this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); |
41 this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); |
45 } |
42 } |
46 |
43 |
55 } |
52 } |
56 } |
53 } |
57 |
54 |
58 void FrameTeams::resetColors() |
55 void FrameTeams::resetColors() |
59 { |
56 { |
60 currentColor = availableColors.last(); // ensure next color is the first one |
57 currentColor = colorsModel->rowCount() - 1; // ensure next color is the first one |
61 } |
58 } |
62 |
59 |
63 QColor FrameTeams::getNextColor() const |
60 int FrameTeams::getNextColor() |
64 { |
61 { |
65 int idx = availableColors.indexOf(currentColor); |
62 currentColor = (currentColor + 1) % colorsModel->rowCount(); |
66 |
63 return currentColor; |
67 idx++; |
|
68 |
|
69 if (idx >= availableColors.size()) |
|
70 idx = 0; |
|
71 |
|
72 return availableColors.at(idx); |
|
73 } |
64 } |
74 |
65 |
75 void FrameTeams::addTeam(HWTeam team, bool willPlay) |
66 void FrameTeams::addTeam(HWTeam team, bool willPlay) |
76 { |
67 { |
77 TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this); |
68 TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this); |