Enable back the ability to see chosen team color in team widget
authorunc0rr
Sat, 20 Sep 2008 04:51:06 +0000
changeset 1283 a1e99d1e4fd3
parent 1282 76533d0e76e3
child 1284 21916b5de218
Enable back the ability to see chosen team color in team widget
QTfrontend/teamselhelper.cpp
hedgewars/uGears.pas
--- a/QTfrontend/teamselhelper.cpp	Sat Sep 20 03:54:56 2008 +0000
+++ b/QTfrontend/teamselhelper.cpp	Sat Sep 20 04:51:06 2008 +0000
@@ -57,22 +57,24 @@
 			"font: bold;"
 		"}");
 
-  if(m_isPlaying) {
-    // team color
-    colorButt=new QPushButton(this);
-    colorButt->setMaximumWidth(30);
-    colorButt->setGeometry(0, 0, 30, 30);
-    changeTeamColor();
-    connect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor()));
-    mainLayout.addWidget(colorButt);
+	if(m_isPlaying) {
+		// team color
+		colorButt=new QPushButton(this);
+		colorButt->setMaximumWidth(30);
+		colorButt->setMinimumHeight(30);
+		colorButt->setGeometry(0, 0, 30, 30);
+		
+		changeTeamColor();
+		connect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor()));
+		mainLayout.addWidget(colorButt);
 
-    phhoger=new CHedgehogerWidget(QImage(":/res/hh25x25.png"), this);
-    connect(phhoger, SIGNAL(hedgehogsNumChanged()), this, SLOT(hhNumChanged()));
-    mainLayout.addWidget(phhoger);
-  }
+		phhoger=new CHedgehogerWidget(QImage(":/res/hh25x25.png"), this);
+		connect(phhoger, SIGNAL(hedgehogsNumChanged()), this, SLOT(hhNumChanged()));
+		mainLayout.addWidget(phhoger);
+	}
 
-  QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
-  //QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
+	QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam()));
+	//QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam()));
 }
 
 void TeamShowWidget::setNonInteractive()
@@ -112,30 +114,30 @@
 
 void TeamShowWidget::changeTeamColor(QColor color)
 {
-  FrameTeams* pOurFrameTeams=dynamic_cast<FrameTeams*>(parentWidget());
-  if(!color.isValid()) {
-    if(++pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
-      pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
-    }
-    color=*pOurFrameTeams->currentColor;
-  } else {
-    // set according color iterator
-    pOurFrameTeams->currentColor=std::find(pOurFrameTeams->availableColors.begin(),
-					   pOurFrameTeams->availableColors.end(), color);
-    if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
-      // error condition
-      pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
-    }
-  }
+	FrameTeams* pOurFrameTeams=dynamic_cast<FrameTeams*>(parentWidget());
+	if(!color.isValid()) {
+		if(++pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
+			pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
+		}
+		color=*pOurFrameTeams->currentColor;
+	} else {
+		// set according color iterator
+		pOurFrameTeams->currentColor=std::find(pOurFrameTeams->availableColors.begin(),
+				pOurFrameTeams->availableColors.end(), color);
+		if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) {
+			// error condition
+			pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin();
+		}
+	}
 
-  QPalette newPalette = palette();
-  newPalette.setColor(QPalette::Button, color);
-  newPalette.setColor(QPalette::Highlight, color);
-  //colorButt->setStyleSheet(QString("background-color : ")+pOurFrameTeams->currentColor->name());
-  colorButt->setStyle(QStyleFactory::create("plastique"));
-  colorButt->setPalette(newPalette);
-  m_team.teamColor=color;
-  emit teamColorChanged(m_team);
+	colorButt->setStyleSheet(QString("QPushButton{"
+			"background-color: %1;"
+			"border-width: 1px;"
+			"border-radius: 2px;"
+			"}").arg(pOurFrameTeams->currentColor->name()));
+
+	m_team.teamColor=color;
+	emit teamColorChanged(m_team);
 }
 
 HWTeam TeamShowWidget::getTeam() const
--- a/hedgewars/uGears.pas	Sat Sep 20 03:54:56 2008 +0000
+++ b/hedgewars/uGears.pas	Sat Sep 20 04:51:06 2008 +0000
@@ -952,8 +952,8 @@
 					if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1;
 					DrawRotatedTex(Team^.CrosshairTex,
 							12, 12,
-							Round(hwRound(Gear^.X) + hwSign(Gear^.dX) * m * Sin(Gear^.Angle*pi/cMaxAngle) * 60) + WorldDx,
-							Round(hwRound(Gear^.Y) - Cos(Gear^.Angle*pi/cMaxAngle) * 60) + WorldDy, 0,
+							Round(hwRound(Gear^.X) + hwSign(Gear^.dX) * m * Sin(Gear^.Angle*pi/cMaxAngle) * 80) + WorldDx,
+							Round(hwRound(Gear^.Y) - Cos(Gear^.Angle*pi/cMaxAngle) * 80) + WorldDy, 0,
 							hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle)
 					end
 			end