From 0fa52c1f61c457c9b68bec53bcce3af858e5eb44 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 27 Apr 2008 17:57:32 +0000 Subject: [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 --- pokemodr/NatureUI.cpp | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'pokemodr/NatureUI.cpp') 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 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(m_nature->pokemod())->rules()->specialSplit(); + const bool isSplit = static_cast(static_cast(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(modified())->name()); + varStatMultiplier->setValue(static_cast(modified())->stat(varStat->currentIndex())); + varWeight->setValue(static_cast(modified())->weight()); } void NatureUI::on_buttonApply_clicked() { - *m_nature = *m_nature_mod; + *static_cast(original()) = *static_cast(modified()); emit(changed(false)); } void NatureUI::on_buttonDiscard_clicked() { - *m_nature_mod = *m_nature; + *static_cast(modified()) = *static_cast(original()); setGui(); emit(changed(false)); } void NatureUI::on_varName_textChanged(const QString& name) { - m_nature_mod->setName(name); + static_cast(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(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(modified())->setWeight(weight); emit(changed(true)); } catch (BoundsException& exception) -- cgit