# HG changeset patch # User unc0rr # Date 1233416647 0 # Node ID 169ebeefd7ab360e78e40ed93b896008a9944f93 # Parent e7589e37a6d6b89d47755dee483b85b4448aabd6 Custom spinbox for bonus boxes factor diff -r e7589e37a6d6 -r 169ebeefd7ab QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Sat Jan 31 15:39:53 2009 +0000 +++ b/QTfrontend/gamecfgwidget.cpp Sat Jan 31 15:44:07 2009 +0000 @@ -80,7 +80,7 @@ SB_SuddenDeath->setValue(15); SB_SuddenDeath->setSingleStep(3); - SB_CaseProb = new QSpinBox(GBoxOptions); + SB_CaseProb = new FreqSpinBox(GBoxOptions); SB_CaseProb->setRange(0, 9); SB_CaseProb->setValue(5); diff -r e7589e37a6d6 -r 169ebeefd7ab QTfrontend/gamecfgwidget.h --- a/QTfrontend/gamecfgwidget.h Sat Jan 31 15:39:53 2009 +0000 +++ b/QTfrontend/gamecfgwidget.h Sat Jan 31 15:44:07 2009 +0000 @@ -22,13 +22,35 @@ #include #include #include +#include #include "mapContainer.h" class QCheckBox; class QVBoxLayout; -class QSpinBox; class QLabel; +class FreqSpinBox; + +class FreqSpinBox : public QSpinBox +{ + Q_OBJECT + +public: + FreqSpinBox(QWidget* parent) : QSpinBox(parent) + { + + } + + QString textFromValue ( int value ) const + { + switch (value) + { + case 0 : return tr("Never"); + case 1 : return tr("Every turn"); + default : return tr("Each %1 turn").arg(value); + } + } +}; class GameCFGWidget : public QGroupBox { @@ -86,7 +108,7 @@ QSpinBox * SB_TurnTime; QSpinBox * SB_InitHealth; QSpinBox * SB_SuddenDeath; - QSpinBox * SB_CaseProb; + FreqSpinBox * SB_CaseProb; QLabel * L_TurnTime; QLabel * L_InitHealth; QLabel * L_SuddenDeath;