diff options
Diffstat (limited to 'pokemodr/TileUI.cpp')
| -rw-r--r-- | pokemodr/TileUI.cpp | 83 |
1 files changed, 13 insertions, 70 deletions
diff --git a/pokemodr/TileUI.cpp b/pokemodr/TileUI.cpp index 1934b793..b0ac2a1a 100644 --- a/pokemodr/TileUI.cpp +++ b/pokemodr/TileUI.cpp @@ -25,9 +25,6 @@ #include "../pokemod/Tile.h" #include "../pokemod/Pokemod.h" -// General includes -#include "../general/BugCatcher.h" - TileUI::TileUI(Tile* tile, QWidget* parent) : ObjectUI(parent) { @@ -35,6 +32,10 @@ TileUI::TileUI(Tile* tile, QWidget* parent) : QMetaObject::connectSlotsByName(this); setObjects(tile, new Tile(*tile)); 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(); } @@ -97,7 +98,6 @@ void TileUI::on_buttonDiscard_clicked() void TileUI::on_varName_textChanged(const QString& name) { static_cast<Tile*>(modified())->setName(name); - emit(changed(true)); } void TileUI::on_varImage_pressed() @@ -105,47 +105,22 @@ void TileUI::on_varImage_pressed() FileDialog dialog(QSize(64, 64)); if (dialog.exec()) { - try - { - static_cast<Tile*>(modified())->setSprite(QPixmap(dialog.selectedFile())); - } - catch (SaveException& exception) - { - BugCatcher::report(exception); - } + static_cast<Tile*>(modified())->setSprite(QPixmap(dialog.selectedFile())); setGui(); } } void TileUI::on_varWild_valueChanged(const Fraction& wildChance) { - try - { - static_cast<Tile*>(modified())->setWildChance(wildChance); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast<Tile*>(modified())->setWildChance(wildChance); } void TileUI::on_varAccessibility_itemSelectionChanged() { - try - { - for (int i = 0; i < varAccessibility->count(); ++i) - { - const QListWidgetItem* widgetItem = varAccessibility->item(i); - static_cast<Tile*>(modified())->setFrom(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); - } - emit(changed(true)); - } - catch (BoundsException& exception) + for (int i = 0; i < varAccessibility->count(); ++i) { - BugCatcher::report(exception); - setGui(); + const QListWidgetItem* widgetItem = varAccessibility->item(i); + static_cast<Tile*>(modified())->setFrom(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); } } @@ -162,28 +137,12 @@ void TileUI::on_boxHMs_toggled(const bool hm) void TileUI::on_varHMType_currentIndexChanged(const int hmType) { - try - { - static_cast<Tile*>(modified())->setHMType(hmType); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast<Tile*>(modified())->setHmType(hmType); } void TileUI::on_varHMUnder_currentIndexChanged(const int hmUnder) { - try - { - static_cast<Tile*>(modified())->setUnder(varHMUnder->itemData(hmUnder, Qt::UserRole).toInt()); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast<Tile*>(modified())->setUnder(varHMUnder->itemData(hmUnder, Qt::UserRole).toInt()); } void TileUI::on_boxForces_toggled(const bool forces) @@ -199,26 +158,10 @@ void TileUI::on_boxForces_toggled(const bool forces) void TileUI::on_varForce_currentIndexChanged(const int force) { - try - { - static_cast<Tile*>(modified())->setForceType(force); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast<Tile*>(modified())->setForceType(force); } void TileUI::on_varDirection_currentIndexChanged(const int direction) { - try - { - static_cast<Tile*>(modified())->setForceDirection(direction); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast<Tile*>(modified())->setForceDirection(direction); } |
