# HG changeset patch
# User unc0rr
# Date 1238704623 0
# Node ID f586d75c8b6ae0dee4507768d1dc13d61810c7ff
# Parent ffe420e9e61a18cc3e26134a360f7d63ef4d2ddd
New schemes page look by TheXception
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/CMakeLists.txt
--- a/QTfrontend/CMakeLists.txt Thu Apr 02 18:50:08 2009 +0000
+++ b/QTfrontend/CMakeLists.txt Thu Apr 02 20:37:03 2009 +0000
@@ -86,6 +86,7 @@
statsPage.cpp
misc.cpp
ammoSchemeModel.cpp
+ togglebutton.cpp
)
if(MINGW)
@@ -135,6 +136,7 @@
statsPage.h
misc.h
ammoSchemeModel.h
+ togglebutton.h
)
set(hwfr_hdrs
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc Thu Apr 02 18:50:08 2009 +0000
+++ b/QTfrontend/hedgewars.qrc Thu Apr 02 20:37:03 2009 +0000
@@ -44,6 +44,19 @@
res/spin_down.png
res/PlaySound.png
res/hh_small.png
- res/dice.png
+ res/btnDisabled.png
+ res/btnForts.png
+ res/btnBorder.png
+ res/btnInvurnable.png
+ res/btnLaserSight.png
+ res/btnLowGravity.png
+ res/btnMines.png
+ res/btnTeamsDivide.png
+ res/btnSolid.png
+ res/iconBox.png
+ res/iconHealth.png
+ res/iconSuddenDeath.png
+ res/iconDamage.png
+ res/iconTime.png
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/pages.cpp
--- a/QTfrontend/pages.cpp Thu Apr 02 18:50:08 2009 +0000
+++ b/QTfrontend/pages.cpp Thu Apr 02 20:37:03 2009 +0000
@@ -59,6 +59,7 @@
#include "igbox.h"
#include "hats.h"
#include "misc.h"
+#include "togglebutton.h"
PageMain::PageMain(QWidget* parent) :
AbstractPage(parent)
@@ -467,7 +468,7 @@
pageLayout->addWidget(BtnNetSvrStart, 4, 2);
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true);
-
+
ConnGroupBox = new QGroupBox(this);
ConnGroupBox->setTitle(QGroupBox::tr("Net game"));
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3);
@@ -858,71 +859,144 @@
AbstractPage(parent)
{
QGridLayout * pageLayout = new QGridLayout(this);
-
- CB_mode_Forts = new QCheckBox(this);
- CB_mode_Forts->setText(QCheckBox::tr("Forts mode"));
- pageLayout->addWidget(CB_mode_Forts, 0, 0, 1, 2);
+ QGroupBox * gb = new QGroupBox(QGroupBox::tr("Scheme options"), this);
+
+ QGridLayout * gl = new QGridLayout();
+ gb->setLayout(gl);
- CB_teamsDivide = new QCheckBox(this);
- CB_teamsDivide->setText(QCheckBox::tr("Divide teams"));
- pageLayout->addWidget(CB_teamsDivide, 1, 0, 1, 2);
+ pageLayout->addWidget(gb, 1,0,13,4);
+
+ QGroupBox * gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb);
+ QGroupBox * gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb);
+
+ gl->addWidget(gbGameModes,0,0,1,1);
+ gl->addWidget(gbBasicSettings,0,1,1,1);
+
+ QGridLayout * glGMLayout = new QGridLayout(gbGameModes);
+ QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings);
+ gbGameModes->setLayout(glGMLayout);
+ gbBasicSettings->setLayout(glBSLayout);
+ // Left
+
+ TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png");
+ TBW_mode_Forts->setText(ToggleButtonWidget::tr("Fort Mode"));
+ glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1);
- CB_solid = new QCheckBox(this);
- CB_solid->setText(QCheckBox::tr("Solid land"));
- pageLayout->addWidget(CB_solid, 2, 0, 1, 2);
+ TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide.png");
+ TBW_teamsDivide->setText(ToggleButtonWidget::tr("Divide Teams"));
+ glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1);
+ //pageLayout->addWidget(TBW_teamsDivide, 1, 0, 1, 2);
- CB_border = new QCheckBox(this);
- CB_border->setText(QCheckBox::tr("Add Border"));
- pageLayout->addWidget(CB_border, 3, 0, 1, 2);
+ TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid.png");
+ TBW_solid->setText(ToggleButtonWidget::tr("Solid Land"));
+ glGMLayout->addWidget(TBW_solid,0,2,1,1);
+ //pageLayout->addWidget(TBW_solid, 2, 0, 1, 2);
- CB_lowGravity = new QCheckBox(this);
- CB_lowGravity->setText(QCheckBox::tr("Low Gravity"));
- pageLayout->addWidget(CB_lowGravity, 4, 0, 1, 2);
+ TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png");
+ TBW_border->setText(ToggleButtonWidget::tr("Add Border"));
+ glGMLayout->addWidget(TBW_border,0,3,1,1);
+ //pageLayout->addWidget(TBW_border, 3, 0, 1, 2);
- CB_laserSight = new QCheckBox(this);
- CB_laserSight->setText(QCheckBox::tr("Laser Sight"));
- pageLayout->addWidget(CB_laserSight, 5, 0, 1, 2);
+ TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png");
+ TBW_lowGravity->setText(ToggleButtonWidget::tr("Low Gravity"));
+ glGMLayout->addWidget(TBW_lowGravity,1,0,1,1);
+ //pageLayout->addWidget(TBW_lowGravity, 4, 0, 1, 2);
+
+ TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png");
+ TBW_laserSight->setText(ToggleButtonWidget::tr("Laser Sight"));
+ glGMLayout->addWidget(TBW_laserSight,1,1,1,1);
+ //pageLayout->addWidget(TBW_laserSight, 5, 0, 1, 2);
- CB_invulnerable = new QCheckBox(this);
- CB_invulnerable->setText(QCheckBox::tr("Invulnerable"));
- pageLayout->addWidget(CB_invulnerable, 6, 0, 1, 2);
+ TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvurnable.png");
+ TBW_invulnerable->setText(ToggleButtonWidget::tr("Invulnerable"));
+ glGMLayout->addWidget(TBW_invulnerable,1,2,1,1);
+ //pageLayout->addWidget(TBW_invulnerable, 6, 0, 1, 2);
+
+ TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png");
+ TBW_mines->setText(ToggleButtonWidget::tr("Add Mines"));
+ glGMLayout->addWidget(TBW_mines,1,3,1,1);
+ //pageLayout->addWidget(TBW_mines, 7, 0, 1, 2);
- CB_mines = new QCheckBox(this);
- CB_mines->setText(QCheckBox::tr("Add Mines"));
- pageLayout->addWidget(CB_mines, 7, 0, 1, 2);
-
- SB_DamageModifier = new QSpinBox(this);
+ // Right
+ QLabel * l;
+
+ l = new QLabel(gbBasicSettings);
+ l->setText(QLabel::tr("Damage Modifier"));
+ glBSLayout->addWidget(l,0,0,1,1);
+ l = new QLabel(gbBasicSettings);
+ l->setFixedSize(32,32);
+ l->setPixmap(QPixmap(":/res/iconDamage.png"));
+ glBSLayout->addWidget(l,0,2,1,1);
+
+ SB_DamageModifier = new QSpinBox(gbBasicSettings);
SB_DamageModifier->setRange(10, 300);
SB_DamageModifier->setValue(100);
SB_DamageModifier->setSingleStep(25);
+ glBSLayout->addWidget(SB_DamageModifier,0,1,1,1);
+
+ l = new QLabel(gbBasicSettings);
+ l->setText(QLabel::tr("Turn Time"));
+ glBSLayout->addWidget(l,1,0,1,1);
+ l = new QLabel(gbBasicSettings);
+ l->setFixedSize(32,32);
+ l->setPixmap(QPixmap(":/res/iconTime.png"));
+ glBSLayout->addWidget(l,1,2,1,1);
- SB_TurnTime = new QSpinBox(this);
+ SB_TurnTime = new QSpinBox(gbBasicSettings);
SB_TurnTime->setRange(1, 99);
SB_TurnTime->setValue(45);
SB_TurnTime->setSingleStep(15);
+ glBSLayout->addWidget(SB_TurnTime,1,1,1,1);
- SB_InitHealth = new QSpinBox(this);
+ l = new QLabel(gbBasicSettings);
+ l->setText(QLabel::tr("Initial Health"));
+ glBSLayout->addWidget(l,2,0,1,1);
+ l = new QLabel(gbBasicSettings);
+ l->setFixedSize(32,32);
+ l->setPixmap(QPixmap(":/res/iconHealth.png"));
+ glBSLayout->addWidget(l,2,2,1,1);
+
+ SB_InitHealth = new QSpinBox(gbBasicSettings);
SB_InitHealth->setRange(50, 200);
SB_InitHealth->setValue(100);
SB_InitHealth->setSingleStep(25);
+ glBSLayout->addWidget(SB_InitHealth,2,1,1,1);
- SB_SuddenDeath = new QSpinBox(this);
+ l = new QLabel(gbBasicSettings);
+ l->setText(QLabel::tr("Sudden Death Timeout"));
+ glBSLayout->addWidget(l,3,0,1,1);
+ l = new QLabel(gbBasicSettings);
+ l->setFixedSize(32,32);
+ l->setPixmap(QPixmap(":/res/iconSuddenDeath.png"));
+ glBSLayout->addWidget(l,3,2,1,1);
+
+ SB_SuddenDeath = new QSpinBox(gbBasicSettings);
SB_SuddenDeath->setRange(0, 50);
SB_SuddenDeath->setValue(15);
SB_SuddenDeath->setSingleStep(3);
+ glBSLayout->addWidget(SB_SuddenDeath,3,1,1,1);
- SB_CaseProb = new FreqSpinBox(this);
+ l = new QLabel(gbBasicSettings);
+ l->setText(QLabel::tr("Case Probability"));
+ glBSLayout->addWidget(l,4,0,1,1);
+ l = new QLabel(gbBasicSettings);
+ l->setFixedSize(32,32);
+ l->setPixmap(QPixmap(":/res/iconBox.png"));
+ glBSLayout->addWidget(l,4,2,1,1);
+
+ SB_CaseProb = new FreqSpinBox(gbBasicSettings);
SB_CaseProb->setRange(0, 9);
SB_CaseProb->setValue(5);
+ glBSLayout->addWidget(SB_CaseProb,4,1,1,1);
+
+
+ l = new QLabel(gbBasicSettings);
+ l->setText(QLabel::tr("Scheme Name:"));
LE_name = new QLineEdit(this);
-
- pageLayout->addWidget(SB_DamageModifier, 8, 1);
- pageLayout->addWidget(SB_TurnTime, 9, 1);
- pageLayout->addWidget(SB_InitHealth, 10, 1);
- pageLayout->addWidget(SB_SuddenDeath, 11, 1);
- pageLayout->addWidget(SB_CaseProb, 12, 1);
- pageLayout->addWidget(LE_name, 13, 1);
+
+ gl->addWidget(LE_name,14,1,1,1);
+ gl->addWidget(l,14,0,1,1);
mapper = new QDataWidgetMapper(this);
@@ -944,14 +1018,14 @@
selectScheme->setModel(model);
mapper->addMapping(LE_name, 0);
- mapper->addMapping(CB_mode_Forts, 1);
- mapper->addMapping(CB_teamsDivide, 2);
- mapper->addMapping(CB_solid, 3);
- mapper->addMapping(CB_border, 4);
- mapper->addMapping(CB_lowGravity, 5);
- mapper->addMapping(CB_laserSight, 6);
- mapper->addMapping(CB_invulnerable, 7);
- mapper->addMapping(CB_mines, 8);
+ 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(SB_DamageModifier, 9);
mapper->addMapping(SB_TurnTime, 10);
mapper->addMapping(SB_InitHealth, 11);
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/pages.h
--- a/QTfrontend/pages.h Thu Apr 02 18:50:08 2009 +0000
+++ b/QTfrontend/pages.h Thu Apr 02 20:37:03 2009 +0000
@@ -27,6 +27,7 @@
#include "binds.h"
#include "mapContainer.h"
+#include "togglebutton.h"
class QPushButton;
class QGroupBox;
@@ -416,14 +417,14 @@
private:
QDataWidgetMapper * mapper;
- QCheckBox * CB_mode_Forts;
- QCheckBox * CB_teamsDivide;
- QCheckBox * CB_solid;
- QCheckBox * CB_border;
- QCheckBox * CB_lowGravity;
- QCheckBox * CB_laserSight;
- QCheckBox * CB_invulnerable;
- QCheckBox * CB_mines;
+ ToggleButtonWidget * TBW_mode_Forts;
+ ToggleButtonWidget * TBW_teamsDivide;
+ ToggleButtonWidget * TBW_solid;
+ ToggleButtonWidget * TBW_border;
+ ToggleButtonWidget * TBW_lowGravity;
+ ToggleButtonWidget * TBW_laserSight;
+ ToggleButtonWidget * TBW_invulnerable;
+ ToggleButtonWidget * TBW_mines;
QSpinBox * SB_DamageModifier;
QSpinBox * SB_TurnTime;
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/PlaySound.png
Binary file QTfrontend/res/PlaySound.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/ammopic.png
Binary file QTfrontend/res/ammopic.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnBorder.png
Binary file QTfrontend/res/btnBorder.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnDisabled.png
Binary file QTfrontend/res/btnDisabled.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnForts.png
Binary file QTfrontend/res/btnForts.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnInvurnable.png
Binary file QTfrontend/res/btnInvurnable.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnLaserSight.png
Binary file QTfrontend/res/btnLaserSight.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnLowGravity.png
Binary file QTfrontend/res/btnLowGravity.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnMines.png
Binary file QTfrontend/res/btnMines.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnOverlay.png
Binary file QTfrontend/res/btnOverlay.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnSolid.png
Binary file QTfrontend/res/btnSolid.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/btnTeamsDivide.png
Binary file QTfrontend/res/btnTeamsDivide.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/dice.png
Binary file QTfrontend/res/dice.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/hh25x25.png
Binary file QTfrontend/res/hh25x25.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/hh_small.png
Binary file QTfrontend/res/hh_small.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/iconBox.png
Binary file QTfrontend/res/iconBox.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/iconDamage.png
Binary file QTfrontend/res/iconDamage.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/iconHealth.png
Binary file QTfrontend/res/iconHealth.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/iconSuddenDeath.png
Binary file QTfrontend/res/iconSuddenDeath.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/iconTime.png
Binary file QTfrontend/res/iconTime.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/icons.png
Binary file QTfrontend/res/icons.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/infinity.png
Binary file QTfrontend/res/infinity.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/res/lightbulb_off.png
Binary file QTfrontend/res/lightbulb_off.png has changed
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/togglebutton.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/togglebutton.cpp Thu Apr 02 20:37:03 2009 +0000
@@ -0,0 +1,76 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2009 Kristian Lehmann
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include "togglebutton.h"
+
+ToggleButtonWidget::ToggleButtonWidget(QWidget * parent, QString img)
+{
+ QVBoxLayout * l = new QVBoxLayout(this);
+ setLayout(l);
+
+ pbMain = new QPushButton(this);
+ pbMain->setCheckable(true);
+
+ QPixmap pm(":/res/btnDisabled.png");
+ QPainter * painter = new QPainter();
+
+ pmChecked.load(img);
+ pmDisabled.load(img);
+
+ l->addWidget(pbMain);
+
+ 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)));
+
+ lbMain = new QLabel(this);
+ lbMain->setFixedHeight(32);
+
+ l->addWidget(lbMain);
+}
+
+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);
+}
diff -r ffe420e9e61a -r f586d75c8b6a QTfrontend/togglebutton.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/togglebutton.h Thu Apr 02 20:37:03 2009 +0000
@@ -0,0 +1,50 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2009 Kristian Lehmann
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef TOGGLEBUTTONWIDGET_H
+#define TOGGLEBUTTONWIDGET_H
+
+#include
+#include
+#include
+#include
+#include
+
+class ToggleButtonWidget : public QWidget
+{
+ 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:
+ void eventToggled(bool checked);
+};
+
+#endif // TOGGLEBUTTONWIDGET_H