Customize team select widget background
authorunc0rr
Tue, 21 Oct 2008 13:36:59 +0000
changeset 1389 6e411559cc7b
parent 1388 5e7920f2e2aa
child 1390 914fa66aec05
Customize team select widget background
QTfrontend/frameTeam.cpp
QTfrontend/pages.cpp
QTfrontend/teamselect.cpp
QTfrontend/teamselhelper.cpp
--- a/QTfrontend/frameTeam.cpp	Mon Oct 20 21:15:28 2008 +0000
+++ b/QTfrontend/frameTeam.cpp	Tue Oct 21 13:36:59 2008 +0000
@@ -18,7 +18,7 @@
 
 #include <QResizeEvent>
 #include <QCoreApplication>
-#include <QDebug>
+#include <QPalette>
 
 #include "frameTeam.h"
 #include "teamselhelper.h"
@@ -27,16 +27,21 @@
 FrameTeams::FrameTeams(QWidget* parent) :
   QWidget(parent), maxHedgehogsPerGame(18), overallHedgehogs(0), mainLayout(this), nonInteractive(false)
 {
-  mainLayout.setSpacing(1);
+	QPalette newPalette = palette();
+	newPalette.setColor(QPalette::Window, QColor(0x13, 0x0f, 0x2c));
+	setPalette(newPalette);
+	setAutoFillBackground(true);
+	
+	mainLayout.setSpacing(1);
 
-  availableColors.push_back(*color1);
-  availableColors.push_back(*color2);
-  availableColors.push_back(*color3);
-  availableColors.push_back(*color4);
-  availableColors.push_back(*color5);
-  availableColors.push_back(*color6);
+	availableColors.push_back(*color1);
+	availableColors.push_back(*color2);
+	availableColors.push_back(*color3);
+	availableColors.push_back(*color4);
+	availableColors.push_back(*color5);
+	availableColors.push_back(*color6);
 
-  resetColors();
+	resetColors();
 }
 
 void FrameTeams::setNonInteractive()
--- a/QTfrontend/pages.cpp	Mon Oct 20 21:15:28 2008 +0000
+++ b/QTfrontend/pages.cpp	Tue Oct 21 13:36:59 2008 +0000
@@ -91,8 +91,8 @@
 {
 	QGridLayout * pageLayout = new QGridLayout(this);
 	QTabWidget * tbw = new QTabWidget(this);
-	QWidget * page1 = new QWidget();
-	QWidget * page2 = new QWidget();
+	QWidget * page1 = new QWidget(this);
+	QWidget * page2 = new QWidget(this);
 	tbw->addTab(page1, tr("General"));
 	tbw->addTab(page2, tr("Advanced"));
 	pageLayout->addWidget(tbw, 0, 0, 1, 3);
@@ -199,13 +199,13 @@
 	BindsBox = new QToolBox(GBoxBinds);
 	BindsBox->setLineWidth(0);
 	GBBLayout->addWidget(BindsBox);
-	page_A = new QWidget();
+	page_A = new QWidget(this);
 	BindsBox->addItem(page_A, QToolBox::tr("Actions"));
-	page_W = new QWidget();
+	page_W = new QWidget(this);
 	BindsBox->addItem(page_W, QToolBox::tr("Weapons"));
-	page_WP = new QWidget();
+	page_WP = new QWidget(this);
 	BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties"));
-	page_O = new QWidget();
+	page_O = new QWidget(this);
 	BindsBox->addItem(page_O, QToolBox::tr("Other"));
 	page2Layout->addWidget(GBoxBinds, 0, 0);
 
@@ -218,18 +218,19 @@
 	quint16 widind = 0, i = 0;
 	while (i < BINDS_NUMBER) {
 		quint16 num = 0;
-		QGridLayout * pagelayout = new QGridLayout(BindsBox->widget(widind));
+		QWidget * curW = BindsBox->widget(widind);
+		QGridLayout * pagelayout = new QGridLayout(curW);
 		do {
-			LBind[i] = new QLabel(BindsBox->widget(widind));
+			LBind[i] = new QLabel(curW);
 			LBind[i]->setText(QApplication::translate("binds", cbinds[i].name));
 			LBind[i]->setAlignment(Qt::AlignRight);
 			pagelayout->addWidget(LBind[i], num, 0);
-			CBBind[i] = new QComboBox(BindsBox->widget(widind));
+			CBBind[i] = new QComboBox(curW);
 			CBBind[i]->addItems(binds);
 			pagelayout->addWidget(CBBind[i], num, 1);
 			num++;
 		} while (!cbinds[i++].chwidget);
-		pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2);
+		pagelayout->addWidget(new QWidget(curW), num, 0, 1, 2);
 		widind++;
 	}
 }
--- a/QTfrontend/teamselect.cpp	Mon Oct 20 21:15:28 2008 +0000
+++ b/QTfrontend/teamselect.cpp	Tue Oct 21 13:36:59 2008 +0000
@@ -215,11 +215,10 @@
   QGroupBox(parent), mainLayout(this), m_acceptOuter(false)
 {
   setTitle(QGroupBox::tr("Playing teams"));
-  framePlaying=new FrameTeams();
-  frameDontPlaying=new FrameTeams();
-//  addScrArea(framePlaying, QColor("DarkTurquoise"));
-//  addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow"));
+  framePlaying = new FrameTeams();
+  frameDontPlaying = new FrameTeams();
   QPalette p;
+  p.setColor(QPalette::Window, QColor(0x13, 0x0f, 0x2c));
   addScrArea(framePlaying, p.color(QPalette::Window).light(105), 200);
   addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 0);
   QPushButton * btnSetup = new QPushButton(this);
--- a/QTfrontend/teamselhelper.cpp	Mon Oct 20 21:15:28 2008 +0000
+++ b/QTfrontend/teamselhelper.cpp	Tue Oct 21 13:36:59 2008 +0000
@@ -35,19 +35,20 @@
   QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0),
   colorButt(0)
 {
-  mainLayout.setSpacing(1);
-  mainLayout.setMargin(2);
-  this->setMaximumHeight(35);
-  QIcon difficultyIcon=team.isNetTeam() ?
-    QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty))
-    : QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty));
+	QPalette newPalette = palette();
+	newPalette.setColor(QPalette::Window, QColor(0x13, 0x0f, 0x2c));
+	setPalette(newPalette);
+	setAutoFillBackground(true);
 
-  QPalette newPalette = palette();
-  newPalette.setColor(QPalette::Button, palette().color(backgroundRole()));
+	mainLayout.setSpacing(0);
+	mainLayout.setMargin(0);
+	this->setMaximumHeight(30);
+	QIcon difficultyIcon=team.isNetTeam() ?
+		QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty))
+		: QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty));
 
 	butt = new QPushButton(difficultyIcon, team.TeamName, this);
 	butt->setFlat(true);
-	butt->setPalette(newPalette);
 	mainLayout.addWidget(butt);
 	butt->setStyleSheet("QPushButton{"
 			"icon-size: 36px;"
@@ -55,14 +56,15 @@
 			"background-color: #0d0544;"
 			"color: orange;"
 			"font: bold;"
+			"border-width: 2px;"
 		"}");
 
 	if(m_isPlaying) {
 		// team color
-		colorButt=new QPushButton(this);
-		colorButt->setMaximumWidth(30);
-		colorButt->setMinimumHeight(30);
-		colorButt->setGeometry(0, 0, 30, 30);
+		colorButt = new QPushButton(this);
+		colorButt->setMaximumWidth(26);
+		colorButt->setMinimumHeight(26);
+		colorButt->setGeometry(0, 0, 26, 26);
 		
 		changeTeamColor();
 		connect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor()));