diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 17:57:32 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 17:57:32 +0000 |
| commit | 0fa52c1f61c457c9b68bec53bcce3af858e5eb44 (patch) | |
| tree | c5b10b77a01b417775097476029bcf67fac79975 /pokemodr/NatureUI.cpp | |
| parent | 807071d35159de0660f9df31c48d5bf895ca3622 (diff) | |
[FIX] More header cleanliness
[FIX] UI classes now just use the ObjectUI pointers
[FIX] Some miscellaneous qmake options
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@112 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/NatureUI.cpp')
| -rw-r--r-- | pokemodr/NatureUI.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp index c74575c6..945d535a 100644 --- a/pokemodr/NatureUI.cpp +++ b/pokemodr/NatureUI.cpp @@ -19,57 +19,56 @@ #include "NatureUI.h" // Pokemod includes +#include "../pokemod/Nature.h" #include "../pokemod/Pokemod.h" // General includes #include "../general/BugCatcher.h" -#include "../general/Exception.h" - -// Qt includes -#include <QStringList> NatureUI::NatureUI(Nature* nature, QWidget* parent) : - ObjectUI(parent), - m_nature(nature), - m_nature_mod(new Nature(*nature)) + ObjectUI(parent) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(m_nature, m_nature_mod); + setObjects(nature, new Nature(*nature)); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } +NatureUI::~NatureUI() +{ +} + void NatureUI::refreshGui() { varStat->clear(); - const bool isSplit = static_cast<const Pokemod*>(m_nature->pokemod())->rules()->specialSplit(); + const bool isSplit = static_cast<const Pokemod*>(static_cast<Nature*>(original())->pokemod())->rules()->specialSplit(); varStat->addItems((isSplit ? Pokemod::StatRBYStr : Pokemod::StatGSCStr).mid(0, isSplit ? Pokemod::ST_End_RBY : Pokemod::ST_End_GSC)); } void NatureUI::setGui() { - varName->setText(m_nature_mod->name()); - varStatMultiplier->setValue(m_nature_mod->stat(varStat->currentIndex())); - varWeight->setValue(m_nature_mod->weight()); + varName->setText(static_cast<Nature*>(modified())->name()); + varStatMultiplier->setValue(static_cast<Nature*>(modified())->stat(varStat->currentIndex())); + varWeight->setValue(static_cast<Nature*>(modified())->weight()); } void NatureUI::on_buttonApply_clicked() { - *m_nature = *m_nature_mod; + *static_cast<Nature*>(original()) = *static_cast<Nature*>(modified()); emit(changed(false)); } void NatureUI::on_buttonDiscard_clicked() { - *m_nature_mod = *m_nature; + *static_cast<Nature*>(modified()) = *static_cast<Nature*>(original()); setGui(); emit(changed(false)); } void NatureUI::on_varName_textChanged(const QString& name) { - m_nature_mod->setName(name); + static_cast<Nature*>(modified())->setName(name); emit(changed(true)); } @@ -83,7 +82,7 @@ void NatureUI::on_varStatMultiplier_valueChanged(const Fraction& statMultiplier) { try { - m_nature_mod->setStat(varStat->currentIndex(), statMultiplier); + static_cast<Nature*>(modified())->setStat(varStat->currentIndex(), statMultiplier); emit(changed(true)); } catch (Exception& exception) @@ -97,7 +96,7 @@ void NatureUI::on_varWeight_valueChanged(const int weight) { try { - m_nature_mod->setWeight(weight); + static_cast<Nature*>(modified())->setWeight(weight); emit(changed(true)); } catch (BoundsException& exception) |
