# HG changeset patch # User Wuzzy # Date 1492120200 -7200 # Node ID 05f1935175dacde26a03ef2c00357112230ad4b8 # Parent d23695f9629073c42236b6d0af6f1853ae0a5af9 Team editor: Disable flag widget when selecting CPU team diff -r d23695f96290 -r 05f1935175da ChangeLog.txt --- a/ChangeLog.txt Thu Apr 13 21:22:32 2017 +0200 +++ b/ChangeLog.txt Thu Apr 13 23:50:00 2017 +0200 @@ -195,6 +195,7 @@ * Clicking on "New" in weapon scheme editor now creates empty weapon scheme instead of default * Fix language names in language list being always in English * Prevent starting game with >48 hogs (because engine doesn't support it yet) + * Team editor Fix flag being selectable for computer players although it had no effect Content Creation: + Theme objects can now have more than 1 in-land rect specified. You can specify the amount in theme.cfg by adding another number (and ,) before the first rect diff -r d23695f96290 -r 05f1935175da QTfrontend/ui/page/pageeditteam.cpp --- a/QTfrontend/ui/page/pageeditteam.cpp Thu Apr 13 21:22:32 2017 +0200 +++ b/QTfrontend/ui/page/pageeditteam.cpp Thu Apr 13 23:50:00 2017 +0200 @@ -150,6 +150,7 @@ CBGrave->setFixedHeight(44); GBTLayout->addWidget(CBGrave, 2, 1, 1, 2); + // Player flags, combobox to select flag CBFlag = new QComboBox(GBoxTeam); CBFlag->setMaxCount(65535); CBFlag->setMaxVisibleItems(50); @@ -157,6 +158,38 @@ CBFlag->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); GBTLayout->addWidget(CBFlag, 3, 1, 1, 2); + // CPU level flag. Static image, only displayed when computer player is selected + QImage imgBotlevels = QImage("physfs://Graphics/botlevels.png"); + + int botlevelOffsets[5]= { 19, 14, 10, 6, 0 }; + + for(int i=0; i<5; i++) { + QImage imgCPU = QImage("physfs://Graphics/Flags/cpu.png"); + QPainter painter(&imgCPU); + painter.drawImage(botlevelOffsets[i], 0, imgBotlevels, botlevelOffsets[i]); + + pixCPU[i] = QPixmap::fromImage(imgCPU); + } + + QHBoxLayout* hboxCPU = new QHBoxLayout(); + hboxCPU->setContentsMargins(0, 0, 0, 0); + + hboxCPUWidget = new QWidget(); + hboxCPUWidget->setLayout(hboxCPU); + + CPUFlag = new QLabel(); + CPUFlag->setPixmap(pixCPU[0]); + CPUFlag->setFixedHeight(38); + + hboxCPU->addWidget(CPUFlag); + + CPUFlagLabel = new QLabel("CPU"); + CPUFlagLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + hboxCPU->addWidget(CPUFlagLabel); + + hboxCPUWidget->setHidden(true); + GBTLayout->addWidget(hboxCPUWidget, 3, 1, 1, 1); + btnRandomTeamName = addButton(":/res/dice.png", GBTLayout, 0, 3, 1, 1, true); btnRandomTeamName->setWhatsThis(tr("Randomize the team name")); @@ -234,6 +267,8 @@ connect(btnRandomNames, SIGNAL(clicked()), this, SLOT(setRandomHogNames())); connect(btnRandomHats, SIGNAL(clicked()), this, SLOT(setRandomHats())); + connect(CBTeamLvl, SIGNAL(currentIndexChanged(const int)), this, SLOT(CBTeamLvl_activated(const int))); + connect(btnRandomTeamName, SIGNAL(clicked()), this, SLOT(setRandomTeamName())); connect(btnRandomGrave, SIGNAL(clicked()), this, SLOT(setRandomGrave())); connect(btnRandomFlag, SIGNAL(clicked()), this, SLOT(setRandomFlag())); @@ -360,6 +395,20 @@ FortPreview->setPixmap(pix); } +void PageEditTeam::CBTeamLvl_activated(const int index) +{ + CBFlag->setHidden(index != 0); + btnRandomFlag->setHidden(index != 0); + + if(index > 0) + { + int cpuLevel = 6 - index; + CPUFlag->setPixmap(pixCPU[cpuLevel - 1]); + CPUFlagLabel->setText(tr("CPU %1").arg(cpuLevel)); + } + hboxCPUWidget->setHidden(index == 0); +} + void PageEditTeam::testSound() { DataManager & dataMgr = DataManager::instance(); diff -r d23695f96290 -r 05f1935175da QTfrontend/ui/page/pageeditteam.h --- a/QTfrontend/ui/page/pageeditteam.h Thu Apr 13 21:22:32 2017 +0200 +++ b/QTfrontend/ui/page/pageeditteam.h Thu Apr 13 23:50:00 2017 +0200 @@ -43,6 +43,7 @@ void deleteTeam(const QString & name); public slots: + void CBTeamLvl_activated(const int index); void CBFort_activated(const QString & gravename); private: @@ -56,6 +57,10 @@ SquareLabel *FortPreview; QComboBox *CBGrave; QComboBox *CBFlag; + QLabel *CPUFlag; + QLabel *CPUFlagLabel; + QWidget *hboxCPUWidget; + QPixmap pixCPU[5]; QComboBox *CBTeamLvl; QComboBox *CBVoicepack; QGroupBox *GBoxBinds;