summaryrefslogtreecommitdiffstats
path: root/pokemodr/MoveUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/MoveUI.cpp')
-rw-r--r--pokemodr/MoveUI.cpp81
1 files changed, 10 insertions, 71 deletions
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<Move*>(modified())->setName(name);
- emit(changed(true));
}
void MoveUI::on_varAccuracy_valueChanged(const Fraction& accuracy)
{
- try
- {
- static_cast<Move*>(modified())->setAccuracy(accuracy);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Move*>(modified())->setAccuracy(accuracy);
}
void MoveUI::on_varType_currentIndexChanged(const int type)
{
- try
- {
- static_cast<Move*>(modified())->setType(varType->itemData(type).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Move*>(modified())->setType(varType->itemData(type).toInt());
}
void MoveUI::on_varPowerPoints_valueChanged(const int powerPoints)
{
- try
- {
- static_cast<Move*>(modified())->setPowerPoints(powerPoints);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Move*>(modified())->setPowerPoints(powerPoints);
}
void MoveUI::on_varTarget_currentIndexChanged(const int target)
{
- try
- {
- static_cast<Move*>(modified())->setTarget(target);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Move*>(modified())->setTarget(target);
}
void MoveUI::on_varNumTargets_valueChanged(const int numTargets)
{
- try
- {
- static_cast<Move*>(modified())->setNumTargets(numTargets);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Move*>(modified())->setNumTargets(numTargets);
}
void MoveUI::on_varTargetChoice_currentIndexChanged(const int targetChoice)
{
- try
- {
- static_cast<Move*>(modified())->setTargetChoice(targetChoice);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Move*>(modified())->setTargetChoice(targetChoice);
}
void MoveUI::on_varSpecial_toggled(const bool special)
{
static_cast<Move*>(modified())->setSpecial(special);
- emit(changed(true));
}
void MoveUI::on_varIgnoreAccuracy_toggled(const bool ignoreAccuracy)
{
static_cast<Move*>(modified())->setIgnoreAccuracy(ignoreAccuracy);
- emit(changed(true));
}
void MoveUI::on_varCanFlinch_toggled(const bool canFlinch)
{
static_cast<Move*>(modified())->setCanFlinch(canFlinch);
- emit(changed(true));
}
void MoveUI::on_varCanRandom_toggled(const bool canRandom)
{
static_cast<Move*>(modified())->setCanRandom(canRandom);
- emit(changed(true));
}
void MoveUI::on_varCanSnatch_toggled(const bool canSnatch)
{
static_cast<Move*>(modified())->setCanSnatch(canSnatch);
- emit(changed(true));
}
void MoveUI::on_varSound_toggled(const bool sound)
{
static_cast<Move*>(modified())->setSound(sound);
- emit(changed(true));
}
void MoveUI::on_varDescription_textChanged()
{
static_cast<Move*>(modified())->setDescription(varDescription->toPlainText());
- emit(changed(true));
}