Team level at new place on team config page
authorunc0rr
Sun, 14 Jan 2007 21:17:35 +0000
changeset 336 82d654db133d
parent 335 751348947fce
child 337 a46abb65eb0c
Team level at new place on team config page
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/team.cpp
--- a/QTfrontend/pages.cpp	Sun Jan 14 21:10:36 2007 +0000
+++ b/QTfrontend/pages.cpp	Sun Jan 14 21:17:35 2007 +0000
@@ -115,9 +115,11 @@
 	pageLayout->setColumnStretch(0, 1);
 	pageLayout->setColumnMinimumWidth(0, 150);
 	pageLayout->setColumnStretch(1, 100);
-	pageLayout->setColumnMinimumWidth(1, 200);
+	pageLayout->setColumnMinimumWidth(1, 210);
 	pageLayout->setColumnStretch(2, 150);
-	pageLayout->setColumnMinimumWidth(2, 250);
+	pageLayout->setColumnMinimumWidth(2, 110);
+	pageLayout->setColumnStretch(3, 150);
+	pageLayout->setColumnMinimumWidth(3, 110);
 
 	GBoxTeam = new QGroupBox(this);
 	GBoxTeam->setTitle(QGroupBox::tr("Team"));
@@ -127,15 +129,6 @@
 	TeamNameEdit->setMaxLength(15);
 	GBTLayout->addWidget(TeamNameEdit, 0, 0, 1, 0);
 
-	QLabel* difficultyLabel=new QLabel(GBoxTeam);
-	difficultyLabel->setText(QLabel::tr("difficulty:"));
-	difficultyBox=new QSpinBox(GBoxTeam);
-	difficultyBox->setRange(0, 5);
-	difficultyBox->setSingleStep(1);
-	difficultyBox->setValue(0);
-	GBTLayout->addWidget(difficultyLabel, 1, 0);
-	GBTLayout->addWidget(difficultyBox, 1, 1);
-
 	pageLayout->addWidget(GBoxTeam, 0, 0);
 
 	GBoxHedgehogs = new	QGroupBox(this);
@@ -205,8 +198,27 @@
 	GBGLayout->addWidget(CBGrave, 0, 0, 1, 3);
 	GravePreview = new QLabel(GBoxGrave);
 	GravePreview->setScaledContents(false);
+	pageLayout->addWidget(GBoxGrave, 0, 3, 2, 1);
 	GBGLayout->addWidget(GravePreview, 1, 1);
-	pageLayout->addWidget(GBoxGrave, 0, 2, 2, 1);
+
+	GBoxTeamLvl = new QGroupBox(this);
+	GBoxTeamLvl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+	GBoxTeamLvl->setTitle(QGroupBox::tr("Team level"));
+	QGridLayout * GBTLLayout = new QGridLayout(GBoxTeamLvl);
+	CBTeamLvl = new QComboBox(GBoxTeamLvl);
+	CBTeamLvl->addItem(QComboBox::tr("Human"));
+	CBTeamLvl->addItem(QComboBox::tr("Level 1"));
+	CBTeamLvl->addItem(QComboBox::tr("Level 2"));
+	CBTeamLvl->addItem(QComboBox::tr("Level 3"));
+	CBTeamLvl->addItem(QComboBox::tr("Level 4"));
+	CBTeamLvl->addItem(QComboBox::tr("Level 5"));
+	CBTeamLvl->setMaxCount(6);
+	GBTLLayout->addWidget(CBTeamLvl, 0, 0, 1, 3);
+	LevelPict = new QLabel(GBoxTeamLvl);
+	LevelPict->setScaledContents(false);
+	LevelPict->setFixedSize(32, 32);
+	pageLayout->addWidget(GBoxTeamLvl, 0, 2, 2, 1);
+	GBTLLayout->addWidget(LevelPict, 1, 1);
 
 	GBoxFort = new QGroupBox(this);
 	GBoxFort->setTitle(QGroupBox::tr("Fort"));
@@ -218,13 +230,12 @@
 	FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 	FortPreview->setPixmap(QPixmap());
 	GBFLayout->addWidget(FortPreview, 1, 0);
-	pageLayout->addWidget(GBoxFort, 2, 2, 1, 1);
+	pageLayout->addWidget(GBoxFort, 2, 2, 1, 2);
 
 	BtnTeamSave	= new QPushButton(this);
 	BtnTeamSave->setFont(*font14);
 	BtnTeamSave->setText(QPushButton::tr("Save"));
-	pageLayout->addWidget(BtnTeamSave, 4, 2);
-
+	pageLayout->addWidget(BtnTeamSave, 4, 2, 1, 2);
 
 	QDir tmpdir;
 	tmpdir.cd(datadir->absolutePath());
@@ -240,6 +251,7 @@
 	}
 
 	connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &)));
+	connect(CBTeamLvl, SIGNAL(activated(int)), this, SLOT(CBTeamLvl_activated(int)));
 	connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &)));
 }
 
@@ -255,6 +267,12 @@
 	FortPreview->setPixmap(pix);
 }
 
+void PageEditTeam::CBTeamLvl_activated(int id)
+{
+	QPixmap pix(QString(":/res/botlevels/%1.png").arg(id));
+	LevelPict->setPixmap(pix);
+}
+
 PageMultiplayer::PageMultiplayer(QWidget* parent) : QWidget(parent)
 {
 	QFont * font14 = new QFont("MS Shell Dlg", 14);
--- a/QTfrontend/pages.h	Sun Jan 14 21:10:36 2007 +0000
+++ b/QTfrontend/pages.h	Sun Jan 14 21:17:35 2007 +0000
@@ -82,6 +82,9 @@
 	QGroupBox *GBoxGrave;
 	QComboBox *CBGrave;
 	QLabel *GravePreview;
+	QGroupBox *GBoxTeamLvl;
+	QComboBox *CBTeamLvl;
+	QLabel *LevelPict;
 	QGroupBox *GBoxBinds;
 	QToolBox *BindsBox;
 	QWidget *page_A;
@@ -91,13 +94,13 @@
 	QPushButton *BtnTeamDiscard;
 	QPushButton *BtnTeamSave;
 	QLineEdit * TeamNameEdit;
-	QSpinBox* difficultyBox;
 	QLineEdit * HHNameEdit[8];
 	QComboBox * CBBind[BINDS_NUMBER];
 
 public slots:
 	void CBGrave_activated(const QString & gravename);
 	void CBFort_activated(const QString & gravename);
+	void CBTeamLvl_activated(int id);
 
 private:
 	QLabel * LBind[BINDS_NUMBER];
--- a/QTfrontend/team.cpp	Sun Jan 14 21:10:36 2007 +0000
+++ b/QTfrontend/team.cpp	Sun Jan 14 21:17:35 2007 +0000
@@ -164,7 +164,8 @@
 void HWTeam::SetToPage(HWForm * hwform)
 {
 	hwform->ui.pageEditTeam->TeamNameEdit->setText(TeamName);
-	hwform->ui.pageEditTeam->difficultyBox->setValue(difficulty);
+	hwform->ui.pageEditTeam->CBTeamLvl->setCurrentIndex(difficulty);
+	hwform->ui.pageEditTeam->CBTeamLvl_activated(difficulty);
 	for(int i = 0; i < 8; i++)
 	{
 		hwform->ui.pageEditTeam->HHNameEdit[i]->setText(HHName[i]);
@@ -184,7 +185,7 @@
 void HWTeam::GetFromPage(HWForm * hwform)
 {
 	TeamName  = hwform->ui.pageEditTeam->TeamNameEdit->text();
-	difficulty = hwform->ui.pageEditTeam->difficultyBox->value();
+	difficulty = hwform->ui.pageEditTeam->CBTeamLvl->currentIndex();
 	for(int i = 0; i < 8; i++)
 	{
 		HHName[i] = hwform->ui.pageEditTeam->HHNameEdit[i]->text();