QTfrontend/gamecfgwidget.cpp
changeset 1782 e7589e37a6d6
parent 1628 4939254196d6
child 1783 169ebeefd7ab
equal deleted inserted replaced
1781:28f674367d68 1782:e7589e37a6d6
    55 	CB_solid->setText(QCheckBox::tr("Solid land"));
    55 	CB_solid->setText(QCheckBox::tr("Solid land"));
    56 	GBoxOptionsLayout->addWidget(CB_solid, 2, 0, 1, 2);
    56 	GBoxOptionsLayout->addWidget(CB_solid, 2, 0, 1, 2);
    57 
    57 
    58 	L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
    58 	L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
    59 	L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
    59 	L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
       
    60 	L_SuddenDeath = new QLabel(QLabel::tr("Turns before SD"), GBoxOptions);
       
    61 	L_CaseProb = new QLabel(QLabel::tr("Bonus factor"), GBoxOptions);
    60 	GBoxOptionsLayout->addWidget(L_TurnTime, 3, 0);
    62 	GBoxOptionsLayout->addWidget(L_TurnTime, 3, 0);
    61 	GBoxOptionsLayout->addWidget(L_InitHealth, 4, 0);
    63 	GBoxOptionsLayout->addWidget(L_InitHealth, 4, 0);
    62 	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 5, 0);
    64 	GBoxOptionsLayout->addWidget(L_SuddenDeath, 5, 0);
       
    65 	GBoxOptionsLayout->addWidget(L_CaseProb, 6, 0);
       
    66 	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 7, 0);
    63 
    67 
    64 	SB_TurnTime = new QSpinBox(GBoxOptions);
    68 	SB_TurnTime = new QSpinBox(GBoxOptions);
    65 	SB_TurnTime->setRange(1, 99);
    69 	SB_TurnTime->setRange(1, 99);
    66 	SB_TurnTime->setValue(45);
    70 	SB_TurnTime->setValue(45);
    67 	SB_TurnTime->setSingleStep(15);
    71 	SB_TurnTime->setSingleStep(15);
    68 	
    72 	
    69 	SB_InitHealth = new QSpinBox(GBoxOptions);
    73 	SB_InitHealth = new QSpinBox(GBoxOptions);
    70 	SB_InitHealth->setRange(50, 200);
    74 	SB_InitHealth->setRange(50, 200);
    71 	SB_InitHealth->setValue(100);
    75 	SB_InitHealth->setValue(100);
    72 	SB_InitHealth->setSingleStep(25);
    76 	SB_InitHealth->setSingleStep(25);
       
    77 	
       
    78 	SB_SuddenDeath = new QSpinBox(GBoxOptions);
       
    79 	SB_SuddenDeath->setRange(0, 50);
       
    80 	SB_SuddenDeath->setValue(15);
       
    81 	SB_SuddenDeath->setSingleStep(3);
       
    82 	
       
    83 	SB_CaseProb = new QSpinBox(GBoxOptions);
       
    84 	SB_CaseProb->setRange(0, 9);
       
    85 	SB_CaseProb->setValue(5);
       
    86 
    73 	GBoxOptionsLayout->addWidget(SB_TurnTime, 3, 1);
    87 	GBoxOptionsLayout->addWidget(SB_TurnTime, 3, 1);
    74 	GBoxOptionsLayout->addWidget(SB_InitHealth, 4, 1);
    88 	GBoxOptionsLayout->addWidget(SB_InitHealth, 4, 1);
       
    89 	GBoxOptionsLayout->addWidget(SB_SuddenDeath, 5, 1);
       
    90 	GBoxOptionsLayout->addWidget(SB_CaseProb, 6, 1);
    75 	
    91 	
    76 	WeaponsName = new QComboBox(GBoxOptions);
    92 	WeaponsName = new QComboBox(GBoxOptions);
    77 	GBoxOptionsLayout->addWidget(WeaponsName, 5, 1);
    93 	GBoxOptionsLayout->addWidget(WeaponsName, 7, 1);
    78 
    94 
    79 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
    95 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
    80 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
    96 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
       
    97 	connect(SB_SuddenDeath, SIGNAL(valueChanged(int)), this, SIGNAL(suddenDeathTurnsChanged(int)));
       
    98 	connect(SB_CaseProb, SIGNAL(valueChanged(int)), this, SIGNAL(caseProbabilityChanged(int)));
    81 	connect(CB_mode_Forts, SIGNAL(toggled(bool)), this, SIGNAL(fortsModeChanged(bool)));
    99 	connect(CB_mode_Forts, SIGNAL(toggled(bool)), this, SIGNAL(fortsModeChanged(bool)));
    82 	connect(CB_teamsDivide, SIGNAL(toggled(bool)), this, SIGNAL(teamsDivideChanged(bool)));
   100 	connect(CB_teamsDivide, SIGNAL(toggled(bool)), this, SIGNAL(teamsDivideChanged(bool)));
    83 	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
   101 	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
    84 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
   102 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
    85 
   103 
   125 quint32 GameCFGWidget::getTurnTime() const
   143 quint32 GameCFGWidget::getTurnTime() const
   126 {
   144 {
   127 	return SB_TurnTime->value();
   145 	return SB_TurnTime->value();
   128 }
   146 }
   129 
   147 
       
   148 quint32 GameCFGWidget::getSuddenDeathTurns() const
       
   149 {
       
   150 	return SB_SuddenDeath->value();
       
   151 }
       
   152 
       
   153 quint32 GameCFGWidget::getCaseProbability() const
       
   154 {
       
   155 	return SB_CaseProb->value();
       
   156 }
       
   157 
   130 QStringList GameCFGWidget::getFullConfig() const
   158 QStringList GameCFGWidget::getFullConfig() const
   131 {
   159 {
   132 	QStringList sl;
   160 	QStringList sl;
   133 	sl.append("eseed " + getCurrentSeed());
   161 	sl.append("eseed " + getCurrentSeed());
   134 	sl.append(QString("e$gmflags %1").arg(getGameFlags()));
   162 	sl.append(QString("e$gmflags %1").arg(getGameFlags()));
   135 	sl.append(QString("e$turntime %1").arg(getTurnTime() * 1000));
   163 	sl.append(QString("e$turntime %1").arg(getTurnTime() * 1000));
       
   164 	sl.append(QString("e$sd_turns %1").arg(getSuddenDeathTurns()));
       
   165 	sl.append(QString("e$casefreq %1").arg(getCaseProbability()));
       
   166 
   136 	QString currentMap = getCurrentMap();
   167 	QString currentMap = getCurrentMap();
   137 	if (currentMap.size() > 0)
   168 	if (currentMap.size() > 0)
   138 		sl.append("emap " + currentMap);
   169 		sl.append("emap " + currentMap);
   139 	sl.append("etheme " + getCurrentTheme());
   170 	sl.append("etheme " + getCurrentTheme());
   140 	return sl;
   171 	return sl;
   161 }
   192 }
   162 
   193 
   163 void GameCFGWidget::setTurnTime(int time)
   194 void GameCFGWidget::setTurnTime(int time)
   164 {
   195 {
   165 	SB_TurnTime->setValue(time);
   196 	SB_TurnTime->setValue(time);
       
   197 }
       
   198 
       
   199 void GameCFGWidget::setSuddenDeathTurns(int turns)
       
   200 {
       
   201 	SB_SuddenDeath->setValue(turns);
       
   202 }
       
   203 
       
   204 void GameCFGWidget::setCaseProbability(int prob)
       
   205 {
       
   206 	SB_CaseProb->setValue(prob);
   166 }
   207 }
   167 
   208 
   168 void GameCFGWidget::setFortsMode(bool value)
   209 void GameCFGWidget::setFortsMode(bool value)
   169 {
   210 {
   170 	CB_mode_Forts->setChecked(value);
   211 	CB_mode_Forts->setChecked(value);