summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--Changelog9
-rw-r--r--pokemod/AbilityEffect.h2
-rw-r--r--pokemod/Author.h2
-rw-r--r--pokemod/Badge.h2
-rw-r--r--pokemod/CoinList.h2
-rw-r--r--pokemod/CoinListObject.h2
-rw-r--r--pokemod/Dialog.h2
-rw-r--r--pokemod/EggGroup.h2
-rw-r--r--pokemod/Item.h2
-rw-r--r--pokemod/ItemEffect.h2
-rw-r--r--pokemod/ItemType.h2
-rw-r--r--pokemod/Map.h2
-rw-r--r--pokemod/MapEffect.h2
-rw-r--r--pokemod/MapTrainer.h2
-rw-r--r--pokemod/MapTrainerTeamMember.h2
-rw-r--r--pokemod/MapWarp.h2
-rw-r--r--pokemod/MapWildList.h2
-rw-r--r--pokemod/MapWildListEncounter.h2
-rw-r--r--pokemod/Move.h2
-rw-r--r--pokemod/MoveEffect.h2
-rw-r--r--pokemod/Nature.h2
-rw-r--r--pokemod/Object.h4
-rw-r--r--pokemod/Pokemod.h2
-rw-r--r--pokemod/Rules.h2
-rw-r--r--pokemod/Species.h2
-rw-r--r--pokemod/SpeciesAbility.h2
-rw-r--r--pokemod/SpeciesEvolution.h2
-rw-r--r--pokemod/SpeciesItem.h2
-rw-r--r--pokemod/SpeciesMove.h2
-rw-r--r--pokemod/Store.h2
-rw-r--r--pokemod/TODO4
-rw-r--r--pokemod/Tile.h2
-rw-r--r--pokemod/Time.h2
-rw-r--r--pokemod/Trainer.h2
-rw-r--r--pokemod/Type.h2
-rw-r--r--pokemod/pokemod.pro1
-rw-r--r--pokemodr/AbilityUI.cpp4
-rw-r--r--pokemodr/AbilityUI.h2
-rw-r--r--pokemodr/AuthorUI.cpp4
-rw-r--r--pokemodr/AuthorUI.h2
-rw-r--r--pokemodr/BadgeUI.cpp68
-rw-r--r--pokemodr/BadgeUI.h3
-rw-r--r--pokemodr/CoinListObjectUI.cpp52
-rw-r--r--pokemodr/CoinListObjectUI.h4
-rw-r--r--pokemodr/CoinListUI.cpp19
-rw-r--r--pokemodr/CoinListUI.h2
-rw-r--r--pokemodr/EggGroupUI.cpp5
-rw-r--r--pokemodr/EggGroupUI.h2
-rw-r--r--pokemodr/ItemTypeUI.cpp20
-rw-r--r--pokemodr/ItemTypeUI.h2
-rw-r--r--pokemodr/ItemUI.cpp30
-rw-r--r--pokemodr/ItemUI.h2
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.cpp55
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.h2
-rw-r--r--pokemodr/MapUI.cpp31
-rw-r--r--pokemodr/MapUI.h4
-rw-r--r--pokemodr/MapWarpUI.cpp124
-rw-r--r--pokemodr/MapWarpUI.h4
-rw-r--r--pokemodr/MapWildListEncounterUI.cpp40
-rw-r--r--pokemodr/MapWildListEncounterUI.h2
-rw-r--r--pokemodr/MapWildListUI.cpp57
-rw-r--r--pokemodr/MapWildListUI.h2
-rw-r--r--pokemodr/MoveUI.cpp81
-rw-r--r--pokemodr/MoveUI.h2
-rw-r--r--pokemodr/NatureUI.cpp41
-rw-r--r--pokemodr/NatureUI.h4
-rw-r--r--pokemodr/ObjectUI.h16
-rw-r--r--pokemodr/PokeModr.cpp24
-rw-r--r--pokemodr/PokeModrUI.cpp3
-rw-r--r--pokemodr/PokemodUI.cpp101
-rw-r--r--pokemodr/PokemodUI.h5
-rw-r--r--pokemodr/RulesUI.cpp104
-rw-r--r--pokemodr/RulesUI.h2
-rw-r--r--pokemodr/SpeciesAbilityUI.cpp29
-rw-r--r--pokemodr/SpeciesAbilityUI.h3
-rw-r--r--pokemodr/SpeciesEvolutionUI.cpp79
-rw-r--r--pokemodr/SpeciesEvolutionUI.h4
-rw-r--r--pokemodr/SpeciesItemUI.cpp29
-rw-r--r--pokemodr/SpeciesItemUI.h2
-rw-r--r--pokemodr/SpeciesMoveUI.cpp40
-rw-r--r--pokemodr/SpeciesMoveUI.h2
-rw-r--r--pokemodr/SpeciesUI.cpp196
-rw-r--r--pokemodr/SpeciesUI.h4
-rw-r--r--pokemodr/StoreUI.cpp23
-rw-r--r--pokemodr/StoreUI.h2
-rw-r--r--pokemodr/TileDelegate.cpp4
-rw-r--r--pokemodr/TileUI.cpp83
-rw-r--r--pokemodr/TileUI.h2
-rw-r--r--pokemodr/TilemapModel.cpp2
-rw-r--r--pokemodr/TimeUI.cpp21
-rw-r--r--pokemodr/TimeUI.h2
-rw-r--r--pokemodr/TrainerUI.cpp28
-rw-r--r--pokemodr/TrainerUI.h2
-rw-r--r--pokemodr/TypeUI.cpp18
-rw-r--r--pokemodr/TypeUI.h4
-rw-r--r--pokemodr/pokemodr.pro21
96 files changed, 377 insertions, 1230 deletions
diff --git a/Changelog b/Changelog
index 217c8318..aa013795 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,13 @@
-----------------
+Rev: 121
+Date: 6 May 2008
+User: MathStuf
+-----------------
+[FIX] Added Q_OBJECT to pokemod classes
+[FIX] UI classes fixed to work with new API
+[FIX] Qmake files fixed
+
+-----------------
Rev: 120
Date: 3 May 2008
User: MathStuf
diff --git a/pokemod/AbilityEffect.h b/pokemod/AbilityEffect.h
index 974585c5..340fcf97 100644
--- a/pokemod/AbilityEffect.h
+++ b/pokemod/AbilityEffect.h
@@ -32,6 +32,8 @@ class Ability;
class AbilityEffect : public Object
{
+ Q_OBJECT
+
public:
enum Effect
{
diff --git a/pokemod/Author.h b/pokemod/Author.h
index e4ed2768..9326ea5f 100644
--- a/pokemod/Author.h
+++ b/pokemod/Author.h
@@ -26,6 +26,8 @@ class Pokemod;
class Author : public Object
{
+ Q_OBJECT
+
public:
Author(const Author& author);
Author(const Pokemod* parent, const int id);
diff --git a/pokemod/Badge.h b/pokemod/Badge.h
index 97ac2f13..70b5c528 100644
--- a/pokemod/Badge.h
+++ b/pokemod/Badge.h
@@ -30,6 +30,8 @@
class Badge : public Object
{
+ Q_OBJECT
+
public:
Badge(const Badge& badge);
Badge(const Pokemod* parent, const int id);
diff --git a/pokemod/CoinList.h b/pokemod/CoinList.h
index 673a11be..74d50695 100644
--- a/pokemod/CoinList.h
+++ b/pokemod/CoinList.h
@@ -30,6 +30,8 @@ class Pokemod;
class CoinList : public Object
{
+ Q_OBJECT
+
public:
CoinList(const CoinList& coinList);
CoinList(const Pokemod* parent, const int id);
diff --git a/pokemod/CoinListObject.h b/pokemod/CoinListObject.h
index 95135a32..81b50047 100644
--- a/pokemod/CoinListObject.h
+++ b/pokemod/CoinListObject.h
@@ -26,6 +26,8 @@ class CoinList;
class CoinListObject : public Object
{
+ Q_OBJECT
+
public:
enum
{
diff --git a/pokemod/Dialog.h b/pokemod/Dialog.h
index 4117e0a6..6da41746 100644
--- a/pokemod/Dialog.h
+++ b/pokemod/Dialog.h
@@ -29,6 +29,8 @@ class Pokemod;
class Dialog : public Object
{
+ Q_OBJECT
+
public:
enum
{
diff --git a/pokemod/EggGroup.h b/pokemod/EggGroup.h
index 37eb7595..28850b9a 100644
--- a/pokemod/EggGroup.h
+++ b/pokemod/EggGroup.h
@@ -26,6 +26,8 @@ class Pokemod;
class EggGroup : public Object
{
+ Q_OBJECT
+
public:
EggGroup(const EggGroup& eggGroup);
EggGroup(const Pokemod* parent, const int id);
diff --git a/pokemod/Item.h b/pokemod/Item.h
index d2967bbd..c70e3ae7 100644
--- a/pokemod/Item.h
+++ b/pokemod/Item.h
@@ -30,6 +30,8 @@ class Pokemod;
class Item : public Object
{
+ Q_OBJECT
+
public:
Item(const Item& item);
Item(const Pokemod* parent, const int id);
diff --git a/pokemod/ItemEffect.h b/pokemod/ItemEffect.h
index f15dee2e..456ef3ad 100644
--- a/pokemod/ItemEffect.h
+++ b/pokemod/ItemEffect.h
@@ -32,6 +32,8 @@ class Item;
class ItemEffect : public Object
{
+ Q_OBJECT
+
public:
enum Effect
{
diff --git a/pokemod/ItemType.h b/pokemod/ItemType.h
index 42941f3f..77f0aaa5 100644
--- a/pokemod/ItemType.h
+++ b/pokemod/ItemType.h
@@ -26,6 +26,8 @@ class Pokemod;
class ItemType : public Object
{
+ Q_OBJECT
+
public:
enum Count
{
diff --git a/pokemod/Map.h b/pokemod/Map.h
index 88446fda..d09d684f 100644
--- a/pokemod/Map.h
+++ b/pokemod/Map.h
@@ -36,6 +36,8 @@ class Pokemod;
class Map : public Object
{
+ Q_OBJECT
+
public:
enum
{
diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h
index a891a8be..d9cc2383 100644
--- a/pokemod/MapEffect.h
+++ b/pokemod/MapEffect.h
@@ -33,6 +33,8 @@ class Map;
class MapEffect : public Object
{
+ Q_OBJECT
+
public:
enum Effect
{
diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h
index c722a4e7..eb4b9970 100644
--- a/pokemod/MapTrainer.h
+++ b/pokemod/MapTrainer.h
@@ -34,6 +34,8 @@ class MapTrainerTeamMember;
class MapTrainer : public Object
{
+ Q_OBJECT
+
public:
MapTrainer(const MapTrainer& trainer);
MapTrainer(const Map* parent, const int id);
diff --git a/pokemod/MapTrainerTeamMember.h b/pokemod/MapTrainerTeamMember.h
index ee482edf..c0b30e59 100644
--- a/pokemod/MapTrainerTeamMember.h
+++ b/pokemod/MapTrainerTeamMember.h
@@ -29,6 +29,8 @@ class MapTrainer;
class MapTrainerTeamMember : public Object
{
+ Q_OBJECT
+
public:
MapTrainerTeamMember(const MapTrainerTeamMember& teamMember);
MapTrainerTeamMember(const MapTrainer* parent, const int id);
diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h
index bbf41f1d..a25c60c1 100644
--- a/pokemod/MapWarp.h
+++ b/pokemod/MapWarp.h
@@ -28,6 +28,8 @@
class MapWarp : public Object
{
+ Q_OBJECT
+
public:
enum
{
diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h
index 32bb0ea1..6a62e2e3 100644
--- a/pokemod/MapWildList.h
+++ b/pokemod/MapWildList.h
@@ -30,6 +30,8 @@ class MapWildListEncounter;
class MapWildList : public Object
{
+ Q_OBJECT
+
public:
enum
{
diff --git a/pokemod/MapWildListEncounter.h b/pokemod/MapWildListEncounter.h
index c812852d..786d6312 100644
--- a/pokemod/MapWildListEncounter.h
+++ b/pokemod/MapWildListEncounter.h
@@ -26,6 +26,8 @@ class MapWildList;
class MapWildListEncounter: public Object
{
+ Q_OBJECT
+
public:
MapWildListEncounter(const MapWildListEncounter& encounter);
MapWildListEncounter(const MapWildList* parent, const int id);
diff --git a/pokemod/Move.h b/pokemod/Move.h
index 5c5b7310..ca70c7fb 100644
--- a/pokemod/Move.h
+++ b/pokemod/Move.h
@@ -33,6 +33,8 @@ class Pokemod;
class Move : public Object
{
+ Q_OBJECT
+
public:
enum Target
{
diff --git a/pokemod/MoveEffect.h b/pokemod/MoveEffect.h
index 6b1d0d80..bbc0f322 100644
--- a/pokemod/MoveEffect.h
+++ b/pokemod/MoveEffect.h
@@ -32,6 +32,8 @@ class Move;
class MoveEffect : public Object
{
+ Q_OBJECT
+
public:
enum Effect
{
diff --git a/pokemod/Nature.h b/pokemod/Nature.h
index 8b6cfdfe..82cb361f 100644
--- a/pokemod/Nature.h
+++ b/pokemod/Nature.h
@@ -27,6 +27,8 @@
class Nature : public Object
{
+ Q_OBJECT
+
public:
Nature(const Nature& nature);
Nature(const Pokemod* parent, const int id);
diff --git a/pokemod/Object.h b/pokemod/Object.h
index 8048b5b0..ec16e5e9 100644
--- a/pokemod/Object.h
+++ b/pokemod/Object.h
@@ -44,7 +44,9 @@ class Object : public QObject
QString className() const;
signals:
void warning(const QString& message) const;
- void error(const QString& message) const;
+ void error(const QString& message);
+
+ void changed();
public slots:
virtual void validate() = 0;
diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h
index 009f9235..9871b52f 100644
--- a/pokemod/Pokemod.h
+++ b/pokemod/Pokemod.h
@@ -52,6 +52,8 @@ class Type;
class Pokemod : public Object
{
+ Q_OBJECT
+
public:
enum Stat
{
diff --git a/pokemod/Rules.h b/pokemod/Rules.h
index 6ea4510e..040f3cb3 100644
--- a/pokemod/Rules.h
+++ b/pokemod/Rules.h
@@ -29,6 +29,8 @@ class Pokemod;
class Rules : public Object
{
+ Q_OBJECT
+
public:
static const QStringList DVStr;
diff --git a/pokemod/Species.h b/pokemod/Species.h
index 2d05558f..704a6d29 100644
--- a/pokemod/Species.h
+++ b/pokemod/Species.h
@@ -36,6 +36,8 @@ class SpeciesMove;
class Species : public Object
{
+ Q_OBJECT
+
public:
enum
{
diff --git a/pokemod/SpeciesAbility.h b/pokemod/SpeciesAbility.h
index afae09d1..21c68bb4 100644
--- a/pokemod/SpeciesAbility.h
+++ b/pokemod/SpeciesAbility.h
@@ -26,6 +26,8 @@ class Species;
class SpeciesAbility : public Object
{
+ Q_OBJECT
+
public:
SpeciesAbility(const SpeciesAbility& ability);
SpeciesAbility(const Species* parent, const int id);
diff --git a/pokemod/SpeciesEvolution.h b/pokemod/SpeciesEvolution.h
index bb1b235b..e0ba988d 100644
--- a/pokemod/SpeciesEvolution.h
+++ b/pokemod/SpeciesEvolution.h
@@ -26,6 +26,8 @@ class Species;
class SpeciesEvolution : public Object
{
+ Q_OBJECT
+
public:
enum Style
{
diff --git a/pokemod/SpeciesItem.h b/pokemod/SpeciesItem.h
index 0d3f6f89..6945eb5a 100644
--- a/pokemod/SpeciesItem.h
+++ b/pokemod/SpeciesItem.h
@@ -26,6 +26,8 @@ class Species;
class SpeciesItem : public Object
{
+ Q_OBJECT
+
public:
SpeciesItem(const SpeciesItem& item);
SpeciesItem(const Species* parent, const int id);
diff --git a/pokemod/SpeciesMove.h b/pokemod/SpeciesMove.h
index 6619ecdc..69f0a7f0 100644
--- a/pokemod/SpeciesMove.h
+++ b/pokemod/SpeciesMove.h
@@ -26,6 +26,8 @@ class Species;
class SpeciesMove : public Object
{
+ Q_OBJECT
+
public:
SpeciesMove(const SpeciesMove& move);
SpeciesMove(const Species* parent, const int id);
diff --git a/pokemod/Store.h b/pokemod/Store.h
index 348ccf3c..9e487d1c 100644
--- a/pokemod/Store.h
+++ b/pokemod/Store.h
@@ -29,6 +29,8 @@ class Pokemod;
class Store : public Object
{
+ Q_OBJECT
+
public:
Store(const Store& store);
Store(const Pokemod* parent, const int id);
diff --git a/pokemod/TODO b/pokemod/TODO
index febfdb29..256c2693 100644
--- a/pokemod/TODO
+++ b/pokemod/TODO
@@ -8,7 +8,11 @@ General cleanup
Trainer AI stuff
+Emit changed signals
+
Test library
+* Rules
+ - Disallow switch style
* Type
- Immune to weather
diff --git a/pokemod/Tile.h b/pokemod/Tile.h
index 4c9f9c5f..c0ebc44d 100644
--- a/pokemod/Tile.h
+++ b/pokemod/Tile.h
@@ -30,6 +30,8 @@ class Pokemod;
class Tile : public Object
{
+ Q_OBJECT
+
public:
enum Force
{
diff --git a/pokemod/Time.h b/pokemod/Time.h
index 249ee4fe..39bd746d 100644
--- a/pokemod/Time.h
+++ b/pokemod/Time.h
@@ -26,6 +26,8 @@ class Pokemod;
class Time : public Object
{
+ Q_OBJECT
+
public:
Time(const Time& time);
Time(const Pokemod* parent, const int id);
diff --git a/pokemod/Trainer.h b/pokemod/Trainer.h
index be425960..ca66f533 100644
--- a/pokemod/Trainer.h
+++ b/pokemod/Trainer.h
@@ -29,6 +29,8 @@ class Pokemod;
class Trainer : public Object
{
+ Q_OBJECT
+
public:
Trainer(const Trainer& trainer);
Trainer(const Pokemod* parent, const int id);
diff --git a/pokemod/Type.h b/pokemod/Type.h
index fe5fb275..23551a39 100644
--- a/pokemod/Type.h
+++ b/pokemod/Type.h
@@ -30,6 +30,8 @@ class Pokemod;
class Type : public Object
{
+ Q_OBJECT
+
public:
Type(const Type& type);
Type(const Pokemod* parent, const int id);
diff --git a/pokemod/pokemod.pro b/pokemod/pokemod.pro
index 64668dc8..c3c726b2 100644
--- a/pokemod/pokemod.pro
+++ b/pokemod/pokemod.pro
@@ -1,5 +1,6 @@
TEMPLATE = lib
OBJECTS_DIR = .obj
+MOC_DIR = .moc
DESTDIR = ../../bin
LIBS += -L../../bin \
-lgeneral
diff --git a/pokemodr/AbilityUI.cpp b/pokemodr/AbilityUI.cpp
index a307e0f0..bb1f21c4 100644
--- a/pokemodr/AbilityUI.cpp
+++ b/pokemodr/AbilityUI.cpp
@@ -28,6 +28,10 @@ AbilityUI::AbilityUI(Ability* ability, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(ability, new Ability(*ability));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
+ connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(errorMessage(const QString&)));
+ connect(modified(), SIGNAL(warning(const QString&)), this, SLOT(warningMessage(const QString&)));
+ connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
init();
}
diff --git a/pokemodr/AbilityUI.h b/pokemodr/AbilityUI.h
index 0df53107..d2b41073 100644
--- a/pokemodr/AbilityUI.h
+++ b/pokemodr/AbilityUI.h
@@ -38,7 +38,7 @@ class AbilityUI : public ObjectUI, private Ui::formAbility
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& name);
- private:
+ private slots:
void setGui();
};
diff --git a/pokemodr/AuthorUI.cpp b/pokemodr/AuthorUI.cpp
index 556b1fe1..2f2caf09 100644
--- a/pokemodr/AuthorUI.cpp
+++ b/pokemodr/AuthorUI.cpp
@@ -28,6 +28,10 @@ AuthorUI::AuthorUI(Author* author, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(author, new Author(*author));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
+ connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(errorMessage(const QString&)));
+ connect(modified(), SIGNAL(warning(const QString&)), this, SLOT(warningMessage(const QString&)));
+ connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
init();
}
diff --git a/pokemodr/AuthorUI.h b/pokemodr/AuthorUI.h
index 9a6b1b02..dbaf8404 100644
--- a/pokemodr/AuthorUI.h
+++ b/pokemodr/AuthorUI.h
@@ -40,7 +40,7 @@ class AuthorUI : public ObjectUI, private Ui::formAuthor
void on_varName_textChanged(const QString& name);
void on_varEmail_textChanged(const QString& email);
void on_varRole_textChanged(const QString& role);
- private:
+ private slots:
void setGui();
};
diff --git a/pokemodr/BadgeUI.cpp b/pokemodr/BadgeUI.cpp
index 7ee7df28..1643680e 100644
--- a/pokemodr/BadgeUI.cpp
+++ b/pokemodr/BadgeUI.cpp
@@ -25,9 +25,6 @@
#include "../pokemod/Badge.h"
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
BadgeUI::BadgeUI(Badge* badge, QWidget* parent) :
ObjectUI(parent)
{
@@ -35,6 +32,10 @@ BadgeUI::BadgeUI(Badge* badge, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(badge, new Badge(*badge));
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();
}
@@ -44,6 +45,7 @@ BadgeUI::~BadgeUI()
void BadgeUI::initGui()
{
+ connect(varStat, SIGNAL(currentIndexChanged()), this, SLOT(setGui()));
varHMs->addItems(Pokemod::HMStr);
}
@@ -82,21 +84,11 @@ void BadgeUI::on_buttonDiscard_clicked()
void BadgeUI::on_varName_textChanged(const QString& name)
{
static_cast<Badge*>(modified())->setName(name);
- emit(changed(true));
}
void BadgeUI::on_varObey_valueChanged(const int obey)
{
- try
- {
- static_cast<Badge*>(modified())->setObey(obey);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Badge*>(modified())->setObey(obey);
}
void BadgeUI::on_varFace_pressed()
@@ -104,14 +96,7 @@ void BadgeUI::on_varFace_pressed()
FileDialog dialog(QSize(64, 64));
if (dialog.exec())
{
- try
- {
- static_cast<Badge*>(modified())->setFace(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Badge*>(modified())->setFace(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -121,49 +106,18 @@ void BadgeUI::on_varBadge_pressed()
FileDialog dialog(QSize(64, 64));
if (dialog.exec())
{
- try
- {
- static_cast<Badge*>(modified())->setBadge(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Badge*>(modified())->setBadge(QPixmap(dialog.selectedFile()));
setGui();
}
}
-void BadgeUI::on_varStat_currentIndexChanged()
-{
- emit(changed(true));
- setGui();
-}
-
void BadgeUI::on_varStatMultiplier_valueChanged(const Fraction& multiplier)
{
- try
- {
- static_cast<Badge*>(modified())->setStat(varStat->currentIndex(), multiplier);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Badge*>(modified())->setStat(varStat->currentIndex(), multiplier);
}
void BadgeUI::on_varHMs_itemSelectionChanged()
{
- try
- {
- for (int i = 0; i < varHMs->count(); ++i)
- static_cast<Badge*>(modified())->setHm(i, varHMs->item(i)->isSelected());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ for (int i = 0; i < varHMs->count(); ++i)
+ static_cast<Badge*>(modified())->setHm(i, varHMs->item(i)->isSelected());
}
diff --git a/pokemodr/BadgeUI.h b/pokemodr/BadgeUI.h
index a3c2b146..e72f97c8 100644
--- a/pokemodr/BadgeUI.h
+++ b/pokemodr/BadgeUI.h
@@ -41,10 +41,9 @@ class BadgeUI : public ObjectUI, private Ui::formBadge
void on_varObey_valueChanged(const int obey);
void on_varFace_pressed();
void on_varBadge_pressed();
- void on_varStat_currentIndexChanged();
void on_varStatMultiplier_valueChanged(const Fraction& multiplier);
void on_varHMs_itemSelectionChanged();
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
diff --git a/pokemodr/CoinListObjectUI.cpp b/pokemodr/CoinListObjectUI.cpp
index 18c80886..af166d9d 100644
--- a/pokemodr/CoinListObjectUI.cpp
+++ b/pokemodr/CoinListObjectUI.cpp
@@ -25,9 +25,6 @@
#include "../pokemod/Pokemod.h"
#include "../pokemod/Species.h"
-// General includes
-#include "../general/BugCatcher.h"
-
CoinListObjectUI::CoinListObjectUI(CoinListObject* object, QWidget* parent) :
ObjectUI(parent),
m_lastType(-1)
@@ -36,6 +33,10 @@ CoinListObjectUI::CoinListObjectUI(CoinListObject* object, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(object, new CoinListObject(*object));
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();
}
@@ -45,6 +46,7 @@ CoinListObjectUI::~CoinListObjectUI()
void CoinListObjectUI::initGui()
{
+ connect(varType, SIGNAL(currentIndexChanged()), this, SLOT(setGui()));
varType->addItems(CoinListObject::TypeStr);
}
@@ -95,56 +97,20 @@ void CoinListObjectUI::on_buttonDiscard_clicked()
void CoinListObjectUI::on_varType_currentIndexChanged(const int type)
{
- try
- {
- static_cast<CoinListObject*>(modified())->setType(type);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<CoinListObject*>(modified())->setType(type);
}
void CoinListObjectUI::on_varObject_currentIndexChanged(const int obey)
{
- try
- {
- static_cast<CoinListObject*>(modified())->setObject(varObject->itemData(obey).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<CoinListObject*>(modified())->setObject(varObject->itemData(obey).toInt());
}
void CoinListObjectUI::on_varAmount_valueChanged(const int amount)
{
- try
- {
- static_cast<CoinListObject*>(modified())->setAmount(amount);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<CoinListObject*>(modified())->setAmount(amount);
}
void CoinListObjectUI::on_varCost_valueChanged(const int cost)
{
- try
- {
- static_cast<CoinListObject*>(modified())->setCost(cost);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<CoinListObject*>(modified())->setCost(cost);
}
diff --git a/pokemodr/CoinListObjectUI.h b/pokemodr/CoinListObjectUI.h
index a5403ea8..72f9883f 100644
--- a/pokemodr/CoinListObjectUI.h
+++ b/pokemodr/CoinListObjectUI.h
@@ -41,10 +41,10 @@ class CoinListObjectUI : public ObjectUI, private Ui::formCoinListObject
void on_varObject_currentIndexChanged(const int object);
void on_varAmount_valueChanged(const int amount);
void on_varCost_valueChanged(const int cost);
- private:
+ private slots:
void initGui();
void setGui();
-
+ private:
bool m_lastType;
};
diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp
index 54355187..b46bf4a0 100644
--- a/pokemodr/CoinListUI.cpp
+++ b/pokemodr/CoinListUI.cpp
@@ -24,9 +24,6 @@
#include "../pokemod/ItemEffect.h"
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
CoinListUI::CoinListUI(CoinList* coinList, QWidget* parent) :
ObjectUI(parent)
{
@@ -34,6 +31,10 @@ CoinListUI::CoinListUI(CoinList* coinList, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(coinList, new CoinList(*coinList));
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();
}
@@ -81,19 +82,9 @@ void CoinListUI::on_buttonDiscard_clicked()
void CoinListUI::on_varName_textChanged(const QString& name)
{
static_cast<CoinList*>(modified())->setName(name);
- emit(changed(true));
}
void CoinListUI::on_varValue_currentIndexChanged(const int value)
{
- try
- {
- static_cast<CoinList*>(modified())->setValue(varValue->itemData(value).toInt());
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<CoinList*>(modified())->setValue(varValue->itemData(value).toInt());
}
diff --git a/pokemodr/CoinListUI.h b/pokemodr/CoinListUI.h
index dc30b4d7..9a59e675 100644
--- a/pokemodr/CoinListUI.h
+++ b/pokemodr/CoinListUI.h
@@ -39,7 +39,7 @@ class CoinListUI : public ObjectUI, private Ui::formCoinList
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& name);
void on_varValue_currentIndexChanged(const int value);
- private:
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/EggGroupUI.cpp b/pokemodr/EggGroupUI.cpp
index 049e5182..f13807b0 100644
--- a/pokemodr/EggGroupUI.cpp
+++ b/pokemodr/EggGroupUI.cpp
@@ -28,6 +28,10 @@ EggGroupUI::EggGroupUI(EggGroup* eggGroup, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(eggGroup, new EggGroup(*eggGroup));
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();
}
@@ -56,5 +60,4 @@ void EggGroupUI::on_buttonDiscard_clicked()
void EggGroupUI::on_varName_textChanged(const QString& name)
{
static_cast<EggGroup*>(modified())->setName(name);
- emit(changed(true));
}
diff --git a/pokemodr/EggGroupUI.h b/pokemodr/EggGroupUI.h
index cac4402c..767379c0 100644
--- a/pokemodr/EggGroupUI.h
+++ b/pokemodr/EggGroupUI.h
@@ -38,7 +38,7 @@ class EggGroupUI : public ObjectUI, private Ui::formEggGroup
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& name);
- private:
+ private slots:
void setGui();
};
diff --git a/pokemodr/ItemTypeUI.cpp b/pokemodr/ItemTypeUI.cpp
index a4bf120a..dbad0441 100644
--- a/pokemodr/ItemTypeUI.cpp
+++ b/pokemodr/ItemTypeUI.cpp
@@ -18,9 +18,6 @@
// Header include
#include "ItemTypeUI.h"
-// General includes
-#include "../general/BugCatcher.h"
-
// Pokemod includes
#include "../pokemod/ItemType.h"
@@ -31,6 +28,10 @@ ItemTypeUI::ItemTypeUI(ItemType* itemType, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(itemType, new ItemType(*itemType));
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();
}
@@ -61,25 +62,14 @@ void ItemTypeUI::on_buttonDiscard_clicked()
void ItemTypeUI::on_varName_textChanged(const QString& name)
{
static_cast<ItemType*>(modified())->setName(name);
- emit(changed(true));
}
void ItemTypeUI::on_varComputer_valueChanged(const int computer)
{
static_cast<ItemType*>(modified())->setComputer(computer);
- emit(changed(true));
}
void ItemTypeUI::on_varPlayer_valueChanged(const int player)
{
- try
- {
- static_cast<ItemType*>(modified())->setPlayer(player);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<ItemType*>(modified())->setPlayer(player);
}
diff --git a/pokemodr/ItemTypeUI.h b/pokemodr/ItemTypeUI.h
index 2f6cfbf8..bfe9cc31 100644
--- a/pokemodr/ItemTypeUI.h
+++ b/pokemodr/ItemTypeUI.h
@@ -40,7 +40,7 @@ class ItemTypeUI : public ObjectUI, private Ui::formItemType
void on_varName_textChanged(const QString& name);
void on_varComputer_valueChanged(const int computer);
void on_varPlayer_valueChanged(const int player);
- private:
+ private slots:
void setGui();
};
diff --git a/pokemodr/ItemUI.cpp b/pokemodr/ItemUI.cpp
index f2d50867..5dbeb8ff 100644
--- a/pokemodr/ItemUI.cpp
+++ b/pokemodr/ItemUI.cpp
@@ -23,9 +23,6 @@
#include "../pokemod/ItemType.h"
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
ItemUI::ItemUI(Item* item, QWidget* parent) :
ObjectUI(parent)
{
@@ -33,6 +30,10 @@ ItemUI::ItemUI(Item* item, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(item, new Item(*item));
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();
}
@@ -88,34 +89,15 @@ void ItemUI::on_boxSellable_toggled(const bool sellable)
void ItemUI::on_varType_currentIndexChanged(const int type)
{
- try
- {
- static_cast<Item*>(modified())->setType(varType->itemData(type).toInt());
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Item*>(modified())->setType(varType->itemData(type).toInt());
}
void ItemUI::on_varPrice_valueChanged(const int price)
{
- try
- {
- static_cast<Item*>(modified())->setPrice(price);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Item*>(modified())->setPrice(price);
}
void ItemUI::on_varDescription_textChanged()
{
static_cast<Item*>(modified())->setDescription(varDescription->toPlainText());
- emit(changed(true));
}
diff --git a/pokemodr/ItemUI.h b/pokemodr/ItemUI.h
index af807c7b..665b83ce 100644
--- a/pokemodr/ItemUI.h
+++ b/pokemodr/ItemUI.h
@@ -42,7 +42,7 @@ class ItemUI : public ObjectUI, private Ui::formItem
void on_varType_currentIndexChanged(const int type);
void on_varPrice_valueChanged(const int price);
void on_varDescription_textChanged();
- private:
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/MapTrainerTeamMemberUI.cpp b/pokemodr/MapTrainerTeamMemberUI.cpp
index f8836671..e239cd0c 100644
--- a/pokemodr/MapTrainerTeamMemberUI.cpp
+++ b/pokemodr/MapTrainerTeamMemberUI.cpp
@@ -25,9 +25,6 @@
#include "../pokemod/Pokemod.h"
#include "../pokemod/Species.h"
-// General includes
-#include "../general/BugCatcher.h"
-
MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember, QWidget* parent) :
ObjectUI(parent)
{
@@ -35,6 +32,10 @@ MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember,
QMetaObject::connectSlotsByName(this);
setObjects(teamMember, new MapTrainerTeamMember(*teamMember));
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();
}
@@ -105,60 +106,24 @@ void MapTrainerTeamMemberUI::on_buttonDiscard_clicked()
void MapTrainerTeamMemberUI::on_varSpecies_currentIndexChanged(const int species)
{
- try
- {
- static_cast<MapTrainerTeamMember*>(modified())->setSpecies(varSpecies->itemData(species).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapTrainerTeamMember*>(modified())->setSpecies(varSpecies->itemData(species).toInt());
}
void MapTrainerTeamMemberUI::on_varLevel_valueChanged(const int level)
{
- try
- {
- static_cast<MapTrainerTeamMember*>(modified())->setLevel(level);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<MapTrainerTeamMember*>(modified())->setLevel(level);
}
void MapTrainerTeamMemberUI::on_varNature_currentIndexChanged(const int nature)
{
- try
- {
- static_cast<MapTrainerTeamMember*>(modified())->setNature(varNature->itemData(nature).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapTrainerTeamMember*>(modified())->setNature(varNature->itemData(nature).toInt());
}
void MapTrainerTeamMemberUI::on_varItems_itemSelectionChanged()
{
- try
- {
- for (int i = 0; i < varItems->count(); ++i)
- {
- const QListWidgetItem* widgetItem = varItems->item(i);
- static_cast<MapTrainerTeamMember*>(modified())->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
- }
- emit(changed(true));
- }
- catch (BoundsException& exception)
+ for (int i = 0; i < varItems->count(); ++i)
{
- BugCatcher::report(exception);
- setGui();
+ const QListWidgetItem* widgetItem = varItems->item(i);
+ static_cast<MapTrainerTeamMember*>(modified())->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
}
diff --git a/pokemodr/MapTrainerTeamMemberUI.h b/pokemodr/MapTrainerTeamMemberUI.h
index e31e867b..b24067e8 100644
--- a/pokemodr/MapTrainerTeamMemberUI.h
+++ b/pokemodr/MapTrainerTeamMemberUI.h
@@ -41,7 +41,7 @@ class MapTrainerTeamMemberUI : public ObjectUI, private Ui::formMapTrainerTeamMe
void on_varLevel_valueChanged(const int level);
void on_varNature_currentIndexChanged(const int nature);
void on_varItems_itemSelectionChanged();
- private:
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/MapUI.cpp b/pokemodr/MapUI.cpp
index fd23d637..9364edfc 100644
--- a/pokemodr/MapUI.cpp
+++ b/pokemodr/MapUI.cpp
@@ -27,9 +27,6 @@
#include "../pokemod/MapWarp.h"
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
// Qt includes
#include <QHeaderView>
@@ -45,6 +42,10 @@ MapUI::MapUI(Map* map, QWidget* parent) :
setObjects(map, new Map(*map));
m_model = new TilemapModel(this, static_cast<Map*>(modified())->map(), static_cast<const Pokemod*>(static_cast<Map*>(original())->pokemod()));
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();
}
@@ -102,41 +103,21 @@ void MapUI::on_buttonDiscard_clicked()
void MapUI::on_varName_textChanged(const QString& name)
{
static_cast<Map*>(modified())->setName(name);
- emit(changed(true));
}
void MapUI::on_boxFlyWarp_toggled()
{
static_cast<Map*>(modified())->setFlyWarp(-1);
- emit(changed(true));
}
void MapUI::on_varFlyWarp_currentIndexChanged(const int flyWarp)
{
- try
- {
- static_cast<Map*>(modified())->setFlyWarp(varFlyWarp->itemData(flyWarp).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Map*>(modified())->setFlyWarp(varFlyWarp->itemData(flyWarp).toInt());
}
void MapUI::on_varType_currentIndexChanged(const int type)
{
- try
- {
- static_cast<Map*>(modified())->setType(type);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Map*>(modified())->setType(type);
}
void MapUI::on_buttonAddColumn_pressed()
diff --git a/pokemodr/MapUI.h b/pokemodr/MapUI.h
index 1dd70cfa..16e21da0 100644
--- a/pokemodr/MapUI.h
+++ b/pokemodr/MapUI.h
@@ -49,11 +49,11 @@ class MapUI : public ObjectUI, private Ui::formMap
void on_buttonDeleteRow_pressed();
void on_buttonInsertColumn_pressed();
void on_buttonInsertRow_pressed();
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
-
+ private:
TilemapModel* m_model;
TileDelegate* m_delegate;
};
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);
}
diff --git a/pokemodr/MapWarpUI.h b/pokemodr/MapWarpUI.h
index d7b88530..708781c2 100644
--- a/pokemodr/MapWarpUI.h
+++ b/pokemodr/MapWarpUI.h
@@ -51,11 +51,11 @@ class MapWarpUI : public ObjectUI, private Ui::formMapWarp
void on_varFlag_valueChanged(const int flag);
void on_varState_toggled(const bool state);
void on_varDialog_currentIndexChanged(const int dialog);
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
-
+ private:
int m_lastMap;
};
diff --git a/pokemodr/MapWildListEncounterUI.cpp b/pokemodr/MapWildListEncounterUI.cpp
index 52316713..5fd582ed 100644
--- a/pokemodr/MapWildListEncounterUI.cpp
+++ b/pokemodr/MapWildListEncounterUI.cpp
@@ -23,9 +23,6 @@
#include "../pokemod/Species.h"
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* encounter, QWidget* parent) :
ObjectUI(parent)
{
@@ -33,6 +30,10 @@ MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* encounter,
QMetaObject::connectSlotsByName(this);
setObjects(encounter, new MapWildListEncounter(*encounter));
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,42 +75,15 @@ void MapWildListEncounterUI::on_buttonDiscard_clicked()
void MapWildListEncounterUI::on_varSpecies_currentIndexChanged(const int species)
{
- try
- {
- static_cast<MapWildListEncounter*>(modified())->setSpecies(varSpecies->itemData(species).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWildListEncounter*>(modified())->setSpecies(varSpecies->itemData(species).toInt());
}
void MapWildListEncounterUI::on_varLevel_valueChanged(const int level)
{
- try
- {
- static_cast<MapWildListEncounter*>(modified())->setLevel(level);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<MapWildListEncounter*>(modified())->setLevel(level);
}
void MapWildListEncounterUI::on_varWeight_valueChanged(const int weight)
{
- try
- {
- static_cast<MapWildListEncounter*>(modified())->setWeight(weight);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<MapWildListEncounter*>(modified())->setWeight(weight);
}
diff --git a/pokemodr/MapWildListEncounterUI.h b/pokemodr/MapWildListEncounterUI.h
index 27a27369..94e6fa75 100644
--- a/pokemodr/MapWildListEncounterUI.h
+++ b/pokemodr/MapWildListEncounterUI.h
@@ -40,7 +40,7 @@ class MapWildListEncounterUI : public ObjectUI, private Ui::formMapWildListEncou
void on_varSpecies_currentIndexChanged(const int species);
void on_varLevel_valueChanged(const int level);
void on_varWeight_valueChanged(const int weight);
- private:
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp
index 8b204440..3530495e 100644
--- a/pokemodr/MapWildListUI.cpp
+++ b/pokemodr/MapWildListUI.cpp
@@ -25,9 +25,6 @@
#include "../pokemod/MapWildList.h"
#include "../pokemod/Time.h"
-// General includes
-#include "../general/BugCatcher.h"
-
MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) :
ObjectUI(parent)
{
@@ -35,6 +32,10 @@ MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(wildList, new MapWildList(*wildList));
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();
}
@@ -107,47 +108,20 @@ void MapWildListUI::on_buttonDiscard_clicked()
void MapWildListUI::on_varControl_currentIndexChanged(const int control)
{
- try
- {
- static_cast<MapWildList*>(modified())->setControl(control);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<MapWildList*>(modified())->setControl(control);
}
void MapWildListUI::on_varValue_currentIndexChanged(const int value)
{
- try
- {
- static_cast<MapWildList*>(modified())->setValue(varValue->itemData(value).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<MapWildList*>(modified())->setValue(varValue->itemData(value).toInt());
}
void MapWildListUI::on_varTimes_itemSelectionChanged()
{
- try
- {
- for (int i = 0; i < varTimes->count(); ++i)
- {
- const QListWidgetItem* widgetItem = varTimes->item(i);
- static_cast<MapWildList*>(modified())->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
- }
- emit(changed(true));
- }
- catch (BoundsException& exception)
+ for (int i = 0; i < varTimes->count(); ++i)
{
- BugCatcher::report(exception);
- setGui();
+ const QListWidgetItem* widgetItem = varTimes->item(i);
+ static_cast<MapWildList*>(modified())->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
}
@@ -155,20 +129,9 @@ void MapWildListUI::on_boxScope_toggled(const bool scopeUsed)
{
if (!scopeUsed)
static_cast<MapWildList*>(modified())->setScope(INT_MAX);
- emit(changed(true));
- setGui();
}
void MapWildListUI::on_varScope_currentIndexChanged(const int scope)
{
- try
- {
- static_cast<MapWildList*>(modified())->setScope(varScope->itemData(scope).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<MapWildList*>(modified())->setScope(varScope->itemData(scope).toInt());
}
diff --git a/pokemodr/MapWildListUI.h b/pokemodr/MapWildListUI.h
index 75b92cbc..a9336d4f 100644
--- a/pokemodr/MapWildListUI.h
+++ b/pokemodr/MapWildListUI.h
@@ -42,7 +42,7 @@ class MapWildListUI : public ObjectUI, private Ui::formMapWildList
void on_varTimes_itemSelectionChanged();
void on_boxScope_toggled(const bool scopeUsed);
void on_varScope_currentIndexChanged(const int scope);
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
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));
}
diff --git a/pokemodr/MoveUI.h b/pokemodr/MoveUI.h
index 25ffa623..067d5ba4 100644
--- a/pokemodr/MoveUI.h
+++ b/pokemodr/MoveUI.h
@@ -51,7 +51,7 @@ class MoveUI : public ObjectUI, private Ui::formMove
void on_varCanSnatch_toggled(const bool canSnatch);
void on_varSound_toggled(const bool sound);
void on_varDescription_textChanged();
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp
index 945d535a..7a2a43e4 100644
--- a/pokemodr/NatureUI.cpp
+++ b/pokemodr/NatureUI.cpp
@@ -22,9 +22,6 @@
#include "../pokemod/Nature.h"
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
NatureUI::NatureUI(Nature* nature, QWidget* parent) :
ObjectUI(parent)
{
@@ -32,6 +29,10 @@ NatureUI::NatureUI(Nature* nature, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(nature, new Nature(*nature));
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();
}
@@ -39,6 +40,11 @@ NatureUI::~NatureUI()
{
}
+void NatureUI::initGui()
+{
+ connect(varStat, SIGNAL(currentIndexChanged()), this, SLOT(setGui()));
+}
+
void NatureUI::refreshGui()
{
varStat->clear();
@@ -69,39 +75,14 @@ void NatureUI::on_buttonDiscard_clicked()
void NatureUI::on_varName_textChanged(const QString& name)
{
static_cast<Nature*>(modified())->setName(name);
- emit(changed(true));
-}
-
-void NatureUI::on_varStat_currentIndexChanged()
-{
- setGui();
- emit(changed(true));
}
void NatureUI::on_varStatMultiplier_valueChanged(const Fraction& statMultiplier)
{
- try
- {
- static_cast<Nature*>(modified())->setStat(varStat->currentIndex(), statMultiplier);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Nature*>(modified())->setStat(varStat->currentIndex(), statMultiplier);
}
void NatureUI::on_varWeight_valueChanged(const int weight)
{
- try
- {
- static_cast<Nature*>(modified())->setWeight(weight);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Nature*>(modified())->setWeight(weight);
}
diff --git a/pokemodr/NatureUI.h b/pokemodr/NatureUI.h
index d2d1f7b3..15f9be8c 100644
--- a/pokemodr/NatureUI.h
+++ b/pokemodr/NatureUI.h
@@ -38,10 +38,10 @@ class NatureUI : public ObjectUI, private Ui::formNature
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& name);
- void on_varStat_currentIndexChanged();
void on_varStatMultiplier_valueChanged(const Fraction& statMultiplier);
void on_varWeight_valueChanged(const int weight);
- private:
+ private slots:
+ void initGui();
void refreshGui();
void setGui();
};
diff --git a/pokemodr/ObjectUI.h b/pokemodr/ObjectUI.h
index 787c2285..82c715fc 100644
--- a/pokemodr/ObjectUI.h
+++ b/pokemodr/ObjectUI.h
@@ -105,6 +105,14 @@ class ObjectUI : public QWidget
}
virtual void on_buttonApply_clicked() = 0;
virtual void on_buttonDiscard_clicked() = 0;
+ protected slots:
+ void initGui()
+ {
+ }
+ void refreshGui()
+ {
+ }
+ virtual void setGui() = 0;
protected:
void setObjects(Object* original, Object* modified)
{
@@ -118,14 +126,6 @@ class ObjectUI : public QWidget
reload();
emit(changed(false));
}
-
- void initGui()
- {
- }
- void refreshGui()
- {
- }
- virtual void setGui() = 0;
private:
bool m_changed;
diff --git a/pokemodr/PokeModr.cpp b/pokemodr/PokeModr.cpp
index 27a4fdb4..220f717c 100644
--- a/pokemodr/PokeModr.cpp
+++ b/pokemodr/PokeModr.cpp
@@ -22,10 +22,6 @@
#include "FileDialog.h"
#include "PokeModrUI.h"
-// General includes
-#include "../general/BugCatcher.h"
-#include "../general/Exception.h"
-
// Qt includes
#include <QTextCodec>
@@ -49,22 +45,10 @@ int main(int argc, char* argv[])
KCmdLineArgs::init(argc, argv, &about);
KApplication app;
- BugCatcher::setAbout(&about);
-
KConfig cfg("~/.kde/share/config/pokegenrc");
- int ret = 0;
- try
- {
- PokeModrUI mainWindow(cfg.group("pokemodr"), cfg.group("pokemodr-recent"));
- mainWindow.show();
- app.exec();
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- BugCatcher::report(Exception("PokeModr", "Uncaught exception"));
- ret = 1;
- }
- return ret;
+ PokeModrUI mainWindow(cfg.group("pokemodr"), cfg.group("pokemodr-recent"));
+ mainWindow.show();
+ app.exec();
+ return 0;
}
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index e910eaf6..3b7049df 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -24,9 +24,6 @@
// Pokemod includes
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
// Qt includes
#include <QCloseEvent>
#include <QMutableListIterator>
diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp
index a4ab4495..788df1b4 100644
--- a/pokemodr/PokemodUI.cpp
+++ b/pokemodr/PokemodUI.cpp
@@ -28,9 +28,6 @@
#include "../pokemod/MapWarp.h"
#include "../pokemod/Pokemod.h"
-// General includes
-#include "../general/BugCatcher.h"
-
PokemodUI::PokemodUI(Pokemod* pokemod, QWidget* parent) :
ObjectUI(parent),
m_lastMap(-1)
@@ -39,6 +36,10 @@ PokemodUI::PokemodUI(Pokemod* pokemod, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(pokemod, new Pokemod(*pokemod));
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();
}
@@ -84,9 +85,9 @@ void PokemodUI::setGui()
int index = static_cast<Pokemod*>(original())->mapIndex(static_cast<Pokemod*>(modified())->startMap());
if (index != INT_MAX)
{
- try
+ const Map* map = static_cast<Pokemod*>(original())->map(index);
+ if (map)
{
- const Map* map = static_cast<Pokemod*>(original())->map(index);
for (int i = 0; i < map->warpCount(); ++i)
{
const MapWarp* warp = map->warp(i);
@@ -94,10 +95,6 @@ void PokemodUI::setGui()
varWarp->setItemData(i, warp->id());
}
}
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
}
}
varWarp->setCurrentIndex(varWarp->findData(static_cast<Pokemod*>(modified())->startWarp()));
@@ -127,59 +124,36 @@ void PokemodUI::on_buttonDiscard_clicked()
void PokemodUI::on_varTitle_textChanged(const QString& title)
{
static_cast<Pokemod*>(modified())->setTitle(title);
- emit(changed(true));
}
void PokemodUI::on_varVersion_textChanged(const QString& version)
{
static_cast<Pokemod*>(modified())->setVersion(version);
- emit(changed(true));
}
void PokemodUI::on_varDescription_textChanged()
{
static_cast<Pokemod*>(modified())->setDescription(varDescription->toPlainText());
- emit(changed(true));
}
void PokemodUI::on_varMap_currentIndexChanged(const int map)
{
- try
- {
- static_cast<Pokemod*>(modified())->setStartMap(map);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Pokemod*>(modified())->setStartMap(map);
}
void PokemodUI::on_varWarp_currentIndexChanged(const int warp)
{
- try
- {
- static_cast<Pokemod*>(modified())->setStartWarp(warp);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Pokemod*>(modified())->setStartWarp(warp);
}
void PokemodUI::on_varSuperPCUsername_textChanged(const QString& username)
{
static_cast<Pokemod*>(modified())->setSuperPCUname(username);
- emit(changed(true));
}
void PokemodUI::on_varSuperPCPassword_textChanged(const QString& password)
{
static_cast<Pokemod*>(modified())->setSuperPCPasswd(password);
- emit(changed(true));
}
void PokemodUI::on_varWalkSkin_pressed()
@@ -187,14 +161,7 @@ void PokemodUI::on_varWalkSkin_pressed()
FileDialog dialog(QSize(192, 168));
if (dialog.exec())
{
- try
- {
- static_cast<Pokemod*>(original())->setWalkSkin(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Pokemod*>(original())->setWalkSkin(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -204,14 +171,7 @@ void PokemodUI::on_varBikeSkin_pressed()
FileDialog dialog(QSize(192, 168));
if (dialog.exec())
{
- try
- {
- static_cast<Pokemod*>(original())->setBikeSkin(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Pokemod*>(original())->setBikeSkin(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -221,14 +181,7 @@ void PokemodUI::on_varFlySkin_pressed()
FileDialog dialog(QSize(192, 168));
if (dialog.exec())
{
- try
- {
- static_cast<Pokemod*>(original())->setFlySkin(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Pokemod*>(original())->setFlySkin(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -238,14 +191,7 @@ void PokemodUI::on_varSurfSkin_pressed()
FileDialog dialog(QSize(192, 168));
if (dialog.exec())
{
- try
- {
- static_cast<Pokemod*>(original())->setSurfSkin(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Pokemod*>(original())->setSurfSkin(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -255,14 +201,7 @@ void PokemodUI::on_varFishSkin_pressed()
FileDialog dialog(QSize(192, 168));
if (dialog.exec())
{
- try
- {
- static_cast<Pokemod*>(original())->setFishSkin(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Pokemod*>(original())->setFishSkin(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -272,14 +211,7 @@ void PokemodUI::on_varSurfFishSkin_pressed()
FileDialog dialog(QSize(192, 168));
if (dialog.exec())
{
- try
- {
- static_cast<Pokemod*>(original())->setSurfFishSkin(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Pokemod*>(original())->setSurfFishSkin(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -291,8 +223,3 @@ void PokemodUI::on_varTypechart_currentItemChanged(QTableWidgetItem* current, QT
// varEffectiveness->setValue(widgetItem->data(Qt::EditRole).value<Fraction>());
connect(varEffectiveness, SIGNAL(valueChanged(Fraction)), widgetItem, SLOT(setValue(Fraction)));
}
-
-void PokemodUI::on_varEffectiveness_valueChanged()
-{
- emit(changed(true));
-}
diff --git a/pokemodr/PokemodUI.h b/pokemodr/PokemodUI.h
index e6c79812..14e2f877 100644
--- a/pokemodr/PokemodUI.h
+++ b/pokemodr/PokemodUI.h
@@ -50,11 +50,10 @@ class PokemodUI : public ObjectUI, private Ui::formPokemod
void on_varFishSkin_pressed();
void on_varSurfFishSkin_pressed();
void on_varTypechart_currentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
- void on_varEffectiveness_valueChanged();
- private:
+ private slots:
void refreshGui();
void setGui();
-
+ private:
int m_lastMap;
};
diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp
index b63a935e..bb366b59 100644
--- a/pokemodr/RulesUI.cpp
+++ b/pokemodr/RulesUI.cpp
@@ -21,9 +21,6 @@
// Pokemod includes
#include "../pokemod/Rules.h"
-// General includes
-#include "../general/BugCatcher.h"
-
RulesUI::RulesUI(Rules* rules, QWidget* parent) :
ObjectUI(parent)
{
@@ -31,6 +28,10 @@ RulesUI::RulesUI(Rules* rules, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(rules, new Rules(*rules));
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();
}
@@ -94,207 +95,124 @@ void RulesUI::on_buttonDiscard_clicked()
void RulesUI::on_boxGenders_toggled(const bool genders)
{
static_cast<Rules*>(modified())->setGenderAllowed(genders);
- emit(changed(true));
}
void RulesUI::on_varBreeding_toggled(const bool breeding)
{
static_cast<Rules*>(modified())->setBreedingAllowed(breeding);
- emit(changed(true));
}
void RulesUI::on_varHeldItems_valueChanged(const int heldItems)
{
static_cast<Rules*>(modified())->setHoldItems(heldItems);
- emit(changed(true));
}
void RulesUI::on_boxCriticalDomains_toggled(const bool criticalDomains)
{
static_cast<Rules*>(modified())->setCriticalDomains(criticalDomains);
- emit(changed(true));
}
void RulesUI::on_boxAllowAbilities_toggled(const bool allowAbilities)
{
static_cast<Rules*>(modified())->setAbilityAllowed(allowAbilities);
- emit(changed(true));
}
void RulesUI::on_boxAllowNatures_toggled(const bool allowNatures)
{
static_cast<Rules*>(modified())->setNatureAllowed(allowNatures);
- emit(changed(true));
}
void RulesUI::on_varBoxes_valueChanged(const int boxes)
{
static_cast<Rules*>(modified())->setNumBoxes(boxes);
- emit(changed(true));
- setGui();
}
void RulesUI::on_varBoxSize_valueChanged(const int boxSize)
{
static_cast<Rules*>(modified())->setBoxSize(boxSize);
- emit(changed(true));
}
void RulesUI::on_varMaxParty_valueChanged(const int maxParty)
{
static_cast<Rules*>(modified())->setMaxParty(maxParty);
- emit(changed(true));
- setGui();
}
void RulesUI::on_varMaxFight_valueChanged(const int maxFight)
{
- try
- {
- static_cast<Rules*>(modified())->setMaxFight(maxFight);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Rules*>(modified())->setMaxFight(maxFight);
}
void RulesUI::on_varMaxMoves_valueChanged(const int maxMoves)
{
- try
- {
- static_cast<Rules*>(modified())->setMaxMoves(maxMoves);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Rules*>(modified())->setMaxMoves(maxMoves);
}
void RulesUI::on_varMaxLevel_valueChanged(const int maxLevel)
{
- try
- {
- static_cast<Rules*>(modified())->setMaxLevel(maxLevel);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Rules*>(modified())->setMaxLevel(maxLevel);
}
void RulesUI::on_varMaxMoney_valueChanged(const int maxMoney)
{
static_cast<Rules*>(modified())->setMaxMoney(maxMoney);
- emit(changed(true));
}
void RulesUI::on_boxHardCash_toggled(const bool hardCash)
{
static_cast<Rules*>(modified())->setHardCash(hardCash);
- emit(changed(true));
}
void RulesUI::on_boxSplitSpecial_toggled(const bool splitSpecial)
{
static_cast<Rules*>(modified())->setSpecialSplit(splitSpecial);
- emit(changed(true));
}
void RulesUI::on_varSplitSpecialDV_toggled(const bool splitSpecialDV)
{
static_cast<Rules*>(modified())->setSpecialDVSplit(splitSpecialDV);
- emit(changed(true));
}
void RulesUI::on_varMaxDV_currentIndexChanged(const int maxDV)
{
- try
- {
- static_cast<Rules*>(modified())->setMaxDVValue(maxDV);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Rules*>(modified())->setMaxDVValue(maxDV);
}
void RulesUI::on_boxHappiness_toggled(const bool happiness)
{
static_cast<Rules*>(modified())->setHappiness(happiness);
- emit(changed(true));
}
void RulesUI::on_varFaintLoss_valueChanged(const int faintLoss)
{
static_cast<Rules*>(modified())->setHappyFaintLoss(faintLoss);
- emit(changed(true));
}
void RulesUI::on_varLevelGain_valueChanged(const int levelGain)
{
static_cast<Rules*>(modified())->setHappyLevelGain(levelGain);
- emit(changed(true));
}
void RulesUI::on_varNumSteps_valueChanged(const int numSteps)
{
static_cast<Rules*>(modified())->setHappySteps(numSteps);
- emit(changed(true));
}
void RulesUI::on_boxEffortValues_toggled(const bool effortValues)
{
static_cast<Rules*>(modified())->setEffortValuesAllowed(effortValues);
- emit(changed(true));
}
void RulesUI::on_varMaxEV_valueChanged(const int maxEV)
{
- try
- {
- static_cast<Rules*>(modified())->setMaxTotalEV(maxEV);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<Rules*>(modified())->setMaxTotalEV(maxEV);
}
void RulesUI::on_varMaxEVPerStat_valueChanged(const int maxEVPerStat)
{
- try
- {
- static_cast<Rules*>(modified())->setMaxEVPerStat(maxEVPerStat);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Rules*>(modified())->setMaxEVPerStat(maxEVPerStat);
}
void RulesUI::on_varPokerus_valueChanged(const Fraction& pokerusChance)
{
- try
- {
- static_cast<Rules*>(modified())->setPokerusChance(pokerusChance);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Rules*>(modified())->setPokerusChance(pokerusChance);
}
diff --git a/pokemodr/RulesUI.h b/pokemodr/RulesUI.h
index b3758e08..631e8f30 100644
--- a/pokemodr/RulesUI.h
+++ b/pokemodr/RulesUI.h
@@ -62,7 +62,7 @@ class RulesUI : public ObjectUI, private Ui::formRules
void on_varMaxEV_valueChanged(const int maxEV);
void on_varMaxEVPerStat_valueChanged(const int maxEVPerStat);
void on_varPokerus_valueChanged(const Fraction& pokerusChance);
- private:
+ private slots:
void initGui();
void setGui();
};
diff --git a/pokemodr/SpeciesAbilityUI.cpp b/pokemodr/SpeciesAbilityUI.cpp
index a46a699d..c55c6587 100644
--- a/pokemodr/SpeciesAbilityUI.cpp
+++ b/pokemodr/SpeciesAbilityUI.cpp
@@ -23,9 +23,6 @@
#include "../pokemod/Pokemod.h"
#include "../pokemod/SpeciesAbility.h"
-// General includes
-#include "../general/BugCatcher.h"
-
SpeciesAbilityUI::SpeciesAbilityUI(SpeciesAbility* ability, QWidget* parent) :
ObjectUI(parent)
{
@@ -33,6 +30,10 @@ SpeciesAbilityUI::SpeciesAbilityUI(SpeciesAbility* ability, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(ability, new SpeciesAbility(*ability));
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();
}
@@ -72,28 +73,10 @@ void SpeciesAbilityUI::on_buttonDiscard_clicked()
void SpeciesAbilityUI::on_varAbility_currentIndexChanged(const int ability)
{
- try
- {
- static_cast<SpeciesAbility*>(modified())->setAbility(varAbility->itemData(ability).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesAbility*>(modified())->setAbility(varAbility->itemData(ability).toInt());
}
void SpeciesAbilityUI::on_varWeight_valueChanged(const int weight)
{
- try
- {
- static_cast<SpeciesAbility*>(modified())->setWeight(weight);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<SpeciesAbility*>(modified())->setWeight(weight);
}
diff --git a/pokemodr/SpeciesAbilityUI.h b/pokemodr/SpeciesAbilityUI.h
index a4abada8..537b2a89 100644
--- a/pokemodr/SpeciesAbilityUI.h
+++ b/pokemodr/SpeciesAbilityUI.h
@@ -39,8 +39,7 @@ class SpeciesAbilityUI : public ObjectUI, private Ui::formSpeciesAbility
void on_buttonDiscard_clicked();
void on_varAbility_currentIndexChanged(const int ability);
void on_varWeight_valueChanged(const int weight);
- private:
- void initGui();
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp
index 02fae057..85873df2 100644
--- a/pokemodr/SpeciesEvolutionUI.cpp
+++ b/pokemodr/SpeciesEvolutionUI.cpp
@@ -25,9 +25,6 @@
#include "../pokemod/Species.h"
#include "../pokemod/SpeciesEvolution.h"
-// General includes
-#include "../general/BugCatcher.h"
-
SpeciesEvolutionUI::SpeciesEvolutionUI(SpeciesEvolution* evolution, QWidget* parent) :
ObjectUI(parent),
m_lastStyle(-1)
@@ -36,6 +33,10 @@ SpeciesEvolutionUI::SpeciesEvolutionUI(SpeciesEvolution* evolution, QWidget* par
QMetaObject::connectSlotsByName(this);
setObjects(evolution, new SpeciesEvolution(*evolution));
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();
}
@@ -144,87 +145,33 @@ void SpeciesEvolutionUI::on_buttonDiscard_clicked()
void SpeciesEvolutionUI::on_varSpecies_currentIndexChanged(const int species)
{
- try
- {
- static_cast<SpeciesEvolution*>(modified())->setSpecies(varSpecies->itemData(species).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesEvolution*>(modified())->setSpecies(varSpecies->itemData(species).toInt());
}
void SpeciesEvolutionUI::on_varStyle_currentIndexChanged(const int style)
{
- try
- {
- static_cast<SpeciesEvolution*>(modified())->setStyle(style);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesEvolution*>(modified())->setStyle(style);
}
void SpeciesEvolutionUI::on_varValue1_currentIndexChanged(const int value1)
{
- try
- {
- if ((static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_Item) ||(static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_TradeItem))
- static_cast<SpeciesEvolution*>(modified())->setValue1(varValue1->itemData(value1).toInt());
- else
- static_cast<SpeciesEvolution*>(modified())->setValue1(value1);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ if ((static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_Item) ||(static_cast<SpeciesEvolution*>(modified())->style() == SpeciesEvolution::S_TradeItem))
+ static_cast<SpeciesEvolution*>(modified())->setValue1(varValue1->itemData(value1).toInt());
+ else
+ static_cast<SpeciesEvolution*>(modified())->setValue1(value1);
}
void SpeciesEvolutionUI::on_varValue2_currentIndexChanged(const int value2)
{
- try
- {
- static_cast<SpeciesEvolution*>(modified())->setValue2(value2);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesEvolution*>(modified())->setValue2(value2);
}
void SpeciesEvolutionUI::on_varValue3_valueChanged(const int value3)
{
- try
- {
- static_cast<SpeciesEvolution*>(modified())->setValue3(value3);
- emit(changed(true));
- }
- catch (UnusedException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesEvolution*>(modified())->setValue3(value3);
}
void SpeciesEvolutionUI::on_varLevel_valueChanged(const int level)
{
- try
- {
- static_cast<SpeciesEvolution*>(modified())->setLevel(level);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesEvolution*>(modified())->setLevel(level);
}
diff --git a/pokemodr/SpeciesEvolutionUI.h b/pokemodr/SpeciesEvolutionUI.h
index 87332914..15f2a32e 100644
--- a/pokemodr/SpeciesEvolutionUI.h
+++ b/pokemodr/SpeciesEvolutionUI.h
@@ -43,11 +43,11 @@ class SpeciesEvolutionUI : public ObjectUI, private Ui::formSpeciesEvolution
void on_varValue2_currentIndexChanged(const int value2);
void on_varValue3_valueChanged(const int value3);
void on_varLevel_valueChanged(const int level);
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
-
+ private:
int m_lastStyle;
};
diff --git a/pokemodr/SpeciesItemUI.cpp b/pokemodr/SpeciesItemUI.cpp
index 111e4f5e..29d10057 100644
--- a/pokemodr/SpeciesItemUI.cpp
+++ b/pokemodr/SpeciesItemUI.cpp
@@ -23,9 +23,6 @@
#include "../pokemod/Pokemod.h"
#include "../pokemod/SpeciesItem.h"
-// General includes
-#include "../general/BugCatcher.h"
-
SpeciesItemUI::SpeciesItemUI(SpeciesItem* item, QWidget* parent) :
ObjectUI(parent)
{
@@ -33,6 +30,10 @@ SpeciesItemUI::SpeciesItemUI(SpeciesItem* item, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(item, new SpeciesItem(*item));
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();
}
@@ -72,28 +73,10 @@ void SpeciesItemUI::on_buttonDiscard_clicked()
void SpeciesItemUI::on_varItem_currentIndexChanged(const int item)
{
- try
- {
- static_cast<SpeciesItem*>(modified())->setItem(varItem->itemData(item).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesItem*>(modified())->setItem(varItem->itemData(item).toInt());
}
void SpeciesItemUI::on_varWeight_valueChanged(const int weight)
{
- try
- {
- static_cast<SpeciesItem*>(modified())->setWeight(weight);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<SpeciesItem*>(modified())->setWeight(weight);
}
diff --git a/pokemodr/SpeciesItemUI.h b/pokemodr/SpeciesItemUI.h
index c84a2067..0b22ef6e 100644
--- a/pokemodr/SpeciesItemUI.h
+++ b/pokemodr/SpeciesItemUI.h
@@ -39,7 +39,7 @@ class SpeciesItemUI : public ObjectUI, private Ui::formSpeciesItem
void on_buttonDiscard_clicked();
void on_varItem_currentIndexChanged(const int item);
void on_varWeight_valueChanged(const int weight);
- private:
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/SpeciesMoveUI.cpp b/pokemodr/SpeciesMoveUI.cpp
index 3a63c7d1..228b4f91 100644
--- a/pokemodr/SpeciesMoveUI.cpp
+++ b/pokemodr/SpeciesMoveUI.cpp
@@ -23,9 +23,6 @@
#include "../pokemod/Pokemod.h"
#include "../pokemod/SpeciesMove.h"
-// General includes
-#include "../general/BugCatcher.h"
-
SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* move, QWidget* parent) :
ObjectUI(parent)
{
@@ -33,6 +30,10 @@ SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* move, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(move, new SpeciesMove(*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();
}
@@ -75,42 +76,15 @@ void SpeciesMoveUI::on_buttonDiscard_clicked()
void SpeciesMoveUI::on_varMove_currentIndexChanged(const int move)
{
- try
- {
- static_cast<SpeciesMove*>(modified())->setMove(varMove->itemData(move).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- }
- setGui();
+ static_cast<SpeciesMove*>(modified())->setMove(varMove->itemData(move).toInt());
}
void SpeciesMoveUI::on_varLevel_valueChanged(const int level)
{
- try
- {
- static_cast<SpeciesMove*>(modified())->setLevel(level);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<SpeciesMove*>(modified())->setLevel(level);
}
void SpeciesMoveUI::on_varWildLevel_valueChanged(const int wildLevel)
{
- try
- {
- static_cast<SpeciesMove*>(modified())->setWild(wildLevel);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<SpeciesMove*>(modified())->setWild(wildLevel);
}
diff --git a/pokemodr/SpeciesMoveUI.h b/pokemodr/SpeciesMoveUI.h
index d09b5715..c7bfd9c6 100644
--- a/pokemodr/SpeciesMoveUI.h
+++ b/pokemodr/SpeciesMoveUI.h
@@ -40,7 +40,7 @@ class SpeciesMoveUI : public ObjectUI, private Ui::formSpeciesMove
void on_varMove_currentIndexChanged(const int move);
void on_varLevel_valueChanged(const int level);
void on_varWildLevel_valueChanged(const int wildLevel);
- private:
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp
index ff2b35f6..ea5d4b08 100644
--- a/pokemodr/SpeciesUI.cpp
+++ b/pokemodr/SpeciesUI.cpp
@@ -27,9 +27,6 @@
#include "../pokemod/Species.h"
#include "../pokemod/Type.h"
-// General includes
-#include "../general/BugCatcher.h"
-
SpeciesUI::SpeciesUI(Species* species, QWidget* parent) :
ObjectUI(parent)
{
@@ -37,6 +34,10 @@ SpeciesUI::SpeciesUI(Species* species, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(species, new Species(*species));
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();
}
@@ -46,6 +47,8 @@ SpeciesUI::~SpeciesUI()
void SpeciesUI::initGui()
{
+ connect(varBaseStat, SIGNAL(currentIndexChanged()), this, SLOT(setGui()));
+ connect(varEVStat, SIGNAL(currentIndexChanged()), this, SLOT(setGui()));
varGrowth->addItems(Species::StyleStr);
}
@@ -158,140 +161,66 @@ void SpeciesUI::on_buttonDiscard_clicked()
void SpeciesUI::on_varName_textChanged(const QString& name)
{
static_cast<Species*>(modified())->setName(name);
- emit(changed(true));
-}
-
-void SpeciesUI::on_varBaseStat_currentIndexChanged()
-{
- emit(changed(true));
- setGui();
}
void SpeciesUI::on_varBaseStatValue_valueChanged(const int baseStat)
{
- try
- {
- static_cast<Species*>(modified())->setBaseStat(varBaseStat->currentIndex(), baseStat);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
-}
-
-void SpeciesUI::on_varEVStat_currentIndexChanged()
-{
- emit(changed(true));
- setGui();
+ static_cast<Species*>(modified())->setBaseStat(varBaseStat->currentIndex(), baseStat);
}
void SpeciesUI::on_varEffortValue_valueChanged(const int effortValue)
{
- try
- {
- static_cast<Species*>(modified())->setEffortValue(varEVStat->currentIndex(), effortValue);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Species*>(modified())->setEffortValue(varEVStat->currentIndex(), effortValue);
}
void SpeciesUI::on_varGrowth_currentIndexChanged(const int growth)
{
- try
- {
- static_cast<Species*>(modified())->setGrowth(growth);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Species*>(modified())->setGrowth(growth);
}
void SpeciesUI::on_varExperienceValue_valueChanged(const int experienceValue)
{
static_cast<Species*>(modified())->setExperienceValue(experienceValue);
- emit(changed(true));
}
void SpeciesUI::on_varCatchValue_valueChanged(const int catchValue)
{
static_cast<Species*>(modified())->setCatchValue(catchValue);
- emit(changed(true));
}
void SpeciesUI::on_varRunChance_valueChanged(const Fraction& runChance)
{
- try
- {
- static_cast<Species*>(modified())->setRunChance(runChance);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Species*>(modified())->setRunChance(runChance);
}
void SpeciesUI::on_varItemChance_valueChanged(const Fraction& itemChance)
{
- try
- {
- static_cast<Species*>(modified())->setItemChance(itemChance);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Species*>(modified())->setItemChance(itemChance);
}
-
void SpeciesUI::on_varPokedexNumber_valueChanged(const int pokedexNumber)
{
static_cast<Species*>(modified())->setPokedexNumber(pokedexNumber);
- emit(changed(true));
}
void SpeciesUI::on_varWeight_valueChanged(const int weight)
{
static_cast<Species*>(modified())->setWeight(weight);
- emit(changed(true));
}
void SpeciesUI::on_varHeightFeet_valueChanged(const int feet)
{
static_cast<Species*>(modified())->setHeightFeet(feet);
- emit(changed(true));
}
void SpeciesUI::on_varHeightInches_valueChanged(const int inches)
{
- try
- {
- static_cast<Species*>(modified())->setHeightInches(inches);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Species*>(modified())->setHeightInches(inches);
}
void SpeciesUI::on_varPokedexEntry_textChanged()
{
static_cast<Species*>(modified())->setPokedexEntry(varPokedexEntry->toPlainText());
- emit(changed(true));
}
void SpeciesUI::on_varFrontMaleSprite_pressed()
@@ -299,14 +228,7 @@ void SpeciesUI::on_varFrontMaleSprite_pressed()
FileDialog dialog(QSize(64, 64));
if (dialog.exec())
{
- try
- {
- static_cast<Species*>(modified())->setFrontMaleSprite(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Species*>(modified())->setFrontMaleSprite(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -316,14 +238,7 @@ void SpeciesUI::on_varBackMaleSprite_pressed()
FileDialog dialog(QSize(64, 64));
if (dialog.exec())
{
- try
- {
- static_cast<Species*>(modified())->setBackMaleSprite(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Species*>(modified())->setBackMaleSprite(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -333,14 +248,7 @@ void SpeciesUI::on_varFrontFemaleSprite_pressed()
FileDialog dialog(QSize(64, 64));
if (dialog.exec())
{
- try
- {
- static_cast<Species*>(modified())->setFrontFemaleSprite(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Species*>(modified())->setFrontFemaleSprite(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -350,14 +258,7 @@ void SpeciesUI::on_varBackFemaleSprite_pressed()
FileDialog dialog(QSize(64, 64));
if (dialog.exec())
{
- try
- {
- static_cast<Species*>(modified())->setBackFemaleSprite(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Species*>(modified())->setBackFemaleSprite(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -367,14 +268,7 @@ void SpeciesUI::on_varListSprite_pressed()
FileDialog dialog(QSize(128, 64));
if (dialog.exec())
{
- try
- {
- static_cast<Species*>(modified())->setListSprite(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Species*>(modified())->setListSprite(QPixmap(dialog.selectedFile()));
setGui();
}
}
@@ -382,82 +276,42 @@ void SpeciesUI::on_varListSprite_pressed()
void SpeciesUI::on_boxGenderChance_toggled(const bool genderChance)
{
static_cast<Species*>(modified())->setGenderFactor(Fraction(genderChance ? 1 : -1, 1));
- emit(changed(true));
- setGui();
}
void SpeciesUI::on_varGenderChance_valueChanged(const Fraction& genderChance)
{
- try
- {
- static_cast<Species*>(modified())->setGenderFactor(genderChance);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Species*>(modified())->setGenderFactor(genderChance);
}
void SpeciesUI::on_varEggSpecies_currentIndexChanged(const int eggSpecies)
{
- try
- {
- static_cast<Species*>(modified())->setEggSpecies(varEggSpecies->itemData(eggSpecies).toInt());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Species*>(modified())->setEggSpecies(varEggSpecies->itemData(eggSpecies).toInt());
}
void SpeciesUI::on_varEggSteps_valueChanged(const int eggSteps)
{
static_cast<Species*>(modified())->setEggSteps(eggSteps);
- emit(changed(true));
}
void SpeciesUI::on_varNidoranGroup_valueChanged(const int nidoranGroup)
{
static_cast<Species*>(modified())->setNidoranGroup(nidoranGroup);
- emit(changed(true));
}
void SpeciesUI::on_varTypes_itemSelectionChanged()
{
- try
- {
- for (int i = 0; i < varTypes->count(); ++i)
- {
- const QListWidgetItem* widgetItem = varTypes->item(i);
- static_cast<Species*>(modified())->setType(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
- }
- emit(changed(true));
- }
- catch (BoundsException& exception)
+ for (int i = 0; i < varTypes->count(); ++i)
{
- BugCatcher::report(exception);
- setGui();
+ const QListWidgetItem* widgetItem = varTypes->item(i);
+ static_cast<Species*>(modified())->setType(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
}
void SpeciesUI::on_varEggGroups_itemSelectionChanged()
{
- try
- {
- for (int i = 0; i < varEggGroups->count(); ++i)
- {
- const QListWidgetItem* widgetItem = varEggGroups->item(i);
- static_cast<Species*>(modified())->setEggGroup(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
- }
- emit(changed(true));
- }
- catch (BoundsException& exception)
+ for (int i = 0; i < varEggGroups->count(); ++i)
{
- BugCatcher::report(exception);
- setGui();
+ const QListWidgetItem* widgetItem = varEggGroups->item(i);
+ static_cast<Species*>(modified())->setEggGroup(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
}
diff --git a/pokemodr/SpeciesUI.h b/pokemodr/SpeciesUI.h
index e8eb7537..31348d72 100644
--- a/pokemodr/SpeciesUI.h
+++ b/pokemodr/SpeciesUI.h
@@ -38,9 +38,7 @@ class SpeciesUI : public ObjectUI, private Ui::formSpecies
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& name);
- void on_varBaseStat_currentIndexChanged();
void on_varBaseStatValue_valueChanged(const int baseStat);
- void on_varEVStat_currentIndexChanged();
void on_varEffortValue_valueChanged(const int effortValue);
void on_varGrowth_currentIndexChanged(const int growth);
void on_varExperienceValue_valueChanged(const int experienceValue);
@@ -64,7 +62,7 @@ class SpeciesUI : public ObjectUI, private Ui::formSpecies
void on_varNidoranGroup_valueChanged(const int nidoranGroup);
void on_varTypes_itemSelectionChanged();
void on_varEggGroups_itemSelectionChanged();
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
diff --git a/pokemodr/StoreUI.cpp b/pokemodr/StoreUI.cpp
index 31db81a9..72128247 100644
--- a/pokemodr/StoreUI.cpp
+++ b/pokemodr/StoreUI.cpp
@@ -23,9 +23,6 @@
#include "../pokemod/Pokemod.h"
#include "../pokemod/Store.h"
-// General includes
-#include "../general/BugCatcher.h"
-
StoreUI::StoreUI(Store* store, QWidget* parent) :
ObjectUI(parent)
{
@@ -33,6 +30,10 @@ StoreUI::StoreUI(Store* store, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(store, new Store(*store));
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();
}
@@ -77,23 +78,13 @@ void StoreUI::on_buttonDiscard_clicked()
void StoreUI::on_varName_textChanged(const QString& name)
{
static_cast<Store*>(modified())->setName(name);
- emit(changed(true));
}
void StoreUI::on_varItems_itemSelectionChanged()
{
- try
- {
- for (int i = 0; i < varItems->count(); ++i)
- {
- const QListWidgetItem* widgetItem = varItems->item(i);
- static_cast<Store*>(modified())->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
- }
- emit(changed(true));
- }
- catch (BoundsException& exception)
+ for (int i = 0; i < varItems->count(); ++i)
{
- BugCatcher::report(exception);
- setGui();
+ const QListWidgetItem* widgetItem = varItems->item(i);
+ static_cast<Store*>(modified())->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
}
diff --git a/pokemodr/StoreUI.h b/pokemodr/StoreUI.h
index dfc9683b..966e97d3 100644
--- a/pokemodr/StoreUI.h
+++ b/pokemodr/StoreUI.h
@@ -39,7 +39,7 @@ class StoreUI : public ObjectUI, private Ui::formStore
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& name);
void on_varItems_itemSelectionChanged();
- private:
+ private slots:
void refreshGui();
void setGui();
};
diff --git a/pokemodr/TileDelegate.cpp b/pokemodr/TileDelegate.cpp
index 96aa8dfd..5d5a93d4 100644
--- a/pokemodr/TileDelegate.cpp
+++ b/pokemodr/TileDelegate.cpp
@@ -38,9 +38,9 @@ QWidget* TileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem&
void TileDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
- for (int i = 0; i < static_cast<const Pokemod*>(static_cast<ObjectUI*>(editor->parent())->original()->pokemod())->tileCount(); ++i)
+ for (int i = 0; i < static_cast<const Pokemod*>(static_cast<const ObjectUI*>(editor->parent())->original()->pokemod())->tileCount(); ++i)
{
- const Tile* tile = static_cast<const Pokemod*>(static_cast<ObjectUI*>(editor->parent())->original()->pokemod())->tile(i);
+ const Tile* tile = static_cast<const Pokemod*>(static_cast<const ObjectUI*>(editor->parent())->original()->pokemod())->tile(i);
static_cast<KComboBox*>(editor)->addItem(tile->sprite(), tile->name());
static_cast<KComboBox*>(editor)->setItemData(i, tile->id());
}
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);
}
diff --git a/pokemodr/TileUI.h b/pokemodr/TileUI.h
index 2a0abe14..e6b03d9c 100644
--- a/pokemodr/TileUI.h
+++ b/pokemodr/TileUI.h
@@ -47,7 +47,7 @@ class TileUI : public ObjectUI, private Ui::formTile
void on_boxForces_toggled(const bool forces);
void on_varForce_currentIndexChanged(const int force);
void on_varDirection_currentIndexChanged(const int direction);
- private:
+ private slots:
void initGui();
void refreshGui();
void setGui();
diff --git a/pokemodr/TilemapModel.cpp b/pokemodr/TilemapModel.cpp
index b903fd00..dc205250 100644
--- a/pokemodr/TilemapModel.cpp
+++ b/pokemodr/TilemapModel.cpp
@@ -78,7 +78,7 @@ bool TilemapModel::setData(const QModelIndex& index, const QVariant& value, int
if (role != Qt::EditRole)
return false;
// emit(setDataChanged(index, index));
- (*m_map)(index.row(), index.column()) = m_pokemod->tile(value.toInt())->id();
+ m_map->set(index.row(), index.column(), m_pokemod->tile(value.toInt())->id());
emit(dataChanged(index, index));
return true;
}
diff --git a/pokemodr/TimeUI.cpp b/pokemodr/TimeUI.cpp
index 402f2066..7b7874e8 100644
--- a/pokemodr/TimeUI.cpp
+++ b/pokemodr/TimeUI.cpp
@@ -21,9 +21,6 @@
// Pokemod includes
#include "../pokemod/Time.h"
-// General includes
-#include "../general/BugCatcher.h"
-
TimeUI::TimeUI(Time* time, QWidget* parent) :
ObjectUI(parent)
{
@@ -31,6 +28,10 @@ TimeUI::TimeUI(Time* time, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(time, new Time(*time));
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();
}
@@ -60,20 +61,10 @@ void TimeUI::on_buttonDiscard_clicked()
void TimeUI::on_varName_textChanged(const QString& name)
{
static_cast<Time*>(modified())->setName(name);
- emit(changed(true));
}
void TimeUI::on_varTime_timeChanged(const QTime& time)
{
- try
- {
- static_cast<Time*>(modified())->setHour(time.hour());
- static_cast<Time*>(modified())->setMinute(time.minute());
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Time*>(modified())->setHour(time.hour());
+ static_cast<Time*>(modified())->setMinute(time.minute());
}
diff --git a/pokemodr/TimeUI.h b/pokemodr/TimeUI.h
index ff320b72..33864923 100644
--- a/pokemodr/TimeUI.h
+++ b/pokemodr/TimeUI.h
@@ -39,7 +39,7 @@ class TimeUI : public ObjectUI, private Ui::formTime
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& n);
void on_varTime_timeChanged(const QTime& t);
- private:
+ private slots:
void setGui();
};
diff --git a/pokemodr/TrainerUI.cpp b/pokemodr/TrainerUI.cpp
index 5551df55..d105369f 100644
--- a/pokemodr/TrainerUI.cpp
+++ b/pokemodr/TrainerUI.cpp
@@ -24,9 +24,6 @@
// Pokemod includes
#include "../pokemod/Trainer.h"
-// General includes
-#include "../general/BugCatcher.h"
-
TrainerUI::TrainerUI(Trainer * trainer, QWidget * parent) :
ObjectUI(parent)
{
@@ -34,6 +31,10 @@ TrainerUI::TrainerUI(Trainer * trainer, QWidget * parent) :
QMetaObject::connectSlotsByName(this);
setObjects(trainer, new Trainer(*trainer));
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();
}
@@ -64,21 +65,11 @@ void TrainerUI::on_buttonDiscard_clicked()
void TrainerUI::on_varName_textChanged(const QString & name)
{
static_cast<Trainer*>(modified())->setName(name);
- emit(changed(true));
}
void TrainerUI::on_varMoneyFactor_valueChaged(const int moneyFactor)
{
- try
- {
- static_cast<Trainer*>(modified())->setMoneyFactor(moneyFactor);
- emit(changed(true));
- }
- catch (BoundsException& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Trainer*>(modified())->setMoneyFactor(moneyFactor);
}
void TrainerUI::on_varSkin_pressed()
@@ -86,14 +77,7 @@ void TrainerUI::on_varSkin_pressed()
FileDialog dialog(QSize(192, 168));
if (dialog.exec())
{
- try
- {
- static_cast<Trainer*>(modified())->setSkin(QPixmap(dialog.selectedFile()));
- }
- catch (SaveException& exception)
- {
- BugCatcher::report(exception);
- }
+ static_cast<Trainer*>(modified())->setSkin(QPixmap(dialog.selectedFile()));
setGui();
}
}
diff --git a/pokemodr/TrainerUI.h b/pokemodr/TrainerUI.h
index 5c46f15a..e1aa6859 100644
--- a/pokemodr/TrainerUI.h
+++ b/pokemodr/TrainerUI.h
@@ -41,7 +41,7 @@ class TrainerUI : public ObjectUI, private Ui::formTrainer
void on_varMoneyFactor_valueChaged(const int moneyFactor);
void on_varSkin_pressed();
// void on_varAI_pressed();
- private:
+ private slots:
void setGui();
};
diff --git a/pokemodr/TypeUI.cpp b/pokemodr/TypeUI.cpp
index 9b8cda52..e638bfcc 100644
--- a/pokemodr/TypeUI.cpp
+++ b/pokemodr/TypeUI.cpp
@@ -21,9 +21,6 @@
// Pokemod includes
#include "../pokemod/Type.h"
-// General includes
-#include "../general/BugCatcher.h"
-
TypeUI::TypeUI(Type* type, QWidget* parent) :
ObjectUI(parent)
{
@@ -31,6 +28,10 @@ TypeUI::TypeUI(Type* type, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(type, new Type(*type));
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();
}
@@ -64,14 +65,5 @@ void TypeUI::on_varName_textChanged(const QString& name)
void TypeUI::on_varSTAB_valueChanged(const Fraction& stab)
{
- try
- {
- static_cast<Type*>(modified())->setStab(stab);
- emit(changed(true));
- }
- catch (Exception& exception)
- {
- BugCatcher::report(exception);
- setGui();
- }
+ static_cast<Type*>(modified())->setStab(stab);
}
diff --git a/pokemodr/TypeUI.h b/pokemodr/TypeUI.h
index 0984403c..73552701 100644
--- a/pokemodr/TypeUI.h
+++ b/pokemodr/TypeUI.h
@@ -39,9 +39,7 @@ class TypeUI : public ObjectUI, private Ui::formType
void on_buttonDiscard_clicked();
void on_varName_textChanged(const QString& name);
void on_varSTAB_valueChanged(const Fraction& stab);
- private:
- void initGui();
- void refreshGui();
+ private slots:
void setGui();
};
diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro
index 7319b36e..fb388fc8 100644
--- a/pokemodr/pokemodr.pro
+++ b/pokemodr/pokemodr.pro
@@ -11,13 +11,12 @@ LIBS += -L../../bin \
-lkio
CONFIG += qt \
- gui \
warn_on \
- exceptions
-!win32:CONFIG += debug
+ gui
+!win32 : CONFIG += debug
QT += xml
-RESOURCES += images/overlays.qrc
+; RESOURCES += images/overlays.qrc
win32 {
TARGETDEPS += $${DESTDIR}/pokemod.dll $${DESTDIR}/general.dll
@@ -246,13 +245,13 @@ FORMS += gui/ability.ui \
gui/trainer.ui \
gui/type.ui
-IMAGES += images/overlays/effect.png \
- images/overlays/no-walk.png \
- images/overlays/trainer.png \
- images/overlays/walk.png \
- images/overlays/warp.png \
- images/overlays/water.png \
- images/overlays/wilds.png
+; IMAGES += images/overlays/effect.png \
+; images/overlays/no-walk.png \
+; images/overlays/trainer.png \
+; images/overlays/walk.png \
+; images/overlays/warp.png \
+; images/overlays/water.png \
+; images/overlays/wilds.png
INSTALLS += target
isEmpty(PREFIX) {