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/RulesUI.cpp | 104 ++++++--------------------------------------------- 1 file changed, 11 insertions(+), 93 deletions(-) (limited to 'pokemodr/RulesUI.cpp') diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp index b63a935e..bb366b59 100644 --- a/pokemodr/RulesUI.cpp +++ b/pokemodr/RulesUI.cpp @@ -21,9 +21,6 @@ // Pokemod includes #include "../pokemod/Rules.h" -// General includes -#include "../general/BugCatcher.h" - RulesUI::RulesUI(Rules* rules, QWidget* parent) : ObjectUI(parent) { @@ -31,6 +28,10 @@ RulesUI::RulesUI(Rules* rules, QWidget* parent) : QMetaObject::connectSlotsByName(this); setObjects(rules, new Rules(*rules)); 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(); } @@ -94,207 +95,124 @@ void RulesUI::on_buttonDiscard_clicked() void RulesUI::on_boxGenders_toggled(const bool genders) { static_cast(modified())->setGenderAllowed(genders); - emit(changed(true)); } void RulesUI::on_varBreeding_toggled(const bool breeding) { static_cast(modified())->setBreedingAllowed(breeding); - emit(changed(true)); } void RulesUI::on_varHeldItems_valueChanged(const int heldItems) { static_cast(modified())->setHoldItems(heldItems); - emit(changed(true)); } void RulesUI::on_boxCriticalDomains_toggled(const bool criticalDomains) { static_cast(modified())->setCriticalDomains(criticalDomains); - emit(changed(true)); } void RulesUI::on_boxAllowAbilities_toggled(const bool allowAbilities) { static_cast(modified())->setAbilityAllowed(allowAbilities); - emit(changed(true)); } void RulesUI::on_boxAllowNatures_toggled(const bool allowNatures) { static_cast(modified())->setNatureAllowed(allowNatures); - emit(changed(true)); } void RulesUI::on_varBoxes_valueChanged(const int boxes) { static_cast(modified())->setNumBoxes(boxes); - emit(changed(true)); - setGui(); } void RulesUI::on_varBoxSize_valueChanged(const int boxSize) { static_cast(modified())->setBoxSize(boxSize); - emit(changed(true)); } void RulesUI::on_varMaxParty_valueChanged(const int maxParty) { static_cast(modified())->setMaxParty(maxParty); - emit(changed(true)); - setGui(); } void RulesUI::on_varMaxFight_valueChanged(const int maxFight) { - try - { - static_cast(modified())->setMaxFight(maxFight); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setMaxFight(maxFight); } void RulesUI::on_varMaxMoves_valueChanged(const int maxMoves) { - try - { - static_cast(modified())->setMaxMoves(maxMoves); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setMaxMoves(maxMoves); } void RulesUI::on_varMaxLevel_valueChanged(const int maxLevel) { - try - { - static_cast(modified())->setMaxLevel(maxLevel); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setMaxLevel(maxLevel); } void RulesUI::on_varMaxMoney_valueChanged(const int maxMoney) { static_cast(modified())->setMaxMoney(maxMoney); - emit(changed(true)); } void RulesUI::on_boxHardCash_toggled(const bool hardCash) { static_cast(modified())->setHardCash(hardCash); - emit(changed(true)); } void RulesUI::on_boxSplitSpecial_toggled(const bool splitSpecial) { static_cast(modified())->setSpecialSplit(splitSpecial); - emit(changed(true)); } void RulesUI::on_varSplitSpecialDV_toggled(const bool splitSpecialDV) { static_cast(modified())->setSpecialDVSplit(splitSpecialDV); - emit(changed(true)); } void RulesUI::on_varMaxDV_currentIndexChanged(const int maxDV) { - try - { - static_cast(modified())->setMaxDVValue(maxDV); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setMaxDVValue(maxDV); } void RulesUI::on_boxHappiness_toggled(const bool happiness) { static_cast(modified())->setHappiness(happiness); - emit(changed(true)); } void RulesUI::on_varFaintLoss_valueChanged(const int faintLoss) { static_cast(modified())->setHappyFaintLoss(faintLoss); - emit(changed(true)); } void RulesUI::on_varLevelGain_valueChanged(const int levelGain) { static_cast(modified())->setHappyLevelGain(levelGain); - emit(changed(true)); } void RulesUI::on_varNumSteps_valueChanged(const int numSteps) { static_cast(modified())->setHappySteps(numSteps); - emit(changed(true)); } void RulesUI::on_boxEffortValues_toggled(const bool effortValues) { static_cast(modified())->setEffortValuesAllowed(effortValues); - emit(changed(true)); } void RulesUI::on_varMaxEV_valueChanged(const int maxEV) { - try - { - static_cast(modified())->setMaxTotalEV(maxEV); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast(modified())->setMaxTotalEV(maxEV); } void RulesUI::on_varMaxEVPerStat_valueChanged(const int maxEVPerStat) { - try - { - static_cast(modified())->setMaxEVPerStat(maxEVPerStat); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setMaxEVPerStat(maxEVPerStat); } void RulesUI::on_varPokerus_valueChanged(const Fraction& pokerusChance) { - try - { - static_cast(modified())->setPokerusChance(pokerusChance); - emit(changed(true)); - } - catch (Exception& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setPokerusChance(pokerusChance); } -- cgit