QTfrontend/gamecfgwidget.cpp
changeset 1784 dfe9bafb4590
parent 1783 169ebeefd7ab
child 1797 fedd8649fdd9
equal deleted inserted replaced
1783:169ebeefd7ab 1784:dfe9bafb4590
    53 
    53 
    54 	CB_solid = new QCheckBox(GBoxOptions);
    54 	CB_solid = new QCheckBox(GBoxOptions);
    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 	CB_border = new QCheckBox(GBoxOptions);
       
    59 	CB_border->setText(QCheckBox::tr("Add Border"));
       
    60 	GBoxOptionsLayout->addWidget(CB_border, 3, 0, 1, 2);
       
    61 
    58 	L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
    62 	L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
    59 	L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
    63 	L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
    60 	L_SuddenDeath = new QLabel(QLabel::tr("Turns before SD"), GBoxOptions);
    64 	L_SuddenDeath = new QLabel(QLabel::tr("Turns before SD"), GBoxOptions);
    61 	L_CaseProb = new QLabel(QLabel::tr("Bonus factor"), GBoxOptions);
    65 	L_CaseProb = new QLabel(QLabel::tr("Bonus factor"), GBoxOptions);
    62 	GBoxOptionsLayout->addWidget(L_TurnTime, 3, 0);
    66 	GBoxOptionsLayout->addWidget(L_TurnTime, 4, 0);
    63 	GBoxOptionsLayout->addWidget(L_InitHealth, 4, 0);
    67 	GBoxOptionsLayout->addWidget(L_InitHealth, 5, 0);
    64 	GBoxOptionsLayout->addWidget(L_SuddenDeath, 5, 0);
    68 	GBoxOptionsLayout->addWidget(L_SuddenDeath, 6, 0);
    65 	GBoxOptionsLayout->addWidget(L_CaseProb, 6, 0);
    69 	GBoxOptionsLayout->addWidget(L_CaseProb, 7, 0);
    66 	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 7, 0);
    70 	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 8, 0);
    67 
    71 
    68 	SB_TurnTime = new QSpinBox(GBoxOptions);
    72 	SB_TurnTime = new QSpinBox(GBoxOptions);
    69 	SB_TurnTime->setRange(1, 99);
    73 	SB_TurnTime->setRange(1, 99);
    70 	SB_TurnTime->setValue(45);
    74 	SB_TurnTime->setValue(45);
    71 	SB_TurnTime->setSingleStep(15);
    75 	SB_TurnTime->setSingleStep(15);
    82 	
    86 	
    83 	SB_CaseProb = new FreqSpinBox(GBoxOptions);
    87 	SB_CaseProb = new FreqSpinBox(GBoxOptions);
    84 	SB_CaseProb->setRange(0, 9);
    88 	SB_CaseProb->setRange(0, 9);
    85 	SB_CaseProb->setValue(5);
    89 	SB_CaseProb->setValue(5);
    86 
    90 
    87 	GBoxOptionsLayout->addWidget(SB_TurnTime, 3, 1);
    91 	GBoxOptionsLayout->addWidget(SB_TurnTime, 4, 1);
    88 	GBoxOptionsLayout->addWidget(SB_InitHealth, 4, 1);
    92 	GBoxOptionsLayout->addWidget(SB_InitHealth, 5, 1);
    89 	GBoxOptionsLayout->addWidget(SB_SuddenDeath, 5, 1);
    93 	GBoxOptionsLayout->addWidget(SB_SuddenDeath, 6, 1);
    90 	GBoxOptionsLayout->addWidget(SB_CaseProb, 6, 1);
    94 	GBoxOptionsLayout->addWidget(SB_CaseProb, 7, 1);
    91 	
    95 	
    92 	WeaponsName = new QComboBox(GBoxOptions);
    96 	WeaponsName = new QComboBox(GBoxOptions);
    93 	GBoxOptionsLayout->addWidget(WeaponsName, 7, 1);
    97 	GBoxOptionsLayout->addWidget(WeaponsName, 8, 1);
    94 
    98 
    95 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
    99 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
    96 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
   100 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
    97 	connect(SB_SuddenDeath, SIGNAL(valueChanged(int)), this, SIGNAL(suddenDeathTurnsChanged(int)));
   101 	connect(SB_SuddenDeath, SIGNAL(valueChanged(int)), this, SIGNAL(suddenDeathTurnsChanged(int)));
    98 	connect(SB_CaseProb, SIGNAL(valueChanged(int)), this, SIGNAL(caseProbabilityChanged(int)));
   102 	connect(SB_CaseProb, SIGNAL(valueChanged(int)), this, SIGNAL(caseProbabilityChanged(int)));
    99 	connect(CB_mode_Forts, SIGNAL(toggled(bool)), this, SIGNAL(fortsModeChanged(bool)));
   103 	connect(CB_mode_Forts, SIGNAL(toggled(bool)), this, SIGNAL(fortsModeChanged(bool)));
   100 	connect(CB_teamsDivide, SIGNAL(toggled(bool)), this, SIGNAL(teamsDivideChanged(bool)));
   104 	connect(CB_teamsDivide, SIGNAL(toggled(bool)), this, SIGNAL(teamsDivideChanged(bool)));
   101 	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
   105 	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
       
   106 	connect(CB_border, SIGNAL(toggled(bool)), this, SIGNAL(borderChanged(bool)));
   102 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
   107 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
   103 
   108 
   104 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
   109 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
   105 	connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SIGNAL(mapChanged(const QString &)));
   110 	connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SIGNAL(mapChanged(const QString &)));
   106 	connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SIGNAL(themeChanged(const QString &)));
   111 	connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SIGNAL(themeChanged(const QString &)));
   114 		result |= 0x01;
   119 		result |= 0x01;
   115 	if (CB_teamsDivide->isChecked())
   120 	if (CB_teamsDivide->isChecked())
   116 		result |= 0x10;
   121 		result |= 0x10;
   117 	if (CB_solid->isChecked())
   122 	if (CB_solid->isChecked())
   118 		result |= 0x04;
   123 		result |= 0x04;
       
   124 	if (CB_border->isChecked())
       
   125 		result |= 0x08;
   119 
   126 
   120 	return result;
   127 	return result;
   121 }
   128 }
   122 
   129 
   123 QString GameCFGWidget::getCurrentSeed() const
   130 QString GameCFGWidget::getCurrentSeed() const
   217 }
   224 }
   218 
   225 
   219 void GameCFGWidget::setSolid(bool value)
   226 void GameCFGWidget::setSolid(bool value)
   220 {
   227 {
   221 	CB_solid->setChecked(value);
   228 	CB_solid->setChecked(value);
       
   229 }
       
   230 
       
   231 void GameCFGWidget::setBorder(bool value)
       
   232 {
       
   233 	CB_border->setChecked(value);
   222 }
   234 }
   223 
   235 
   224 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
   236 void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo)
   225 {
   237 {
   226 	if (ammo.size() != cDefaultAmmoStore->size())
   238 	if (ammo.size() != cDefaultAmmoStore->size())