summaryrefslogtreecommitdiffstats
path: root/pokemodr/MapWarpUI.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-07 02:08:51 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-07 02:08:51 +0000
commit39a1b43adbebb73b87c4a2346b9ccb2c2a34753b (patch)
tree08d55409c9d5b2149c4e8b341203dcbb42fa0a2c /pokemodr/MapWarpUI.cpp
parent8714e1d409f46b05980b3e1e9f3a10910294b429 (diff)
downloadsigen-39a1b43adbebb73b87c4a2346b9ccb2c2a34753b.tar.gz
sigen-39a1b43adbebb73b87c4a2346b9ccb2c2a34753b.tar.xz
sigen-39a1b43adbebb73b87c4a2346b9ccb2c2a34753b.zip
[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
Diffstat (limited to 'pokemodr/MapWarpUI.cpp')
-rw-r--r--pokemodr/MapWarpUI.cpp124
1 files changed, 17 insertions, 107 deletions
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<MapWarp*>(modified())->from(i));
varDirectionOut->setCurrentIndex(static_cast<MapWarp*>(modified())->directionOut());
- varType->setCurrentIndex(static_cast<MapWarp*>(modified())->warpType());
+ varType->setCurrentIndex(static_cast<MapWarp*>(modified())->type());
varBiking->setCheckState((static_cast<MapWarp*>(modified())->isBiking() == Flag::On) ? Qt::Checked : ((static_cast<MapWarp*>(modified())->isBiking() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
varFlash->setCheckState((static_cast<MapWarp*>(modified())->isFlash() == Flag::On) ? Qt::Checked : ((static_cast<MapWarp*>(modified())->isFlash() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
varFog->setCheckState((static_cast<MapWarp*>(modified())->isFoggy() == Flag::On) ? Qt::Checked : ((static_cast<MapWarp*>(modified())->isFoggy() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
@@ -86,9 +87,9 @@ void MapWarpUI::setGui()
int index = static_cast<const Pokemod*>(static_cast<MapWarp*>(original())->pokemod())->mapIndex(static_cast<MapWarp*>(modified())->toMap());
if (index != INT_MAX)
{
- try
+ const Map* map = static_cast<const Pokemod*>(static_cast<MapWarp*>(original())->pokemod())->map(index);
+ if (map)
{
- const Map* map = static_cast<const Pokemod*>(static_cast<MapWarp*>(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<MapWarp*>(modified())->toWarp()));
@@ -128,158 +125,71 @@ void MapWarpUI::on_buttonDiscard_clicked()
void MapWarpUI::on_varName_textChanged(const QString& name)
{
static_cast<MapWarp*>(modified())->setName(name);
- emit(changed(true));
}
void MapWarpUI::on_varCoordinate_valueChanged(const Point& coordinate)
{
static_cast<MapWarp*>(modified())->setCoordinate(coordinate);
- emit(changed(true));
}
void MapWarpUI::on_varActivation_itemSelectionChanged()
{
- try
- {
- for (int i = 0; i < varActivation->count(); ++i)
- static_cast<MapWarp*>(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<MapWarp*>(modified())->setFrom(i, varActivation->item(i)->isSelected());
}
void MapWarpUI::on_varDirectionOut_currentIndexChanged(const int directionOut)
{
- try
- {
- static_cast<MapWarp*>(modified())->setDirectionOut(directionOut);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWarp*>(modified())->setDirectionOut(directionOut);
}
void MapWarpUI::on_varType_currentIndexChanged(const int type)
{
- try
- {
- static_cast<MapWarp*>(modified())->setWarpType(type);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWarp*>(modified())->setType(type);
}
void MapWarpUI::on_varBiking_stateChanged(const int biking)
{
- try
- {
- static_cast<MapWarp*>(modified())->setIsBiking(biking);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWarp*>(modified())->setIsBiking(biking);
}
void MapWarpUI::on_varFlash_stateChanged(const int flash)
{
- try
- {
- static_cast<MapWarp*>(modified())->setIsFlash(flash);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWarp*>(modified())->setIsFlash(flash);
}
void MapWarpUI::on_varFog_stateChanged(const int fog)
{
- try
- {
- static_cast<MapWarp*>(modified())->setIsFoggy(fog);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWarp*>(modified())->setIsFoggy(fog);
}
void MapWarpUI::on_varToMap_currentIndexChanged(const int toMap)
{
- try
- {
- static_cast<MapWarp*>(modified())->setToMap(toMap);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<MapWarp*>(modified())->setToMap(toMap);
}
void MapWarpUI::on_varToWarp_currentIndexChanged(const int toWarp)
{
- try
- {
- static_cast<MapWarp*>(modified())->setToWarp(toWarp);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWarp*>(modified())->setToWarp(toWarp);
}
void MapWarpUI::on_boxFlag_toggled(const bool flagUsed)
{
if (!flagUsed)
static_cast<MapWarp*>(modified())->setWorkingFlag(Flag(varFlag->value(), Flag::Ignore));
- emit(changed(true));
- setGui();
}
void MapWarpUI::on_varFlag_valueChanged(const int flag)
{
static_cast<MapWarp*>(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<MapWarp*>(modified())->setWorkingFlag(Flag(varFlag->value(), status ? Flag::On : Flag::Off));
- emit(changed(true));
}
void MapWarpUI::on_varDialog_currentIndexChanged(const int dialog)
{
- try
- {
- static_cast<MapWarp*>(modified())->setDialog(dialog);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWarp*>(modified())->setDialog(dialog);
}