diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-02-24 10:35:27 +0000 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-02-24 10:35:27 +0000 |
commit | 26c9e526435474aa3e7f8e1be39dfb474dd8b368 (patch) | |
tree | 186c9f2c98be5c9e317fb3e31fcc50d61ef26289 /pokemodr/PokemodUI.cpp | |
parent | 09ffeef4fd962c5635cafc89df88296e9c6bfd5f (diff) | |
download | sigen-26c9e526435474aa3e7f8e1be39dfb474dd8b368.tar.gz sigen-26c9e526435474aa3e7f8e1be39dfb474dd8b368.tar.xz sigen-26c9e526435474aa3e7f8e1be39dfb474dd8b368.zip |
[DEL] SkinsUI.{h, cpp}, skins.ui, typechat.ui
[ADD] TypechartWidgetItem.h
[FIX] Typechart added
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@81 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/PokemodUI.cpp')
-rw-r--r-- | pokemodr/PokemodUI.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp index e6bb3f91..418cee1f 100644 --- a/pokemodr/PokemodUI.cpp +++ b/pokemodr/PokemodUI.cpp @@ -28,6 +28,7 @@ #include "ImageDialog.h" #include "PokemodUI.h" +#include "TypechartWidgetItem.h" PokemodUI::PokemodUI(Pokemod* p, QWidget* parent) : ObjectUI(parent), @@ -45,6 +46,18 @@ PokemodUI::PokemodUI(Pokemod* p, QWidget* parent) : varMap->addItem(m->getName()); varMap->setItemData(i, m->getId()); } + varTypechart->setRowCount(pokemod->getTypeCount()); + varTypechart->setColumnCount(pokemod->getTypeCount()); + QStringList types; + Matrix<Frac>* tc = pokemod->getTypeChart(); + for (int i = 0; i < pokemod->getTypeCount(); ++i) + { + types << pokemod->getItem(i)->getName(); + for (int j = 0; j < pokemod->getTypeCount(); ++j) + static_cast<TypechartWidgetItem*>(varTypechart->item(i, j))->setData(Qt::EditRole, qVariantFromValue(static_cast<void*>(&(*tc)(i, j)))); + } + varTypechart->setVerticalHeaderLabels(types); + varTypechart->setHorizontalHeaderLabels(types); setGui(); } @@ -298,3 +311,26 @@ void PokemodUI::on_varSurfFishSkin_pressed() setGui(); } } + +void PokemodUI::on_varTypechart_currentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous) +{ + disconnect(varEffectivenessNum, SIGNAL(valueChanged(int)), static_cast<TypechartWidgetItem*>(previous), SLOT(setNum(int))); + disconnect(varEffectivenessDenom, SIGNAL(valueChanged(int)), static_cast<TypechartWidgetItem*>(previous), SLOT(setDenom(int))); + TypechartWidgetItem* twi = static_cast<TypechartWidgetItem*>(current); + varEffectivenessNum->setValue(static_cast<Frac*>(twi->data(Qt::EditRole).value<void*>())->getNum()); + varEffectivenessNum->setMaximum(static_cast<Frac*>(twi->data(Qt::EditRole).value<void*>())->getDenom()); + varEffectivenessDenom->setValue(static_cast<Frac*>(twi->data(Qt::EditRole).value<void*>())->getDenom()); + connect(varEffectivenessNum, SIGNAL(valueChanged(int)), twi, SLOT(setNum(int))); + connect(varEffectivenessDenom, SIGNAL(valueChanged(int)), twi, SLOT(setDenom(int))); +} + +void PokemodUI::on_varEffectivenessNum_valueChanged() +{ + emit(changed(true)); +} + +void PokemodUI::on_varEffectivenessDenom_valueChanged(const int e) +{ + varEffectivenessNum->setMaximum(e); + emit(changed(true)); +} |