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/MapWarpUI.cpp | 124 +++++++------------------------------------------ 1 file changed, 17 insertions(+), 107 deletions(-) (limited to 'pokemodr/MapWarpUI.cpp') diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp index 551d0202..cafdcfba 100644 --- a/pokemodr/MapWarpUI.cpp +++ b/pokemodr/MapWarpUI.cpp @@ -24,9 +24,6 @@ #include "../pokemod/MapWarp.h" #include "../pokemod/Pokemod.h" -// General includes -#include "../general/BugCatcher.h" - MapWarpUI::MapWarpUI(MapWarp* warp, QWidget* parent) : ObjectUI(parent), m_lastMap(-1) @@ -35,6 +32,10 @@ MapWarpUI::MapWarpUI(MapWarp* warp, QWidget* parent) : QMetaObject::connectSlotsByName(this); setObjects(warp, new MapWarp(*warp)); 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(); } @@ -74,7 +75,7 @@ void MapWarpUI::setGui() for (int i = 0; i < varActivation->count(); ++i) varActivation->item(i)->setSelected(static_cast(modified())->from(i)); varDirectionOut->setCurrentIndex(static_cast(modified())->directionOut()); - varType->setCurrentIndex(static_cast(modified())->warpType()); + varType->setCurrentIndex(static_cast(modified())->type()); varBiking->setCheckState((static_cast(modified())->isBiking() == Flag::On) ? Qt::Checked : ((static_cast(modified())->isBiking() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked)); varFlash->setCheckState((static_cast(modified())->isFlash() == Flag::On) ? Qt::Checked : ((static_cast(modified())->isFlash() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked)); varFog->setCheckState((static_cast(modified())->isFoggy() == Flag::On) ? Qt::Checked : ((static_cast(modified())->isFoggy() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked)); @@ -86,9 +87,9 @@ void MapWarpUI::setGui() int index = static_cast(static_cast(original())->pokemod())->mapIndex(static_cast(modified())->toMap()); if (index != INT_MAX) { - try + const Map* map = static_cast(static_cast(original())->pokemod())->map(index); + if (map) { - const Map* map = static_cast(static_cast(original())->pokemod())->map(index); for (int i = 0; i < map->warpCount(); ++i) { const MapWarp* warp = map->warp(i); @@ -96,10 +97,6 @@ void MapWarpUI::setGui() varToWarp->setItemData(i, warp->id()); } } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } } } varToWarp->setCurrentIndex(varToMap->findData(static_cast(modified())->toWarp())); @@ -128,158 +125,71 @@ void MapWarpUI::on_buttonDiscard_clicked() void MapWarpUI::on_varName_textChanged(const QString& name) { static_cast(modified())->setName(name); - emit(changed(true)); } void MapWarpUI::on_varCoordinate_valueChanged(const Point& coordinate) { static_cast(modified())->setCoordinate(coordinate); - emit(changed(true)); } void MapWarpUI::on_varActivation_itemSelectionChanged() { - try - { - for (int i = 0; i < varActivation->count(); ++i) - static_cast(modified())->setFrom(i, varActivation->item(i)->isSelected()); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + for (int i = 0; i < varActivation->count(); ++i) + static_cast(modified())->setFrom(i, varActivation->item(i)->isSelected()); } void MapWarpUI::on_varDirectionOut_currentIndexChanged(const int directionOut) { - try - { - static_cast(modified())->setDirectionOut(directionOut); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setDirectionOut(directionOut); } void MapWarpUI::on_varType_currentIndexChanged(const int type) { - try - { - static_cast(modified())->setWarpType(type); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setType(type); } void MapWarpUI::on_varBiking_stateChanged(const int biking) { - try - { - static_cast(modified())->setIsBiking(biking); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setIsBiking(biking); } void MapWarpUI::on_varFlash_stateChanged(const int flash) { - try - { - static_cast(modified())->setIsFlash(flash); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setIsFlash(flash); } void MapWarpUI::on_varFog_stateChanged(const int fog) { - try - { - static_cast(modified())->setIsFoggy(fog); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setIsFoggy(fog); } void MapWarpUI::on_varToMap_currentIndexChanged(const int toMap) { - try - { - static_cast(modified())->setToMap(toMap); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast(modified())->setToMap(toMap); } void MapWarpUI::on_varToWarp_currentIndexChanged(const int toWarp) { - try - { - static_cast(modified())->setToWarp(toWarp); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setToWarp(toWarp); } void MapWarpUI::on_boxFlag_toggled(const bool flagUsed) { if (!flagUsed) static_cast(modified())->setWorkingFlag(Flag(varFlag->value(), Flag::Ignore)); - emit(changed(true)); - setGui(); } void MapWarpUI::on_varFlag_valueChanged(const int flag) { static_cast(modified())->setWorkingFlag(Flag(flag, boxFlag->isChecked() ? Flag::Ignore : (varState->isChecked() ? Flag::On : Flag::Off))); - emit(changed(true)); } void MapWarpUI::on_varState_toggled(const bool status) { static_cast(modified())->setWorkingFlag(Flag(varFlag->value(), status ? Flag::On : Flag::Off)); - emit(changed(true)); } void MapWarpUI::on_varDialog_currentIndexChanged(const int dialog) { - try - { - static_cast(modified())->setDialog(dialog); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast(modified())->setDialog(dialog); } -- cgit