summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-15 19:55:43 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-15 19:55:43 +0000
commitfdd0eec1d145fb8ac97b4cc9aaed5218214416ec (patch)
tree2389a0d53fe3eaa644ccb220345995feec748823
parent77124f3f105ea3837022d20a49028309a211c4b0 (diff)
downloadsigen-fdd0eec1d145fb8ac97b4cc9aaed5218214416ec.tar.gz
sigen-fdd0eec1d145fb8ac97b4cc9aaed5218214416ec.tar.xz
sigen-fdd0eec1d145fb8ac97b4cc9aaed5218214416ec.zip
[FIX] Refactored out connections made within widgets
[FIX] Flag, Fractiona, and Point widgets fixed to only emit signals when actually changed [FIX] Pokemod classes now emit signals git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@138 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog9
-rw-r--r--general/Flag.h19
-rw-r--r--general/Fraction.h16
-rw-r--r--pokemod/Ability.cpp1
-rw-r--r--pokemod/AbilityEffect.cpp8
-rw-r--r--pokemod/Author.cpp3
-rw-r--r--pokemod/Badge.cpp6
-rw-r--r--pokemod/CoinList.cpp2
-rw-r--r--pokemod/CoinListObject.cpp4
-rw-r--r--pokemod/Dialog.cpp2
-rw-r--r--pokemod/EggGroup.cpp1
-rw-r--r--pokemod/Item.cpp5
-rw-r--r--pokemod/ItemEffect.cpp8
-rw-r--r--pokemod/ItemType.cpp4
-rw-r--r--pokemod/Map.cpp3
-rw-r--r--pokemod/MapEffect.cpp11
-rw-r--r--pokemod/MapTrainer.cpp9
-rw-r--r--pokemod/MapTrainerTeamMember.cpp9
-rw-r--r--pokemod/MapWarp.cpp12
-rw-r--r--pokemod/MapWildList.cpp12
-rw-r--r--pokemod/MapWildListEncounter.cpp3
-rw-r--r--pokemod/Move.cpp15
-rw-r--r--pokemod/MoveEffect.cpp6
-rw-r--r--pokemod/Nature.cpp3
-rw-r--r--pokemod/Object.cpp1
-rw-r--r--pokemod/Pokemod.cpp14
-rw-r--r--pokemod/Rules.cpp29
-rw-r--r--pokemod/Sound.cpp2
-rw-r--r--pokemod/Species.cpp35
-rw-r--r--pokemod/SpeciesAbility.cpp2
-rw-r--r--pokemod/SpeciesEvolution.cpp6
-rw-r--r--pokemod/SpeciesItem.cpp2
-rw-r--r--pokemod/SpeciesMove.cpp3
-rw-r--r--pokemod/Store.cpp7
-rw-r--r--pokemod/Tile.cpp8
-rw-r--r--pokemod/Time.cpp3
-rw-r--r--pokemod/Trainer.cpp3
-rw-r--r--pokemod/Type.cpp4
-rw-r--r--pokemodr/AbilityUI.cpp4
-rw-r--r--pokemodr/AuthorUI.cpp4
-rw-r--r--pokemodr/BadgeUI.cpp4
-rw-r--r--pokemodr/CoinListObjectUI.cpp4
-rw-r--r--pokemodr/CoinListUI.cpp4
-rw-r--r--pokemodr/EggGroupUI.cpp4
-rw-r--r--pokemodr/FlagWidget.cpp2
-rw-r--r--pokemodr/FractionWidget.cpp12
-rw-r--r--pokemodr/ItemTypeUI.cpp4
-rw-r--r--pokemodr/ItemUI.cpp4
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.cpp4
-rw-r--r--pokemodr/MapTrainerUI.cpp4
-rw-r--r--pokemodr/MapUI.cpp4
-rw-r--r--pokemodr/MapWarpUI.cpp4
-rw-r--r--pokemodr/MapWildListEncounterUI.cpp4
-rw-r--r--pokemodr/MapWildListUI.cpp4
-rw-r--r--pokemodr/MoveUI.cpp4
-rw-r--r--pokemodr/NatureUI.cpp4
-rw-r--r--pokemodr/ObjectUI.cpp145
-rw-r--r--pokemodr/ObjectUI.h122
-rw-r--r--pokemodr/PointWidget.cpp2
-rw-r--r--pokemodr/PokeModrUI.cpp7
-rw-r--r--pokemodr/PokeModrUI.h4
-rw-r--r--pokemodr/PokemodTreeModel.cpp1
-rw-r--r--pokemodr/PokemodUI.cpp6
-rw-r--r--pokemodr/RulesUI.cpp10
-rw-r--r--pokemodr/SoundUI.cpp6
-rw-r--r--pokemodr/SpeciesAbilityUI.cpp4
-rw-r--r--pokemodr/SpeciesEvolutionUI.cpp4
-rw-r--r--pokemodr/SpeciesItemUI.cpp4
-rw-r--r--pokemodr/SpeciesMoveUI.cpp4
-rw-r--r--pokemodr/SpeciesUI.cpp4
-rw-r--r--pokemodr/StoreUI.cpp4
-rw-r--r--pokemodr/TODO2
-rw-r--r--pokemodr/TileUI.cpp4
-rw-r--r--pokemodr/TimeUI.cpp4
-rw-r--r--pokemodr/TrainerUI.cpp4
-rw-r--r--pokemodr/TypeUI.cpp4
-rw-r--r--pokemodr/models/BaseModel.cpp8
-rw-r--r--pokemodr/models/BaseModel.h9
-rw-r--r--pokemodr/pokemodr.pro1
79 files changed, 495 insertions, 236 deletions
diff --git a/Changelog b/Changelog
index ae50d9b6..014b6bdd 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,13 @@
-----------------
+Rev: 138
+Date: 15 May 2008
+User: MathStuf
+-----------------
+[FIX] Refactored out connections made within widgets
+[FIX] Flag, Fractiona, and Point widgets fixed to only emit signals when actually changed
+[FIX] Pokemod classes now emit signals
+
+-----------------
Rev: 137
Date: 15 May 2008
User: MathStuf
diff --git a/general/Flag.h b/general/Flag.h
index bb9548f3..55b3a73d 100644
--- a/general/Flag.h
+++ b/general/Flag.h
@@ -38,9 +38,26 @@ class Flag
void set(const int flag, const int status);
void setFlag(const int flag);
void setStatus(const int status);
-
+
int flag() const;
int status() const;
+
+ inline Flag& operator=(const Flag& rhs)
+ {
+ if (this == &rhs)
+ return *this;
+ m_flag = rhs.m_flag;
+ m_status = rhs.m_status;
+ return *this;
+ }
+ inline bool operator==(const Flag& rhs) const
+ {
+ return ((m_flag == rhs.m_flag) && (m_status == rhs.m_status));
+ }
+ inline bool operator!=(const Flag& rhs) const
+ {
+ return !(*this == rhs);
+ }
private:
int m_flag;
int m_status;
diff --git a/general/Fraction.h b/general/Fraction.h
index 99b6eeec..2c1dc663 100644
--- a/general/Fraction.h
+++ b/general/Fraction.h
@@ -62,6 +62,22 @@ class Fraction
{
return Fraction(m_numerator * rhs.m_numerator, m_denominator * rhs.m_denominator);
}
+ inline Fraction& operator=(const Fraction& rhs)
+ {
+ if (this == &rhs)
+ return *this;
+ m_numerator = rhs.m_numerator;
+ m_denominator = rhs.m_denominator;
+ return *this;
+ }
+ inline bool operator==(const Fraction& rhs) const
+ {
+ return ((m_numerator == rhs.m_numerator) && (m_denominator == rhs.m_denominator));
+ }
+ inline bool operator!=(const Fraction& rhs) const
+ {
+ return !(*this == rhs);
+ }
private:
int m_numerator;
int m_denominator;
diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp
index 168dcdae..c0215099 100644
--- a/pokemod/Ability.cpp
+++ b/pokemod/Ability.cpp
@@ -88,6 +88,7 @@ QDomElement Ability::save() const
void Ability::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
QString Ability::name() const
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index 828e5ae3..ecac1af6 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -111,6 +111,7 @@ void AbilityEffect::setChance(const Fraction& chance)
return;
}
m_chance = chance;
+ emit(changed());
}
void AbilityEffect::setEffect(const int effect)
@@ -124,6 +125,7 @@ void AbilityEffect::setEffect(const int effect)
m_value1 = INT_MAX;
m_value2 = INT_MAX;
m_value3 = 0;
+ emit(changed());
}
void AbilityEffect::setValue1(const int value1)
@@ -184,6 +186,7 @@ void AbilityEffect::setValue1(const int value1)
return;
}
m_value1 = value1;
+ emit(changed());
}
void AbilityEffect::setValue2(const int value2)
@@ -224,6 +227,7 @@ void AbilityEffect::setValue2(const int value2)
return;
}
m_value2 = value2;
+ emit(changed());
}
void AbilityEffect::setValue3(const int value3)
@@ -256,6 +260,7 @@ void AbilityEffect::setValue3(const int value3)
return;
}
m_value3 = value3;
+ emit(changed());
}
void AbilityEffect::setTrigger(const int trigger)
@@ -268,6 +273,7 @@ void AbilityEffect::setTrigger(const int trigger)
m_trigger = trigger;
m_triggerValue1 = INT_MAX;
m_triggerValue2.set(1, 1);
+ emit(changed());
}
void AbilityEffect::setTriggerValue1(const int triggerValue1)
@@ -314,6 +320,7 @@ void AbilityEffect::setTriggerValue1(const int triggerValue1)
return;
}
m_triggerValue1 = triggerValue1;
+ emit(changed());
}
void AbilityEffect::setTriggerValue2(const Fraction& triggerValue2)
@@ -324,6 +331,7 @@ void AbilityEffect::setTriggerValue2(const Fraction& triggerValue2)
return;
}
m_triggerValue2 = triggerValue2;
+ emit(changed());
}
Fraction AbilityEffect::chance() const
diff --git a/pokemod/Author.cpp b/pokemod/Author.cpp
index b15da387..f3424978 100644
--- a/pokemod/Author.cpp
+++ b/pokemod/Author.cpp
@@ -82,16 +82,19 @@ QDomElement Author::save() const
void Author::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Author::setEmail(const QString& email)
{
m_email = email;
+ emit(changed());
}
void Author::setRole(const QString& role)
{
m_role = role;
+ emit(changed());
}
QString Author::name() const
diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp
index 95c8cdd1..f4518f0d 100644
--- a/pokemod/Badge.cpp
+++ b/pokemod/Badge.cpp
@@ -89,6 +89,7 @@ QDomElement Badge::save() const
void Badge::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Badge::setFace(const QPixmap& face)
@@ -96,6 +97,7 @@ void Badge::setFace(const QPixmap& face)
if (face.size() != QSize(64, 64))
emit(error(size("face")));
m_face = face;
+ emit(changed());
}
void Badge::setBadge(const QPixmap& badge)
@@ -103,6 +105,7 @@ void Badge::setBadge(const QPixmap& badge)
if (badge.size() != QSize(64, 64))
emit(error(size("badge")));
m_badge = badge;
+ emit(changed());
}
void Badge::setObey(const int obey)
@@ -113,6 +116,7 @@ void Badge::setObey(const int obey)
return;
}
m_obey = obey;
+ emit(changed());
}
void Badge::setStat(const int stat, const Fraction& multiplier)
@@ -128,6 +132,7 @@ void Badge::setStat(const int stat, const Fraction& multiplier)
return;
}
m_stat[stat] = multiplier;
+ emit(changed());
}
void Badge::setHm(const int hm, const bool hmAllowed)
@@ -138,6 +143,7 @@ void Badge::setHm(const int hm, const bool hmAllowed)
return;
}
m_hm[hm] = hmAllowed;
+ emit(changed());
}
QString Badge::name() const
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index 47400c5e..686a63d9 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -108,6 +108,7 @@ QDomElement CoinList::save() const
void CoinList::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void CoinList::setValue(const int value)
@@ -121,6 +122,7 @@ void CoinList::setValue(const int value)
if ((effect->effect() == ItemEffect::E_CoinCase) && (effect->value1() == value))
{
m_value = value;
+ emit(changed());
return;
}
}
diff --git a/pokemod/CoinListObject.cpp b/pokemod/CoinListObject.cpp
index c9ae4423..3eb44e91 100644
--- a/pokemod/CoinListObject.cpp
+++ b/pokemod/CoinListObject.cpp
@@ -86,6 +86,7 @@ void CoinListObject::setType(const int type)
}
m_type = type;
m_object = INT_MAX;
+ emit(changed());
}
void CoinListObject::setObject(const int object)
@@ -96,6 +97,7 @@ void CoinListObject::setObject(const int object)
return;
}
m_object = object;
+ emit(changed());
}
void CoinListObject::setAmount(const int amount)
@@ -106,11 +108,13 @@ void CoinListObject::setAmount(const int amount)
return;
}
m_amount = amount;
+ emit(changed());
}
void CoinListObject::setCost(const int cost)
{
m_cost = cost;
+ emit(changed());
}
int CoinListObject::type() const
diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp
index 43ba518a..15607831 100644
--- a/pokemod/Dialog.cpp
+++ b/pokemod/Dialog.cpp
@@ -637,6 +637,7 @@ QDomElement Dialog::save() const
void Dialog::setDialog(const QString& dialog)
{
m_dialog = dialog;
+ emit(changed());
}
QString Dialog::dialog() const
@@ -652,6 +653,7 @@ void Dialog::insertCommand(const int position, const QString& command)
return;
}
m_dialog.insert(position, command);
+ emit(changed());
}
Dialog& Dialog::operator=(const Dialog& rhs)
diff --git a/pokemod/EggGroup.cpp b/pokemod/EggGroup.cpp
index 7726ea91..82691f2f 100644
--- a/pokemod/EggGroup.cpp
+++ b/pokemod/EggGroup.cpp
@@ -67,6 +67,7 @@ QDomElement EggGroup::save() const
void EggGroup::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
QString EggGroup::name() const
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp
index 44962f46..777f5856 100644
--- a/pokemod/Item.cpp
+++ b/pokemod/Item.cpp
@@ -102,11 +102,13 @@ QDomElement Item::save() const
void Item::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Item::setSellable(const bool sellable)
{
m_sellable = sellable;
+ emit(changed());
}
void Item::setType(const int type)
@@ -117,6 +119,7 @@ void Item::setType(const int type)
return;
}
m_type = type;
+ emit(changed());
}
void Item::setPrice(const int price)
@@ -127,11 +130,13 @@ void Item::setPrice(const int price)
return;
}
m_price = price;
+ emit(changed());
}
void Item::setDescription(const QString& description)
{
m_description = description;
+ emit(changed());
}
QString Item::name() const
diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp
index 30c60f4f..895e101b 100644
--- a/pokemod/ItemEffect.cpp
+++ b/pokemod/ItemEffect.cpp
@@ -145,16 +145,19 @@ void ItemEffect::setOverworld(const bool overworld)
break;
}
m_overworld = overworld;
+ emit(changed());
}
void ItemEffect::setBattle(const bool battle)
{
m_battle = battle;
+ emit(changed());
}
void ItemEffect::setHeld(const bool held)
{
m_held = held;
+ emit(changed());
}
void ItemEffect::setEffect(const int effect)
@@ -203,6 +206,7 @@ void ItemEffect::setEffect(const int effect)
m_value2 = INT_MAX;
m_value3 = INT_MAX;
m_value4.set(1, 1);
+ emit(changed());
}
void ItemEffect::setValue1(const int value1)
@@ -283,6 +287,7 @@ void ItemEffect::setValue1(const int value1)
return;
}
m_value1 = value1;
+ emit(changed());
}
void ItemEffect::setValue2(const int value2)
@@ -397,6 +402,7 @@ void ItemEffect::setValue2(const int value2)
return;
}
m_value2 = value2;
+ emit(changed());
}
void ItemEffect::setValue3(const int value3)
@@ -480,6 +486,7 @@ void ItemEffect::setValue3(const int value3)
return;
}
m_value3 = value3;
+ emit(changed());
}
void ItemEffect::setValue4(const Fraction& value4)
@@ -535,6 +542,7 @@ void ItemEffect::setValue4(const Fraction& value4)
break;
}
m_value4 = value4;
+ emit(changed());
}
bool ItemEffect::overworld() const
diff --git a/pokemod/ItemType.cpp b/pokemod/ItemType.cpp
index f1440673..336ececd 100644
--- a/pokemod/ItemType.cpp
+++ b/pokemod/ItemType.cpp
@@ -80,11 +80,13 @@ QDomElement ItemType::save() const
void ItemType::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void ItemType::setComputer(const int computer)
{
m_computer = computer;
+ emit(changed());
}
void ItemType::setPlayer(const int player)
@@ -95,6 +97,7 @@ void ItemType::setPlayer(const int player)
return;
}
m_player = player;
+ emit(changed());
}
void ItemType::setCount(const int count)
@@ -105,6 +108,7 @@ void ItemType::setCount(const int count)
return;
}
m_count = count;
+ emit(changed());
}
QString ItemType::name() const
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp
index 7a3899f1..92cdb98e 100644
--- a/pokemod/Map.cpp
+++ b/pokemod/Map.cpp
@@ -153,6 +153,7 @@ QDomElement Map::save() const
void Map::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Map::setFlyWarp(const int warp)
@@ -163,6 +164,7 @@ void Map::setFlyWarp(const int warp)
return;
}
m_flyWarp = warp;
+ emit(changed());
}
void Map::setType(const int type)
@@ -173,6 +175,7 @@ void Map::setType(const int type)
return;
}
m_type = type;
+ emit(changed());
}
QString Map::name() const
diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp
index 4b2fd649..6d29a89c 100644
--- a/pokemod/MapEffect.cpp
+++ b/pokemod/MapEffect.cpp
@@ -112,6 +112,7 @@ QDomElement MapEffect::save() const
void MapEffect::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void MapEffect::setCoordinate(const Point& coordinate)
@@ -122,11 +123,13 @@ void MapEffect::setCoordinate(const Point& coordinate)
return;
}
m_coordinate = coordinate;
+ emit(changed());
}
void MapEffect::setExistFlag(const Flag& existFlag)
{
m_existFlag = existFlag;
+ emit(changed());
}
void MapEffect::setSkin(const QPixmap& skin)
@@ -137,6 +140,7 @@ void MapEffect::setSkin(const QPixmap& skin)
return;
}
m_skin = skin;
+ emit(changed());
}
void MapEffect::setEffect(const int effect)
@@ -149,6 +153,7 @@ void MapEffect::setEffect(const int effect)
m_effect = effect;
m_value1 = INT_MAX;
m_value2 = INT_MAX;
+ emit(changed());
}
void MapEffect::setValue1(const int value1)
@@ -159,6 +164,7 @@ void MapEffect::setValue1(const int value1)
return;
}
m_value1 = value1;
+ emit(changed());
}
void MapEffect::setValue2(const int value2)
@@ -192,6 +198,7 @@ void MapEffect::setValue2(const int value2)
return;
}
m_value2 = value2;
+ emit(changed());
}
void MapEffect::setDirection(const int direction)
@@ -202,16 +209,19 @@ void MapEffect::setDirection(const int direction)
return;
}
m_direction = direction;
+ emit(changed());
}
void MapEffect::setIsGhost(const bool isGhost)
{
m_isGhost = isGhost;
+ emit(changed());
}
void MapEffect::setCanMove(const bool canMove)
{
m_canMove = canMove;
+ emit(changed());
}
void MapEffect::setDialog(const int dialog)
@@ -222,6 +232,7 @@ void MapEffect::setDialog(const int dialog)
return;
}
m_dialog = dialog;
+ emit(changed());
}
QString MapEffect::name() const
diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp
index 2da60aa2..ad0da7bc 100644
--- a/pokemod/MapTrainer.cpp
+++ b/pokemod/MapTrainer.cpp
@@ -119,6 +119,7 @@ QDomElement MapTrainer::save() const
void MapTrainer::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void MapTrainer::setTrainerClass(const int trainerClass)
@@ -129,6 +130,7 @@ void MapTrainer::setTrainerClass(const int trainerClass)
return;
}
m_trainerClass = trainerClass;
+ emit(changed());
}
void MapTrainer::setCoordinate(const Point& coordinate)
@@ -139,11 +141,13 @@ void MapTrainer::setCoordinate(const Point& coordinate)
return;
}
m_coordinate = coordinate;
+ emit(changed());
}
void MapTrainer::setSight(const int sight)
{
m_sight = sight;
+ emit(changed());
}
void MapTrainer::setDirection(const int direction)
@@ -154,6 +158,7 @@ void MapTrainer::setDirection(const int direction)
return;
}
m_direction = direction;
+ emit(changed());
}
void MapTrainer::setNumberFight(const int numberFight)
@@ -164,11 +169,13 @@ void MapTrainer::setNumberFight(const int numberFight)
return;
}
m_numberFight = numberFight;
+ emit(changed());
}
void MapTrainer::setAppearFlag(const Flag& appearFlag)
{
m_appearFlag = appearFlag;
+ emit(changed());
}
void MapTrainer::setDialog(const int dialog)
@@ -179,6 +186,7 @@ void MapTrainer::setDialog(const int dialog)
return;
}
m_dialog = dialog;
+ emit(changed());
}
void MapTrainer::setLeadTeamMember(const int leadMember)
@@ -189,6 +197,7 @@ void MapTrainer::setLeadTeamMember(const int leadMember)
return;
}
m_leadTeamMember = leadMember;
+ emit(changed());
}
QString MapTrainer::name() const
diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp
index 67c7109a..f95ae7e0 100644
--- a/pokemod/MapTrainerTeamMember.cpp
+++ b/pokemod/MapTrainerTeamMember.cpp
@@ -96,6 +96,7 @@ void MapTrainerTeamMember::setSpecies(const int species)
return;
}
m_species = species;
+ emit(changed());
}
void MapTrainerTeamMember::setLevel(const int level)
@@ -106,6 +107,7 @@ void MapTrainerTeamMember::setLevel(const int level)
return;
}
m_level = level;
+ emit(changed());
}
void MapTrainerTeamMember::setItem(const int item, const bool state)
@@ -118,10 +120,16 @@ void MapTrainerTeamMember::setItem(const int item, const bool state)
if (state)
{
if (!m_item.contains(item))
+ {
m_item.append(item);
+ emit(changed());
+ }
}
else
+ {
m_item.removeAll(item);
+ emit(changed());
+ }
}
void MapTrainerTeamMember::setNature(const int nature)
@@ -132,6 +140,7 @@ void MapTrainerTeamMember::setNature(const int nature)
return;
}
m_nature = nature;
+ emit(changed());
}
int MapTrainerTeamMember::species() const
diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp
index 996dde94..279f7d3f 100644
--- a/pokemod/MapWarp.cpp
+++ b/pokemod/MapWarp.cpp
@@ -112,6 +112,7 @@ QDomElement MapWarp::save() const
void MapWarp::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void MapWarp::setCoordinate(const Point& coordinate)
@@ -122,6 +123,7 @@ void MapWarp::setCoordinate(const Point& coordinate)
return;
}
m_coordinate = coordinate;
+ emit(changed());
}
void MapWarp::setFrom(const int direction, const bool can)
@@ -132,6 +134,7 @@ void MapWarp::setFrom(const int direction, const bool can)
return;
}
m_from[direction] = can;
+ emit(changed());
}
void MapWarp::setDirectionOut(const int directionOut)
@@ -142,6 +145,7 @@ void MapWarp::setDirectionOut(const int directionOut)
return;
}
m_directionOut = directionOut;
+ emit(changed());
}
void MapWarp::setType(const int type)
@@ -152,6 +156,7 @@ void MapWarp::setType(const int type)
return;
}
m_type = type;
+ emit(changed());
}
void MapWarp::setIsBiking(const int isBiking)
@@ -162,6 +167,7 @@ void MapWarp::setIsBiking(const int isBiking)
return;
}
m_isBiking = isBiking;
+ emit(changed());
}
void MapWarp::setIsFlash(const int isFlash)
@@ -172,6 +178,7 @@ void MapWarp::setIsFlash(const int isFlash)
return;
}
m_isFlash = isFlash;
+ emit(changed());
}
void MapWarp::setIsFoggy(const int isFoggy)
@@ -182,6 +189,7 @@ void MapWarp::setIsFoggy(const int isFoggy)
return;
}
m_isFoggy = isFoggy;
+ emit(changed());
}
void MapWarp::setToMap(const int toMap)
@@ -193,6 +201,7 @@ void MapWarp::setToMap(const int toMap)
}
m_toMap = toMap;
m_toWarp = INT_MAX;
+ emit(changed());
}
void MapWarp::setToWarp(const int toWarp)
@@ -208,11 +217,13 @@ void MapWarp::setToWarp(const int toWarp)
return;
}
m_toWarp = toWarp;
+ emit(changed());
}
void MapWarp::setWorkingFlag(const Flag& workingFlag)
{
m_workingFlag = workingFlag;
+ emit(changed());
}
void MapWarp::setDialog(const int dialog)
@@ -223,6 +234,7 @@ void MapWarp::setDialog(const int dialog)
return;
}
m_dialog = dialog;
+ emit(changed());
}
QString MapWarp::name() const
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index 3c2f25f4..e9e7b71c 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -109,6 +109,7 @@ void MapWildList::setControl(const int control)
}
m_control = control;
m_value = INT_MAX;
+ emit(changed());
}
void MapWildList::setValue(const int value)
@@ -127,6 +128,7 @@ void MapWildList::setValue(const int value)
if ((effect->effect() == ItemEffect::E_Fish) && (effect->value2() == value))
{
m_value = value;
+ emit(changed());
return;
}
}
@@ -144,10 +146,16 @@ void MapWildList::setTime(const int time, const bool state)
if (state)
{
if (!m_time.contains(time))
+ {
m_time.append(time);
+ emit(changed());
+ }
}
else
+ {
m_time.removeAll(time);
+ emit(changed());
+ }
}
void MapWildList::setScope(const int scope)
@@ -163,6 +171,7 @@ void MapWildList::setScope(const int scope)
if ((effect->effect() == ItemEffect::E_Scope) && (effect->value2() == scope))
{
m_scope = scope;
+ emit(changed());
return;
}
}
@@ -170,7 +179,10 @@ void MapWildList::setScope(const int scope)
emit(error(bounds("value")));
}
else
+ {
m_scope = scope;
+ emit(changed());
+ }
}
int MapWildList::control() const
diff --git a/pokemod/MapWildListEncounter.cpp b/pokemod/MapWildListEncounter.cpp
index 60f102c5..5918df09 100644
--- a/pokemod/MapWildListEncounter.cpp
+++ b/pokemod/MapWildListEncounter.cpp
@@ -81,6 +81,7 @@ void MapWildListEncounter::setSpecies(const int species)
return;
}
m_species = species;
+ emit(changed());
}
void MapWildListEncounter::setLevel(const int level)
@@ -91,6 +92,7 @@ void MapWildListEncounter::setLevel(const int level)
return;
}
m_level = level;
+ emit(changed());
}
void MapWildListEncounter::setWeight(const int weight)
@@ -101,6 +103,7 @@ void MapWildListEncounter::setWeight(const int weight)
return;
}
m_weight = weight;
+ emit(changed());
}
int MapWildListEncounter::species() const
diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp
index 723fd5af..5567947d 100644
--- a/pokemod/Move.cpp
+++ b/pokemod/Move.cpp
@@ -137,6 +137,7 @@ QDomElement Move::save() const
void Move::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Move::setAccuracy(const Fraction& accuracy)
@@ -147,11 +148,13 @@ void Move::setAccuracy(const Fraction& accuracy)
return;
}
m_accuracy = accuracy;
+ emit(changed());
}
void Move::setPower(const int power)
{
m_power = power;
+ emit(changed());
}
void Move::setType(const int type)
@@ -162,11 +165,13 @@ void Move::setType(const int type)
return;
}
m_type = type;
+ emit(changed());
}
void Move::setSpecial(const bool special)
{
m_special = special;
+ emit(changed());
}
void Move::setPowerPoints(const int powerPoints)
@@ -177,6 +182,7 @@ void Move::setPowerPoints(const int powerPoints)
return;
}
m_powerPoints = powerPoints;
+ emit(changed());
}
void Move::setTarget(const int target)
@@ -187,6 +193,7 @@ void Move::setTarget(const int target)
return;
}
m_target = target;
+ emit(changed());
}
void Move::setNumTargets(const int numTargets)
@@ -197,6 +204,7 @@ void Move::setNumTargets(const int numTargets)
return;
}
m_numTargets = numTargets;
+ emit(changed());
}
void Move::setTargetChoice(const int targetChoice)
@@ -207,36 +215,43 @@ void Move::setTargetChoice(const int targetChoice)
return;
}
m_targetChoice = targetChoice;
+ emit(changed());
}
void Move::setIgnoreAccuracy(const bool ignoreAccuracy)
{
m_ignoreAccuracy = ignoreAccuracy;
+ emit(changed());
}
void Move::setCanFlinch(const bool canFlinch)
{
m_canFlinch = canFlinch;
+ emit(changed());
}
void Move::setCanRandom(const bool canRandom)
{
m_canRandom = canRandom;
+ emit(changed());
}
void Move::setCanSnatch(const bool canSnatch)
{
m_canSnatch = canSnatch;
+ emit(changed());
}
void Move::setSound(const bool sound)
{
m_sound = sound;
+ emit(changed());
}
void Move::setDescription(const QString& description)
{
m_description = description;
+ emit(changed());
}
QString Move::name() const
diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp
index 37cb51fc..13d2b7a2 100644
--- a/pokemod/MoveEffect.cpp
+++ b/pokemod/MoveEffect.cpp
@@ -94,6 +94,7 @@ void MoveEffect::setChance(const Fraction& chance)
return;
}
m_chance = chance;
+ emit(changed());
}
void MoveEffect::setEffect(const int effect)
@@ -108,6 +109,7 @@ void MoveEffect::setEffect(const int effect)
m_value2 = INT_MAX;
m_value3 = 0;
m_value4.set(1, 1);
+ emit(changed());
}
void MoveEffect::setValue1(const int value1)
@@ -156,6 +158,7 @@ void MoveEffect::setValue1(const int value1)
return;
}
m_value1 = value1;
+ emit(changed());
}
void MoveEffect::setValue2(const int value2)
@@ -174,6 +177,7 @@ void MoveEffect::setValue2(const int value2)
return;
}
m_value2 = value2;
+ emit(changed());
}
void MoveEffect::setValue3(const int value3)
@@ -185,6 +189,7 @@ void MoveEffect::setValue3(const int value3)
break;
}
m_value3 = value3;
+ emit(changed());
}
void MoveEffect::setValue4(const Fraction& value4)
@@ -195,6 +200,7 @@ void MoveEffect::setValue4(const Fraction& value4)
return;
}
m_value4 = value4;
+ emit(changed());
}
Fraction MoveEffect::chance() const
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 86a53deb..db571d00 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -75,6 +75,7 @@ QDomElement Nature::save() const
void Nature::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Nature::setStat(const int stat, const Fraction& multiplier)
@@ -85,6 +86,7 @@ void Nature::setStat(const int stat, const Fraction& multiplier)
return;
}
m_stat[stat] = multiplier;
+ emit(changed());
}
void Nature::setWeight(const int weight)
@@ -95,6 +97,7 @@ void Nature::setWeight(const int weight)
return;
}
m_weight = weight;
+ emit(changed());
}
QString Nature::name() const
diff --git a/pokemod/Object.cpp b/pokemod/Object.cpp
index 0fcb718a..b0e868a1 100644
--- a/pokemod/Object.cpp
+++ b/pokemod/Object.cpp
@@ -59,6 +59,7 @@ QString Object::className() const
void Object::setId(const int id)
{
m_id = id;
+ emit(changed());
}
QString Object::unused(const QString& variable)
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 83c25cb2..bdd3eda3 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -457,16 +457,19 @@ int Pokemod::maxCompatability(const Pokemod& pokemod) const
void Pokemod::setTitle(const QString& title)
{
m_title = title;
+ emit(changed());
}
void Pokemod::setVersion(const QString& version)
{
m_version = version;
+ emit(changed());
}
void Pokemod::setDescription(const QString& description)
{
m_description = description;
+ emit(changed());
}
void Pokemod::setStartMap(const int startMap)
@@ -477,6 +480,7 @@ void Pokemod::setStartMap(const int startMap)
return;
}
m_startMap = startMap;
+ emit(changed());
}
void Pokemod::setStartWarp(const int startWarp)
@@ -492,6 +496,7 @@ void Pokemod::setStartWarp(const int startWarp)
return;
}
m_startWarp = startWarp;
+ emit(changed());
}
void Pokemod::setWalkSkin(const QPixmap& walkSkin)
@@ -502,6 +507,7 @@ void Pokemod::setWalkSkin(const QPixmap& walkSkin)
return;
}
m_walkSkin = walkSkin;
+ emit(changed());
}
void Pokemod::setBikeSkin(const QPixmap& bikeSkin)
@@ -512,6 +518,7 @@ void Pokemod::setBikeSkin(const QPixmap& bikeSkin)
return;
}
m_bikeSkin = bikeSkin;
+ emit(changed());
}
void Pokemod::setSurfSkin(const QPixmap& surfSkin)
@@ -522,6 +529,7 @@ void Pokemod::setSurfSkin(const QPixmap& surfSkin)
return;
}
m_surfSkin = surfSkin;
+ emit(changed());
}
void Pokemod::setFlySkin(const QPixmap& flySkin)
@@ -532,6 +540,7 @@ void Pokemod::setFlySkin(const QPixmap& flySkin)
return;
}
m_flySkin = flySkin;
+ emit(changed());
}
void Pokemod::setFishSkin(const QPixmap& fishSkin)
@@ -542,6 +551,7 @@ void Pokemod::setFishSkin(const QPixmap& fishSkin)
return;
}
m_fishSkin = fishSkin;
+ emit(changed());
}
void Pokemod::setSurfFishSkin(const QPixmap& surfFishSkin)
@@ -552,21 +562,25 @@ void Pokemod::setSurfFishSkin(const QPixmap& surfFishSkin)
return;
}
m_surfFishSkin = surfFishSkin;
+ emit(changed());
}
void Pokemod::setSuperPCUname(const QString& username)
{
m_superPCUname = username;
+ emit(changed());
}
void Pokemod::setSuperPCPasswd(const QString& password)
{
m_superPCPasswd = password;
+ emit(changed());
}
void Pokemod::setTypeChart(const int attack, const int defense, const Fraction& multiplier)
{
m_typeChart.set(attack, defense, multiplier);
+ emit(changed());
}
void Pokemod::setRules(const Rules& rules)
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index f466e42d..fcb63c91 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -163,6 +163,7 @@ QDomElement Rules::save() const
void Rules::setGenderAllowed(const bool genderAllowed)
{
m_genderAllowed = genderAllowed;
+ emit(changed());
}
void Rules::setBreedingAllowed(const bool breedingAllowed)
@@ -173,31 +174,37 @@ void Rules::setBreedingAllowed(const bool breedingAllowed)
return;
}
m_breedingAllowed = breedingAllowed;
+ emit(changed());
}
void Rules::setHoldItems(const int holdItems)
{
m_holdItems = holdItems;
+ emit(changed());
}
void Rules::setCriticalDomains(const bool criticalDomains)
{
m_criticalDomains = criticalDomains;
+ emit(changed());
}
void Rules::setAbilityAllowed(const bool abilityAllowed)
{
m_abilityAllowed = abilityAllowed;
+ emit(changed());
}
void Rules::setNatureAllowed(const bool natureAllowed)
{
m_natureAllowed = natureAllowed;
+ emit(changed());
}
void Rules::setNumBoxes(const int numBoxes)
{
m_numBoxes = numBoxes;
+ emit(changed());
}
void Rules::setBoxSize(const int boxSize)
@@ -208,6 +215,7 @@ void Rules::setBoxSize(const int boxSize)
return;
}
m_boxSize = boxSize;
+ emit(changed());
}
void Rules::setMaxParty(const int maxParty)
@@ -218,6 +226,7 @@ void Rules::setMaxParty(const int maxParty)
return;
}
m_maxParty = maxParty;
+ emit(changed());
}
void Rules::setMaxFight(const int maxFight)
@@ -228,6 +237,7 @@ void Rules::setMaxFight(const int maxFight)
return;
}
m_maxFight = maxFight;
+ emit(changed());
}
void Rules::setMaxPlayers(const int maxPlayers)
@@ -238,6 +248,7 @@ void Rules::setMaxPlayers(const int maxPlayers)
return;
}
m_maxPlayers = maxPlayers;
+ emit(changed());
}
void Rules::setMaxMoves(const int maxMoves)
@@ -248,6 +259,7 @@ void Rules::setMaxMoves(const int maxMoves)
return;
}
m_maxMoves = maxMoves;
+ emit(changed());
}
void Rules::setMaxLevel(const int maxLevel)
@@ -258,36 +270,42 @@ void Rules::setMaxLevel(const int maxLevel)
return;
}
m_maxLevel = maxLevel;
+ emit(changed());
}
void Rules::setMaxMoney(const int maxMoney)
{
m_maxMoney = maxMoney;
+ emit(changed());
}
void Rules::setHardCash(const bool hardCash)
{
m_hardCash = hardCash;
+ emit(changed());
}
void Rules::setAllowSwitchStyle(const bool allowSwitchStyle)
{
m_allowSwitchStyle = allowSwitchStyle;
+ emit(changed());
}
void Rules::setSpecialSplit(const bool specialSplit)
{
m_specialSplit = specialSplit;
+ emit(changed());
}
void Rules::setSpecialDVSplit(const bool specialDVSplit)
{
- if (specialDVSplit && m_specialSplit)
+ if (!specialDVSplit && m_specialSplit)
{
emit(error(bounds("specialDVSplit")));
return;
}
m_specialDVSplit = specialDVSplit;
+ emit(changed());
}
void Rules::setMaxDVValue(const unsigned char maxDVValue)
@@ -298,31 +316,37 @@ void Rules::setMaxDVValue(const unsigned char maxDVValue)
return;
}
m_maxDVValue = maxDVValue;
+ emit(changed());
}
void Rules::setHappiness(const bool happiness)
{
m_happiness = happiness;
+ emit(changed());
}
void Rules::setHappyFaintLoss(const int happyFaintLoss)
{
m_happyFaintLoss = happyFaintLoss;
+ emit(changed());
}
void Rules::setHappyLevelGain(const int happyLevelGain)
{
m_happyLevelGain = happyLevelGain;
+ emit(changed());
}
void Rules::setHappySteps(const int happySteps)
{
m_happySteps = happySteps;
+ emit(changed());
}
void Rules::setEffortValuesAllowed(const bool effortValuesAllowed)
{
m_effortValuesAllowed = effortValuesAllowed;
+ emit(changed());
}
void Rules::setMaxTotalEV(const int maxTotalEV)
@@ -333,6 +357,7 @@ void Rules::setMaxTotalEV(const int maxTotalEV)
return;
}
m_maxTotalEV = maxTotalEV;
+ emit(changed());
}
void Rules::setMaxEVPerStat(const int maxEVPerStat)
@@ -343,6 +368,7 @@ void Rules::setMaxEVPerStat(const int maxEVPerStat)
return;
}
m_maxEVPerStat = maxEVPerStat;
+ emit(changed());
}
void Rules::setPokerusChance(const Fraction& pokerusChance)
@@ -353,6 +379,7 @@ void Rules::setPokerusChance(const Fraction& pokerusChance)
return;
}
m_pokerusChance = pokerusChance;
+ emit(changed());
}
bool Rules::genderAllowed() const
diff --git a/pokemod/Sound.cpp b/pokemod/Sound.cpp
index e707bd6b..b4239027 100644
--- a/pokemod/Sound.cpp
+++ b/pokemod/Sound.cpp
@@ -72,11 +72,13 @@ QDomElement Sound::save() const
void Sound::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Sound::setData(const QByteArray& data)
{
m_data = data;
+ emit(changed());
}
QString Sound::name() const
diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp
index cb22829c..91ba0720 100644
--- a/pokemod/Species.cpp
+++ b/pokemod/Species.cpp
@@ -239,6 +239,7 @@ QDomElement Species::save() const
void Species::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Species::setBaseStat(const int stat, const int baseStat)
@@ -249,6 +250,7 @@ void Species::setBaseStat(const int stat, const int baseStat)
return;
}
m_baseStat[stat] = baseStat;
+ emit(changed());
}
void Species::setEffortValue(const int stat, const int effortValue)
@@ -269,6 +271,7 @@ void Species::setEffortValue(const int stat, const int effortValue)
return;
}
m_effortValue[stat] = effortValue;
+ emit(changed());
}
void Species::setGrowth(const int growth)
@@ -279,11 +282,13 @@ void Species::setGrowth(const int growth)
return;
}
m_growth = growth;
+ emit(changed());
}
void Species::setExperienceValue(const int experienceValue)
{
m_experienceValue = experienceValue;
+ emit(changed());
}
void Species::setCatchValue(const int catchValue)
@@ -294,6 +299,7 @@ void Species::setCatchValue(const int catchValue)
return;
}
m_catchValue = catchValue;
+ emit(changed());
}
void Species::setRunChance(const Fraction& runChance)
@@ -304,6 +310,7 @@ void Species::setRunChance(const Fraction& runChance)
return;
}
m_runChance = runChance;
+ emit(changed());
}
void Species::setFleeChance(const Fraction& fleeChance)
@@ -314,6 +321,7 @@ void Species::setFleeChance(const Fraction& fleeChance)
return;
}
m_fleeChance = fleeChance;
+ emit(changed());
}
void Species::setItemChance(const Fraction& itemChance)
@@ -324,21 +332,25 @@ void Species::setItemChance(const Fraction& itemChance)
return;
}
m_itemChance = itemChance;
+ emit(changed());
}
void Species::setPokedexNumber(const int pokedexNumber)
{
m_pokedexNumber = pokedexNumber;
+ emit(changed());
}
void Species::setWeight(const int weight)
{
m_weight = weight;
+ emit(changed());
}
void Species::setHeightFeet(const int feet)
{
m_heightFeet = feet;
+ emit(changed());
}
void Species::setHeightInches(const int inches)
@@ -349,11 +361,13 @@ void Species::setHeightInches(const int inches)
return;
}
m_heightInches = inches;
+ emit(changed());
}
void Species::setPokedexEntry(const QString& pokedexEntry)
{
m_pokedexEntry = pokedexEntry;
+ emit(changed());
}
void Species::setFrontMaleSprite(const QPixmap& frontMaleSprite)
@@ -369,6 +383,7 @@ void Species::setFrontMaleSprite(const QPixmap& frontMaleSprite)
return;
}
m_frontMaleSprite = frontMaleSprite;
+ emit(changed());
}
void Species::setBackMaleSprite(const QPixmap& backMaleSprite)
@@ -384,6 +399,7 @@ void Species::setBackMaleSprite(const QPixmap& backMaleSprite)
return;
}
m_backMaleSprite = backMaleSprite;
+ emit(changed());
}
void Species::setFrontFemaleSprite(const QPixmap& frontFemaleSprite)
@@ -404,6 +420,7 @@ void Species::setFrontFemaleSprite(const QPixmap& frontFemaleSprite)
return;
}
m_frontFemaleSprite = frontFemaleSprite;
+ emit(changed());
}
void Species::setBackFemaleSprite(const QPixmap& backFemaleSprite)
@@ -424,6 +441,7 @@ void Species::setBackFemaleSprite(const QPixmap& backFemaleSprite)
return;
}
m_backFemaleSprite = backFemaleSprite;
+ emit(changed());
}
void Species::setListSprite(const QPixmap& listSprite)
@@ -434,6 +452,7 @@ void Species::setListSprite(const QPixmap& listSprite)
return;
}
m_listSprite = listSprite;
+ emit(changed());
}
void Species::setGenderFactor(const Fraction& genderFactor)
@@ -444,6 +463,7 @@ void Species::setGenderFactor(const Fraction& genderFactor)
return;
}
m_genderFactor = genderFactor;
+ emit(changed());
}
void Species::setEggSpecies(const int eggSpecies)
@@ -454,16 +474,19 @@ void Species::setEggSpecies(const int eggSpecies)
return;
}
m_eggSpecies = eggSpecies;
+ emit(changed());
}
void Species::setEggSteps(const int eggSteps)
{
m_eggSteps = eggSteps;
+ emit(changed());
}
void Species::setNidoranGroup(const int nidoranGroup)
{
m_nidoranGroup = nidoranGroup;
+ emit(changed());
}
void Species::setType(const int type, const bool state)
@@ -476,10 +499,16 @@ void Species::setType(const int type, const bool state)
if (state)
{
if (!m_type.contains(type))
+ {
m_type.append(type);
+ emit(changed());
+ }
}
else
+ {
m_type.removeAll(type);
+ emit(changed());
+ }
}
void Species::setEggGroup(const int eggGroup, const bool state)
@@ -492,10 +521,16 @@ void Species::setEggGroup(const int eggGroup, const bool state)
if (state)
{
if (!m_eggGroup.contains(eggGroup))
+ {
m_eggGroup.append(eggGroup);
+ emit(changed());
+ }
}
else
+ {
m_eggGroup.removeAll(eggGroup);
+ emit(changed());
+ }
}
QString Species::name() const
diff --git a/pokemod/SpeciesAbility.cpp b/pokemod/SpeciesAbility.cpp
index 751b8e31..005684e9 100644
--- a/pokemod/SpeciesAbility.cpp
+++ b/pokemod/SpeciesAbility.cpp
@@ -76,6 +76,7 @@ void SpeciesAbility::setAbility(const int ability)
return;
}
m_ability = ability;
+ emit(changed());
}
void SpeciesAbility::setWeight(const int weight)
@@ -86,6 +87,7 @@ void SpeciesAbility::setWeight(const int weight)
return;
}
m_weight = weight;
+ emit(changed());
}
int SpeciesAbility::ability() const
diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp
index ba32cf3b..b57f3715 100644
--- a/pokemod/SpeciesEvolution.cpp
+++ b/pokemod/SpeciesEvolution.cpp
@@ -97,6 +97,7 @@ void SpeciesEvolution::setSpecies(const int species)
return;
}
m_species = species;
+ emit(changed());
}
void SpeciesEvolution::setStyle(const int style)
@@ -107,6 +108,7 @@ void SpeciesEvolution::setStyle(const int style)
return;
}
m_style = style;
+ emit(changed());
}
void SpeciesEvolution::setValue1(const int value1)
@@ -143,6 +145,7 @@ void SpeciesEvolution::setValue1(const int value1)
return;
}
m_value1 = value1;
+ emit(changed());
}
void SpeciesEvolution::setValue2(const int value2)
@@ -167,6 +170,7 @@ void SpeciesEvolution::setValue2(const int value2)
return;
}
m_value2 = value2;
+ emit(changed());
}
void SpeciesEvolution::setValue3(const int value3)
@@ -182,6 +186,7 @@ void SpeciesEvolution::setValue3(const int value3)
return;
}
m_value3 = value3;
+ emit(changed());
}
void SpeciesEvolution::setLevel(const int level)
@@ -192,6 +197,7 @@ void SpeciesEvolution::setLevel(const int level)
return;
}
m_level = level;
+ emit(changed());
}
int SpeciesEvolution::species() const
diff --git a/pokemod/SpeciesItem.cpp b/pokemod/SpeciesItem.cpp
index 53b70f7d..261cc331 100644
--- a/pokemod/SpeciesItem.cpp
+++ b/pokemod/SpeciesItem.cpp
@@ -76,6 +76,7 @@ void SpeciesItem::setItem(const int item)
return;
}
m_item = item;
+ emit(changed());
}
void SpeciesItem::setWeight(const int weight)
@@ -86,6 +87,7 @@ void SpeciesItem::setWeight(const int weight)
return;
}
m_weight = weight;
+ emit(changed());
}
int SpeciesItem::item() const
diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp
index b057ba2a..d5042414 100644
--- a/pokemod/SpeciesMove.cpp
+++ b/pokemod/SpeciesMove.cpp
@@ -80,6 +80,7 @@ void SpeciesMove::setMove(const int move)
return;
}
m_move = move;
+ emit(changed());
}
void SpeciesMove::setLevel(const int level)
@@ -90,6 +91,7 @@ void SpeciesMove::setLevel(const int level)
return;
}
m_level = level;
+ emit(changed());
}
void SpeciesMove::setWild(const int wild)
@@ -100,6 +102,7 @@ void SpeciesMove::setWild(const int wild)
return;
}
m_wild = wild;
+ emit(changed());
}
int SpeciesMove::move() const
diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp
index 0358e473..e0a54159 100644
--- a/pokemod/Store.cpp
+++ b/pokemod/Store.cpp
@@ -73,6 +73,7 @@ QDomElement Store::save() const
void Store::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Store::setItem(const int item, const bool state)
@@ -85,10 +86,16 @@ void Store::setItem(const int item, const bool state)
if (state)
{
if (!m_item.contains(item))
+ {
m_item.append(item);
+ emit(changed());
+ }
}
else
+ {
m_item.removeAll(item);
+ emit(changed());
+ }
}
QString Store::name() const
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp
index 40f4d9b2..1ca60d40 100644
--- a/pokemod/Tile.cpp
+++ b/pokemod/Tile.cpp
@@ -100,6 +100,7 @@ QDomElement Tile::save() const
void Tile::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Tile::setSprite(const QPixmap& sprite)
@@ -110,6 +111,7 @@ void Tile::setSprite(const QPixmap& sprite)
return;
}
m_sprite = sprite;
+ emit(changed());
}
void Tile::setFrom(const int direction, const bool state)
@@ -120,6 +122,7 @@ void Tile::setFrom(const int direction, const bool state)
return;
}
m_from[direction] = state;
+ emit(changed());
}
void Tile::setWildChance(const Fraction& wildChance)
@@ -130,6 +133,7 @@ void Tile::setWildChance(const Fraction& wildChance)
return;
}
m_wildChance = wildChance;
+ emit(changed());
}
void Tile::setHmType(const int hmType)
@@ -146,6 +150,7 @@ void Tile::setHmType(const int hmType)
}
m_hmType = hmType;
m_under = INT_MAX;
+ emit(changed());
}
void Tile::setUnder(const int under)
@@ -164,6 +169,7 @@ void Tile::setUnder(const int under)
}
}
m_under = under;
+ emit(changed());
}
void Tile::setForceType(const int forceType)
@@ -174,6 +180,7 @@ void Tile::setForceType(const int forceType)
return;
}
m_forceType = forceType;
+ emit(changed());
}
void Tile::setForceDirection(const int forceDirection)
@@ -192,6 +199,7 @@ void Tile::setForceDirection(const int forceDirection)
}
}
m_forceDirection = forceDirection;
+ emit(changed());
}
QString Tile::name() const
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
index 06e13e30..90488e1f 100644
--- a/pokemod/Time.cpp
+++ b/pokemod/Time.cpp
@@ -75,6 +75,7 @@ QDomElement Time::save() const
void Time::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Time::setHour(const int hour)
@@ -85,6 +86,7 @@ void Time::setHour(const int hour)
return;
}
m_hour = hour;
+ emit(changed());
}
void Time::setMinute(const int minute)
@@ -95,6 +97,7 @@ void Time::setMinute(const int minute)
return;
}
m_minute = minute;
+ emit(changed());
}
QString Time::name() const
diff --git a/pokemod/Trainer.cpp b/pokemod/Trainer.cpp
index 230dcc17..fac920bf 100644
--- a/pokemod/Trainer.cpp
+++ b/pokemod/Trainer.cpp
@@ -78,6 +78,7 @@ QDomElement Trainer::save() const
void Trainer::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Trainer::setMoneyFactor(const int moneyFactor)
@@ -88,6 +89,7 @@ void Trainer::setMoneyFactor(const int moneyFactor)
return;
}
m_moneyFactor = moneyFactor;
+ emit(changed());
}
void Trainer::setSkin(const QPixmap& skin)
@@ -98,6 +100,7 @@ void Trainer::setSkin(const QPixmap& skin)
return;
}
m_skin = skin;
+ emit(changed());
}
// void Trainer::setAi(const QString& fileName)
diff --git a/pokemod/Type.cpp b/pokemod/Type.cpp
index c36b65be..ed1d4698 100644
--- a/pokemod/Type.cpp
+++ b/pokemod/Type.cpp
@@ -78,6 +78,7 @@ QDomElement Type::save() const
void Type::setName(const QString& name)
{
m_name = name;
+ emit(changed());
}
void Type::setStab(const Fraction& stab)
@@ -88,6 +89,7 @@ void Type::setStab(const Fraction& stab)
return;
}
m_stab = stab;
+ emit(changed());
}
void Type::setStatusImmunity(const int status, const bool immune)
@@ -98,6 +100,7 @@ void Type::setStatusImmunity(const int status, const bool immune)
return;
}
m_statusImmunity[status] = immune;
+ emit(changed());
}
void Type::setWeatherImmunity(const int weather, const bool immune)
@@ -108,6 +111,7 @@ void Type::setWeatherImmunity(const int weather, const bool immune)
return;
}
m_weatherImmunity[weather] = immune;
+ emit(changed());
}
QString Type::name() const
diff --git a/pokemodr/AbilityUI.cpp b/pokemodr/AbilityUI.cpp
index 14e5f0cb..a0b693c7 100644
--- a/pokemodr/AbilityUI.cpp
+++ b/pokemodr/AbilityUI.cpp
@@ -27,10 +27,6 @@ AbilityUI::AbilityUI(Ability* ability, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(ability, new Ability(*ability));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/AuthorUI.cpp b/pokemodr/AuthorUI.cpp
index 45020256..235931e0 100644
--- a/pokemodr/AuthorUI.cpp
+++ b/pokemodr/AuthorUI.cpp
@@ -27,10 +27,6 @@ AuthorUI::AuthorUI(Author* author, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(author, new Author(*author));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/BadgeUI.cpp b/pokemodr/BadgeUI.cpp
index cb4b5b9a..a07943a2 100644
--- a/pokemodr/BadgeUI.cpp
+++ b/pokemodr/BadgeUI.cpp
@@ -31,10 +31,6 @@ BadgeUI::BadgeUI(Badge* badge, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(badge, new Badge(*badge));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/CoinListObjectUI.cpp b/pokemodr/CoinListObjectUI.cpp
index 2e672415..7fe2d9d6 100644
--- a/pokemodr/CoinListObjectUI.cpp
+++ b/pokemodr/CoinListObjectUI.cpp
@@ -32,10 +32,6 @@ CoinListObjectUI::CoinListObjectUI(CoinListObject* object, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(object, new CoinListObject(*object));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp
index da0cd85e..5c0800cc 100644
--- a/pokemodr/CoinListUI.cpp
+++ b/pokemodr/CoinListUI.cpp
@@ -30,10 +30,6 @@ CoinListUI::CoinListUI(CoinList* coinList, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(coinList, new CoinList(*coinList));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/EggGroupUI.cpp b/pokemodr/EggGroupUI.cpp
index fc2b5ed8..23faa3b5 100644
--- a/pokemodr/EggGroupUI.cpp
+++ b/pokemodr/EggGroupUI.cpp
@@ -27,10 +27,6 @@ EggGroupUI::EggGroupUI(EggGroup* eggGroup, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(eggGroup, new EggGroup(*eggGroup));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/FlagWidget.cpp b/pokemodr/FlagWidget.cpp
index 70f47a45..0386fe9a 100644
--- a/pokemodr/FlagWidget.cpp
+++ b/pokemodr/FlagWidget.cpp
@@ -37,6 +37,8 @@ Flag FlagWidget::value() const
void FlagWidget::setValue(const Flag& value)
{
+ if (m_value == value)
+ return;
m_value = value;
setChecked(m_value.status() == Flag::Ignore);
varFlag->setValue(m_value.flag());
diff --git a/pokemodr/FractionWidget.cpp b/pokemodr/FractionWidget.cpp
index a418133a..da51da9d 100644
--- a/pokemodr/FractionWidget.cpp
+++ b/pokemodr/FractionWidget.cpp
@@ -52,9 +52,21 @@ void FractionWidget::setBehavior(const int behavior)
void FractionWidget::setValue(const Fraction& value)
{
+ if (m_value == value)
+ return;
m_value = value;
varDenominator->setValue(m_value.denominator());
varNumerator->setValue(m_value.numerator());
+ if (0 < m_behavior)
+ {
+ varNumerator->setMaximum(INT_MAX);
+ varDenominator->setMaximum(m_value.numerator());
+ }
+ else
+ {
+ varNumerator->setMaximum(m_value.denominator());
+ varDenominator->setMaximum(INT_MAX);
+ }
emit(valueChanged(m_value));
}
diff --git a/pokemodr/ItemTypeUI.cpp b/pokemodr/ItemTypeUI.cpp
index f95827ac..8a17f6b6 100644
--- a/pokemodr/ItemTypeUI.cpp
+++ b/pokemodr/ItemTypeUI.cpp
@@ -27,10 +27,6 @@ ItemTypeUI::ItemTypeUI(ItemType* itemType, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(itemType, new ItemType(*itemType));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/ItemUI.cpp b/pokemodr/ItemUI.cpp
index cf99132c..9d3c9ec1 100644
--- a/pokemodr/ItemUI.cpp
+++ b/pokemodr/ItemUI.cpp
@@ -29,10 +29,6 @@ ItemUI::ItemUI(Item* item, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(item, new Item(*item));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapTrainerTeamMemberUI.cpp b/pokemodr/MapTrainerTeamMemberUI.cpp
index d08f17e3..65b9e802 100644
--- a/pokemodr/MapTrainerTeamMemberUI.cpp
+++ b/pokemodr/MapTrainerTeamMemberUI.cpp
@@ -31,10 +31,6 @@ MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember,
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(teamMember, new MapTrainerTeamMember(*teamMember));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapTrainerUI.cpp b/pokemodr/MapTrainerUI.cpp
index 1ca6b1cd..30632013 100644
--- a/pokemodr/MapTrainerUI.cpp
+++ b/pokemodr/MapTrainerUI.cpp
@@ -33,10 +33,6 @@ MapTrainerUI::MapTrainerUI(MapTrainer* trainer, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(trainer, new MapTrainer(*trainer));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapUI.cpp b/pokemodr/MapUI.cpp
index 749b2bf5..0c32c759 100644
--- a/pokemodr/MapUI.cpp
+++ b/pokemodr/MapUI.cpp
@@ -41,10 +41,6 @@ MapUI::MapUI(Map* map, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(map, new Map(*map));
m_model = new TilemapModel(this, static_cast<Map*>(modified())->map(), static_cast<const Pokemod*>(original()->pokemod()));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp
index b12a53a7..72ecdd0c 100644
--- a/pokemodr/MapWarpUI.cpp
+++ b/pokemodr/MapWarpUI.cpp
@@ -31,10 +31,6 @@ MapWarpUI::MapWarpUI(MapWarp* warp, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(warp, new MapWarp(*warp));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapWildListEncounterUI.cpp b/pokemodr/MapWildListEncounterUI.cpp
index c3bfe837..7468023e 100644
--- a/pokemodr/MapWildListEncounterUI.cpp
+++ b/pokemodr/MapWildListEncounterUI.cpp
@@ -29,10 +29,6 @@ MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* encounter,
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(encounter, new MapWildListEncounter(*encounter));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp
index 00f332eb..fc506eb1 100644
--- a/pokemodr/MapWildListUI.cpp
+++ b/pokemodr/MapWildListUI.cpp
@@ -31,10 +31,6 @@ MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(wildList, new MapWildList(*wildList));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp
index ca9d085f..4109cb2d 100644
--- a/pokemodr/MoveUI.cpp
+++ b/pokemodr/MoveUI.cpp
@@ -29,10 +29,6 @@ MoveUI::MoveUI(Move* move, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(move, new Move(*move));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp
index f8f49c77..3a71fcbf 100644
--- a/pokemodr/NatureUI.cpp
+++ b/pokemodr/NatureUI.cpp
@@ -28,10 +28,6 @@ NatureUI::NatureUI(Nature* nature, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(nature, new Nature(*nature));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/ObjectUI.cpp b/pokemodr/ObjectUI.cpp
new file mode 100644
index 00000000..29423d8c
--- /dev/null
+++ b/pokemodr/ObjectUI.cpp
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2008 Ben Boeckel <MathStuf@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// Header include
+#include "ObjectUI.h"
+
+// Pokemod includes
+#include "../pokemod/Object.h"
+
+// Qt includes
+#include <QCloseEvent>
+#include <QMetaObject>
+
+// KDE includes
+#include <KMessageBox>
+
+ObjectUI::ObjectUI(QWidget* parent) :
+ QWidget(parent),
+ m_changed(false),
+ m_object(NULL),
+ m_object_mod(NULL)
+{
+ connect(this, SIGNAL(changed(bool)), SLOT(setChanged(bool)));
+ connect(this, SIGNAL(changed()), SLOT(setChanged()));
+}
+
+ObjectUI::~ObjectUI()
+{
+ if (m_changed)
+ {
+// if (KMessageBox::questionYesNo(this, "You have unsaved changes, would you like to save them?", QString("Unsaved %1").arg(m_object->className())) == KMessageBox::Yes)
+// apply();
+// else
+// discard();
+ }
+ delete m_object_mod;
+}
+
+void ObjectUI::closeEvent(QCloseEvent* event)
+{
+ if (m_changed)
+ {
+ switch (KMessageBox::questionYesNoCancel(this, "You have unsaved changes, would you like to save them?", QString("Unsaved %1").arg(m_object->className())))
+ {
+ case KMessageBox::Yes:
+ event->accept();
+ apply();
+ break;
+ case KMessageBox::No:
+ event->accept();
+ discard();
+ break;
+ case KMessageBox::Cancel:
+ event->ignore();
+ break;
+ }
+ }
+}
+
+void ObjectUI::reload()
+{
+ refreshGui();
+ setGui();
+}
+
+bool ObjectUI::isChanged() const
+{
+ return m_changed;
+}
+
+const Object* ObjectUI::original() const
+{
+ return m_object;
+}
+
+Object* ObjectUI::original()
+{
+ return m_object;
+}
+
+const Object* ObjectUI::modified() const
+{
+ return m_object_mod;
+}
+
+Object* ObjectUI::modified()
+{
+ return m_object_mod;
+}
+
+void ObjectUI::setChanged(const bool changed)
+{
+ m_changed = changed;
+}
+
+void ObjectUI::errorMessage(const QString& message)
+{
+ KMessageBox::error(this, message, "Error");
+}
+
+void ObjectUI::warningMessage(const QString& message)
+{
+ KMessageBox::warningContinueCancel(this, message, "Warning");
+}
+
+void ObjectUI::initGui()
+{
+}
+
+void ObjectUI::refreshGui()
+{
+}
+
+void ObjectUI::setObjects(Object* original, Object* modified)
+{
+ m_object = original;
+ m_object_mod = modified;
+ connect(m_object_mod, SIGNAL(changed()), this, SIGNAL(changed()));
+ connect(m_object_mod, SIGNAL(error(const QString&)), this, SLOT(setGui()));
+ connect(m_object_mod, SIGNAL(error(const QString&)), this, SLOT(errorMessage(const QString&)));
+ connect(m_object_mod, SIGNAL(warning(const QString&)), this, SLOT(warningMessage(const QString&)));
+ connect(m_object_mod, SIGNAL(changed()), this, SLOT(setChanged()));
+ connect(m_object_mod, SIGNAL(changed()), this, SLOT(setGui()));
+}
+
+void ObjectUI::init()
+{
+ initGui();
+ reload();
+ emit(changed(false));
+}
diff --git a/pokemodr/ObjectUI.h b/pokemodr/ObjectUI.h
index 3a31801b..0c2b8278 100644
--- a/pokemodr/ObjectUI.h
+++ b/pokemodr/ObjectUI.h
@@ -18,130 +18,48 @@
#ifndef __POKEMODR_OBJECTUI__
#define __POKEMODR_OBJECTUI__
-// Pokemod includes
-#include "../pokemod/Object.h"
-
// Qt includes
-#include <QCloseEvent>
-#include <QMetaObject>
#include <QWidget>
-// KDE includes
-#include <KMessageBox>
-
-#define DBL_PREC 7
+// Forward declarations
+class QCloseEvent;
+class Object;
class ObjectUI : public QWidget
{
Q_OBJECT
public:
- ObjectUI(QWidget* parent) :
- QWidget(parent),
- m_changed(false),
- m_object(NULL),
- m_object_mod(NULL)
- {
- connect(this, SIGNAL(changed(bool)), SLOT(setChanged(bool)));
- }
- virtual ~ObjectUI()
- {
- if (m_changed)
- {
-// if (KMessageBox::questionYesNo(this, "You have unsaved changes, would you like to save them?", QString("Unsaved %1").arg(m_object->className())) == KMessageBox::Yes)
-// apply();
-// else
-// discard();
- }
- delete m_object_mod;
- }
+ ObjectUI(QWidget* parent);
+ virtual ~ObjectUI();
- void closeEvent(QCloseEvent* event)
- {
- if (m_changed)
- {
- switch (KMessageBox::questionYesNoCancel(this, "You have unsaved changes, would you like to save them?", QString("Unsaved %1").arg(m_object->className())))
- {
- case KMessageBox::Yes:
- event->accept();
- apply();
- break;
- case KMessageBox::No:
- event->accept();
- discard();
- break;
- case KMessageBox::Cancel:
- event->ignore();
- break;
- }
- }
- }
- void reload()
- {
- refreshGui();
- setGui();
- }
+ void closeEvent(QCloseEvent* event);
+ void reload();
- bool isChanged() const
- {
- return m_changed;
- }
+ bool isChanged() const;
- const Object* original() const
- {
- return m_object;
- }
- Object* original()
- {
- return m_object;
- }
- const Object* modified() const
- {
- return m_object_mod;
- }
- Object* modified()
- {
- return m_object_mod;
- }
+ const Object* original() const;
+ Object* original();
+ const Object* modified() const;
+ Object* modified();
signals:
+ void changed();
void changed(bool);
public slots:
virtual void apply() = 0;
virtual void discard() = 0;
protected slots:
- void setChanged(const bool changed = true)
- {
- m_changed = changed;
- }
- void errorMessage(const QString& message)
- {
- KMessageBox::error(this, message, "Error");
- }
- void warningMessage(const QString& message)
- {
- KMessageBox::warningContinueCancel(this, message, "Warning");
- }
+ void setChanged(const bool changed = true);
+ void errorMessage(const QString& message);
+ void warningMessage(const QString& message);
- void initGui()
- {
- }
- void refreshGui()
- {
- }
+ virtual void initGui();
+ virtual void refreshGui();
virtual void setGui() = 0;
protected:
- void setObjects(Object* original, Object* modified)
- {
- m_object = original;
- m_object_mod = modified;
- }
+ void setObjects(Object* original, Object* modified);
- void init()
- {
- initGui();
- reload();
- emit(changed(false));
- }
+ void init();
private:
bool m_changed;
diff --git a/pokemodr/PointWidget.cpp b/pokemodr/PointWidget.cpp
index 8fa61091..c342f8ad 100644
--- a/pokemodr/PointWidget.cpp
+++ b/pokemodr/PointWidget.cpp
@@ -33,6 +33,8 @@ Point PointWidget::value() const
void PointWidget::setValue(const Point& value)
{
+ if (m_value == value)
+ return;
m_value = value;
varX->setValue(m_value.x());
varY->setValue(m_value.y());
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index 4df5f88d..e96e08b7 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -120,6 +120,7 @@ PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* paren
// }
setAutoSaveSettings("MainWindow", true);
treePokemod->setModel(new PokemodTreeModel(QStringList(), treePokemod));
+ connect(buttonApply, SIGNAL(clicked()), this, SLOT(update()));
}
PokeModrUI::~PokeModrUI()
@@ -128,6 +129,11 @@ PokeModrUI::~PokeModrUI()
// on_actionQuit_triggered();
}
+void PokeModrUI::update()
+{
+ treePokemod->update(treePokemod->currentIndex());
+}
+
void PokeModrUI::closeEvent(QCloseEvent* event)
{
quit();
@@ -217,7 +223,6 @@ void PokeModrUI::saveAsPokemod()
void PokeModrUI::closePokeMod()
{
-
// TODO: Close the Pokemod with the current editor open
// if (formPanel->widget())
// {
diff --git a/pokemodr/PokeModrUI.h b/pokemodr/PokeModrUI.h
index 36118d84..2a715b21 100644
--- a/pokemodr/PokeModrUI.h
+++ b/pokemodr/PokeModrUI.h
@@ -41,7 +41,9 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr
public:
PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* parent = 0);
~PokeModrUI();
- public slots:
+ protected slots:
+ void update();
+
void closeEvent(QCloseEvent* event);
void setChangedTitle(const bool changed);
diff --git a/pokemodr/PokemodTreeModel.cpp b/pokemodr/PokemodTreeModel.cpp
index e41ec0d8..2844f73f 100644
--- a/pokemodr/PokemodTreeModel.cpp
+++ b/pokemodr/PokemodTreeModel.cpp
@@ -22,6 +22,7 @@
#include "models/RootModel.h"
// Qt includes
+#include <QDomDocument>
#include <QMimeData>
PokemodTreeModel::PokemodTreeModel(const QStringList& pokemods, QObject* parent) :
diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp
index f04ee87e..5977ea52 100644
--- a/pokemodr/PokemodUI.cpp
+++ b/pokemodr/PokemodUI.cpp
@@ -35,10 +35,6 @@ PokemodUI::PokemodUI(Pokemod* pokemod, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(pokemod, new Pokemod(*pokemod));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
@@ -64,7 +60,7 @@ void PokemodUI::refreshGui()
types << static_cast<Pokemod*>(original())->item(i)->name();
// TODO: set the typechart corrently
// for (int j = 0; j < static_cast<Pokemod*>(original())->typeCount(); ++j)
-// static_cast<TypechartWidgetItem*>(varTypechart->item(i, j))->setData(Qt::EditRole, QVariant::fromValue((*typeChart)(i, j)));
+// varTypechart->item(i, j)->setData(Qt::EditRole, QVariant::fromValue(typeChart->at(i, j)));
}
varTypechart->setVerticalHeaderLabels(types);
varTypechart->setHorizontalHeaderLabels(types);
diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp
index e7648f14..9a489570 100644
--- a/pokemodr/RulesUI.cpp
+++ b/pokemodr/RulesUI.cpp
@@ -27,10 +27,6 @@ RulesUI::RulesUI(Rules* rules, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(rules, new Rules(*rules));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
@@ -52,10 +48,7 @@ void RulesUI::setGui()
boxAllowAbilities->setChecked(static_cast<Rules*>(modified())->abilityAllowed() ? Qt::Checked : Qt::Unchecked);
boxAllowNatures->setChecked(static_cast<Rules*>(modified())->natureAllowed() ? Qt::Checked : Qt::Unchecked);
varBoxes->setValue(static_cast<Rules*>(modified())->numBoxes());
- if (static_cast<Rules*>(modified())->numBoxes())
- varBoxSize->setEnabled(true);
- else
- varBoxSize->setEnabled(false);
+ varBoxSize->setEnabled(0 < static_cast<Rules*>(modified())->numBoxes());
varBoxSize->setValue(static_cast<Rules*>(modified())->boxSize());
varMaxParty->setValue(static_cast<Rules*>(modified())->maxParty());
varMaxFight->setMaximum(static_cast<Rules*>(modified())->maxParty());
@@ -73,6 +66,7 @@ void RulesUI::setGui()
varNumSteps->setValue(static_cast<Rules*>(modified())->happySteps());
boxEffortValues->setChecked(static_cast<Rules*>(modified())->effortValuesAllowed() ? Qt::Checked : Qt::Unchecked);
varMaxEV->setValue(static_cast<Rules*>(modified())->maxTotalEV());
+ varMaxEVPerStat->setEnabled(0 < static_cast<Rules*>(modified())->maxTotalEV());
varMaxEVPerStat->setMaximum(static_cast<Rules*>(modified())->maxTotalEV());
varMaxEVPerStat->setValue(static_cast<Rules*>(modified())->maxEVPerStat());
varPokerus->setValue(static_cast<Rules*>(modified())->pokerusChance());
diff --git a/pokemodr/SoundUI.cpp b/pokemodr/SoundUI.cpp
index 299861ab..717c4b95 100644
--- a/pokemodr/SoundUI.cpp
+++ b/pokemodr/SoundUI.cpp
@@ -38,10 +38,6 @@ SoundUI::SoundUI(Sound* sound, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(sound, new Sound(*sound));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
@@ -53,7 +49,7 @@ SoundUI::~SoundUI()
void SoundUI::initGui()
{
seeker->setMediaObject(m_media);
- connect(m_media, SIGNAL(finished()), buttonStop, SLOT(clicked()));
+ connect(m_media, SIGNAL(finished()), buttonStop, SIGNAL(clicked()));
buttonPlayPause->setIcon(KIcon("media-playback-play"));
buttonStop->setIcon(KIcon("media-playback-stop"));
buttonBrowse->setIcon(KIcon("document-open"));
diff --git a/pokemodr/SpeciesAbilityUI.cpp b/pokemodr/SpeciesAbilityUI.cpp
index 93d28634..e7158469 100644
--- a/pokemodr/SpeciesAbilityUI.cpp
+++ b/pokemodr/SpeciesAbilityUI.cpp
@@ -29,10 +29,6 @@ SpeciesAbilityUI::SpeciesAbilityUI(SpeciesAbility* ability, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(ability, new SpeciesAbility(*ability));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp
index b6313b38..f920da41 100644
--- a/pokemodr/SpeciesEvolutionUI.cpp
+++ b/pokemodr/SpeciesEvolutionUI.cpp
@@ -32,10 +32,6 @@ SpeciesEvolutionUI::SpeciesEvolutionUI(SpeciesEvolution* evolution, QWidget* par
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(evolution, new SpeciesEvolution(*evolution));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesItemUI.cpp b/pokemodr/SpeciesItemUI.cpp
index b3d412ed..713eb0e9 100644
--- a/pokemodr/SpeciesItemUI.cpp
+++ b/pokemodr/SpeciesItemUI.cpp
@@ -29,10 +29,6 @@ SpeciesItemUI::SpeciesItemUI(SpeciesItem* item, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(item, new SpeciesItem(*item));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesMoveUI.cpp b/pokemodr/SpeciesMoveUI.cpp
index 0f402c15..f694478e 100644
--- a/pokemodr/SpeciesMoveUI.cpp
+++ b/pokemodr/SpeciesMoveUI.cpp
@@ -29,10 +29,6 @@ SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* move, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(move, new SpeciesMove(*move));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp
index a75506c2..461a16ef 100644
--- a/pokemodr/SpeciesUI.cpp
+++ b/pokemodr/SpeciesUI.cpp
@@ -33,10 +33,6 @@ SpeciesUI::SpeciesUI(Species* species, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(species, new Species(*species));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/StoreUI.cpp b/pokemodr/StoreUI.cpp
index 16428ea1..56c0a6b6 100644
--- a/pokemodr/StoreUI.cpp
+++ b/pokemodr/StoreUI.cpp
@@ -29,10 +29,6 @@ StoreUI::StoreUI(Store* store, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(store, new Store(*store));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TODO b/pokemodr/TODO
index adaf0254..3223fbdc 100644
--- a/pokemodr/TODO
+++ b/pokemodr/TODO
@@ -3,8 +3,6 @@ Dialog (with command dialogs)
ItemEffect
MoveEffect
-Set better permissions on slots
-
Set sub class stuff by passing it on to subclasses via setData
TilemapModel is (probably) wrong
diff --git a/pokemodr/TileUI.cpp b/pokemodr/TileUI.cpp
index 9f5bd0bb..e9e1d96f 100644
--- a/pokemodr/TileUI.cpp
+++ b/pokemodr/TileUI.cpp
@@ -31,10 +31,6 @@ TileUI::TileUI(Tile* tile, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(tile, new Tile(*tile));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TimeUI.cpp b/pokemodr/TimeUI.cpp
index d2e9e6b1..9d7ae0b6 100644
--- a/pokemodr/TimeUI.cpp
+++ b/pokemodr/TimeUI.cpp
@@ -27,10 +27,6 @@ TimeUI::TimeUI(Time* time, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(time, new Time(*time));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TrainerUI.cpp b/pokemodr/TrainerUI.cpp
index 03d39792..d7b8830e 100644
--- a/pokemodr/TrainerUI.cpp
+++ b/pokemodr/TrainerUI.cpp
@@ -30,10 +30,6 @@ TrainerUI::TrainerUI(Trainer * trainer, QWidget * parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(trainer, new Trainer(*trainer));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TypeUI.cpp b/pokemodr/TypeUI.cpp
index 893c9709..b7f51043 100644
--- a/pokemodr/TypeUI.cpp
+++ b/pokemodr/TypeUI.cpp
@@ -27,10 +27,6 @@ TypeUI::TypeUI(Type* type, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(type, new Type(*type));
- connect(modified(), SIGNAL(error(const QString&)), 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, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/models/BaseModel.cpp b/pokemodr/models/BaseModel.cpp
index 761ff3e7..4754ddec 100644
--- a/pokemodr/models/BaseModel.cpp
+++ b/pokemodr/models/BaseModel.cpp
@@ -18,6 +18,9 @@
// Header include
#include "BaseModel.h"
+// Pokemod includes
+#include "../../pokemod/Object.h"
+
BaseModel::BaseModel(BaseModel* parent, Object* object, const QString& name) :
m_object(object),
m_name(name),
@@ -50,6 +53,11 @@ Qt::DropActions BaseObjectModel::supportedDropActions()
return Qt::CopyAction | Qt::MoveAction;
}
+QString BaseObjectModel::type() const
+{
+ return m_object->className();
+}
+
ObjectModel::ObjectModel(BaseModel* parent, Object* object) :
BaseObjectModel(parent, object)
{
diff --git a/pokemodr/models/BaseModel.h b/pokemodr/models/BaseModel.h
index f690e5d0..ab52d327 100644
--- a/pokemodr/models/BaseModel.h
+++ b/pokemodr/models/BaseModel.h
@@ -23,8 +23,8 @@
#include <QString>
#include <QVariant>
-// Pokemod includes
-#include "../../pokemod/Object.h"
+// Forward declarations
+class Object;
class BaseModel
{
@@ -93,10 +93,7 @@ class BaseObjectModel : public BaseModel
Qt::DropActions supportedDragActions();
Qt::DropActions supportedDropActions();
- QString type() const
- {
- return m_object->className();
- }
+ QString type() const;
};
class ObjectModel : public BaseObjectModel
diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro
index 48c86082..83de43cb 100644
--- a/pokemodr/pokemodr.pro
+++ b/pokemodr/pokemodr.pro
@@ -84,6 +84,7 @@ SOURCES += AbilityUI.cpp \
MapWildListEncounterUI.cpp \
MoveUI.cpp \
NatureUI.cpp \
+ ObjectUI.cpp \
PointWidget.cpp \
PokemodTree.cpp \
PokemodTreeModel.cpp \