# HG changeset patch
# User smxx
# Date 1269473473 0
# Node ID e129e4c3f30ee13b6c104eba9409e33f7a79a50d
# Parent 0c5f5f13eef43a670dfa6632f973687d9430c78e
Frontend:
* Updated game scheme page
* Removed text labels from toggle buttons (looked ugly on smaller resolutions)
diff -r 0c5f5f13eef4 -r e129e4c3f30e QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc Wed Mar 24 18:01:49 2010 +0000
+++ b/QTfrontend/hedgewars.qrc Wed Mar 24 23:31:13 2010 +0000
@@ -64,13 +64,14 @@
res/btnKing.png
res/btnPlaceHog.png
res/btnSharedAmmo.png
- res/btnDisableGirders.png
+ res/btnDisableGirders.png
res/iconBox.png
res/iconHealth.png
res/iconSuddenDeath.png
res/iconDamage.png
res/iconTime.png
res/iconMine.png
+ res/iconDud.png
res/dice.png
res/Star.png
res/file_save.png
diff -r 0c5f5f13eef4 -r e129e4c3f30e QTfrontend/pages.cpp
--- a/QTfrontend/pages.cpp Wed Mar 24 18:01:49 2010 +0000
+++ b/QTfrontend/pages.cpp Wed Mar 24 23:31:13 2010 +0000
@@ -1151,83 +1151,67 @@
// Left
TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png");
- TBW_mode_Forts->setText(ToggleButtonWidget::tr("Fort Mode"));
- TBW_mode_Forts->setToolTip(tr("Defend your fort and destroy the opponents, two team colours max!"));
+ TBW_mode_Forts->setToolTip("" + ToggleButtonWidget::tr("Fort Mode") + ":
" + tr("Defend your fort and destroy the opponents, two team colours max!"));
glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1);
TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide.png");
- TBW_teamsDivide->setText(ToggleButtonWidget::tr("Divide Teams"));
- TBW_teamsDivide->setToolTip(tr("Teams will start on opposite sides of the terrain, two team colours max!"));
+ TBW_teamsDivide->setToolTip("" + ToggleButtonWidget::tr("Divide Teams") + ":
" + tr("Teams will start on opposite sides of the terrain, two team colours max!"));
glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1);
TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid.png");
- TBW_solid->setText(ToggleButtonWidget::tr("Solid Land"));
- TBW_solid->setToolTip(tr("Land can not be destroyed!"));
+ TBW_solid->setToolTip("" + ToggleButtonWidget::tr("Solid Land") + ":
" + tr("Land can not be destroyed!"));
glGMLayout->addWidget(TBW_solid,0,2,1,1);
TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png");
- TBW_border->setText(ToggleButtonWidget::tr("Add Border"));
- TBW_border->setToolTip(tr("Add an indestructable border around the terrain"));
+ TBW_border->setToolTip("" + ToggleButtonWidget::tr("Add Border") + ":
" + tr("Add an indestructable border around the terrain"));
glGMLayout->addWidget(TBW_border,0,3,1,1);
TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png");
- TBW_lowGravity->setText(ToggleButtonWidget::tr("Low Gravity"));
- TBW_lowGravity->setToolTip(tr("Lower gravity"));
+ TBW_lowGravity->setToolTip("" + ToggleButtonWidget::tr("Low Gravity") + ":
" + tr("Lower gravity"));
glGMLayout->addWidget(TBW_lowGravity,1,0,1,1);
TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png");
- TBW_laserSight->setText(ToggleButtonWidget::tr("Laser Sight"));
- TBW_laserSight->setToolTip(tr("Assisted aiming with laser sight"));
+ TBW_laserSight->setToolTip("" + ToggleButtonWidget::tr("Laser Sight") + ":
" + tr("Assisted aiming with laser sight"));
glGMLayout->addWidget(TBW_laserSight,1,1,1,1);
TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png");
- TBW_invulnerable->setText(ToggleButtonWidget::tr("Invulnerable"));
- TBW_invulnerable->setToolTip(tr("All hogs have a personal forcefield"));
+ TBW_invulnerable->setToolTip("" + ToggleButtonWidget::tr("Invulnerable") + ":
" + tr("All hogs have a personal forcefield"));
glGMLayout->addWidget(TBW_invulnerable,1,2,1,1);
TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png");
- TBW_mines->setText(ToggleButtonWidget::tr("Add Mines"));
- TBW_mines->setToolTip(tr("Enable random mines"));
+ TBW_mines->setToolTip("" + ToggleButtonWidget::tr("Add Mines") + ":
" + tr("Enable random mines"));
glGMLayout->addWidget(TBW_mines,1,3,1,1);
TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png");
- TBW_vampiric->setText(ToggleButtonWidget::tr("Vampirism"));
- TBW_vampiric->setToolTip(tr("Gain 80% of the damage you do back in health"));
+ TBW_vampiric->setToolTip("" + ToggleButtonWidget::tr("Vampirism") + ":
" + tr("Gain 80% of the damage you do back in health"));
glGMLayout->addWidget(TBW_vampiric,2,0,1,1);
TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png");
- TBW_karma->setText(ToggleButtonWidget::tr("Karma"));
- TBW_karma->setToolTip(tr("Share your opponents pain, share their damage"));
+ TBW_karma->setToolTip("" + ToggleButtonWidget::tr("Karma") + ":
" + tr("Share your opponents pain, share their damage"));
glGMLayout->addWidget(TBW_karma,2,1,1,1);
TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png");
- TBW_artillery->setText(ToggleButtonWidget::tr("Artillery"));
- TBW_artillery->setToolTip(tr("Your hogs are unable to move, put your artillery skills to the test"));
+ TBW_artillery->setToolTip("" + ToggleButtonWidget::tr("Artillery") + ":
" + tr("Your hogs are unable to move, put your artillery skills to the test"));
glGMLayout->addWidget(TBW_artillery,2,2,1,1);
TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png");
- TBW_randomorder->setText(ToggleButtonWidget::tr("Random Order"));
- TBW_randomorder->setToolTip(tr("Order of play is random instead of in room order."));
+ TBW_randomorder->setToolTip("" + ToggleButtonWidget::tr("Random Order") + ":
" + tr("Order of play is random instead of in room order."));
glGMLayout->addWidget(TBW_randomorder,2,3,1,1);
TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png");
- TBW_king->setText(ToggleButtonWidget::tr("King"));
- TBW_king->setToolTip(tr("Play with a King. If he dies, your side dies."));
+ TBW_king->setToolTip("" + ToggleButtonWidget::tr("King") + ":
" + tr("Play with a King. If he dies, your side dies."));
glGMLayout->addWidget(TBW_king,3,0,1,1);
TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png");
- TBW_placehog->setText(ToggleButtonWidget::tr("Place Hedgehogs"));
- TBW_placehog->setToolTip(tr("Take turns placing your hedgehogs before the start of play."));
+ TBW_placehog->setToolTip("" + ToggleButtonWidget::tr("Place Hedgehogs") + ":
" + tr("Take turns placing your hedgehogs before the start of play."));
glGMLayout->addWidget(TBW_placehog,3,1,1,1);
TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png");
- TBW_sharedammo->setText(ToggleButtonWidget::tr("Clan Shares Ammo"));
- TBW_sharedammo->setToolTip(tr("Ammo is shared between all teams that share a colour."));
+ TBW_sharedammo->setToolTip("" + ToggleButtonWidget::tr("Clan Shares Ammo") + ":
" + tr("Ammo is shared between all teams that share a colour."));
glGMLayout->addWidget(TBW_sharedammo,3,2,1,1);
TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders.png");
- TBW_disablegirders->setText(ToggleButtonWidget::tr("Disable Girders"));
- TBW_disablegirders->setToolTip(tr("Disable girders when generating random maps."));
+ TBW_disablegirders->setToolTip("" + ToggleButtonWidget::tr("Disable Girders") + ":
" + tr("Disable girders when generating random maps."));
glGMLayout->addWidget(TBW_disablegirders,3,3,1,1);
// Right
@@ -1343,7 +1327,7 @@
glBSLayout->addWidget(l,7,0,1,1);
l = new QLabel(gbBasicSettings);
l->setFixedSize(32,32);
- l->setPixmap(QPixmap(":/res/iconMine.png"));
+ l->setPixmap(QPixmap(":/res/iconDud.png"));
glBSLayout->addWidget(l,7,1,1,1);
SB_MineDuds = new QSpinBox(gbBasicSettings);
SB_MineDuds->setRange(0, 100);
@@ -1396,22 +1380,22 @@
selectScheme->setModel(model);
mapper->addMapping(LE_name, 0);
- mapper->addMapping(TBW_mode_Forts->button(), 1);
- mapper->addMapping(TBW_teamsDivide->button(), 2);
- mapper->addMapping(TBW_solid->button(), 3);
- mapper->addMapping(TBW_border->button(), 4);
- mapper->addMapping(TBW_lowGravity->button(), 5);
- mapper->addMapping(TBW_laserSight->button(), 6);
- mapper->addMapping(TBW_invulnerable->button(), 7);
- mapper->addMapping(TBW_mines->button(), 8);
- mapper->addMapping(TBW_vampiric->button(), 9);
- mapper->addMapping(TBW_karma->button(), 10);
- mapper->addMapping(TBW_artillery->button(), 11);
- mapper->addMapping(TBW_randomorder->button(), 12);
- mapper->addMapping(TBW_king->button(), 13);
- mapper->addMapping(TBW_placehog->button(), 14);
- mapper->addMapping(TBW_sharedammo->button(), 15);
- mapper->addMapping(TBW_disablegirders->button(), 16);
+ mapper->addMapping(TBW_mode_Forts, 1);
+ mapper->addMapping(TBW_teamsDivide, 2);
+ mapper->addMapping(TBW_solid, 3);
+ mapper->addMapping(TBW_border, 4);
+ mapper->addMapping(TBW_lowGravity, 5);
+ mapper->addMapping(TBW_laserSight, 6);
+ mapper->addMapping(TBW_invulnerable, 7);
+ mapper->addMapping(TBW_mines, 8);
+ mapper->addMapping(TBW_vampiric, 9);
+ mapper->addMapping(TBW_karma, 10);
+ mapper->addMapping(TBW_artillery, 11);
+ mapper->addMapping(TBW_randomorder, 12);
+ mapper->addMapping(TBW_king, 13);
+ mapper->addMapping(TBW_placehog, 14);
+ mapper->addMapping(TBW_sharedammo, 15);
+ mapper->addMapping(TBW_disablegirders, 16);
mapper->addMapping(SB_DamageModifier, 17);
mapper->addMapping(SB_TurnTime, 18);
mapper->addMapping(SB_InitHealth, 19);
diff -r 0c5f5f13eef4 -r e129e4c3f30e QTfrontend/res/iconDud.png
Binary file QTfrontend/res/iconDud.png has changed
diff -r 0c5f5f13eef4 -r e129e4c3f30e QTfrontend/togglebutton.cpp
--- a/QTfrontend/togglebutton.cpp Wed Mar 24 18:01:49 2010 +0000
+++ b/QTfrontend/togglebutton.cpp Wed Mar 24 23:31:13 2010 +0000
@@ -20,11 +20,7 @@
ToggleButtonWidget::ToggleButtonWidget(QWidget * parent, QString img)
{
- QVBoxLayout * l = new QVBoxLayout(this);
- setLayout(l);
-
- pbMain = new QPushButton(this);
- pbMain->setCheckable(true);
+ setCheckable(true);
QPixmap pm(":/res/btnDisabled.png");
QPainter * painter = new QPainter();
@@ -32,48 +28,23 @@
pmChecked.load(img);
pmDisabled.load(img);
- pbMain->setMaximumWidth(pmChecked.width() + 6);
-
- l->addWidget(pbMain);
+ setMaximumWidth(pmChecked.width() + 6);
painter->begin(&pmDisabled);
painter->drawPixmap(pmDisabled.rect(), pm);
painter->end();
- pbMain->setIconSize(pmDisabled.size());
- pbMain->setIcon(pmDisabled);
-
- connect(pbMain, SIGNAL(toggled(bool)), this, SLOT(eventToggled(bool)));
+ setIconSize(pmDisabled.size());
+ setIcon(pmDisabled);
- lbMain = new QLabel(this);
- lbMain->setWordWrap(true);
-// lbMain->setFixedHeight(32);
-
- l->addWidget(lbMain);
+ connect(this, SIGNAL(toggled(bool)), this, SLOT(eventToggled(bool)));
}
ToggleButtonWidget::~ToggleButtonWidget()
{
- delete pbMain;
- delete lbMain;
-}
-
-bool ToggleButtonWidget::isChecked()
-{
- return pbMain->isChecked();
-}
-
-void ToggleButtonWidget::setChecked(bool checked)
-{
- pbMain->setChecked(checked);
-}
-
-void ToggleButtonWidget::setText(QString s)
-{
- lbMain->setText(s);
}
void ToggleButtonWidget::eventToggled(bool checked)
{
- if (checked) pbMain->setIcon(pmChecked); else pbMain->setIcon(pmDisabled);
+ setIcon(checked ? pmChecked : pmDisabled);
}
diff -r 0c5f5f13eef4 -r e129e4c3f30e QTfrontend/togglebutton.h
--- a/QTfrontend/togglebutton.h Wed Mar 24 18:01:49 2010 +0000
+++ b/QTfrontend/togglebutton.h Wed Mar 24 23:31:13 2010 +0000
@@ -25,22 +25,13 @@
#include
#include
-class ToggleButtonWidget : public QWidget
+class ToggleButtonWidget : public QPushButton
{
Q_OBJECT
public:
ToggleButtonWidget(QWidget * parent, QString img);
~ToggleButtonWidget();
- bool isChecked();
- void setChecked(bool checked);
- void setText(QString s);
- QPushButton * button()
- {
- return pbMain;
- }
private:
- QLabel * lbMain;
- QPushButton * pbMain;
QPixmap pmChecked;
QPixmap pmDisabled;
private slots: