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/TileUI.cpp | 83 +++++++++-------------------------------------------- 1 file changed, 13 insertions(+), 70 deletions(-) (limited to 'pokemodr/TileUI.cpp') 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(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(modified())->setSprite(QPixmap(dialog.selectedFile())); - } - catch (SaveException& exception) - { - BugCatcher::report(exception); - } + static_cast(modified())->setSprite(QPixmap(dialog.selectedFile())); setGui(); } } void TileUI::on_varWild_valueChanged(const Fraction& wildChance) { - try - { - static_cast(modified())->setWildChance(wildChance); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(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(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(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(modified())->setHMType(hmType); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast(modified())->setHmType(hmType); } void TileUI::on_varHMUnder_currentIndexChanged(const int hmUnder) { - try - { - static_cast(modified())->setUnder(varHMUnder->itemData(hmUnder, Qt::UserRole).toInt()); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(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(modified())->setForceType(force); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast(modified())->setForceType(force); } void TileUI::on_varDirection_currentIndexChanged(const int direction) { - try - { - static_cast(modified())->setForceDirection(direction); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setForceDirection(direction); } -- cgit