diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-07 02:08:51 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-07 02:08:51 +0000 |
| commit | 39a1b43adbebb73b87c4a2346b9ccb2c2a34753b (patch) | |
| tree | 08d55409c9d5b2149c4e8b341203dcbb42fa0a2c /pokemodr/NatureUI.cpp | |
| parent | 8714e1d409f46b05980b3e1e9f3a10910294b429 (diff) | |
[FIX] Added Q_OBJECT to pokemod classes
[FIX] UI classes fixed to work with new API
[FIX] Qmake files fixed
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@121 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/NatureUI.cpp')
| -rw-r--r-- | pokemodr/NatureUI.cpp | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp index 945d535a..7a2a43e4 100644 --- a/pokemodr/NatureUI.cpp +++ b/pokemodr/NatureUI.cpp @@ -22,9 +22,6 @@ #include "../pokemod/Nature.h" #include "../pokemod/Pokemod.h" -// General includes -#include "../general/BugCatcher.h" - NatureUI::NatureUI(Nature* nature, QWidget* parent) : ObjectUI(parent) { @@ -32,6 +29,10 @@ NatureUI::NatureUI(Nature* nature, QWidget* parent) : QMetaObject::connectSlotsByName(this); setObjects(nature, new Nature(*nature)); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); + connect(modified(), SIGNAL(error()), this, SLOT(setGui())); + connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&))); + connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&))); + connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true))); init(); } @@ -39,6 +40,11 @@ NatureUI::~NatureUI() { } +void NatureUI::initGui() +{ + connect(varStat, SIGNAL(currentIndexChanged()), this, SLOT(setGui())); +} + void NatureUI::refreshGui() { varStat->clear(); @@ -69,39 +75,14 @@ void NatureUI::on_buttonDiscard_clicked() void NatureUI::on_varName_textChanged(const QString& name) { static_cast<Nature*>(modified())->setName(name); - emit(changed(true)); -} - -void NatureUI::on_varStat_currentIndexChanged() -{ - setGui(); - emit(changed(true)); } void NatureUI::on_varStatMultiplier_valueChanged(const Fraction& statMultiplier) { - try - { - static_cast<Nature*>(modified())->setStat(varStat->currentIndex(), statMultiplier); - emit(changed(true)); - } - catch (Exception& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast<Nature*>(modified())->setStat(varStat->currentIndex(), statMultiplier); } void NatureUI::on_varWeight_valueChanged(const int weight) { - try - { - static_cast<Nature*>(modified())->setWeight(weight); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast<Nature*>(modified())->setWeight(weight); } |
