summaryrefslogtreecommitdiffstats
path: root/pokemodr/NatureUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/NatureUI.cpp')
-rw-r--r--pokemodr/NatureUI.cpp33
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)