From 39a1b43adbebb73b87c4a2346b9ccb2c2a34753b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 May 2008 02:08:51 +0000 Subject: [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 --- pokemodr/MoveUI.cpp | 81 +++++++---------------------------------------------- 1 file changed, 10 insertions(+), 71 deletions(-) (limited to 'pokemodr/MoveUI.cpp') diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp index 38a526c5..33454ebd 100644 --- a/pokemodr/MoveUI.cpp +++ b/pokemodr/MoveUI.cpp @@ -23,9 +23,6 @@ #include "../pokemod/Type.h" #include "../pokemod/Pokemod.h" -// General includes -#include "../general/BugCatcher.h" - MoveUI::MoveUI(Move* move, QWidget* parent) : ObjectUI(parent) { @@ -33,6 +30,10 @@ MoveUI::MoveUI(Move* move, QWidget* parent) : QMetaObject::connectSlotsByName(this); setObjects(move, new Move(*move)); 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(); } @@ -91,131 +92,69 @@ void MoveUI::on_buttonDiscard_clicked() void MoveUI::on_varName_textChanged(const QString& name) { static_cast(modified())->setName(name); - emit(changed(true)); } void MoveUI::on_varAccuracy_valueChanged(const Fraction& accuracy) { - try - { - static_cast(modified())->setAccuracy(accuracy); - emit(changed(true)); - } - catch (Exception& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setAccuracy(accuracy); } void MoveUI::on_varType_currentIndexChanged(const int type) { - try - { - static_cast(modified())->setType(varType->itemData(type).toInt()); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setType(varType->itemData(type).toInt()); } void MoveUI::on_varPowerPoints_valueChanged(const int powerPoints) { - try - { - static_cast(modified())->setPowerPoints(powerPoints); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setPowerPoints(powerPoints); } void MoveUI::on_varTarget_currentIndexChanged(const int target) { - try - { - static_cast(modified())->setTarget(target); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setTarget(target); } void MoveUI::on_varNumTargets_valueChanged(const int numTargets) { - try - { - static_cast(modified())->setNumTargets(numTargets); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setNumTargets(numTargets); } void MoveUI::on_varTargetChoice_currentIndexChanged(const int targetChoice) { - try - { - static_cast(modified())->setTargetChoice(targetChoice); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setTargetChoice(targetChoice); } void MoveUI::on_varSpecial_toggled(const bool special) { static_cast(modified())->setSpecial(special); - emit(changed(true)); } void MoveUI::on_varIgnoreAccuracy_toggled(const bool ignoreAccuracy) { static_cast(modified())->setIgnoreAccuracy(ignoreAccuracy); - emit(changed(true)); } void MoveUI::on_varCanFlinch_toggled(const bool canFlinch) { static_cast(modified())->setCanFlinch(canFlinch); - emit(changed(true)); } void MoveUI::on_varCanRandom_toggled(const bool canRandom) { static_cast(modified())->setCanRandom(canRandom); - emit(changed(true)); } void MoveUI::on_varCanSnatch_toggled(const bool canSnatch) { static_cast(modified())->setCanSnatch(canSnatch); - emit(changed(true)); } void MoveUI::on_varSound_toggled(const bool sound) { static_cast(modified())->setSound(sound); - emit(changed(true)); } void MoveUI::on_varDescription_textChanged() { static_cast(modified())->setDescription(varDescription->toPlainText()); - emit(changed(true)); } -- cgit