Set custom palette to scrollbars
authorunc0rr
Sun, 26 Oct 2008 14:49:47 +0000 (2008-10-26)
changeset 1419 8650a8f55006
parent 1418 69df8f2a7cba
child 1420 917beaf54b75
Set custom palette to scrollbars
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/teamselhelper.cpp
--- a/QTfrontend/hwform.cpp	Sun Oct 26 14:45:07 2008 +0000
+++ b/QTfrontend/hwform.cpp	Sun Oct 26 14:49:47 2008 +0000
@@ -31,6 +31,7 @@
 #include <QTextBrowser>
 #include <QAction>
 #include <QTimer>
+#include <QScrollBar>
 
 #include "hwform.h"
 #include "game.h"
@@ -53,6 +54,8 @@
 {
 	ui.setupUi(this);
 
+	CustomizePalettes();
+
 	ui.pageOptions->CBResolution->addItems(sdli.getResolutions());
 
 	config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
@@ -147,28 +150,44 @@
   }
 }
 
+void HWForm::CustomizePalettes()
+{
+	QList<QScrollBar *> allSBars = findChildren<QScrollBar *>();
+	QPalette pal = palette();
+	pal.setColor(QPalette::WindowText, QColor(0xff, 0xcc, 0x00));
+	pal.setColor(QPalette::Button, QColor(0x00, 0x35, 0x1d));
+	pal.setColor(QPalette::Base, QColor(0x00, 0x35, 0x1d));
+	pal.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
+
+	for (int i = 0; i < allSBars.size(); ++i)
+		allSBars.at(i)->setPalette(pal);
+}
+
 void HWForm::UpdateWeapons()
 {
-  // FIXME: rewrite this with boost (or TR1/0x)
-  QVector<QComboBox*> combos;
-  combos.push_back(ui.pageOptions->WeaponsName);
-  combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
-  combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
+	// FIXME: rewrite this with boost (or TR1/0x)
+	QVector<QComboBox*> combos;
+	combos.push_back(ui.pageOptions->WeaponsName);
+	combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
+	combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
 
-  for(QVector<QComboBox*>::iterator it=combos.begin(); it!=combos.end(); ++it) {
-    (*it)->clear();
-    (*it)->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
-    int pos=(*it)->findText("Default");
-    if (pos!=-1) {
-      (*it)->setCurrentIndex(pos);
-    }
-  }
+	for(QVector<QComboBox*>::iterator it=combos.begin(); it!=combos.end(); ++it) {
+		(*it)->clear();
+		(*it)->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
+		int pos=(*it)->findText("Default");
+		if (pos!=-1) {
+			(*it)->setCurrentIndex(pos);
+		}
+	}
 }
 
 void HWForm::NetWeaponNameChanged(const QString& name)
 {
-  QString ammo=ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageNetGame->pGameCFG->WeaponsName->currentText());
-  hwnet->onWeaponsNameChanged(name, ammo);
+	QString ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString(
+			ui.pageNetGame->pGameCFG->WeaponsName->currentText()
+			);
+
+	hwnet->onWeaponsNameChanged(name, ammo);
 }
 
 void HWForm::UpdateTeamsLists(const QStringList* editable_teams)
--- a/QTfrontend/hwform.h	Sun Oct 26 14:45:07 2008 +0000
+++ b/QTfrontend/hwform.h	Sun Oct 26 14:49:47 2008 +0000
@@ -96,6 +96,8 @@
 	void UpdateTeamsLists(const QStringList* editable_teams=0);
 	void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo);
 	void closeEvent(QCloseEvent *event);
+	void CustomizePalettes();
+	
 	enum PageIDs {
 		ID_PAGE_SETUP_TEAM      =  0,
 		ID_PAGE_SETUP           =  1,
--- a/QTfrontend/teamselhelper.cpp	Sun Oct 26 14:45:07 2008 +0000
+++ b/QTfrontend/teamselhelper.cpp	Sun Oct 26 14:49:47 2008 +0000
@@ -70,7 +70,7 @@
 		connect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor()));
 		mainLayout.addWidget(colorButt);
 
-		phhoger=new CHedgehogerWidget(QImage(":/res/hh25x25.png"), this);
+		phhoger = new CHedgehogerWidget(QImage(":/res/hh25x25.png"), this);
 		connect(phhoger, SIGNAL(hedgehogsNumChanged()), this, SLOT(hhNumChanged()));
 		mainLayout.addWidget(phhoger);
 	}