diff options
Diffstat (limited to 'pokemodr/SpeciesEvolutionUI.cpp')
-rw-r--r-- | pokemodr/SpeciesEvolutionUI.cpp | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp deleted file mode 100644 index fd6c7e22..00000000 --- a/pokemodr/SpeciesEvolutionUI.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -// Header include -#include "SpeciesEvolutionUI.h" - -// Pokemod includes -#include "../pokemod/Item.h" -#include "../pokemod/ItemEffect.h" -#include "../pokemod/Pokemod.h" -#include "../pokemod/Rules.h" -#include "../pokemod/Species.h" -#include "../pokemod/SpeciesEvolution.h" - -SpeciesEvolutionUI::SpeciesEvolutionUI(SpeciesEvolution* evolution, QWidget* parent) : - ObjectUI(parent), - m_lastStyle(-1) -{ - setupUi(this); - setObjects(evolution, new SpeciesEvolution(*evolution)); -} - -SpeciesEvolutionUI::~SpeciesEvolutionUI() -{ -} - -void SpeciesEvolutionUI::initGui() -{ - varStyle->addItems(SpeciesEvolution::StyleStr); -} - -void SpeciesEvolutionUI::refreshGui() -{ - varSpecies->clear(); - for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->speciesCount(); ++i) - { - const Species* species = static_cast<const Pokemod*>(original()->pokemod())->species(i); - varSpecies->addItem(species->name(), species->id()); - } -} - -void SpeciesEvolutionUI::setGui() -{ - const bool styleChanged = (static_cast<SpeciesEvolution*>(modified())->style() != m_lastStyle); - varSpecies->setCurrentIndex(varSpecies->findData(static_cast<SpeciesEvolution*>(modified())->species())); - varStyle->setCurrentIndex(static_cast<SpeciesEvolution*>(modified())->style()); - m_lastStyle = static_cast<SpeciesEvolution*>(modified())->style(); - if (styleChanged) - { - varValue1->clear(); - varValue1->setEnabled(false); - varValue2->clear(); - varValue2->setEnabled(false); - varValue3->setEnabled(false); - switch (static_cast<SpeciesEvolution*>(modified())->style()) - { - case SpeciesEvolution::S_Level: - case SpeciesEvolution::S_Happiness: - case SpeciesEvolution::S_Stat: - case SpeciesEvolution::S_Personality: - varValue1->setEnabled(true); - varValue1->addItems(Pokemod::RelativeStr); - break; - case SpeciesEvolution::S_Item: - case SpeciesEvolution::S_TradeItem: - varValue1->setEnabled(true); - for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->itemCount(); ++i) - { - const Item* item = static_cast<const Pokemod*>(original()->pokemod())->item(i); - for (int j = 0; j < item->effectCount(); ++j) - { - if (item->effect(i)->effect() == ItemEffect::E_Evolution) - varValue1->addItem(item->name(), item->id()); - } - } - break; - } - const bool isSplit = static_cast<const Pokemod*>(original()->pokemod())->rules()->specialSplit(); - switch (static_cast<SpeciesEvolution*>(modified())->style()) - { - case SpeciesEvolution::S_Stat: - varValue2->setEnabled(true); - varValue2->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY)); - break; - case SpeciesEvolution::S_Item: - varValue2->setEnabled(true); - varValue2->addItems(SpeciesEvolution::GiveHoldStr); - break; - } - switch (static_cast<SpeciesEvolution*>(modified())->style()) - { - case SpeciesEvolution::S_Happiness: - case SpeciesEvolution::S_Stat: - case SpeciesEvolution::S_Item: - case SpeciesEvolution::S_Personality: - varValue3->setEnabled(true); - break; - } - } - if ((static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_Item) ||(static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_TradeItem)) - varValue1->setCurrentIndex(varValue1->findData(static_cast<SpeciesEvolution*>(modified())->value1())); - else - varValue1->setCurrentIndex(static_cast<SpeciesEvolution*>(modified())->value1()); - varValue2->setCurrentIndex(static_cast<SpeciesEvolution*>(modified())->value2()); - varValue3->setValue(static_cast<SpeciesEvolution*>(modified())->value3()); - varLevel->setValue(static_cast<SpeciesEvolution*>(modified())->level()); -} - -void SpeciesEvolutionUI::apply() -{ - *static_cast<SpeciesEvolution*>(original()) = *static_cast<SpeciesEvolution*>(modified()); - emit(changed(false)); -} - -void SpeciesEvolutionUI::discard() -{ - *static_cast<SpeciesEvolution*>(modified()) = *static_cast<SpeciesEvolution*>(original()); - setGui(); - emit(changed(false)); -} - -void SpeciesEvolutionUI::on_varSpecies_activated(const int species) -{ - static_cast<SpeciesEvolution*>(modified())->setSpecies(varSpecies->itemData(species).toInt()); -} - -void SpeciesEvolutionUI::on_varStyle_activated(const int style) -{ - static_cast<SpeciesEvolution*>(modified())->setStyle(style); -} - -void SpeciesEvolutionUI::on_varValue1_activated(const int value1) -{ - if ((static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_Item) ||(static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_TradeItem)) - static_cast<SpeciesEvolution*>(modified())->setValue1(varValue1->itemData(value1).toInt()); - else - static_cast<SpeciesEvolution*>(modified())->setValue1(value1); -} - -void SpeciesEvolutionUI::on_varValue2_activated(const int value2) -{ - static_cast<SpeciesEvolution*>(modified())->setValue2(value2); -} - -void SpeciesEvolutionUI::on_varValue3_valueChanged(const int value3) -{ - static_cast<SpeciesEvolution*>(modified())->setValue3(value3); -} - -void SpeciesEvolutionUI::on_varLevel_valueChanged(const int level) -{ - static_cast<SpeciesEvolution*>(modified())->setLevel(level); -} |