summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-17 23:34:36 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-17 23:34:36 +0000
commit6679f5cffa9d35a23b76605ddfbf3257f882b6ee (patch)
treec8e41854a60b64e8569939bca6b827807175ef9a
parent05980e883719b1c8ebde1bd2fcbf4f8c16df7ad6 (diff)
[FIX] Frac -> Fraction
[FIX] ImageCache and Ini removed [FIX] Fraction/Point widgets moved to pokemodr [FIX] Copy ctors made for pokemod classes [FIX] Ctors in pokemod fixed [FIX] Copyright headers fixed in pokemodr [FIX] PokeModr updated to new API and fixed in some places git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@99 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog13
-rw-r--r--general/Fraction.cpp (renamed from general/Frac.cpp)6
-rw-r--r--general/Fraction.h (renamed from general/Frac.h)10
-rw-r--r--general/ImageCache.cpp33
-rw-r--r--general/ImageCache.h42
-rw-r--r--general/Ini.cpp174
-rw-r--r--general/Ini.h65
-rw-r--r--general/general.pro16
-rw-r--r--pokemod/Ability.cpp16
-rw-r--r--pokemod/Ability.h5
-rw-r--r--pokemod/AbilityEffect.cpp26
-rw-r--r--pokemod/AbilityEffect.h19
-rw-r--r--pokemod/Author.cpp10
-rw-r--r--pokemod/Author.h5
-rw-r--r--pokemod/Badge.cpp18
-rw-r--r--pokemod/Badge.h13
-rw-r--r--pokemod/CoinList.cpp16
-rw-r--r--pokemod/CoinList.h5
-rw-r--r--pokemod/CoinListObject.cpp10
-rw-r--r--pokemod/CoinListObject.h5
-rw-r--r--pokemod/Dialog.cpp10
-rw-r--r--pokemod/Dialog.h5
-rw-r--r--pokemod/EggGroup.cpp13
-rw-r--r--pokemod/EggGroup.h5
-rw-r--r--pokemod/Item.cpp16
-rw-r--r--pokemod/Item.h5
-rw-r--r--pokemod/ItemEffect.cpp20
-rw-r--r--pokemod/ItemEffect.h13
-rw-r--r--pokemod/ItemType.cpp10
-rw-r--r--pokemod/ItemType.h5
-rw-r--r--pokemod/Map.cpp29
-rw-r--r--pokemod/Map.h5
-rw-r--r--pokemod/MapEffect.cpp10
-rw-r--r--pokemod/MapEffect.h5
-rw-r--r--pokemod/MapTrainer.cpp16
-rw-r--r--pokemod/MapTrainer.h5
-rw-r--r--pokemod/MapTrainerTeamMember.cpp10
-rw-r--r--pokemod/MapTrainerTeamMember.h5
-rw-r--r--pokemod/MapWarp.cpp10
-rw-r--r--pokemod/MapWarp.h5
-rw-r--r--pokemod/MapWildList.cpp15
-rw-r--r--pokemod/MapWildList.h5
-rw-r--r--pokemod/MapWildListEncounter.cpp10
-rw-r--r--pokemod/MapWildListEncounter.h5
-rw-r--r--pokemod/Move.cpp23
-rw-r--r--pokemod/Move.h13
-rw-r--r--pokemod/MoveEffect.cpp28
-rw-r--r--pokemod/MoveEffect.h19
-rw-r--r--pokemod/Nature.cpp20
-rw-r--r--pokemod/Nature.h13
-rw-r--r--pokemod/Object.h16
-rw-r--r--pokemod/Pokemod.cpp94
-rw-r--r--pokemod/Pokemod.h12
-rw-r--r--pokemod/Rules.cpp20
-rw-r--r--pokemod/Rules.h13
-rw-r--r--pokemod/Species.cpp59
-rw-r--r--pokemod/Species.h31
-rw-r--r--pokemod/SpeciesAbility.cpp10
-rw-r--r--pokemod/SpeciesAbility.h5
-rw-r--r--pokemod/SpeciesEvolution.cpp10
-rw-r--r--pokemod/SpeciesEvolution.h5
-rw-r--r--pokemod/SpeciesItem.cpp10
-rw-r--r--pokemod/SpeciesItem.h5
-rw-r--r--pokemod/SpeciesMove.cpp10
-rw-r--r--pokemod/SpeciesMove.h5
-rw-r--r--pokemod/Store.cpp10
-rw-r--r--pokemod/Store.h5
-rw-r--r--pokemod/Tile.cpp18
-rw-r--r--pokemod/Tile.h13
-rw-r--r--pokemod/Time.cpp13
-rw-r--r--pokemod/Time.h5
-rw-r--r--pokemod/Trainer.cpp10
-rw-r--r--pokemod/Trainer.h5
-rw-r--r--pokemod/Type.cpp18
-rw-r--r--pokemod/Type.h13
-rw-r--r--pokemodr/AbilityUI.cpp58
-rw-r--r--pokemodr/AbilityUI.h52
-rw-r--r--pokemodr/AuthorUI.cpp71
-rw-r--r--pokemodr/AuthorUI.h58
-rw-r--r--pokemodr/BadgeUI.cpp155
-rw-r--r--pokemodr/BadgeUI.h57
-rw-r--r--pokemodr/CoinListObjectUI.cpp118
-rw-r--r--pokemodr/CoinListObjectUI.h58
-rw-r--r--pokemodr/CoinListUI.cpp84
-rw-r--r--pokemodr/CoinListUI.h54
-rw-r--r--pokemodr/EggGroupUI.cpp58
-rw-r--r--pokemodr/EggGroupUI.h52
-rw-r--r--pokemodr/FileDialog.cpp70
-rw-r--r--pokemodr/FileDialog.h68
-rw-r--r--pokemodr/FractionWidget.cpp (renamed from general/FracWidget.cpp)30
-rw-r--r--pokemodr/FractionWidget.h (renamed from general/FracWidget.h)16
-rw-r--r--pokemodr/ItemTypeUI.cpp75
-rw-r--r--pokemodr/ItemTypeUI.h54
-rw-r--r--pokemodr/ItemUI.cpp100
-rw-r--r--pokemodr/ItemUI.h58
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.cpp126
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.h54
-rw-r--r--pokemodr/MapUI.cpp126
-rw-r--r--pokemodr/MapUI.h64
-rw-r--r--pokemodr/MapWarpUI.cpp218
-rw-r--r--pokemodr/MapWarpUI.h79
-rw-r--r--pokemodr/MapWildListEncounterUI.cpp94
-rw-r--r--pokemodr/MapWildListEncounterUI.h54
-rw-r--r--pokemodr/MapWildListUI.cpp134
-rw-r--r--pokemodr/MapWildListUI.h56
-rw-r--r--pokemodr/MoveUI.cpp189
-rw-r--r--pokemodr/MoveUI.h77
-rw-r--r--pokemodr/NatureUI.cpp101
-rw-r--r--pokemodr/NatureUI.h57
-rw-r--r--pokemodr/ObjectUI.h78
-rw-r--r--pokemodr/PointWidget.cpp (renamed from general/PointWidget.cpp)12
-rw-r--r--pokemodr/PointWidget.h (renamed from general/PointWidget.h)4
-rw-r--r--pokemodr/PokeModTreeItem.cpp332
-rw-r--r--pokemodr/PokeModTreeItem.h117
-rw-r--r--pokemodr/PokeModr.cpp41
-rw-r--r--pokemodr/PokeModr.h37
-rw-r--r--pokemodr/PokeModrUI.cpp141
-rw-r--r--pokemodr/PokeModrUI.h55
-rw-r--r--pokemodr/PokemodUI.cpp279
-rw-r--r--pokemodr/PokemodUI.h67
-rw-r--r--pokemodr/RulesUI.cpp258
-rw-r--r--pokemodr/RulesUI.h99
-rw-r--r--pokemodr/SpeciesAbilityUI.cpp82
-rw-r--r--pokemodr/SpeciesAbilityUI.h52
-rw-r--r--pokemodr/SpeciesEvolutionUI.cpp184
-rw-r--r--pokemodr/SpeciesEvolutionUI.h64
-rw-r--r--pokemodr/SpeciesItemUI.cpp82
-rw-r--r--pokemodr/SpeciesItemUI.h52
-rw-r--r--pokemodr/SpeciesMoveUI.cpp96
-rw-r--r--pokemodr/SpeciesMoveUI.h54
-rw-r--r--pokemodr/SpeciesUI.cpp402
-rw-r--r--pokemodr/SpeciesUI.h87
-rw-r--r--pokemodr/StoreUI.cpp80
-rw-r--r--pokemodr/StoreUI.h52
-rw-r--r--pokemodr/TODO4
-rw-r--r--pokemodr/TileDelegate.cpp56
-rw-r--r--pokemodr/TileDelegate.h38
-rw-r--r--pokemodr/TileUI.cpp187
-rw-r--r--pokemodr/TileUI.h67
-rw-r--r--pokemodr/TilemapModel.cpp96
-rw-r--r--pokemodr/TilemapModel.h46
-rw-r--r--pokemodr/TimeUI.cpp71
-rw-r--r--pokemodr/TimeUI.h51
-rw-r--r--pokemodr/TrainerUI.cpp124
-rw-r--r--pokemodr/TrainerUI.h54
-rw-r--r--pokemodr/TypeUI.cpp88
-rw-r--r--pokemodr/TypeUI.h55
-rw-r--r--pokemodr/TypechartWidgetItem.h69
-rw-r--r--pokemodr/gui/abilityeffect.ui61
-rw-r--r--pokemodr/gui/badge.ui50
-rw-r--r--pokemodr/gui/fraction.ui (renamed from general/gui/frac.ui)4
-rw-r--r--pokemodr/gui/itemeffect.ui35
-rw-r--r--pokemodr/gui/mapeffect.ui35
-rw-r--r--pokemodr/gui/mapwarp.ui28
-rw-r--r--pokemodr/gui/move.ui32
-rw-r--r--pokemodr/gui/moveeffect.ui74
-rw-r--r--pokemodr/gui/nature.ui32
-rw-r--r--pokemodr/gui/point.ui (renamed from general/gui/point.ui)0
-rw-r--r--pokemodr/gui/pokemod.ui18
-rw-r--r--pokemodr/gui/pokemodr.ui4
-rw-r--r--pokemodr/gui/rules.ui30
-rw-r--r--pokemodr/gui/species.ui107
-rw-r--r--pokemodr/gui/speciesevolution.ui12
-rw-r--r--pokemodr/gui/tile.ui51
-rw-r--r--pokemodr/gui/trainer.ui24
-rw-r--r--pokemodr/gui/type.ui37
-rw-r--r--pokemodr/pokemodr.pro7
167 files changed, 3816 insertions, 4688 deletions
diff --git a/Changelog b/Changelog
index 9807e956..386a28b5 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,17 @@
-----------------
+Rev: 99
+Date: 17 April 2008
+User: MathStuf
+-----------------
+[FIX] Frac -> Fraction
+[FIX] ImageCache and Ini removed
+[FIX] Fraction/Point widgets moved to pokemodr
+[FIX] Copy ctors made for pokemod classes
+[FIX] Ctors in pokemod fixed
+[FIX] Copyright headers fixed in pokemodr
+[FIX] PokeModr updated to new API and fixed in some places
+
+-----------------
Rev: 98
Date: 16 April 2008
User: MathStuf
diff --git a/general/Frac.cpp b/general/Fraction.cpp
index e0a99e32..a4a41e7d 100644
--- a/general/Frac.cpp
+++ b/general/Fraction.cpp
@@ -16,15 +16,15 @@
*/
// Header include
-#include "Frac.h"
+#include "Fraction.h"
-void Frac::set(const int numerator, const int denominator)
+void Fraction::set(const int numerator, const int denominator)
{
m_numerator = numerator;
m_denominator = denominator;
}
-void Frac::reduce()
+void Fraction::reduce()
{
int i = m_numerator;
int j = m_denominator;
diff --git a/general/Frac.h b/general/Fraction.h
index e1970a51..0eef9d71 100644
--- a/general/Frac.h
+++ b/general/Fraction.h
@@ -23,14 +23,14 @@
#include <QFile>
#include <QString>
-class Frac
+class Fraction
{
public:
- inline Frac()
+ inline Fraction()
{
set(1, 1);
}
- inline Frac(const int numerator, const int denominator)
+ inline Fraction(const int numerator, const int denominator)
{
set(numerator, denominator);
}
@@ -60,9 +60,9 @@ class Frac
{
return (double(m_numerator) / m_denominator);
}
- inline Frac operator*(const Frac& rhs) const
+ inline Fraction operator*(const Fraction& rhs) const
{
- return Frac(m_numerator * rhs.m_numerator, m_denominator * rhs.m_denominator);
+ return Fraction(m_numerator * rhs.m_numerator, m_denominator * rhs.m_denominator);
}
private:
int m_numerator;
diff --git a/general/ImageCache.cpp b/general/ImageCache.cpp
deleted file mode 100644
index 22f09a03..00000000
--- a/general/ImageCache.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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/>.
- */
-
-// Qt includes
-#include <QFile>
-#include <QString>
-
-// Header include
-#include "ImageCache.h"
-
-KPixmapCache ImageCache::m_cache("pokegen");
-
-QPixmap ImageCache::open(const QString& fileName) throw(OpenException)
-{
- if (!QFile::exists(fileName))
- throw(OpenException("ImageCache", fileName));
- QPixmap pm(m_cache.loadFromFile(fileName));
- return pm;
-}
diff --git a/general/ImageCache.h b/general/ImageCache.h
deleted file mode 100644
index 3f8b29c0..00000000
--- a/general/ImageCache.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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/>.
- */
-
-#ifndef __IMAGECACHE__
-#define __IMAGECACHE__
-
-// KDE includes
-#include <kpixmapcache.h>
-
-// Qt includes
-#include <QPixmap>
-
-// General includes
-#include "Exception.h"
-
-class ImageCache
-{
- public:
- static QPixmap open(const QString& fileName) throw(OpenException);
- static void clear()
- {
- m_cache.discard();
- }
- private:
- static KPixmapCache m_cache;
-};
-
-#endif
diff --git a/general/Ini.cpp b/general/Ini.cpp
deleted file mode 100644
index 859dc59b..00000000
--- a/general/Ini.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright 2007-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/>.
- */
-
-// Qt includes
-#include <QDir>
-#include <QStringList>
-#include <QTextStream>
-
-// Header include
-#include "Ini.h"
-
-Ini::Ini()
-{
-}
-
-Ini::Ini(const QString& fileName) throw(Exception)
-{
- load(fileName);
-}
-
-void Ini::load(const QString& fileName) throw(Exception)
-{
- QFile fin(fileName);
- if (!fin.exists())
- throw(OpenException("Ini", fileName));
- load(fin);
- fin.close();
-}
-
-void Ini::load(QFile& fin) throw(InvalidException)
-{
- QTextStream file(&fin);
- QString line = file.readLine();
- QString field;
- QString value;
- int pos;
- m_fields.clear();
- while (!file.atEnd())
- {
- pos = line.indexOf('=');
- if (pos == INT_MAX)
- throw(InvalidException("Ini", fin.fileName()));
- field = line.mid(0, pos - 1);
- value = line.mid(pos + 1, line.length() - pos);
- if (field.isEmpty())
- throw(InvalidException("Ini", fin.fileName()));
- m_fields[field] = value;
- line = file.readLine();
- }
-}
-
-void Ini::save(const QString& fileName) const throw(Exception)
-{
- QStringList path = fileName.split(QDir::separator(), QString::SkipEmptyParts);
- path.removeLast();
- if (!QDir().mkpath(path.join("/")))
- throw(DirException("Ini", path.join("/")));
- QFile fout(fileName);
- if (!fout.open(QIODevice::WriteOnly))
- throw(OpenException("Ini", fileName));
- save(fout);
- fout.close();
-}
-
-void Ini::save(QFile& file) const
-{
- QTextStream fout(&file);
- foreach (QString field, m_fields)
- fout << field << '=' << m_fields[field] << '\n';
- fout << '\n';
-}
-
-void Ini::addField(const QString& field, const bool value)
-{
- m_fields[field] = value ? "true" : "false";
-}
-
-void Ini::addField(const QString& field, const unsigned char value)
-{
- m_fields[field] = QString::number(value);
-}
-
-void Ini::addField(const QString& field, const int value)
-{
- m_fields[field] = QString::number(value);
-}
-
-void Ini::addField(const QString& field, const double value)
-{
- m_fields[field] = QString::number(value);
-}
-
-void Ini::addField(const QString& field, const QString& value)
-{
- m_fields[field] = value;
-}
-
-void Ini::getValue(const QString& field, bool& value, const bool defaultValue)
-{
- if (!m_fields.contains(field))
- {
- value = defaultValue;
- return;
- }
- value = (m_fields[field] == "true") ? true : ((m_fields[field] == "false") ? false : defaultValue);
-}
-
-void Ini::getValue(const QString& field, unsigned char& value, const unsigned char defaultValue)
-{
- if (!m_fields.contains(field))
- {
- value = defaultValue;
- return;
- }
- bool ok;
- unsigned temp;
- temp = m_fields[field].toUInt(&ok);
- value = (ok && (temp <= UCHAR_MAX)) ? temp : defaultValue;
-}
-
-void Ini::getValue(const QString& field, int& value, const int defaultValue)
-{
- if (!m_fields.contains(field))
- {
- value = defaultValue;
- return;
- }
- bool ok;
- value = m_fields[field].toInt(&ok);
- if (!ok)
- value = defaultValue;
-}
-
-void Ini::getValue(const QString& field, double& value, const double defaultValue)
-{
- if (!m_fields.contains(field))
- {
- value = defaultValue;
- return;
- }
- bool ok;
- value = m_fields[field].toDouble(&ok);
- if (!ok)
- value = defaultValue;
-}
-
-void Ini::getValue(const QString& field, QString& value, const QString& defaultValue)
-{
- if (!m_fields.contains(field))
- {
- value = defaultValue;
- return;
- }
- value = m_fields[field];
-}
-
-QStringList Ini::fields() const
-{
- return m_fields.keys();
-}
diff --git a/general/Ini.h b/general/Ini.h
deleted file mode 100644
index 741c5dfd..00000000
--- a/general/Ini.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2007-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/>.
- */
-
-#ifndef __INI__
-#define __INI__
-
-// Qt includes
-#include <QFile>
-#include <QMap>
-#include <QString>
-#include <QStringList>
-
-// General includes
-#include "Exception.h"
-
-class Ini
-{
- public:
- Ini();
- Ini(const QString& fileName) throw(Exception);
-
- void load(const QString& fileName) throw(Exception);
- void save(const QString& fileName) const throw(Exception);
-
- void addField(const QString& field, const bool value);
- void addField(const QString& field, const unsigned char value);
- void addField(const QString& field, const int value);
- void addField(const QString& field, const double value);
- void addField(const QString& field, const QString& value);
-
- void getValue(const QString& field, bool& value, const bool defaultValue = true);
- void getValue(const QString& field, unsigned char& value, const unsigned char defaultValue = 0);
- void getValue(const QString& field, int& value, const int defaultValue = INT_MAX);
- void getValue(const QString& field, double& value, const double defaultValue = 0);
- void getValue(const QString& field, QString& value, const QString& defaultValue = "");
-
- QStringList fields() const;
- private:
- enum LinePos
- {
- Field = 0,
- Value = 1
- };
-
- void load(QFile& fin) throw(InvalidException);
- void save(QFile& fout) const;
-
- QMap<QString, QString> m_fields;
-};
-
-#endif
diff --git a/general/general.pro b/general/general.pro
index 4f55f095..bb7256ce 100644
--- a/general/general.pro
+++ b/general/general.pro
@@ -51,26 +51,16 @@ win32 {
SOURCES += Audio.cpp \
BugCatcher.cpp \
Flag.cpp \
- Frac.cpp \
- FracWidget.cpp \
- ImageCache.cpp \
- Ini.cpp
+ Fraction.cpp
HEADERS += Audio.h \
BugCatcher.h \
Exception.h \
Flag.h \
- Frac.h \
- FracWidget.h \
+ Fraction.h \
Hat.h \
- ImageCache.h \
- Ini.h \
Matrix.h \
- Point.h \
- PointWidget.h
-
-FORMS += gui/frac.ui \
- gui/point.ui
+ Point.h
INSTALLS += target
target.path = /usr/lib`kde4-config --libsuffix`
diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp
index 57b11739..59574a9e 100644
--- a/pokemod/Ability.cpp
+++ b/pokemod/Ability.cpp
@@ -16,9 +16,7 @@
*/
// Qt includes
-#include <QDir>
#include <QMap>
-#include <QStringList>
// Pokemod includes
#include "Pokemod.h"
@@ -27,19 +25,25 @@
// Header include
#include "Ability.h"
+Ability::Ability(const Ability& ability) :
+ Object("Ability", ability.pokemod(), ability.id())
+{
+ *this = ability;
+}
+
Ability::Ability(const Pokemod* pokemod, const int id) :
Object("Ability", pokemod, id),
m_name("")
{
}
-Ability::Ability(const Pokemod* pokemod, const Ability& ability, const int id) :
+Ability::Ability(const Ability& ability, const Pokemod* pokemod, const int id) :
Object("Ability", pokemod, id)
{
*this = ability;
}
-Ability::Ability(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Ability::Ability(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Ability", pokemod, id)
{
load(xml, id);
@@ -151,13 +155,13 @@ AbilityEffect* Ability::newEffect()
AbilityEffect* Ability::newEffect(const QDomElement& xml)
{
- m_effects.append(new AbilityEffect(pokemod(), xml, effectId()));
+ m_effects.append(new AbilityEffect(xml, pokemod(), effectId()));
return m_effects[effectCount() - 1];
}
AbilityEffect* Ability::newEffect(const AbilityEffect& effect)
{
- m_effects.append(new AbilityEffect(pokemod(), effect, effectId()));
+ m_effects.append(new AbilityEffect(effect, pokemod(), effectId()));
return m_effects[effectCount() - 1];
}
diff --git a/pokemod/Ability.h b/pokemod/Ability.h
index b608de63..845c51fe 100644
--- a/pokemod/Ability.h
+++ b/pokemod/Ability.h
@@ -35,9 +35,10 @@ class Pokemod;
class Ability : public Object
{
public:
+ Ability(const Ability& ability);
Ability(const Pokemod* pokemod, const int id);
- Ability(const Pokemod* pokemod, const Ability& ability, const int id);
- Ability(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Ability(const Ability& ability, const Pokemod* pokemod, const int id);
+ Ability(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~Ability();
void load(const QDomElement& xml, int id = INT_MAX);
diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp
index 369095d9..40f3368a 100644
--- a/pokemod/AbilityEffect.cpp
+++ b/pokemod/AbilityEffect.cpp
@@ -33,6 +33,12 @@ const QStringList AbilityEffect::BoostStr = QStringList() << "Boost" << "Hinder"
const QStringList AbilityEffect::SideStr = QStringList() << "Above" << "Below";
+AbilityEffect::AbilityEffect(const AbilityEffect& effect) :
+ Object("AbilityEffect", effect.pokemod(), effect.id())
+{
+ *this = effect;
+}
+
AbilityEffect::AbilityEffect(const Pokemod* pokemod, const int id) :
Object("AbilityEffect", pokemod, id),
m_chance(1, 1),
@@ -46,13 +52,13 @@ AbilityEffect::AbilityEffect(const Pokemod* pokemod, const int id) :
{
}
-AbilityEffect::AbilityEffect(const Pokemod* pokemod, const AbilityEffect& effect, const int id) :
+AbilityEffect::AbilityEffect(const AbilityEffect& effect, const Pokemod* pokemod, const int id) :
Object("AbilityEffect", pokemod, id)
{
*this = effect;
}
-AbilityEffect::AbilityEffect(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+AbilityEffect::AbilityEffect(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("AbilityEffect", pokemod, id)
{
load(xml, id);
@@ -201,31 +207,31 @@ bool AbilityEffect::validate() const
void AbilityEffect::load(const QDomElement& xml, int id)
{
LOAD_ID();
- LOAD(Frac, chance);
+ LOAD(Fraction, chance);
LOAD(int, effect);
LOAD(int, value1);
LOAD(int, value2);
LOAD(int, value3);
LOAD(int, trigger);
LOAD(int, triggerValue1);
- LOAD(Frac, triggerValue2);
+ LOAD(Fraction, triggerValue2);
}
QDomElement AbilityEffect::save() const
{
SAVE_CREATE();
- SAVE(Frac, chance);
+ SAVE(Fraction, chance);
SAVE(int, effect);
SAVE(int, value1);
SAVE(int, value2);
SAVE(int, value3);
SAVE(int, trigger);
SAVE(int, triggerValue1);
- SAVE(Frac, triggerValue2);
+ SAVE(Fraction, triggerValue2);
return xml;
}
-void AbilityEffect::setChance(const Frac& chance) throw(Exception)
+void AbilityEffect::setChance(const Fraction& chance) throw(Exception)
{
m_chance = chance;
}
@@ -373,14 +379,14 @@ void AbilityEffect::setTriggerValue1(const int triggerValue1) throw(Exception)
m_triggerValue1 = triggerValue1;
}
-void AbilityEffect::setTriggerValue2(const Frac& triggerValue2) throw(Exception)
+void AbilityEffect::setTriggerValue2(const Fraction& triggerValue2) throw(Exception)
{
if (m_trigger != T_HPBoundary)
throw(UnusedException(className(), "triggerValue2"));
m_triggerValue2 = triggerValue2;
}
-Frac AbilityEffect::chance() const
+Fraction AbilityEffect::chance() const
{
return m_chance;
}
@@ -415,7 +421,7 @@ int AbilityEffect::triggerValue1() const
return m_triggerValue1;
}
-Frac AbilityEffect::triggerValue2() const
+Fraction AbilityEffect::triggerValue2() const
{
return m_triggerValue2;
}
diff --git a/pokemod/AbilityEffect.h b/pokemod/AbilityEffect.h
index 2fd688f5..516c3958 100644
--- a/pokemod/AbilityEffect.h
+++ b/pokemod/AbilityEffect.h
@@ -24,7 +24,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -120,30 +120,31 @@ class AbilityEffect : public Object
};
static const QStringList SideStr;
+ AbilityEffect(const AbilityEffect& effect);
AbilityEffect(const Pokemod* pokemod, const int id);
- AbilityEffect(const Pokemod* pokemod, const AbilityEffect& effect, const int id);
- AbilityEffect(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ AbilityEffect(const AbilityEffect& effect, const Pokemod* pokemod, const int id);
+ AbilityEffect(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
- void setChance(const Frac& chance) throw(Exception);
+ void setChance(const Fraction& chance) throw(Exception);
void setEffect(const int effect) throw(BoundsException);
void setValue1(const int value1) throw(Exception);
void setValue2(const int value2) throw(Exception);
void setValue3(const int value3) throw(Exception);
void setTrigger(const int trigger) throw(BoundsException);
void setTriggerValue1(const int triggerValue1) throw(Exception);
- void setTriggerValue2(const Frac& triggerValue2) throw(Exception);
+ void setTriggerValue2(const Fraction& triggerValue2) throw(Exception);
- Frac chance() const;
+ Fraction chance() const;
int effect() const;
int value1() const;
int value2() const;
int value3() const;
int trigger() const;
int triggerValue1() const;
- Frac triggerValue2() const;
+ Fraction triggerValue2() const;
AbilityEffect& operator=(const AbilityEffect& rhs);
private:
@@ -152,14 +153,14 @@ class AbilityEffect : public Object
{
}
- Frac m_chance;
+ Fraction m_chance;
int m_effect;
int m_value1;
int m_value2;
int m_value3;
int m_trigger;
int m_triggerValue1;
- Frac m_triggerValue2;
+ Fraction m_triggerValue2;
};
#endif
diff --git a/pokemod/Author.cpp b/pokemod/Author.cpp
index 9cb00cb0..abfd8cb1 100644
--- a/pokemod/Author.cpp
+++ b/pokemod/Author.cpp
@@ -24,6 +24,12 @@
// Header include
#include "Author.h"
+Author::Author(const Author& author) :
+ Object("Author", author.pokemod(), author.id())
+{
+ *this = author;
+}
+
Author::Author(const Pokemod* pokemod, const int id) :
Object("Author", pokemod, id),
m_name(""),
@@ -32,13 +38,13 @@ Author::Author(const Pokemod* pokemod, const int id) :
{
}
-Author::Author(const Pokemod* pokemod, const Author& author, const int id) :
+Author::Author(const Author& author, const Pokemod* pokemod, const int id) :
Object("Author", pokemod, id)
{
*this = author;
}
-Author::Author(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Author::Author(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Author", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/Author.h b/pokemod/Author.h
index df2e0264..3af63143 100644
--- a/pokemod/Author.h
+++ b/pokemod/Author.h
@@ -30,9 +30,10 @@ class Pokemod;
class Author : public Object
{
public:
+ Author(const Author& author);
Author(const Pokemod* pokemod, const int id);
- Author(const Pokemod* pokemod, const Author& author, const int id);
- Author(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Author(const Author& author, const Pokemod* pokemod, const int id);
+ Author(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp
index 5d220124..8c5088a9 100644
--- a/pokemod/Badge.cpp
+++ b/pokemod/Badge.cpp
@@ -18,6 +18,12 @@
// Header include
#include "Badge.h"
+Badge::Badge(const Badge& badge) :
+ Object("Badge", badge.pokemod(), badge.id())
+{
+ *this = badge;
+}
+
Badge::Badge(const Pokemod* pokemod, const int id) :
Object("Badge", pokemod, id),
m_name(""),
@@ -29,13 +35,13 @@ Badge::Badge(const Pokemod* pokemod, const int id) :
m_hm[i] = false;
}
-Badge::Badge(const Pokemod* pokemod, const Badge& badge, const int id) :
+Badge::Badge(const Badge& badge, const Pokemod* pokemod, const int id) :
Object("Badge", pokemod, id)
{
*this = badge;
}
-Badge::Badge(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Badge::Badge(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Badge", pokemod, id)
{
load(xml, id);
@@ -63,7 +69,7 @@ void Badge::load(const QDomElement& xml, int id)
LOAD_ID();
LOAD(QString, name);
LOAD(int, obey);
- LOAD_ARRAY(Frac, stat, Pokemod::ST_End_GSC);
+ LOAD_ARRAY(Fraction, stat, Pokemod::ST_End_GSC);
LOAD_ARRAY(bool, hm, Pokemod::HM_End_All);
}
@@ -72,7 +78,7 @@ QDomElement Badge::save() const
SAVE_CREATE();
SAVE(QString, name);
SAVE(int, obey);
- SAVE_ARRAY(Frac, stat, Pokemod::ST_End_GSC);
+ SAVE_ARRAY(Fraction, stat, Pokemod::ST_End_GSC);
SAVE_ARRAY(bool, hm, Pokemod::HM_End_All);
return xml;
}
@@ -101,7 +107,7 @@ void Badge::setObey(const int obey) throw(BoundsException)
m_obey = obey;
}
-void Badge::setStat(const int stat, const Frac& multiplier) throw(Exception)
+void Badge::setStat(const int stat, const Fraction& multiplier) throw(Exception)
{
if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= stat)
throw(BoundsException(className(), "stat"));
@@ -135,7 +141,7 @@ int Badge::obey() const
return m_obey;
}
-Frac Badge::stat(const int stat) const throw(BoundsException)
+Fraction Badge::stat(const int stat) const throw(BoundsException)
{
if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= stat)
throw(BoundsException(className(), "stat"));
diff --git a/pokemod/Badge.h b/pokemod/Badge.h
index 8fc9f4af..2e394aac 100644
--- a/pokemod/Badge.h
+++ b/pokemod/Badge.h
@@ -24,7 +24,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -33,9 +33,10 @@
class Badge : public Object
{
public:
+ Badge(const Badge& badge);
Badge(const Pokemod* pokemod, const int id);
- Badge(const Pokemod* pokemod, const Badge& badge, const int id);
- Badge(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Badge(const Badge& badge, const Pokemod* pokemod, const int id);
+ Badge(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
@@ -44,14 +45,14 @@ class Badge : public Object
void setFace(const QPixmap& face) throw(Exception);
void setBadge(const QPixmap& badge) throw(Exception);
void setObey(const int obey) throw(BoundsException);
- void setStat(const int stat, const Frac& multiplier) throw(Exception);
+ void setStat(const int stat, const Fraction& multiplier) throw(Exception);
void setHm(const int hm, const bool hmAllowed) throw(BoundsException);
QString name() const;
QPixmap face() const;
QPixmap badge() const;
int obey() const;
- Frac stat(const int stat) const throw(BoundsException);
+ Fraction stat(const int stat) const throw(BoundsException);
bool hm(const int hm) const throw(BoundsException);
Badge& operator=(const Badge& rhs);
@@ -65,7 +66,7 @@ class Badge : public Object
QPixmap m_face;
QPixmap m_badge;
int m_obey;
- Frac m_stat[Pokemod::ST_End_GSC];
+ Fraction m_stat[Pokemod::ST_End_GSC];
bool m_hm[Pokemod::HM_End_All];
};
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp
index b6349c50..e0b9f2fb 100644
--- a/pokemod/CoinList.cpp
+++ b/pokemod/CoinList.cpp
@@ -16,9 +16,7 @@
*/
// Qt includes
-#include <QDir>
#include <QMap>
-#include <QStringList>
// Pokemod includes
#include "Pokemod.h"
@@ -29,6 +27,12 @@
// Header include
#include "CoinList.h"
+CoinList::CoinList(const CoinList& coinList) :
+ Object("CoinList", coinList.pokemod(), coinList.id())
+{
+ *this = coinList;
+}
+
CoinList::CoinList(const Pokemod* pokemod, const int id) :
Object("CoinList", pokemod, id),
m_name(""),
@@ -36,13 +40,13 @@ CoinList::CoinList(const Pokemod* pokemod, const int id) :
{
}
-CoinList::CoinList(const Pokemod* pokemod, const CoinList& coinList, const int id) :
+CoinList::CoinList(const CoinList& coinList, const Pokemod* pokemod, const int id) :
Object("CoinList", pokemod, id)
{
*this = coinList;
}
-CoinList::CoinList(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+CoinList::CoinList(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("CoinList", pokemod, id)
{
load(xml, id);
@@ -209,13 +213,13 @@ CoinListObject* CoinList::newObject()
CoinListObject* CoinList::newObject(const QDomElement& xml)
{
- m_objects.append(new CoinListObject(pokemod(), xml, objectId()));
+ m_objects.append(new CoinListObject(xml, pokemod(), objectId()));
return m_objects[objectCount() - 1];
}
CoinListObject* CoinList::newObject(const CoinListObject& object)
{
- m_objects.append(new CoinListObject(pokemod(), object, objectId()));
+ m_objects.append(new CoinListObject(object, pokemod(), objectId()));
return m_objects[objectCount() - 1];
}
diff --git a/pokemod/CoinList.h b/pokemod/CoinList.h
index a0097571..e9fd1752 100644
--- a/pokemod/CoinList.h
+++ b/pokemod/CoinList.h
@@ -35,9 +35,10 @@ class Pokemod;
class CoinList : public Object
{
public:
+ CoinList(const CoinList& coinList);
CoinList(const Pokemod* pokemod, const int id);
- CoinList(const Pokemod* pokemod, const CoinList& coinList, const int id);
- CoinList(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ CoinList(const CoinList& coinList, const Pokemod* pokemod, const int id);
+ CoinList(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~CoinList();
void load(const QDomElement& xml, int id = INT_MAX);
diff --git a/pokemod/CoinListObject.cpp b/pokemod/CoinListObject.cpp
index 53cf1b19..cc110a8e 100644
--- a/pokemod/CoinListObject.cpp
+++ b/pokemod/CoinListObject.cpp
@@ -20,6 +20,12 @@
const QStringList CoinListObject::TypeStr = QStringList() << "Item" << "Pokémon";
+CoinListObject::CoinListObject(const CoinListObject& object) :
+ Object("CoinListObject", object.pokemod(), object.id())
+{
+ *this = object;
+}
+
CoinListObject::CoinListObject(const Pokemod* pokemod, const int id) :
Object("CoinListObject", pokemod, id),
m_type(Item),
@@ -29,13 +35,13 @@ CoinListObject::CoinListObject(const Pokemod* pokemod, const int id) :
{
}
-CoinListObject::CoinListObject(const Pokemod* pokemod, const CoinListObject& object, const int id) :
+CoinListObject::CoinListObject(const CoinListObject& object, const Pokemod* pokemod, const int id) :
Object("CoinListObject", pokemod, id)
{
*this = object;
}
-CoinListObject::CoinListObject(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+CoinListObject::CoinListObject(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("CoinListObject", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/CoinListObject.h b/pokemod/CoinListObject.h
index 2e9fd065..2613fbf0 100644
--- a/pokemod/CoinListObject.h
+++ b/pokemod/CoinListObject.h
@@ -42,9 +42,10 @@ class CoinListObject : public Object
};
static const QStringList TypeStr;
+ CoinListObject(const CoinListObject& object);
CoinListObject(const Pokemod* pokemod, const int id);
- CoinListObject(const Pokemod* pokemod, const CoinListObject& object, const int id);
- CoinListObject(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ CoinListObject(const CoinListObject& object, const Pokemod* pokemod, const int id);
+ CoinListObject(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp
index 01463a48..58252431 100644
--- a/pokemod/Dialog.cpp
+++ b/pokemod/Dialog.cpp
@@ -33,19 +33,25 @@ const QStringList Dialog::CommandStr = QStringList() << "Flip Flag" << "Set Flag
const QStringList Dialog::CommandAbbrStr = QStringList() << "FF" << "SF" << "UF" << "RF" << "TF" << "D" << "YN" << "ItS" << "GIt" << "TIt" << "CIt" << "CL" << "TMv" << "DMv" << "GPk" << "TPk" << "SPk" << "VPk" << "G$" << "T$" << "MvEf" << "TEf" << "CD" << "CR" << "CLv" << "CS" << "CHIt" << "C$" << "T" << "Dc" << "Bat" << "Bdg" << "W" << "N" << "Ms" << "SFX" << "Tmr" << "MS" << "WS" << "S" << "HP" << "R" << "C" << "P" << "NL" << "X" << "M";
const QList<int> Dialog::CommandNumArgs = QList<int>() << 1 << 1 << 1 << 1 << 3 << 2 << 2 << 1 << 4 << 4 << 4 << 1 << 5 << 3 << 7 << 4 << 1 << 4 << 1 << 4 << 6 << 3 << 6 << 5 << 5 << 4 << 4 << 5 << 6 << 1 << 2 << 1 << 2 << 1 << 2 << 1 << 3 << 1 << 1 << 3 << 0 << 0 << 0 << 0 << 0 << 0;
+Dialog::Dialog(const Dialog& dialog) :
+ Object("Dialog", dialog.pokemod(), dialog.id())
+{
+ *this = dialog;
+}
+
Dialog::Dialog(const Pokemod* pokemod, const int id) :
Object("Dialog", pokemod, id),
m_dialog("")
{
}
-Dialog::Dialog(const Pokemod* pokemod, const Dialog& dialog, const int id) :
+Dialog::Dialog(const Dialog& dialog, const Pokemod* pokemod, const int id) :
Object("Dialog", pokemod, id)
{
*this = dialog;
}
-Dialog::Dialog(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Dialog::Dialog(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Dialog", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/Dialog.h b/pokemod/Dialog.h
index 5ce593d4..0ac8b8a8 100644
--- a/pokemod/Dialog.h
+++ b/pokemod/Dialog.h
@@ -91,9 +91,10 @@ class Dialog : public Object
static const QStringList CommandAbbrStr;
static const QList<int> CommandNumArgs;
+ Dialog(const Dialog& dialog);
Dialog(const Pokemod* pokemod, const int id);
- Dialog(const Pokemod* pokemod, const Dialog& dialog, const int id);
- Dialog(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Dialog(const Dialog& dialog, const Pokemod* pokemod, const int id);
+ Dialog(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/EggGroup.cpp b/pokemod/EggGroup.cpp
index 4749ee5c..5e9fe519 100644
--- a/pokemod/EggGroup.cpp
+++ b/pokemod/EggGroup.cpp
@@ -15,22 +15,31 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+// Pokemod includes
#include "Pokemod.h"
+
+// Header include
#include "EggGroup.h"
+EggGroup::EggGroup(const EggGroup& eggGroup) :
+ Object("EggGroup", eggGroup.pokemod(), eggGroup.id())
+{
+ *this = eggGroup;
+}
+
EggGroup::EggGroup(const Pokemod* pokemod, const int id) :
Object("EggGroup", pokemod, id),
m_name("")
{
}
-EggGroup::EggGroup(const Pokemod* pokemod, const EggGroup& eggGroup, const int id) :
+EggGroup::EggGroup(const EggGroup& eggGroup, const Pokemod* pokemod, const int id) :
Object("EggGroup", pokemod, id)
{
*this = eggGroup;
}
-EggGroup::EggGroup(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+EggGroup::EggGroup(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("EggGroup", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/EggGroup.h b/pokemod/EggGroup.h
index 7b8c8599..f0dbd077 100644
--- a/pokemod/EggGroup.h
+++ b/pokemod/EggGroup.h
@@ -33,9 +33,10 @@ class Pokemod;
class EggGroup : public Object
{
public:
+ EggGroup(const EggGroup& eggGroup);
EggGroup(const Pokemod* pokemod, const int id);
- EggGroup(const Pokemod* pokemod, const EggGroup& eggGroup, const int id);
- EggGroup(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ EggGroup(const EggGroup& eggGroup, const Pokemod* pokemod, const int id);
+ EggGroup(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp
index 7fa91e02..afd4bd67 100644
--- a/pokemod/Item.cpp
+++ b/pokemod/Item.cpp
@@ -16,9 +16,7 @@
*/
// Qt includes
-#include <QDir>
#include <QMap>
-#include <QStringList>
// Pokemod includes
#include "Pokemod.h"
@@ -27,6 +25,12 @@
// Header include
#include "Item.h"
+Item::Item(const Item& item) :
+ Object("Item", item.pokemod(), item.id())
+{
+ *this = item;
+}
+
Item::Item(const Pokemod* pokemod, const int id) :
Object("Item", pokemod, id),
m_name(""),
@@ -37,13 +41,13 @@ Item::Item(const Pokemod* pokemod, const int id) :
{
}
-Item::Item(const Pokemod* pokemod, const Item& item, const int id) :
+Item::Item(const Item& item, const Pokemod* pokemod, const int id) :
Object("Item", pokemod, id)
{
*this = item;
}
-Item::Item(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Item::Item(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Item", pokemod, id)
{
load(xml, id);
@@ -217,13 +221,13 @@ ItemEffect* Item::newEffect()
ItemEffect* Item::newEffect(const QDomElement& xml)
{
- m_effects.append(new ItemEffect(pokemod(), xml, effectId()));
+ m_effects.append(new ItemEffect(xml, pokemod(), effectId()));
return m_effects[effectCount() - 1];
}
ItemEffect* Item::newEffect(const ItemEffect& effect)
{
- m_effects.append(new ItemEffect(pokemod(), effect, effectId()));
+ m_effects.append(new ItemEffect(effect, pokemod(), effectId()));
return m_effects[effectCount() - 1];
}
diff --git a/pokemod/Item.h b/pokemod/Item.h
index 6654ce23..f17c39b6 100644
--- a/pokemod/Item.h
+++ b/pokemod/Item.h
@@ -35,9 +35,10 @@ class Pokemod;
class Item : public Object
{
public:
+ Item(const Item& item);
Item(const Pokemod* pokemod, const int id);
- Item(const Pokemod* pokemod, const Item& item, const int id);
- Item(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Item(const Item& item, const Pokemod* pokemod, const int id);
+ Item(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~Item();
void load(const QDomElement& xml, int id = INT_MAX);
diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp
index 8520548f..9d223475 100644
--- a/pokemod/ItemEffect.cpp
+++ b/pokemod/ItemEffect.cpp
@@ -32,6 +32,12 @@ const QStringList ItemEffect::SpecialPhysicalStr = QStringList() << "Special" <<
const QStringList ItemEffect::BallTypeStr = QStringList() << "Regular" << "Master" << "Level" << "Love" << "Area" << "Time" << "Battle" << "Friend" << "Stat" << "Type" << "Weight";
const QStringList ItemEffect::BerryTypeStr = QStringList() << "HP Cure" << "Status Cure";
+ItemEffect::ItemEffect(const ItemEffect& effect) :
+ Object("ItemEffect", effect.pokemod(), effect.id())
+{
+ *this = effect;
+}
+
ItemEffect::ItemEffect(const Pokemod* pokemod, const int id) :
Object("ItemEffect", pokemod, id),
m_overworld(false),
@@ -45,13 +51,13 @@ ItemEffect::ItemEffect(const Pokemod* pokemod, const int id) :
{
}
-ItemEffect::ItemEffect(const Pokemod* pokemod, const ItemEffect& effect, const int id) :
+ItemEffect::ItemEffect(const ItemEffect& effect, const Pokemod* pokemod, const int id) :
Object("ItemEffect", pokemod, id)
{
*this = effect;
}
-ItemEffect::ItemEffect(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+ItemEffect::ItemEffect(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("ItemEffect", pokemod, id)
{
load(xml, id);
@@ -306,7 +312,7 @@ void ItemEffect::load(const QDomElement& xml, int id)
LOAD(int, value1);
LOAD(int, value2);
LOAD(int, value3);
- LOAD(Frac, value4);
+ LOAD(Fraction, value4);
}
QDomElement ItemEffect::save() const
@@ -319,7 +325,7 @@ QDomElement ItemEffect::save() const
SAVE(int, value1);
SAVE(int, value2);
SAVE(int, value3);
- SAVE(Frac, value4);
+ SAVE(Fraction, value4);
return xml;
}
@@ -416,7 +422,7 @@ void ItemEffect::setEffect(const int effect) throw(Exception)
m_value1 = 0;
m_value2 = INT_MAX;
m_value3 = INT_MAX;
- m_value4.set(1, 1); //, ((E_TypeBoost == effect) || (E_PPBoost == effect)) ? Frac::Over1 : Frac::Proper);
+ m_value4.set(1, 1); //, ((E_TypeBoost == effect) || (E_PPBoost == effect)) ? Fraction::Over1 : Fraction::Proper);
}
void ItemEffect::setValue1(const int value1) throw(Exception)
@@ -614,7 +620,7 @@ void ItemEffect::setValue3(const int value3) throw(Exception)
m_value3 = value3;
}
-void ItemEffect::setValue4(const Frac& value4) throw(Exception)
+void ItemEffect::setValue4(const Fraction& value4) throw(Exception)
{
switch (m_effect)
{
@@ -682,7 +688,7 @@ int ItemEffect::value3() const
return m_value3;
}
-Frac ItemEffect::value4() const
+Fraction ItemEffect::value4() const
{
return m_value4;
}
diff --git a/pokemod/ItemEffect.h b/pokemod/ItemEffect.h
index e5262f14..b9d6c829 100644
--- a/pokemod/ItemEffect.h
+++ b/pokemod/ItemEffect.h
@@ -24,7 +24,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod include
#include "Object.h"
@@ -137,9 +137,10 @@ class ItemEffect : public Object
};
static const QStringList BerryTypeStr;
+ ItemEffect(const ItemEffect& effect);
ItemEffect(const Pokemod* pokemod, const int id);
- ItemEffect(const Pokemod* pokemod, const ItemEffect& effect, const int id);
- ItemEffect(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ ItemEffect(const ItemEffect& effect, const Pokemod* pokemod, const int id);
+ ItemEffect(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
@@ -151,7 +152,7 @@ class ItemEffect : public Object
void setValue1(const int value1) throw(Exception);
void setValue2(const int value2) throw(Exception);
void setValue3(const int value3) throw(Exception);
- void setValue4(const Frac& value4) throw(Exception);
+ void setValue4(const Fraction& value4) throw(Exception);
bool overworld() const;
bool battle() const;
@@ -160,7 +161,7 @@ class ItemEffect : public Object
int value1() const;
int value2() const;
int value3() const;
- Frac value4() const;
+ Fraction value4() const;
ItemEffect& operator=(const ItemEffect& rhs);
private:
@@ -176,7 +177,7 @@ class ItemEffect : public Object
int m_value1;
int m_value2;
int m_value3;
- Frac m_value4;
+ Fraction m_value4;
};
#endif
diff --git a/pokemod/ItemType.cpp b/pokemod/ItemType.cpp
index 84b92a51..88d1690f 100644
--- a/pokemod/ItemType.cpp
+++ b/pokemod/ItemType.cpp
@@ -26,6 +26,12 @@
QStringList ItemType::CountStr = QStringList() << "Distinct" << "Total";
+ItemType::ItemType(const ItemType& itemType) :
+ Object("ItemType", itemType.pokemod(), itemType.id())
+{
+ *this = itemType;
+}
+
ItemType::ItemType(const Pokemod* pokemod, const int id) :
Object("ItemType", pokemod, id),
m_name(""),
@@ -35,13 +41,13 @@ ItemType::ItemType(const Pokemod* pokemod, const int id) :
{
}
-ItemType::ItemType(const Pokemod* pokemod, const ItemType& itemType, const int id) :
+ItemType::ItemType(const ItemType& itemType, const Pokemod* pokemod, const int id) :
Object("ItemType", pokemod, id)
{
*this = itemType;
}
-ItemType::ItemType(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+ItemType::ItemType(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("ItemType", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/ItemType.h b/pokemod/ItemType.h
index 8a68abc8..cecc3e42 100644
--- a/pokemod/ItemType.h
+++ b/pokemod/ItemType.h
@@ -42,9 +42,10 @@ class ItemType : public Object
};
static QStringList CountStr;
+ ItemType(const ItemType& itemType);
ItemType(const Pokemod* pokemod, const int id);
- ItemType(const Pokemod* pokemod, const ItemType& itemType, const int id);
- ItemType(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ ItemType(const ItemType& itemType, const Pokemod* pokemod, const int id);
+ ItemType(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp
index 2aa64f3d..7b577e14 100644
--- a/pokemod/Map.cpp
+++ b/pokemod/Map.cpp
@@ -16,7 +16,6 @@
*/
// Qt includes
-#include <QDir>
#include <QMap>
// Pokemod includes
@@ -31,6 +30,12 @@
const QStringList Map::TypeStr = QStringList() << "Outdoor" << "Dungeon" << "Building";
+Map::Map(const Map& map) :
+ Object("Map", map.pokemod(), map.id())
+{
+ *this = map;
+}
+
Map::Map(const Pokemod* pokemod, const int id) :
Object("Map", pokemod, id),
m_name(""),
@@ -39,13 +44,13 @@ Map::Map(const Pokemod* pokemod, const int id) :
{
}
-Map::Map(const Pokemod* pokemod, const Map& map, const int id) :
+Map::Map(const Map& map, const Pokemod* pokemod, const int id) :
Object("Map", pokemod, id)
{
*this = map;
}
-Map::Map(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Map::Map(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Map", pokemod, id)
{
load(xml, id);
@@ -184,7 +189,7 @@ void Map::load(const QDomElement& xml, int id)
LOAD(QString, name);
LOAD(int, flyWarp);
LOAD(int, type);
- LOAD_MATRIX(setTile, Frac, tile);
+ LOAD_MATRIX(setTile, Fraction, tile);
LOAD_SUB(newEffect, effects);
LOAD_SUB(newTrainer, trainers);
LOAD_SUB(newWarp, warps);
@@ -348,13 +353,13 @@ MapEffect* Map::newEffect()
MapEffect* Map::newEffect(const QDomElement& xml)
{
- m_effects.append(new MapEffect(pokemod(), xml, newEffectId()));
+ m_effects.append(new MapEffect(xml, pokemod(), newEffectId()));
return m_effects[effectCount() - 1];
}
MapEffect* Map::newEffect(const MapEffect& effect)
{
- m_effects.append(new MapEffect(pokemod(), effect, newEffectId()));
+ m_effects.append(new MapEffect(effect, pokemod(), newEffectId()));
return m_effects[effectCount() - 1];
}
@@ -426,13 +431,13 @@ MapTrainer* Map::newTrainer()
MapTrainer* Map::newTrainer(const QDomElement& xml)
{
- m_trainers.append(new MapTrainer(pokemod(), xml, newTrainerId()));
+ m_trainers.append(new MapTrainer(xml, pokemod(), newTrainerId()));
return m_trainers[trainerCount() - 1];
}
MapTrainer* Map::newTrainer(const MapTrainer& trainer)
{
- m_trainers.append(new MapTrainer(pokemod(), trainer, newTrainerId()));
+ m_trainers.append(new MapTrainer(trainer, pokemod(), newTrainerId()));
return m_trainers[trainerCount() - 1];
}
@@ -504,13 +509,13 @@ MapWarp* Map::newWarp()
MapWarp* Map::newWarp(const QDomElement& xml)
{
- m_warps.append(new MapWarp(pokemod(), xml, newWarpId()));
+ m_warps.append(new MapWarp(xml, pokemod(), newWarpId()));
return m_warps[warpCount() - 1];
}
MapWarp* Map::newWarp(const MapWarp& warp)
{
- m_warps.append(new MapWarp(pokemod(), warp, newWarpId()));
+ m_warps.append(new MapWarp(warp, pokemod(), newWarpId()));
return m_warps[warpCount() - 1];
}
@@ -582,13 +587,13 @@ MapWildList* Map::newWildList()
MapWildList* Map::newWildList(const QDomElement& xml)
{
- m_wildLists.append(new MapWildList(pokemod(), xml, newWildListId()));
+ m_wildLists.append(new MapWildList(xml, pokemod(), newWildListId()));
return m_wildLists[wildListCount() - 1];
}
MapWildList* Map::newWildList(const MapWildList& wildList)
{
- m_wildLists.append(new MapWildList(pokemod(), wildList, newWildListId()));
+ m_wildLists.append(new MapWildList(wildList, pokemod(), newWildListId()));
return m_wildLists[wildListCount() - 1];
}
diff --git a/pokemod/Map.h b/pokemod/Map.h
index 74146804..cdb7e71d 100644
--- a/pokemod/Map.h
+++ b/pokemod/Map.h
@@ -49,9 +49,10 @@ class Map : public Object
};
static const QStringList TypeStr;
+ Map(const Map& map);
Map(const Pokemod* pokemod, const int id);
- Map(const Pokemod* pokemod, const Map& map, const int id);
- Map(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Map(const Map& map, const Pokemod* pokemod, const int id);
+ Map(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~Map();
void load(const QDomElement& xml, int id = INT_MAX);
diff --git a/pokemod/MapEffect.cpp b/pokemod/MapEffect.cpp
index 57000542..f9f39a24 100644
--- a/pokemod/MapEffect.cpp
+++ b/pokemod/MapEffect.cpp
@@ -28,6 +28,12 @@
const QStringList MapEffect::MapEffectStr = QStringList() << "Item" << "PC" << "Strength Block" << "Button" << "Slot Machine" << "Card Flip Game";
const QStringList MapEffect::PCTypeStr = QStringList() << "Item" << "Pokémon" << "PokéDex" << "Hall of Fame" << "All";
+MapEffect::MapEffect(const MapEffect& effect) :
+ Object("MapEffect", effect.pokemod(), effect.id())
+{
+ *this = effect;
+}
+
MapEffect::MapEffect(const Pokemod* pokemod, const int id) :
Object("MapEffect", pokemod, id),
m_name(""),
@@ -44,13 +50,13 @@ MapEffect::MapEffect(const Pokemod* pokemod, const int id) :
{
}
-MapEffect::MapEffect(const Pokemod* pokemod, const MapEffect& effect, const int id) :
+MapEffect::MapEffect(const MapEffect& effect, const Pokemod* pokemod, const int id) :
Object("MapEffect", pokemod, id)
{
*this = effect;
}
-MapEffect::MapEffect(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+MapEffect::MapEffect(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("MapEffect", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h
index 77721bb6..acbbbf55 100644
--- a/pokemod/MapEffect.h
+++ b/pokemod/MapEffect.h
@@ -60,9 +60,10 @@ class MapEffect : public Object
};
static const QStringList PCTypeStr;
+ MapEffect(const MapEffect& effect);
MapEffect(const Pokemod* pokemod, const int id);
- MapEffect(const Pokemod* pokemod, const MapEffect& effect, const int id);
- MapEffect(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ MapEffect(const MapEffect& effect, const Pokemod* pokemod, const int id);
+ MapEffect(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp
index b1db08d3..e64d6c16 100644
--- a/pokemod/MapTrainer.cpp
+++ b/pokemod/MapTrainer.cpp
@@ -16,9 +16,7 @@
*/
// Qt includes
-#include <QDir>
#include <QMap>
-#include <QStringList>
// Pokemod includes
#include "Pokemod.h"
@@ -28,6 +26,12 @@
// Header include
#include "MapTrainer.h"
+MapTrainer::MapTrainer(const MapTrainer& trainer) :
+ Object("MapTrainer", trainer.pokemod(), trainer.id())
+{
+ *this = trainer;
+}
+
MapTrainer::MapTrainer(const Pokemod* pokemod, const int id) :
Object("MapTrainer", pokemod, id),
m_name(""),
@@ -42,13 +46,13 @@ MapTrainer::MapTrainer(const Pokemod* pokemod, const int id) :
{
}
-MapTrainer::MapTrainer(const Pokemod* pokemod, const MapTrainer& trainer, const int id) :
+MapTrainer::MapTrainer(const MapTrainer& trainer, const Pokemod* pokemod, const int id) :
Object("MapTrainer", pokemod, id)
{
*this = trainer;
}
-MapTrainer::MapTrainer(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+MapTrainer::MapTrainer(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("MapTrainer", pokemod, id)
{
load(xml, id);
@@ -290,13 +294,13 @@ MapTrainerTeamMember* MapTrainer::newTeamMember()
MapTrainerTeamMember* MapTrainer::newTeamMember(const QDomElement& xml)
{
- m_teamMember.append(new MapTrainerTeamMember(pokemod(), xml, newTeamMemberId()));
+ m_teamMember.append(new MapTrainerTeamMember(xml, pokemod(), newTeamMemberId()));
return m_teamMember[teamMemberCount() - 1];
}
MapTrainerTeamMember* MapTrainer::newTeamMember(const MapTrainerTeamMember& teamMember)
{
- m_teamMember.append(new MapTrainerTeamMember(pokemod(), teamMember, newTeamMemberId()));
+ m_teamMember.append(new MapTrainerTeamMember(teamMember, pokemod(), newTeamMemberId()));
return m_teamMember[teamMemberCount() - 1];
}
diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h
index eeaa8359..52b1845d 100644
--- a/pokemod/MapTrainer.h
+++ b/pokemod/MapTrainer.h
@@ -37,9 +37,10 @@ class Pokemod;
class MapTrainer : public Object
{
public:
+ MapTrainer(const MapTrainer& trainer);
MapTrainer(const Pokemod* pokemod, const int id);
- MapTrainer(const Pokemod* pokemod, const MapTrainer& trainer, const int id);
- MapTrainer(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ MapTrainer(const MapTrainer& trainer, const Pokemod* pokemod, const int id);
+ MapTrainer(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~MapTrainer();
void load(const QDomElement& xml, int id = INT_MAX);
diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp
index 2ce7d529..2948faa7 100644
--- a/pokemod/MapTrainerTeamMember.cpp
+++ b/pokemod/MapTrainerTeamMember.cpp
@@ -28,6 +28,12 @@
// Header include
#include "MapTrainerTeamMember.h"
+MapTrainerTeamMember::MapTrainerTeamMember(const MapTrainerTeamMember& teamMember) :
+ Object("MapTrainerTeamMember", teamMember.pokemod(), teamMember.id())
+{
+ *this = teamMember;
+}
+
MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod* pokemod, const int id) :
Object("MapTrainerTeamMember", pokemod, id),
m_species(INT_MAX),
@@ -36,13 +42,13 @@ MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod* pokemod, const int id)
{
}
-MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod* pokemod, const MapTrainerTeamMember& teamMember, const int id) :
+MapTrainerTeamMember::MapTrainerTeamMember(const MapTrainerTeamMember& teamMember, const Pokemod* pokemod, const int id) :
Object("MapTrainerTeamMember", pokemod, id)
{
*this = teamMember;
}
-MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+MapTrainerTeamMember::MapTrainerTeamMember(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("MapTrainerTeamMember", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/MapTrainerTeamMember.h b/pokemod/MapTrainerTeamMember.h
index c91436e7..ee546f8c 100644
--- a/pokemod/MapTrainerTeamMember.h
+++ b/pokemod/MapTrainerTeamMember.h
@@ -33,9 +33,10 @@ class Pokemod;
class MapTrainerTeamMember : public Object
{
public:
+ MapTrainerTeamMember(const MapTrainerTeamMember& teamMember);
MapTrainerTeamMember(const Pokemod* pokemod, const int id);
- MapTrainerTeamMember(const Pokemod* pokemod, const MapTrainerTeamMember& teamMember, const int id);
- MapTrainerTeamMember(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ MapTrainerTeamMember(const MapTrainerTeamMember& teamMember, const Pokemod* pokemod, const int id);
+ MapTrainerTeamMember(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/MapWarp.cpp b/pokemod/MapWarp.cpp
index d23db520..546984ff 100644
--- a/pokemod/MapWarp.cpp
+++ b/pokemod/MapWarp.cpp
@@ -25,6 +25,12 @@
const QStringList MapWarp::TypeStr = QStringList() << "Door/Stair" << "Warp Pad" << "Hole" << "Boundary";
+MapWarp::MapWarp(const MapWarp& warp) :
+ Object("MapWarp", warp.pokemod(), warp.id())
+{
+ *this = warp;
+}
+
MapWarp::MapWarp(const Pokemod* pokemod, const int id) :
Object("MapWarp", pokemod, id),
m_name(""),
@@ -43,13 +49,13 @@ MapWarp::MapWarp(const Pokemod* pokemod, const int id) :
m_from[i] = false;
}
-MapWarp::MapWarp(const Pokemod* pokemod, const MapWarp& warp, const int id) :
+MapWarp::MapWarp(const MapWarp& warp, const Pokemod* pokemod, const int id) :
Object("MapWarp", pokemod, id)
{
*this = warp;
}
-MapWarp::MapWarp(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+MapWarp::MapWarp(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("MapWarp", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h
index 2b243fe3..9885dc1f 100644
--- a/pokemod/MapWarp.h
+++ b/pokemod/MapWarp.h
@@ -44,9 +44,10 @@ class MapWarp : public Object
};
static const QStringList TypeStr;
+ MapWarp(const MapWarp& warp);
MapWarp(const Pokemod* pokemod, const int id);
- MapWarp(const Pokemod* pokemod, const MapWarp& warp, const int id);
- MapWarp(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ MapWarp(const MapWarp& warp, const Pokemod* pokemod, const int id);
+ MapWarp(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index 52a1dc78..07cd46ec 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -16,7 +16,6 @@
*/
// Qt includes
-#include <QDir>
#include <QMap>
// Pokemod includes
@@ -30,6 +29,12 @@
const QStringList MapWildList::ControlStr = QStringList() << "Grass" << "Surfing" << "Fishing" << "Dive" << "Headbutt" << "Rock Smash";
+MapWildList::MapWildList(const MapWildList& wildList) :
+ Object("MapWildList", wildList.pokemod(), wildList.id())
+{
+ *this = wildList;
+}
+
MapWildList::MapWildList(const Pokemod* pokemod, const int id) :
Object("MapWildList", pokemod, id),
m_control(INT_MAX),
@@ -38,13 +43,13 @@ MapWildList::MapWildList(const Pokemod* pokemod, const int id) :
{
}
-MapWildList::MapWildList(const Pokemod* pokemod, const MapWildList& wildList, const int id) :
+MapWildList::MapWildList(const MapWildList& wildList, const Pokemod* pokemod, const int id) :
Object("MapWildList", pokemod, id)
{
*this = wildList;
}
-MapWildList::MapWildList(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+MapWildList::MapWildList(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("MapWildList", pokemod, id)
{
load(xml, id);
@@ -280,13 +285,13 @@ MapWildListEncounter* MapWildList::newEncounter()
MapWildListEncounter* MapWildList::newEncounter(const QDomElement& xml)
{
- m_encounters.append(new MapWildListEncounter(pokemod(), xml, newEncounterId()));
+ m_encounters.append(new MapWildListEncounter(xml, pokemod(), newEncounterId()));
return m_encounters[encounterCount() - 1];
}
MapWildListEncounter* MapWildList::newEncounter(const MapWildListEncounter& encounter)
{
- m_encounters.append(new MapWildListEncounter(pokemod(), encounter, newEncounterId()));
+ m_encounters.append(new MapWildListEncounter(encounter, pokemod(), newEncounterId()));
return m_encounters[encounterCount() - 1];
}
diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h
index 452ce326..2167718d 100644
--- a/pokemod/MapWildList.h
+++ b/pokemod/MapWildList.h
@@ -48,9 +48,10 @@ class MapWildList : public Object
};
static const QStringList ControlStr;
+ MapWildList(const MapWildList& wildList);
MapWildList(const Pokemod* pokemod, const int id);
- MapWildList(const Pokemod* pokemod, const MapWildList& wildList, const int id);
- MapWildList(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ MapWildList(const MapWildList& wildList, const Pokemod* pokemod, const int id);
+ MapWildList(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~MapWildList();
void load(const QDomElement& xml, int id = INT_MAX);
diff --git a/pokemod/MapWildListEncounter.cpp b/pokemod/MapWildListEncounter.cpp
index f2a4dd51..a90b6515 100644
--- a/pokemod/MapWildListEncounter.cpp
+++ b/pokemod/MapWildListEncounter.cpp
@@ -22,6 +22,12 @@
// Header include
#include "MapWildListEncounter.h"
+MapWildListEncounter::MapWildListEncounter(const MapWildListEncounter& encounter) :
+ Object("MapWildListEncounter", encounter.pokemod(), encounter.id())
+{
+ *this = encounter;
+}
+
MapWildListEncounter::MapWildListEncounter(const Pokemod* pokemod, const int id) :
Object("MapWildListEncounter", pokemod, id),
m_species(INT_MAX),
@@ -30,13 +36,13 @@ MapWildListEncounter::MapWildListEncounter(const Pokemod* pokemod, const int id)
{
}
-MapWildListEncounter::MapWildListEncounter(const Pokemod* pokemod, const MapWildListEncounter& encounter, const int id) :
+MapWildListEncounter::MapWildListEncounter(const MapWildListEncounter& encounter, const Pokemod* pokemod, const int id) :
Object("MapWildListEncounter", pokemod, id)
{
*this = encounter;
}
-MapWildListEncounter::MapWildListEncounter(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+MapWildListEncounter::MapWildListEncounter(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("MapWildListEncounter", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/MapWildListEncounter.h b/pokemod/MapWildListEncounter.h
index c3806257..2c0907bd 100644
--- a/pokemod/MapWildListEncounter.h
+++ b/pokemod/MapWildListEncounter.h
@@ -33,9 +33,10 @@ class Pokemod;
class MapWildListEncounter: public Object
{
public:
+ MapWildListEncounter(const MapWildListEncounter& encounter);
MapWildListEncounter(const Pokemod* pokemod, const int id);
- MapWildListEncounter(const Pokemod* pokemod, const MapWildListEncounter& encounter, const int id);
- MapWildListEncounter(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ MapWildListEncounter(const MapWildListEncounter& encounter, const Pokemod* pokemod, const int id);
+ MapWildListEncounter(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp
index 490c8eca..21611be8 100644
--- a/pokemod/Move.cpp
+++ b/pokemod/Move.cpp
@@ -16,7 +16,6 @@
*/
// Qt includes
-#include <QDir>
#include <QMap>
// Pokemod includes
@@ -29,6 +28,12 @@
const QStringList Move::TargetStr = QStringList() << "Player" << "Enemy" << "All" << "Random";
const QStringList Move::ChoiceStr = QStringList() << "Player" << "Enemy" << "Random";
+Move::Move(const Move& move) :
+ Object("Move", move.pokemod(), move.id())
+{
+ *this = move;
+}
+
Move::Move(const Pokemod* pokemod, const int id) :
Object("Move", pokemod, id),
m_name(""),
@@ -49,13 +54,13 @@ Move::Move(const Pokemod* pokemod, const int id) :
{
}
-Move::Move(const Pokemod* pokemod, const Move& move, const int id) :
+Move::Move(const Move& move, const Pokemod* pokemod, const int id) :
Object("Move", pokemod, id)
{
*this = move;
}
-Move::Move(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Move::Move(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Move", pokemod, id)
{
load(xml, id);
@@ -124,7 +129,7 @@ void Move::load(const QDomElement& xml, int id)
{
LOAD_ID();
LOAD(QString, name);
- LOAD(Frac, accuracy);
+ LOAD(Fraction, accuracy);
LOAD(int, power);
LOAD(int, type);
LOAD(bool, special);
@@ -144,7 +149,7 @@ QDomElement Move::save() const
{
SAVE_CREATE();
SAVE(QString, name);
- SAVE(Frac, accuracy);
+ SAVE(Fraction, accuracy);
SAVE(int, power);
SAVE(int, type);
SAVE(bool, special);
@@ -167,7 +172,7 @@ void Move::setName(const QString& name)
m_name = name;
}
-void Move::setAccuracy(const Frac& accuracy) throw(Exception)
+void Move::setAccuracy(const Fraction& accuracy) throw(Exception)
{
m_accuracy = accuracy;
}
@@ -252,7 +257,7 @@ QString Move::name() const
return m_name;
}
-Frac Move::accuracy() const
+Fraction Move::accuracy() const
{
return m_accuracy;
}
@@ -369,13 +374,13 @@ MoveEffect* Move::newEffect()
MoveEffect* Move::newEffect(const QDomElement& xml)
{
- m_effects.append(new MoveEffect(pokemod(), xml, newEffectId()));
+ m_effects.append(new MoveEffect(xml, pokemod(), newEffectId()));
return m_effects[effectCount() - 1];
}
MoveEffect* Move::newEffect(const MoveEffect& effect)
{
- m_effects.append(new MoveEffect(pokemod(), effect, newEffectId()));
+ m_effects.append(new MoveEffect(effect, pokemod(), newEffectId()));
return m_effects[effectCount() - 1];
}
diff --git a/pokemod/Move.h b/pokemod/Move.h
index 92b8aabb..280b7eca 100644
--- a/pokemod/Move.h
+++ b/pokemod/Move.h
@@ -25,7 +25,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -56,16 +56,17 @@ class Move : public Object
};
static const QStringList ChoiceStr;
+ Move(const Move& move);
Move(const Pokemod* pokemod, const int id);
- Move(const Pokemod* pokemod, const Move& move, const int id);
- Move(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Move(const Move& move, const Pokemod* pokemod, const int id);
+ Move(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~Move();
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
void setName(const QString& name);
- void setAccuracy(const Frac& accuracy) throw(Exception);
+ void setAccuracy(const Fraction& accuracy) throw(Exception);
void setPower(const int power);
void setType(const int type) throw(BoundsException);
void setSpecial(const bool special);
@@ -82,7 +83,7 @@ class Move : public Object
void setDescription(const QString& description);
QString name() const;
- Frac accuracy() const;
+ Fraction accuracy() const;
int power() const;
int type() const;
bool special() const;
@@ -121,7 +122,7 @@ class Move : public Object
}
QString m_name;
- Frac m_accuracy;
+ Fraction m_accuracy;
int m_power;
int m_type;
bool m_special;
diff --git a/pokemod/MoveEffect.cpp b/pokemod/MoveEffect.cpp
index 7b656803..e267337b 100644
--- a/pokemod/MoveEffect.cpp
+++ b/pokemod/MoveEffect.cpp
@@ -23,6 +23,12 @@
const QStringList MoveEffect::EffectStr = QStringList() << "Damage" << "Status" << "Confuse" << "Stat" << "StealHP" << "Counter" << "Selfdestruct" << "Need Status" << "Mirror" << "GetMoney" << "Never Miss" << "Steal Types" << "Clear Effects" << "Wait And Return" << "Self Confuse" << "Force Switch" << "Hit Multiple" << "Hit Multiple Turns" << "Flinch" << "One Hit K.O." << "Recoil" << "Recover" << "Rest" << "Sheild" << "Substitute" << "Recharge" << "Rage" << "Mimic" << "Random Move" << "Seed" << "Disable" << "Cut HM" << "Fly HM" << "Surf HM" << "Strength HM" << "Flash HM" << "Rock Smash HM" << "Rock Climb HM" << "Whirlpool HM" << "Waterfall HM" << "Share HP HM " << "Escape HM";
+MoveEffect::MoveEffect(const MoveEffect& effect) :
+ Object("MoveEffect", effect.pokemod(), effect.id())
+{
+ *this = effect;
+}
+
MoveEffect::MoveEffect(const Pokemod* pokemod, const int id) :
Object("MoveEffect", pokemod, id),
m_chance(1, 1),
@@ -34,13 +40,13 @@ MoveEffect::MoveEffect(const Pokemod* pokemod, const int id) :
{
}
-MoveEffect::MoveEffect(const Pokemod* pokemod, const MoveEffect& effect, const int id) :
+MoveEffect::MoveEffect(const MoveEffect& effect, const Pokemod* pokemod, const int id) :
Object("MoveEffect", pokemod, id)
{
*this = effect;
}
-MoveEffect::MoveEffect(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+MoveEffect::MoveEffect(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("MoveEffect", pokemod, id)
{
load(xml, id);
@@ -57,27 +63,27 @@ bool MoveEffect::validate() const
void MoveEffect::load(const QDomElement& xml, int id)
{
LOAD_ID();
- LOAD(Frac, chance);
+ LOAD(Fraction, chance);
LOAD(int, effect);
LOAD(int, value1);
LOAD(int, value2);
LOAD(int, value3);
- LOAD(Frac, value4);
+ LOAD(Fraction, value4);
}
QDomElement MoveEffect::save() const
{
SAVE_CREATE();
- SAVE(Frac, chance);
+ SAVE(Fraction, chance);
SAVE(int, effect);
SAVE(int, value1);
SAVE(int, value2);
SAVE(int, value3);
- SAVE(Frac, value4);
+ SAVE(Fraction, value4);
return xml;
}
-void MoveEffect::setChance(const Frac& chance) throw(Exception)
+void MoveEffect::setChance(const Fraction& chance) throw(Exception)
{
m_chance = chance;
}
@@ -90,7 +96,7 @@ void MoveEffect::setEffect(const int effect) throw(BoundsException)
m_value1 = INT_MAX;
m_value2 = INT_MAX;
m_value3 = 0;
- m_value4.set(1, 1);//, ((effect == E_StealHP) || (effect == E_Counter) || (effect == E_Selfdestruct) || (effect == E_Mirror) || (effect == E_GetMoney) || (effect == E_WaitAndReturn) || (effect == E_Recoil)) ? Frac::Improper : Frac::Proper);
+ m_value4.set(1, 1);//, ((effect == E_StealHP) || (effect == E_Counter) || (effect == E_Selfdestruct) || (effect == E_Mirror) || (effect == E_GetMoney) || (effect == E_WaitAndReturn) || (effect == E_Recoil)) ? Fraction::Improper : Fraction::Proper);
}
void MoveEffect::setValue1(const int value1) throw(Exception)
@@ -152,12 +158,12 @@ void MoveEffect::setValue3(const int value3)
m_value3 = value3;
}
-void MoveEffect::setValue4(const Frac& value4) throw(Exception)
+void MoveEffect::setValue4(const Fraction& value4) throw(Exception)
{
m_value4 = value4;
}
-Frac MoveEffect::chance() const
+Fraction MoveEffect::chance() const
{
return m_chance;
}
@@ -182,7 +188,7 @@ int MoveEffect::value3() const
return m_value3;
}
-Frac MoveEffect::value4() const
+Fraction MoveEffect::value4() const
{
return m_value4;
}
diff --git a/pokemod/MoveEffect.h b/pokemod/MoveEffect.h
index 6c8b8524..13189554 100644
--- a/pokemod/MoveEffect.h
+++ b/pokemod/MoveEffect.h
@@ -24,7 +24,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -112,26 +112,27 @@ class MoveEffect : public Object
};
static const QStringList RecoilStr;
+ MoveEffect(const MoveEffect& effect);
MoveEffect(const Pokemod* pokemod, const int id);
- MoveEffect(const Pokemod* pokemod, const MoveEffect& effect, const int id);
- MoveEffect(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ MoveEffect(const MoveEffect& effect, const Pokemod* pokemod, const int id);
+ MoveEffect(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
- void setChance(const Frac& chance) throw(Exception);
+ void setChance(const Fraction& chance) throw(Exception);
void setEffect(const int effect) throw(BoundsException);
void setValue1(const int value1) throw(Exception);
void setValue2(const int value2) throw(Exception);
void setValue3(const int value3);
- void setValue4(const Frac& value4) throw(Exception);
+ void setValue4(const Fraction& value4) throw(Exception);
- Frac chance() const;
+ Fraction chance() const;
int effect() const;
int value1() const;
int value2() const;
int value3() const;
- Frac value4() const;
+ Fraction value4() const;
MoveEffect& operator=(const MoveEffect& rhs);
private:
@@ -140,12 +141,12 @@ class MoveEffect : public Object
{
}
- Frac m_chance;
+ Fraction m_chance;
int m_effect;
int m_value1;
int m_value2;
int m_value3;
- Frac m_value4;
+ Fraction m_value4;
};
#endif
diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp
index 73164b20..7f84286e 100644
--- a/pokemod/Nature.cpp
+++ b/pokemod/Nature.cpp
@@ -21,22 +21,28 @@
// Header include
#include "Nature.h"
+Nature::Nature(const Nature& nature) :
+ Object("Nature", nature.pokemod(), nature.id())
+{
+ *this = nature;
+}
+
Nature::Nature(const Pokemod* pokemod, const int id) :
Object("Nature", pokemod, id),
m_name(""),
m_weight(1)
{
for (int i = 0; i < Pokemod::ST_End_GSC; ++i)
- m_stat[i].set(1, 1);//, Frac::Improper);
+ m_stat[i].set(1, 1);//, Fraction::Improper);
}
-Nature::Nature(const Pokemod* pokemod, const Nature& nature, const int id) :
+Nature::Nature(const Nature& nature, const Pokemod* pokemod, const int id) :
Object("Nature", pokemod, id)
{
*this = nature;
}
-Nature::Nature(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Nature::Nature(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Nature", pokemod, id)
{
load(xml, id);
@@ -63,7 +69,7 @@ void Nature::load(const QDomElement& xml, int id)
{
LOAD_ID();
LOAD(QString, name);
- LOAD_ARRAY(Frac, stat, Pokemod::ST_End_GSC);
+ LOAD_ARRAY(Fraction, stat, Pokemod::ST_End_GSC);
LOAD(int, weight);
}
@@ -71,7 +77,7 @@ QDomElement Nature::save() const
{
SAVE_CREATE();
SAVE(QString, name);
- SAVE_ARRAY(Frac, stat, Pokemod::ST_End_GSC);
+ SAVE_ARRAY(Fraction, stat, Pokemod::ST_End_GSC);
SAVE(int, weight);
return xml;
}
@@ -81,7 +87,7 @@ void Nature::setName(const QString& name)
m_name = name;
}
-void Nature::setStat(const int stat, const Frac& multiplier) throw(Exception)
+void Nature::setStat(const int stat, const Fraction& multiplier) throw(Exception)
{
if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= stat)
throw(BoundsException(className(), "stat"));
@@ -100,7 +106,7 @@ QString Nature::name() const
return m_name;
}
-Frac Nature::stat(const int stat) const throw(BoundsException)
+Fraction Nature::stat(const int stat) const throw(BoundsException)
{
if ((pokemod()->rules()->specialSplit() ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY) <= stat)
throw(BoundsException(className(), "stat"));
diff --git a/pokemod/Nature.h b/pokemod/Nature.h
index 47bcb2d4..0f468c26 100644
--- a/pokemod/Nature.h
+++ b/pokemod/Nature.h
@@ -23,7 +23,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -32,19 +32,20 @@
class Nature : public Object
{
public:
+ Nature(const Nature& nature);
Nature(const Pokemod* pokemod, const int id);
- Nature(const Pokemod* pokemod, const Nature& nature, const int id);
- Nature(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Nature(const Nature& nature, const Pokemod* pokemod, const int id);
+ Nature(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
void setName(const QString& name);
- void setStat(const int stat, const Frac& multiplier) throw(Exception);
+ void setStat(const int stat, const Fraction& multiplier) throw(Exception);
void setWeight(const int weight) throw(BoundsException);
QString name() const;
- Frac stat(const int stat) const throw(BoundsException);
+ Fraction stat(const int stat) const throw(BoundsException);
int weight() const;
Nature& operator=(const Nature& rhs);
@@ -55,7 +56,7 @@ class Nature : public Object
}
QString m_name;
- Frac m_stat[Pokemod::ST_End_GSC];
+ Fraction m_stat[Pokemod::ST_End_GSC];
int m_weight;
};
diff --git a/pokemod/Object.h b/pokemod/Object.h
index 52b2ea05..8dd29da9 100644
--- a/pokemod/Object.h
+++ b/pokemod/Object.h
@@ -30,6 +30,12 @@ class Pokemod;
class Object
{
public:
+ Object(const Object& object) :
+ m_id(object.id()),
+ m_className(object.className()),
+ m_pokemod(object.pokemod())
+ {
+ }
Object(const QString& className, const Pokemod* pokemod, const int id) :
m_id(id),
m_className(className),
@@ -93,12 +99,12 @@ class Object
#define LOAD_bool(node) ((LOAD_DATA(node) == "true") ? true : false)
#define LOAD_int(node) LOAD_DATA(node).toInt()
#define LOAD_QString LOAD_DATA
-#define LOAD_Frac(node) Frac(node.attribute("numerator", "1").toInt(), node.attribute("denominator", "1").toInt())
+#define LOAD_Fraction(node) Fraction(node.attribute("numerator", "1").toInt(), node.attribute("denominator", "1").toInt())
#define LOAD_Flag(node) Flag(node.attribute("flag", "0").toInt(), node.attribute("status", "1").toInt())
#define LOAD_Point(node) Point(node.attribute("x", "0").toInt(), node.attribute("y", "0").toInt())
// FIXME: QPixmap::fromData static member would be nice
#define LOAD_QPixmap(node) QPixmap::fromImage(QImage::fromData(QByteArray::fromBase64(LOAD_DATA(node).toUtf8())))
-#define LOAD_Rules(node) Rules(this, node)
+#define LOAD_Rules(node) Rules(node, this)
#define LOAD_ARRAY(type, variable, size) \
QDomElement xml_##variable = LOAD_NODE(#variable).firstChildElement("element"); \
while (!xml_##variable.isNull()) \
@@ -152,8 +158,8 @@ class Object
#define SAVE_bool(variable, value) xml_##variable.setNodeValue(value ? "true" : "false")
#define SAVE_int(variable, value) xml_##variable.setNodeValue(QString::number(value))
#define SAVE_QString(variable, value) xml_##variable.setNodeValue(value)
-#define SAVE_Frac(variable, value) \
- Frac frac_##variable = value; \
+#define SAVE_Fraction(variable, value) \
+ Fraction frac_##variable = value; \
xml_##variable.setAttribute("numerator", frac_##variable.numerator()); \
xml_##variable.setAttribute("denominator", frac_##variable.denominator())
#define SAVE_Flag(variable, value) \
@@ -222,6 +228,6 @@ class Object
COPY(variable[i])
#define COPY_SUB(class, variable) \
foreach (class* subclass, rhs.m_##variable) \
- m_##variable.append(new class(pokemod(), *subclass, subclass->id()))
+ m_##variable.append(new class(*subclass, pokemod(), subclass->id()))
#endif
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 6070b9fa..b5cc1cc5 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -63,7 +63,7 @@ Pokemod::Pokemod() :
m_startWarp(INT_MAX),
m_superPCUname(""),
m_superPCPasswd(""),
- m_typeChart(0, 0),//, Frac(1, 1, Frac::Improper)),
+ m_typeChart(0, 0),//, Fraction(1, 1, Fraction::Improper)),
m_rules(this)
{
}
@@ -404,7 +404,7 @@ void Pokemod::load(const QDomElement& xml, const int) throw(Exception)
LOAD_SUB(newTime, times);
LOAD_SUB(newTrainer, trainers);
LOAD_SUB(newType, types);
- LOAD_MATRIX(setTypeChart, Frac, typeChart);
+ LOAD_MATRIX(setTypeChart, Fraction, typeChart);
}
QDomElement Pokemod::save() const
@@ -425,7 +425,7 @@ QDomElement Pokemod::save() const
SAVE(QString, superPCUname);
SAVE(QString, superPCPasswd);
xml.appendChild(m_rules.save());
- SAVE_MATRIX(Frac, typeChart);
+ SAVE_MATRIX(Fraction, typeChart);
SAVE_SUB(Ability, abilities);
SAVE_SUB(Author, authors);
SAVE_SUB(Badge, badges);
@@ -547,7 +547,7 @@ void Pokemod::setSuperPCPasswd(const QString& password)
m_superPCPasswd = password;
}
-void Pokemod::setTypeChart(const int attack, const int defense, const Frac& multiplier) throw(Exception)
+void Pokemod::setTypeChart(const int attack, const int defense, const Fraction& multiplier) throw(Exception)
{
m_typeChart(attack, defense) = multiplier;
}
@@ -627,17 +627,17 @@ QString Pokemod::superPCPasswd() const
return m_superPCPasswd;
}
-const Matrix<Frac>* Pokemod::typeChart() const
+const Matrix<Fraction>* Pokemod::typeChart() const
{
return &m_typeChart;
}
-Matrix<Frac>* Pokemod::typeChart()
+Matrix<Fraction>* Pokemod::typeChart()
{
return &m_typeChart;
}
-Frac Pokemod::typeChart(const int attack, const int defense) const
+Fraction Pokemod::typeChart(const int attack, const int defense) const
{
return m_typeChart(attack, defense);
}
@@ -699,13 +699,13 @@ Ability* Pokemod::newAbility()
Ability* Pokemod::newAbility(const QDomElement& xml)
{
- m_abilities.append(new Ability(this, xml, newAbilityId()));
+ m_abilities.append(new Ability(xml, this, newAbilityId()));
return m_abilities[abilityCount() - 1];
}
Ability* Pokemod::newAbility(const Ability& ability)
{
- m_abilities.append(new Ability(this, ability, newAbilityId()));
+ m_abilities.append(new Ability(ability, this, newAbilityId()));
return m_abilities[abilityCount() - 1];
}
@@ -777,13 +777,13 @@ Author* Pokemod::newAuthor()
Author* Pokemod::newAuthor(const QDomElement& xml)
{
- m_authors.append(new Author(this, xml, newAuthorId()));
+ m_authors.append(new Author(xml, this, newAuthorId()));
return m_authors[authorCount() - 1];
}
Author* Pokemod::newAuthor(const Author& author)
{
- m_authors.append(new Author(this, author, newAuthorId()));
+ m_authors.append(new Author(author, this, newAuthorId()));
return m_authors[authorCount() - 1];
}
@@ -855,13 +855,13 @@ Badge* Pokemod::newBadge()
Badge* Pokemod::newBadge(const QDomElement& xml)
{
- m_badges.append(new Badge(this, xml, newBadgeId()));
+ m_badges.append(new Badge(xml, this, newBadgeId()));
return m_badges[badgeCount() - 1];
}
Badge* Pokemod::newBadge(const Badge& badge)
{
- m_badges.append(new Badge(this, badge, newBadgeId()));
+ m_badges.append(new Badge(badge, this, newBadgeId()));
return m_badges[badgeCount() - 1];
}
@@ -933,13 +933,13 @@ CoinList* Pokemod::newCoinList()
CoinList* Pokemod::newCoinList(const QDomElement& xml)
{
- m_coinLists.append(new CoinList(this, xml, newCoinListId()));
+ m_coinLists.append(new CoinList(xml, this, newCoinListId()));
return m_coinLists[coinListCount() - 1];
}
CoinList* Pokemod::newCoinList(const CoinList& coinList)
{
- m_coinLists.append(new CoinList(this, coinList, newCoinListId()));
+ m_coinLists.append(new CoinList(coinList, this, newCoinListId()));
return m_coinLists[coinListCount() - 1];
}
@@ -1011,13 +1011,13 @@ Dialog* Pokemod::newDialog()
Dialog* Pokemod::newDialog(const QDomElement& xml)
{
- m_dialogs.append(new Dialog(this, xml, newDialogId()));
+ m_dialogs.append(new Dialog(xml, this, newDialogId()));
return m_dialogs[dialogCount() - 1];
}
Dialog* Pokemod::newDialog(const Dialog& dialog)
{
- m_dialogs.append(new Dialog(this, dialog, newDialogId()));
+ m_dialogs.append(new Dialog(dialog, this, newDialogId()));
return m_dialogs[dialogCount() - 1];
}
@@ -1089,13 +1089,13 @@ EggGroup* Pokemod::newEggGroup()
EggGroup* Pokemod::newEggGroup(const QDomElement& xml)
{
- m_eggGroups.append(new EggGroup(this, xml, newEggGroupId()));
+ m_eggGroups.append(new EggGroup(xml, this, newEggGroupId()));
return m_eggGroups[eggGroupCount() - 1];
}
EggGroup* Pokemod::newEggGroup(const EggGroup& eggGroup)
{
- m_eggGroups.append(new EggGroup(this, eggGroup, newEggGroupId()));
+ m_eggGroups.append(new EggGroup(eggGroup, this, newEggGroupId()));
return m_eggGroups[eggGroupCount() - 1];
}
@@ -1167,13 +1167,13 @@ Item* Pokemod::newItem()
Item* Pokemod::newItem(const QDomElement& xml)
{
- m_items.append(new Item(this, xml, newItemId()));
+ m_items.append(new Item(xml, this, newItemId()));
return m_items[itemCount() - 1];
}
Item* Pokemod::newItem(const Item& item)
{
- m_items.append(new Item(this, item, newItemId()));
+ m_items.append(new Item(item, this, newItemId()));
return m_items[itemCount() - 1];
}
@@ -1245,13 +1245,13 @@ ItemType* Pokemod::newItemType()
ItemType* Pokemod::newItemType(const QDomElement& xml)
{
- m_itemTypes.append(new ItemType(this, xml, newItemTypeId()));
+ m_itemTypes.append(new ItemType(xml, this, newItemTypeId()));
return m_itemTypes[itemTypeCount() - 1];
}
ItemType* Pokemod::newItemType(const ItemType& itemType)
{
- m_itemTypes.append(new ItemType(this, itemType, newItemTypeId()));
+ m_itemTypes.append(new ItemType(itemType, this, newItemTypeId()));
return m_itemTypes[itemTypeCount() - 1];
}
@@ -1323,13 +1323,13 @@ Map* Pokemod::newMap()
Map* Pokemod::newMap(const QDomElement& xml)
{
- m_maps.append(new Map(this, xml, newMapId()));
+ m_maps.append(new Map(xml, this, newMapId()));
return m_maps[mapCount() - 1];
}
Map* Pokemod::newMap(const Map& map)
{
- m_maps.append(new Map(this, map, newMapId()));
+ m_maps.append(new Map(map, this, newMapId()));
return m_maps[mapCount() - 1];
}
@@ -1401,13 +1401,13 @@ Move* Pokemod::newMove()
Move* Pokemod::newMove(const QDomElement& xml)
{
- m_moves.append(new Move(this, xml, newMoveId()));
+ m_moves.append(new Move(xml, this, newMoveId()));
return m_moves[moveCount() - 1];
}
Move* Pokemod::newMove(const Move& move)
{
- m_moves.append(new Move(this, move, newMoveId()));
+ m_moves.append(new Move(move, this, newMoveId()));
return m_moves[moveCount() - 1];
}
@@ -1479,13 +1479,13 @@ Nature* Pokemod::newNature()
Nature* Pokemod::newNature(const QDomElement& xml)
{
- m_natures.append(new Nature(this, xml, newNatureId()));
+ m_natures.append(new Nature(xml, this, newNatureId()));
return m_natures[natureCount() - 1];
}
Nature* Pokemod::newNature(const Nature& nature)
{
- m_natures.append(new Nature(this, nature, newNatureId()));
+ m_natures.append(new Nature(nature, this, newNatureId()));
return m_natures[natureCount() - 1];
}
@@ -1557,13 +1557,13 @@ Species* Pokemod::newSpecies()
Species* Pokemod::newSpecies(const QDomElement& xml)
{
- m_species.append(new Species(this, xml, newSpeciesId()));
+ m_species.append(new Species(xml, this, newSpeciesId()));
return m_species[speciesCount() - 1];
}
Species* Pokemod::newSpecies(const Species& species)
{
- m_species.append(new Species(this, species, newSpeciesId()));
+ m_species.append(new Species(species, this, newSpeciesId()));
return m_species[speciesCount() - 1];
}
@@ -1635,13 +1635,13 @@ Store* Pokemod::newStore()
Store* Pokemod::newStore(const QDomElement& xml)
{
- m_stores.append(new Store(this, xml, newStoreId()));
+ m_stores.append(new Store(xml, this, newStoreId()));
return m_stores[storeCount() - 1];
}
Store* Pokemod::newStore(const Store& store)
{
- m_stores.append(new Store(this, store, newStoreId()));
+ m_stores.append(new Store(store, this, newStoreId()));
return m_stores[storeCount() - 1];
}
@@ -1713,13 +1713,13 @@ Tile* Pokemod::newTile()
Tile* Pokemod::newTile(const QDomElement& xml)
{
- m_tiles.append(new Tile(this, xml, newTileId()));
+ m_tiles.append(new Tile(xml, this, newTileId()));
return m_tiles[tileCount() - 1];
}
Tile* Pokemod::newTile(const Tile& tile)
{
- m_tiles.append(new Tile(this, tile, newTileId()));
+ m_tiles.append(new Tile(tile, this, newTileId()));
return m_tiles[tileCount() - 1];
}
@@ -1791,13 +1791,13 @@ Time* Pokemod::newTime()
Time* Pokemod::newTime(const QDomElement& xml)
{
- m_times.append(new Time(this, xml, newTimeId()));
+ m_times.append(new Time(xml, this, newTimeId()));
return m_times[timeCount() - 1];
}
Time* Pokemod::newTime(const Time& time)
{
- m_times.append(new Time(this, time, newTimeId()));
+ m_times.append(new Time(time, this, newTimeId()));
return m_times[timeCount() - 1];
}
@@ -1869,13 +1869,13 @@ Trainer* Pokemod::newTrainer()
Trainer* Pokemod::newTrainer(const QDomElement& xml)
{
- m_trainers.append(new Trainer(this, xml, newTrainerId()));
+ m_trainers.append(new Trainer(xml, this, newTrainerId()));
return m_trainers[trainerCount() - 1];
}
Trainer* Pokemod::newTrainer(const Trainer& trainer)
{
- m_trainers.append(new Trainer(this, trainer, newTrainerId()));
+ m_trainers.append(new Trainer(trainer, this, newTrainerId()));
return m_trainers[trainerCount() - 1];
}
@@ -1943,25 +1943,25 @@ Type* Pokemod::newType()
{
int i;
m_types.append(new Type(this, i = newTypeId()));
- m_typeChart.addColumn(Frac(1, 1));
- m_typeChart.addRow(Frac(1, 1));
+ m_typeChart.addColumn(Fraction(1, 1));
+ m_typeChart.addRow(Fraction(1, 1));
return m_types[typeCount() - 1];
}
Type* Pokemod::newType(const QDomElement& xml)
{
int i;
- m_types.append(new Type(this, xml, i = newTypeId()));
- m_typeChart.addColumn(Frac(1, 1));
- m_typeChart.addRow(Frac(1, 1));
+ m_types.append(new Type(xml, this, i = newTypeId()));
+ m_typeChart.addColumn(Fraction(1, 1));
+ m_typeChart.addRow(Fraction(1, 1));
return m_types[typeCount() - 1];
}
Type* Pokemod::newType(const Type& type)
{
- m_types.append(new Type(this, type, newTypeId()));
- m_typeChart.addColumn(Frac(1, 1));
- m_typeChart.addRow(Frac(1, 1));
+ m_types.append(new Type(type, this, newTypeId()));
+ m_typeChart.addColumn(Fraction(1, 1));
+ m_typeChart.addRow(Fraction(1, 1));
return m_types[typeCount() - 1];
}
diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h
index 72e147bb..ff771269 100644
--- a/pokemod/Pokemod.h
+++ b/pokemod/Pokemod.h
@@ -26,7 +26,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
#include <Matrix.h>
#include <Point.h>
@@ -188,7 +188,7 @@ class Pokemod : public Object
void setSurfFishSkin(const QPixmap& surfFishSkin) throw(Exception);
void setSuperPCUname(const QString& username);
void setSuperPCPasswd(const QString& password);
- void setTypeChart(const int attack, const int defense, const Frac& multiplier) throw(Exception);
+ void setTypeChart(const int attack, const int defense, const Fraction& multiplier) throw(Exception);
void setRules(const Rules& rules);
void setRules(const QDomElement& xml);
@@ -205,9 +205,9 @@ class Pokemod : public Object
QPixmap surfFishSkin() const;
QString superPCUname() const;
QString superPCPasswd() const;
- const Matrix<Frac>* typeChart() const;
- Matrix<Frac>* typeChart();
- Frac typeChart(const int attack, const int defense) const;
+ const Matrix<Fraction>* typeChart() const;
+ Matrix<Fraction>* typeChart();
+ Fraction typeChart(const int attack, const int defense) const;
const Rules* rules() const;
Rules* rules();
@@ -490,7 +490,7 @@ class Pokemod : public Object
QPixmap m_surfFishSkin;
QString m_superPCUname;
QString m_superPCPasswd;
- Matrix<Frac> m_typeChart;
+ Matrix<Fraction> m_typeChart;
Rules m_rules;
QList<Ability*> m_abilities;
QList<Author*> m_authors;
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index 89288b5c..dfc940c9 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -23,6 +23,12 @@
const QStringList Rules::DVStr = QStringList() << "16" << "32";
+Rules::Rules(const Rules& rules) :
+ Object("Rules", rules.pokemod(), 0)
+{
+ *this = rules;
+}
+
Rules::Rules(const Pokemod* pokemod) :
Object("Rules", pokemod, 0),
m_genderAllowed(false),
@@ -54,13 +60,13 @@ Rules::Rules(const Pokemod* pokemod) :
{
}
-Rules::Rules(const Pokemod* pokemod, const Rules& rules) :
+Rules::Rules(const Rules& rules, const Pokemod* pokemod) :
Object("Rules", pokemod, 0)
{
*this = rules;
}
-Rules::Rules(const Pokemod* pokemod, const QDomElement& xml) :
+Rules::Rules(const QDomElement& xml, const Pokemod* pokemod) :
Object("Rules", pokemod, 0)
{
load(xml);
@@ -145,7 +151,7 @@ void Rules::load(const QDomElement& xml, const int) throw(Exception)
LOAD(bool, effortValuesAllowed);
LOAD(int, maxTotalEV);
LOAD(int, maxEVPerStat);
- LOAD(Frac, pokerusChance);
+ LOAD(Fraction, pokerusChance);
}
QDomElement Rules::save() const
@@ -177,7 +183,7 @@ QDomElement Rules::save() const
SAVE(bool, effortValuesAllowed);
SAVE(int, maxTotalEV);
SAVE(int, maxEVPerStat);
- SAVE(Frac, pokerusChance);
+ SAVE(Fraction, pokerusChance);
return xml;
}
@@ -328,9 +334,9 @@ void Rules::setMaxEVPerStat(const int maxEVPerStat) throw(BoundsException)
m_maxEVPerStat = maxEVPerStat;
}
-void Rules::setPokerusChance(const int numerator, const int denominator) throw(Exception)
+void Rules::setPokerusChance(const Fraction& pokerusChance) throw(Exception)
{
- m_pokerusChance.set(numerator, denominator);
+ m_pokerusChance = pokerusChance;
}
bool Rules::genderAllowed() const
@@ -458,7 +464,7 @@ int Rules::maxEVPerStat() const
return m_maxEVPerStat;
}
-Frac Rules::pokerusChance() const
+Fraction Rules::pokerusChance() const
{
return m_pokerusChance;
}
diff --git a/pokemod/Rules.h b/pokemod/Rules.h
index b5ecf53d..2268d6c0 100644
--- a/pokemod/Rules.h
+++ b/pokemod/Rules.h
@@ -23,7 +23,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -36,9 +36,10 @@ class Rules : public Object
public:
static const QStringList DVStr;
+ Rules(const Rules& rules);
Rules(const Pokemod* pokemod);
- Rules(const Pokemod* pokemod, const Rules& rules);
- Rules(const Pokemod* pokemod, const QDomElement& xml);
+ Rules(const Rules& rules, const Pokemod* pokemod);
+ Rules(const QDomElement& xml, const Pokemod* pokemod);
void load(const QDomElement& xml, const int = 0) throw(Exception);
QDomElement save() const;
@@ -68,7 +69,7 @@ class Rules : public Object
void setEffortValuesAllowed(const bool effortValues);
void setMaxTotalEV(const int maxTotalEV) throw(BoundsException);
void setMaxEVPerStat(const int maxEVPerStat) throw(BoundsException);
- void setPokerusChance(const int numerator, const int denominator) throw(Exception);
+ void setPokerusChance(const Fraction& pokerusChance) throw(Exception);
bool genderAllowed() const;
bool breedingAllowed() const;
@@ -95,7 +96,7 @@ class Rules : public Object
bool effortValuesAllowed() const;
int maxTotalEV() const;
int maxEVPerStat() const;
- Frac pokerusChance() const;
+ Fraction pokerusChance() const;
Rules& operator=(const Rules& rhs);
private:
@@ -129,7 +130,7 @@ class Rules : public Object
bool m_effortValuesAllowed;
int m_maxTotalEV;
int m_maxEVPerStat;
- Frac m_pokerusChance;
+ Fraction m_pokerusChance;
};
#endif
diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp
index 57022c52..34141db4 100644
--- a/pokemod/Species.cpp
+++ b/pokemod/Species.cpp
@@ -17,7 +17,6 @@
// Qt includes
#include <QBuffer>
-#include <QDir>
#include <QMap>
// Pokemod includes
@@ -32,6 +31,12 @@
const QStringList Species::StyleStr = QStringList() << "Fluctuating" << "Fading" << "Slow" << "Normal" << "Fast" << "Erratic";
+Species::Species(const Species& species) :
+ Object("Species", species.pokemod(), species.id())
+{
+ *this = species;
+}
+
Species::Species(const Pokemod* pokemod, const int id) :
Object("Species", pokemod, id),
m_name(""),
@@ -57,13 +62,13 @@ Species::Species(const Pokemod* pokemod, const int id) :
}
}
-Species::Species(const Pokemod* pokemod, const Species& species, const int id) :
+Species::Species(const Species& species, const Pokemod* pokemod, const int id) :
Object("Species", pokemod, id)
{
*this = species;
}
-Species::Species(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Species::Species(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Species", pokemod, id)
{
load(xml, id);
@@ -226,15 +231,15 @@ void Species::load(const QDomElement& xml, int id)
LOAD(int, growth);
LOAD(int, experienceValue);
LOAD(int, catchValue);
- LOAD(Frac,runChance);
- LOAD(Frac, fleeChance);
- LOAD(Frac, itemChance);
+ LOAD(Fraction,runChance);
+ LOAD(Fraction, fleeChance);
+ LOAD(Fraction, itemChance);
LOAD(int, pokedexNumber);
LOAD(int, weight);
LOAD(int, heightFeet);
LOAD(int, heightInches);
LOAD(QString, pokedexEntry);
- LOAD(Frac, genderFactor);
+ LOAD(Fraction, genderFactor);
LOAD(int, eggSpecies);
LOAD(int, eggSteps);
LOAD(int, nidoranGroup);
@@ -255,15 +260,15 @@ QDomElement Species::save() const
SAVE(int, growth);
SAVE(int, experienceValue);
SAVE(int, catchValue);
- SAVE(Frac,runChance);
- SAVE(Frac, fleeChance);
- SAVE(Frac, itemChance);
+ SAVE(Fraction,runChance);
+ SAVE(Fraction, fleeChance);
+ SAVE(Fraction, itemChance);
SAVE(int, pokedexNumber);
SAVE(int, weight);
SAVE(int, heightFeet);
SAVE(int, heightInches);
SAVE(QString, pokedexEntry);
- SAVE(Frac, genderFactor);
+ SAVE(Fraction, genderFactor);
SAVE(int, eggSpecies);
SAVE(int, eggSteps);
SAVE(int, nidoranGroup);
@@ -318,17 +323,17 @@ void Species::setCatchValue(const int catchValue) throw(BoundsException)
m_catchValue = catchValue;
}
-void Species::setRunChance(const Frac& runChance) throw(Exception)
+void Species::setRunChance(const Fraction& runChance) throw(Exception)
{
m_runChance = runChance;
}
-void Species::setFleeChance(const Frac& fleeChance) throw(Exception)
+void Species::setFleeChance(const Fraction& fleeChance) throw(Exception)
{
m_fleeChance = fleeChance;
}
-void Species::setItemChance(const Frac& itemChance) throw(Exception)
+void Species::setItemChance(const Fraction& itemChance) throw(Exception)
{
m_itemChance = itemChance;
}
@@ -398,7 +403,7 @@ void Species::setListSprite(const QPixmap& listSprite) throw(Exception)
m_listSprite = listSprite;
}
-void Species::setGenderFactor(const Frac& genderFactor) throw(Exception)
+void Species::setGenderFactor(const Fraction& genderFactor) throw(Exception)
{
m_genderFactor = genderFactor;
}
@@ -480,17 +485,17 @@ int Species::catchValue() const
return m_catchValue;
}
-Frac Species::runChance() const
+Fraction Species::runChance() const
{
return m_runChance;
}
-Frac Species::fleeChance() const
+Fraction Species::fleeChance() const
{
return m_fleeChance;
}
-Frac Species::itemChance() const
+Fraction Species::itemChance() const
{
return m_itemChance;
}
@@ -545,7 +550,7 @@ QPixmap Species::listSprite() const
return m_listSprite;
}
-Frac Species::genderFactor() const
+Fraction Species::genderFactor() const
{
return m_genderFactor;
}
@@ -622,13 +627,13 @@ SpeciesAbility* Species::newAbility()
SpeciesAbility* Species::newAbility(const QDomElement& xml)
{
- m_abilities.append(new SpeciesAbility(pokemod(), xml, newAbilityId()));
+ m_abilities.append(new SpeciesAbility(xml, pokemod(), newAbilityId()));
return m_abilities[abilityCount() - 1];
}
SpeciesAbility* Species::newAbility(const SpeciesAbility& ability)
{
- m_abilities.append(new SpeciesAbility(pokemod(), ability, newAbilityId()));
+ m_abilities.append(new SpeciesAbility(ability, pokemod(), newAbilityId()));
return m_abilities[abilityCount() - 1];
}
@@ -700,13 +705,13 @@ SpeciesEvolution* Species::newEvolution()
SpeciesEvolution* Species::newEvolution(const QDomElement& xml)
{
- m_evolutions.append(new SpeciesEvolution(pokemod(), xml, newEvolutionId()));
+ m_evolutions.append(new SpeciesEvolution(xml, pokemod(), newEvolutionId()));
return m_evolutions[evolutionCount() - 1];
}
SpeciesEvolution* Species::newEvolution(const SpeciesEvolution& evolution)
{
- m_evolutions.append(new SpeciesEvolution(pokemod(), evolution, newEvolutionId()));
+ m_evolutions.append(new SpeciesEvolution(evolution, pokemod(), newEvolutionId()));
return m_evolutions[evolutionCount() - 1];
}
@@ -778,13 +783,13 @@ SpeciesItem* Species::newItem()
SpeciesItem* Species::newItem(const QDomElement& xml)
{
- m_items.append(new SpeciesItem(pokemod(), xml, newItemId()));
+ m_items.append(new SpeciesItem(xml, pokemod(), newItemId()));
return m_items[itemCount() - 1];
}
SpeciesItem* Species::newItem(const SpeciesItem& item)
{
- m_items.append(new SpeciesItem(pokemod(), item, newItemId()));
+ m_items.append(new SpeciesItem(item, pokemod(), newItemId()));
return m_items[itemCount() - 1];
}
@@ -856,13 +861,13 @@ SpeciesMove* Species::newMove()
SpeciesMove* Species::newMove(const QDomElement& xml)
{
- m_moves.append(new SpeciesMove(pokemod(), xml, newMoveId()));
+ m_moves.append(new SpeciesMove(xml, pokemod(), newMoveId()));
return m_moves[moveCount() - 1];
}
SpeciesMove* Species::newMove(const SpeciesMove& move)
{
- m_moves.append(new SpeciesMove(pokemod(), move, newMoveId()));
+ m_moves.append(new SpeciesMove(move, pokemod(), newMoveId()));
return m_moves[moveCount() - 1];
}
diff --git a/pokemod/Species.h b/pokemod/Species.h
index 42956a57..58e082dd 100644
--- a/pokemod/Species.h
+++ b/pokemod/Species.h
@@ -25,7 +25,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -52,9 +52,10 @@ class Species : public Object
};
static const QStringList StyleStr;
+ Species(const Species& species);
Species(const Pokemod* pokemod, const int id);
- Species(const Pokemod* pokemod, const Species& species, const int id);
- Species(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Species(const Species& species, const Pokemod* pokemod, const int id);
+ Species(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
~Species();
void load(const QDomElement& xml, int id = INT_MAX);
@@ -66,9 +67,9 @@ class Species : public Object
void setGrowth(const int growth) throw(BoundsException);
void setExperienceValue(const int experienceValue);
void setCatchValue(const int catchValue) throw(BoundsException);
- void setRunChance(const Frac& runChance) throw(Exception);
- void setFleeChance(const Frac& fleeChance) throw(Exception);
- void setItemChance(const Frac& itemChance) throw(Exception);
+ void setRunChance(const Fraction& runChance) throw(Exception);
+ void setFleeChance(const Fraction& fleeChance) throw(Exception);
+ void setItemChance(const Fraction& itemChance) throw(Exception);
void setPokedexNumber(const int pokedexNumber);
void setWeight(const int weight);
void setHeightFeet(const int feet);
@@ -79,7 +80,7 @@ class Species : public Object
void setFrontFemaleSprite(const QPixmap& frontFemaleSprite) throw(Exception);
void setBackFemaleSprite(const QPixmap& backFemaleSprite) throw(Exception);
void setListSprite(const QPixmap& listSprite) throw(Exception);
- void setGenderFactor(const Frac& genderFactor) throw(Exception);
+ void setGenderFactor(const Fraction& genderFactor) throw(Exception);
void setEggSpecies(const int eggSpecies) throw(BoundsException);
void setEggSteps(const int eggSteps);
void setNidoranGroup(const int nidoranGroup);
@@ -92,9 +93,9 @@ class Species : public Object
int growth() const;
int experienceValue() const;
int catchValue() const;
- Frac runChance() const;
- Frac fleeChance() const;
- Frac itemChance() const;
+ Fraction runChance() const;
+ Fraction fleeChance() const;
+ Fraction itemChance() const;
int pokedexNumber() const;
int weight() const;
int heightFeet() const;
@@ -105,7 +106,7 @@ class Species : public Object
QPixmap frontFemaleSprite() const;
QPixmap backFemaleSprite() const;
QPixmap listSprite() const;
- Frac genderFactor() const;
+ Fraction genderFactor() const;
int eggSpecies() const;
int eggSteps() const;
int nidoranGroup() const;
@@ -185,9 +186,9 @@ class Species : public Object
int m_growth;
int m_experienceValue;
int m_catchValue;
- Frac m_runChance;
- Frac m_fleeChance;
- Frac m_itemChance;
+ Fraction m_runChance;
+ Fraction m_fleeChance;
+ Fraction m_itemChance;
int m_pokedexNumber;
int m_weight;
int m_heightFeet;
@@ -198,7 +199,7 @@ class Species : public Object
QPixmap m_backFemaleSprite;
QPixmap m_listSprite;
QString m_pokedexEntry;
- Frac m_genderFactor;
+ Fraction m_genderFactor;
int m_eggSpecies;
int m_eggSteps;
int m_nidoranGroup;
diff --git a/pokemod/SpeciesAbility.cpp b/pokemod/SpeciesAbility.cpp
index f41c3924..0dda3ccf 100644
--- a/pokemod/SpeciesAbility.cpp
+++ b/pokemod/SpeciesAbility.cpp
@@ -21,6 +21,12 @@
// Header include
#include "SpeciesAbility.h"
+SpeciesAbility::SpeciesAbility(const SpeciesAbility& ability) :
+ Object("SpeciesAbility", ability.pokemod(), ability.id())
+{
+ *this = ability;
+}
+
SpeciesAbility::SpeciesAbility(const Pokemod* pokemod, const int id) :
Object("SpeciesAbility", pokemod, id),
m_ability(INT_MAX),
@@ -28,13 +34,13 @@ SpeciesAbility::SpeciesAbility(const Pokemod* pokemod, const int id) :
{
}
-SpeciesAbility::SpeciesAbility(const Pokemod* pokemod, const SpeciesAbility& ability, const int id) :
+SpeciesAbility::SpeciesAbility(const SpeciesAbility& ability, const Pokemod* pokemod, const int id) :
Object("SpeciesAbility", pokemod, id)
{
*this = ability;
}
-SpeciesAbility::SpeciesAbility(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+SpeciesAbility::SpeciesAbility(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("SpeciesAbility", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/SpeciesAbility.h b/pokemod/SpeciesAbility.h
index 3089f3cc..35830fbe 100644
--- a/pokemod/SpeciesAbility.h
+++ b/pokemod/SpeciesAbility.h
@@ -33,9 +33,10 @@ class Pokemod;
class SpeciesAbility : public Object
{
public:
+ SpeciesAbility(const SpeciesAbility& ability);
SpeciesAbility(const Pokemod* pokemod, const int id);
- SpeciesAbility(const Pokemod* pokemod, const SpeciesAbility& ability, const int id);
- SpeciesAbility(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ SpeciesAbility(const SpeciesAbility& ability, const Pokemod* pokemod, const int id);
+ SpeciesAbility(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp
index 64bfb5fd..62df543b 100644
--- a/pokemod/SpeciesEvolution.cpp
+++ b/pokemod/SpeciesEvolution.cpp
@@ -26,6 +26,12 @@
const QStringList SpeciesEvolution::StyleStr = QStringList() << "Level" << "Happiness" << "Stat" << "Item" << "Trade" << "TradeItem" << "Personality" << "Spare Slot";
const QStringList SpeciesEvolution::GiveHoldStr = QStringList() <<"Give" << "Hold";
+SpeciesEvolution::SpeciesEvolution(const SpeciesEvolution& evolution) :
+ Object("SpeciesEvolution", evolution.pokemod(), evolution.id())
+{
+ *this = evolution;
+}
+
SpeciesEvolution::SpeciesEvolution(const Pokemod* pokemod, const int id) :
Object("SpeciesEvolution", pokemod, id),
m_species(INT_MAX),
@@ -37,13 +43,13 @@ SpeciesEvolution::SpeciesEvolution(const Pokemod* pokemod, const int id) :
{
}
-SpeciesEvolution::SpeciesEvolution(const Pokemod* pokemod, const SpeciesEvolution& evolution, const int id) :
+SpeciesEvolution::SpeciesEvolution(const SpeciesEvolution& evolution, const Pokemod* pokemod, const int id) :
Object("SpeciesEvolution", pokemod, id)
{
*this = evolution;
}
-SpeciesEvolution::SpeciesEvolution(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+SpeciesEvolution::SpeciesEvolution(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("SpeciesEvolution", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/SpeciesEvolution.h b/pokemod/SpeciesEvolution.h
index 8cef1117..47683139 100644
--- a/pokemod/SpeciesEvolution.h
+++ b/pokemod/SpeciesEvolution.h
@@ -56,9 +56,10 @@ class SpeciesEvolution : public Object
};
static const QStringList GiveHoldStr;
+ SpeciesEvolution(const SpeciesEvolution& evolution);
SpeciesEvolution(const Pokemod* pokemod, const int id);
- SpeciesEvolution(const Pokemod* pokemod, const SpeciesEvolution& evolution, const int id);
- SpeciesEvolution(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ SpeciesEvolution(const SpeciesEvolution& evolution, const Pokemod* pokemod, const int id);
+ SpeciesEvolution(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/SpeciesItem.cpp b/pokemod/SpeciesItem.cpp
index ad646883..1a015df0 100644
--- a/pokemod/SpeciesItem.cpp
+++ b/pokemod/SpeciesItem.cpp
@@ -21,6 +21,12 @@
// Header include
#include "SpeciesItem.h"
+SpeciesItem::SpeciesItem(const SpeciesItem& item) :
+ Object("SpeciesItem", item.pokemod(), item.id())
+{
+ *this = item;
+}
+
SpeciesItem::SpeciesItem(const Pokemod* pokemod, const int id) :
Object("SpeciesItem", pokemod, id),
m_item(INT_MAX),
@@ -28,13 +34,13 @@ SpeciesItem::SpeciesItem(const Pokemod* pokemod, const int id) :
{
}
-SpeciesItem::SpeciesItem(const Pokemod* pokemod, const SpeciesItem& item, const int id) :
+SpeciesItem::SpeciesItem(const SpeciesItem& item, const Pokemod* pokemod, const int id) :
Object("SpeciesItem", pokemod, id)
{
*this = item;
}
-SpeciesItem::SpeciesItem(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+SpeciesItem::SpeciesItem(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("SpeciesItem", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/SpeciesItem.h b/pokemod/SpeciesItem.h
index 1b6bb54c..d858e3e0 100644
--- a/pokemod/SpeciesItem.h
+++ b/pokemod/SpeciesItem.h
@@ -33,9 +33,10 @@ class Pokemod;
class SpeciesItem : public Object
{
public:
+ SpeciesItem(const SpeciesItem& item);
SpeciesItem(const Pokemod* pokemod, const int id);
- SpeciesItem(const Pokemod* pokemod, const SpeciesItem& item, const int id);
- SpeciesItem(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ SpeciesItem(const SpeciesItem& item, const Pokemod* pokemod, const int id);
+ SpeciesItem(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp
index 5b24b483..287474eb 100644
--- a/pokemod/SpeciesMove.cpp
+++ b/pokemod/SpeciesMove.cpp
@@ -21,6 +21,12 @@
// Header include
#include "SpeciesMove.h"
+SpeciesMove::SpeciesMove(const SpeciesMove& move) :
+ Object("SpeciesMove", move.pokemod(), move.id())
+{
+ *this = move;
+}
+
SpeciesMove::SpeciesMove(const Pokemod* pokemod, const int id) :
Object("SpeciesMove", pokemod, id),
m_move(INT_MAX),
@@ -29,13 +35,13 @@ SpeciesMove::SpeciesMove(const Pokemod* pokemod, const int id) :
{
}
-SpeciesMove::SpeciesMove(const Pokemod* pokemod, const SpeciesMove& move, const int id) :
+SpeciesMove::SpeciesMove(const SpeciesMove& move, const Pokemod* pokemod, const int id) :
Object("SpeciesMove", pokemod, id)
{
*this = move;
}
-SpeciesMove::SpeciesMove(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+SpeciesMove::SpeciesMove(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("SpeciesMove", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/SpeciesMove.h b/pokemod/SpeciesMove.h
index b84cea15..b257d757 100644
--- a/pokemod/SpeciesMove.h
+++ b/pokemod/SpeciesMove.h
@@ -33,9 +33,10 @@ class Pokemod;
class SpeciesMove : public Object
{
public:
+ SpeciesMove(const SpeciesMove& move);
SpeciesMove(const Pokemod* pokemod, const int id);
- SpeciesMove(const Pokemod* pokemod, const SpeciesMove& move, const int id);
- SpeciesMove(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ SpeciesMove(const SpeciesMove& move, const Pokemod* pokemod, const int id);
+ SpeciesMove(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Store.cpp b/pokemod/Store.cpp
index 37e1b3fa..a3f6e37a 100644
--- a/pokemod/Store.cpp
+++ b/pokemod/Store.cpp
@@ -24,19 +24,25 @@
// Header include
#include "Store.h"
+Store::Store(const Store& store) :
+ Object("Store", store.pokemod(), store.id())
+{
+ *this = store;
+}
+
Store::Store(const Pokemod* pokemod, const int id) :
Object("Store", pokemod, id),
m_name("")
{
}
-Store::Store(const Pokemod* pokemod, const Store& store, const int id) :
+Store::Store(const Store& store, const Pokemod* pokemod, const int id) :
Object("Store", pokemod, id)
{
*this = store;
}
-Store::Store(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Store::Store(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Store", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/Store.h b/pokemod/Store.h
index a2a970ef..e3a234e6 100644
--- a/pokemod/Store.h
+++ b/pokemod/Store.h
@@ -34,9 +34,10 @@ class Pokemod;
class Store : public Object
{
public:
+ Store(const Store& store);
Store(const Pokemod* pokemod, const int id);
- Store(const Pokemod* pokemod, const Store& store, const int id);
- Store(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Store(const Store& store, const Pokemod* pokemod, const int id);
+ Store(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Tile.cpp b/pokemod/Tile.cpp
index 2eb80173..ba6bb9ab 100644
--- a/pokemod/Tile.cpp
+++ b/pokemod/Tile.cpp
@@ -26,6 +26,12 @@
const QStringList Tile::ForceStr = QStringList() << "Slip" << "Stop" << "Force" << "Push";
+Tile::Tile(const Tile& tile) :
+ Object("Tile", tile.pokemod(), tile.id())
+{
+ *this = tile;
+}
+
Tile::Tile(const Pokemod* pokemod, const int id) :
Object("Tile", pokemod, id),
m_name(""),
@@ -39,13 +45,13 @@ Tile::Tile(const Pokemod* pokemod, const int id) :
m_from[i] = false;
}
-Tile::Tile(const Pokemod* pokemod, const Tile& tile, const int id) :
+Tile::Tile(const Tile& tile, const Pokemod* pokemod, const int id) :
Object("Tile", pokemod, id)
{
*this = tile;
}
-Tile::Tile(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Tile::Tile(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Tile", pokemod, id)
{
load(xml, id);
@@ -102,7 +108,7 @@ void Tile::load(const QDomElement& xml, int id)
LOAD(QString, name);
LOAD(QPixmap, sprite);
LOAD_ARRAY(bool, from, Pokemod::D_End);
- LOAD(Frac, wildChance);
+ LOAD(Fraction, wildChance);
LOAD(int, hmType);
LOAD(int, under);
LOAD(int, forceType);
@@ -115,7 +121,7 @@ QDomElement Tile::save() const
SAVE(QString, name);
SAVE(QPixmap, sprite);
SAVE_ARRAY(bool, from, Pokemod::D_End);
- SAVE(Frac, wildChance);
+ SAVE(Fraction, wildChance);
SAVE(int, hmType);
SAVE(int, under);
SAVE(int, forceType);
@@ -141,7 +147,7 @@ void Tile::setFrom(const int direction, const bool state) throw(BoundsException)
m_from[direction] = state;
}
-void Tile::setWildChance(const Frac& wildChance) throw(Exception)
+void Tile::setWildChance(const Fraction& wildChance) throw(Exception)
{
m_wildChance = wildChance;
}
@@ -202,7 +208,7 @@ bool Tile::from(const int direction) const throw(BoundsException)
return m_from[direction];
}
-Frac Tile::wildChance() const
+Fraction Tile::wildChance() const
{
return m_wildChance;
}
diff --git a/pokemod/Tile.h b/pokemod/Tile.h
index 934bbb58..4bb398cd 100644
--- a/pokemod/Tile.h
+++ b/pokemod/Tile.h
@@ -24,7 +24,7 @@
// General includes
#include <Exception.h>
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -43,9 +43,10 @@ class Tile : public Object
};
static const QStringList ForceStr;
+ Tile(const Tile& tile);
Tile(const Pokemod* pokemod, const int id);
- Tile(const Pokemod* pokemod, const Tile& tile, const int id);
- Tile(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Tile(const Tile& tile, const Pokemod* pokemod, const int id);
+ Tile(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
@@ -53,7 +54,7 @@ class Tile : public Object
void setName(const QString& name);
void setSprite(const QPixmap& sprite) throw(Exception);
void setFrom(const int direction, const bool state) throw(BoundsException);
- void setWildChance(const Frac& wildChance) throw(Exception);
+ void setWildChance(const Fraction& wildChance) throw(Exception);
void setHMType(const int hmType) throw(BoundsException);
void setUnder(const int under) throw(Exception);
void setForceType(const int forceType) throw(BoundsException);
@@ -62,7 +63,7 @@ class Tile : public Object
QString name() const;
QPixmap sprite() const;
bool from(const int direction) const throw(BoundsException);
- Frac wildChance() const;
+ Fraction wildChance() const;
int hmType() const;
int under() const;
int forceType() const;
@@ -78,7 +79,7 @@ class Tile : public Object
QString m_name;
QPixmap m_sprite;
bool m_from[Pokemod::D_End];
- Frac m_wildChance;
+ Fraction m_wildChance;
int m_hmType;
int m_under;
int m_forceType;
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
index b87106df..c308801c 100644
--- a/pokemod/Time.cpp
+++ b/pokemod/Time.cpp
@@ -15,9 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+// Pokemod includes
#include "Pokemod.h"
+
+// Header include
#include "Time.h"
+Time::Time(const Time& time) :
+ Object("Time", time.pokemod(), time.id())
+{
+ *this = time;
+}
+
Time::Time(const Pokemod* pokemod, const int id) :
Object("Time", pokemod, id),
m_name(""),
@@ -26,13 +35,13 @@ Time::Time(const Pokemod* pokemod, const int id) :
{
}
-Time::Time(const Pokemod* pokemod, const Time& time, const int id) :
+Time::Time(const Time& time, const Pokemod* pokemod, const int id) :
Object("Time", pokemod, id)
{
*this = time;
}
-Time::Time(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Time::Time(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Time", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/Time.h b/pokemod/Time.h
index 776c0cff..2f2d807e 100644
--- a/pokemod/Time.h
+++ b/pokemod/Time.h
@@ -33,9 +33,10 @@ class Pokemod;
class Time : public Object
{
public:
+ Time(const Time& time);
Time(const Pokemod* pokemod, const int id);
- Time(const Pokemod* pokemod, const Time& time, const int id);
- Time(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Time(const Time& time, const Pokemod* pokemod, const int id);
+ Time(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Trainer.cpp b/pokemod/Trainer.cpp
index 0c27f11d..a4a86578 100644
--- a/pokemod/Trainer.cpp
+++ b/pokemod/Trainer.cpp
@@ -24,6 +24,12 @@
// Header include
#include "Trainer.h"
+Trainer::Trainer(const Trainer& trainer) :
+ Object("Trainer", trainer.pokemod(), trainer.id())
+{
+ *this = trainer;
+}
+
Trainer::Trainer(const Pokemod* pokemod, const int id) :
Object("Trainer", pokemod, id),
m_name(""),
@@ -31,13 +37,13 @@ Trainer::Trainer(const Pokemod* pokemod, const int id) :
{
}
-Trainer::Trainer(const Pokemod* pokemod, const Trainer& trainer, const int id) :
+Trainer::Trainer(const Trainer& trainer, const Pokemod* pokemod, const int id) :
Object("Trainer", pokemod, id)
{
*this = trainer;
}
-Trainer::Trainer(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Trainer::Trainer(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Trainer", pokemod, id)
{
load(xml, id);
diff --git a/pokemod/Trainer.h b/pokemod/Trainer.h
index 41fcf10f..bc845e35 100644
--- a/pokemod/Trainer.h
+++ b/pokemod/Trainer.h
@@ -33,9 +33,10 @@ class Pokemod;
class Trainer : public Object
{
public:
+ Trainer(const Trainer& trainer);
Trainer(const Pokemod* pokemod, const int id);
- Trainer(const Pokemod* pokemod, const Trainer& trainer, const int id);
- Trainer(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Trainer(const Trainer& trainer, const Pokemod* pokemod, const int id);
+ Trainer(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, int id = INT_MAX);
QDomElement save() const;
diff --git a/pokemod/Type.cpp b/pokemod/Type.cpp
index 385d9560..eca0673c 100644
--- a/pokemod/Type.cpp
+++ b/pokemod/Type.cpp
@@ -21,6 +21,12 @@
// Header includes
#include "Type.h"
+Type::Type(const Type& type) :
+ Object("Type", type.pokemod(), type.id())
+{
+ *this = type;
+}
+
Type::Type(const Pokemod* pokemod, const int id) :
Object("Type", pokemod, id),
m_name(""),
@@ -30,13 +36,13 @@ Type::Type(const Pokemod* pokemod, const int id) :
m_immunity[i] = false;
}
-Type::Type(const Pokemod* pokemod, const Type& type, const int id) :
+Type::Type(const Type& type, const Pokemod* pokemod, const int id) :
Object("Type", pokemod, id)
{
*this = type;
}
-Type::Type(const Pokemod* pokemod, const QDomElement& xml, const int id) :
+Type::Type(const QDomElement& xml, const Pokemod* pokemod, const int id) :
Object("Type", pokemod, id)
{
load(xml, id);
@@ -58,7 +64,7 @@ void Type::load(const QDomElement& xml, int id)
{
LOAD_ID();
LOAD(QString, name);
- LOAD(Frac, stab);
+ LOAD(Fraction, stab);
LOAD_ARRAY(bool, immunity, Pokemod::STS_End);
}
@@ -66,7 +72,7 @@ QDomElement Type::save() const
{
SAVE_CREATE();
SAVE(QString, name);
- SAVE(Frac, stab);
+ SAVE(Fraction, stab);
SAVE_ARRAY(bool, immunity, Pokemod::STS_End);
return xml;
}
@@ -76,7 +82,7 @@ void Type::setName(const QString& name)
m_name = name;
}
-void Type::setStab(const Frac& stab) throw(Exception)
+void Type::setStab(const Fraction& stab) throw(Exception)
{
m_stab = stab;
}
@@ -93,7 +99,7 @@ QString Type::name() const
return m_name;
}
-Frac Type::stab() const
+Fraction Type::stab() const
{
return m_stab;
}
diff --git a/pokemod/Type.h b/pokemod/Type.h
index 550f6c2d..db221046 100644
--- a/pokemod/Type.h
+++ b/pokemod/Type.h
@@ -22,7 +22,7 @@
#include <QString>
// General includes
-#include <Frac.h>
+#include <Fraction.h>
// Pokemod includes
#include "Object.h"
@@ -31,19 +31,20 @@
class Type : public Object
{
public:
+ Type(const Type& type);
Type(const Pokemod* pokemod, const int id);
- Type(const Pokemod* pokemod, const Type& type, const int id);
- Type(const Pokemod* pokemod, const QDomElement& xml, const int id = INT_MAX);
+ Type(const Type& type, const Pokemod* pokemod, const int id);
+ Type(const QDomElement& xml, const Pokemod* pokemod, const int id = INT_MAX);
void load(const QDomElement& xml, const int id = INT_MAX);
QDomElement save() const;
void setName(const QString& name);
- void setStab(const Frac& stab) throw(Exception);
+ void setStab(const Fraction& stab) throw(Exception);
void setImmunity(const int status, const bool immune) throw(BoundsException);
QString name() const;
- Frac stab() const;
+ Fraction stab() const;
bool immunity(const int status) const throw(BoundsException);
Type& operator=(const Type& rhs);
@@ -54,7 +55,7 @@ class Type : public Object
}
QString m_name;
- Frac m_stab;
+ Fraction m_stab;
bool m_immunity[Pokemod::STS_End];
};
diff --git a/pokemodr/AbilityUI.cpp b/pokemodr/AbilityUI.cpp
index 2e9ca895..cd9459ed 100644
--- a/pokemodr/AbilityUI.cpp
+++ b/pokemodr/AbilityUI.cpp
@@ -1,61 +1,55 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/AbilityUI.cpp
-// Purpose: Ability UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:31:08 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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 "AbilityUI.h"
-AbilityUI::AbilityUI(Ability* a, QWidget* parent) :
+AbilityUI::AbilityUI(Ability* ability, QWidget* parent) :
ObjectUI(parent),
- ability(a),
- ability_mod(new Ability(a->getPokemod(), *a, a->getId()))
+ m_ability(ability),
+ m_ability_mod(new Ability(*ability))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(ability, ability_mod);
+ setObjects(m_ability, m_ability_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
void AbilityUI::setGui()
{
- varName->setText(ability_mod->getName());
+ varName->setText(m_ability_mod->name());
}
void AbilityUI::on_buttonApply_clicked()
{
- *ability = *ability_mod;
+ *m_ability = *m_ability_mod;
emit(changed(false));
}
void AbilityUI::on_buttonDiscard_clicked()
{
- *ability_mod = *ability;
+ *m_ability_mod = *m_ability;
setGui();
emit(changed(false));
}
-void AbilityUI::on_varName_textChanged(const QString& n)
+void AbilityUI::on_varName_textChanged(const QString& name)
{
- ability_mod->setName(n);
+ m_ability_mod->setName(name);
emit(changed(true));
}
diff --git a/pokemodr/AbilityUI.h b/pokemodr/AbilityUI.h
index 3121355d..ec6cd1dc 100644
--- a/pokemodr/AbilityUI.h
+++ b/pokemodr/AbilityUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/AbilityUI.h
-// Purpose: Ability UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:29:48 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_ABILITYUI__
#define __POKEMODR_ABILITYUI__
-#include <QString>
-
+// Pokemod includes
#include <Ability.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_ability.h"
class AbilityUI : public ObjectUI, private Ui::formAbility
@@ -36,20 +32,20 @@ class AbilityUI : public ObjectUI, private Ui::formAbility
Q_OBJECT
public:
- AbilityUI(Ability* a, QWidget* parent);
+ AbilityUI(Ability* ability, QWidget* parent);
~AbilityUI()
{
- delete ability_mod;
+ delete m_ability_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
+ void on_varName_textChanged(const QString& name);
private:
void setGui();
- Ability* ability;
- Ability* ability_mod;
+ Ability* m_ability;
+ Ability* m_ability_mod;
};
#endif
diff --git a/pokemodr/AuthorUI.cpp b/pokemodr/AuthorUI.cpp
index e973f7fb..641f6756 100644
--- a/pokemodr/AuthorUI.cpp
+++ b/pokemodr/AuthorUI.cpp
@@ -1,77 +1,72 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/AuthorUI.cpp
-// Purpose: Author UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:45:04 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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/>.
+ */
+// General includes
#include <Exception.h>
+// Header include
#include "AuthorUI.h"
-AuthorUI::AuthorUI(Author* a, QWidget* parent) :
+AuthorUI::AuthorUI(Author* author, QWidget* parent) :
ObjectUI(parent),
- author(a),
- author_mod(new Author(a->getPokemod(), *a, a->getId()))
+ m_author(author),
+ m_author_mod(new Author(*author))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(author, author_mod);
+ setObjects(m_author, m_author_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
void AuthorUI::setGui()
{
- varName->setText(author_mod->getName());
- varEmail->setText(author_mod->getEmail());
- varRole->setText(author_mod->getRole());
+ varName->setText(m_author_mod->name());
+ varEmail->setText(m_author_mod->email());
+ varRole->setText(m_author_mod->role());
}
void AuthorUI::on_buttonApply_clicked()
{
- *author = *author_mod;
+ *m_author = *m_author_mod;
emit(changed(false));
}
void AuthorUI::on_buttonDiscard_clicked()
{
- *author_mod = *author;
+ *m_author_mod = *m_author;
setGui();
emit(changed(false));
}
-void AuthorUI::on_varName_textChanged(const QString& n)
+void AuthorUI::on_varName_textChanged(const QString& name)
{
- author_mod->setName(n);
+ m_author_mod->setName(name);
emit(changed(true));
}
-void AuthorUI::on_varEmail_textChanged(const QString& e)
+void AuthorUI::on_varEmail_textChanged(const QString& email)
{
- author_mod->setEmail(e);
+ m_author_mod->setEmail(email);
emit(changed(true));
}
-void AuthorUI::on_varRole_textChanged(const QString& r)
+void AuthorUI::on_varRole_textChanged(const QString& role)
{
- author_mod->setRole(r);
+ m_author_mod->setRole(role);
emit(changed(true));
}
diff --git a/pokemodr/AuthorUI.h b/pokemodr/AuthorUI.h
index 296a3d6e..6ba4a020 100644
--- a/pokemodr/AuthorUI.h
+++ b/pokemodr/AuthorUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/AuthorUI.h
-// Purpose: Author UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:35:59 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_AUTHORUI__
#define __POKEMODR_AUTHORUI__
-#include <QString>
-
+// Pokemod includes
#include <Author.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_author.h"
class AuthorUI : public ObjectUI, private Ui::formAuthor
@@ -36,24 +32,22 @@ class AuthorUI : public ObjectUI, private Ui::formAuthor
Q_OBJECT
public:
- AuthorUI(Author* a, QWidget* parent);
+ AuthorUI(Author* author, QWidget* parent);
~AuthorUI()
{
- delete author_mod;
+ delete m_author_mod;
}
-
-// KToolbar getToolbar(QWidget* parent);
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varEmail_textChanged(const QString& e);
- void on_varRole_textChanged(const QString& r);
+ void on_varName_textChanged(const QString& name);
+ void on_varEmail_textChanged(const QString& email);
+ void on_varRole_textChanged(const QString& role);
private:
void setGui();
- Author* author;
- Author* author_mod;
+ Author* m_author;
+ Author* m_author_mod;
};
#endif
diff --git a/pokemodr/BadgeUI.cpp b/pokemodr/BadgeUI.cpp
index f77b873b..b7ec48d5 100644
--- a/pokemodr/BadgeUI.cpp
+++ b/pokemodr/BadgeUI.cpp
@@ -1,46 +1,45 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/BadgeUI.cpp
-// Purpose: Badge UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 13:10:47 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
+/*
+ * 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/>.
+ */
+
+// Qt includes
#include <QListWidgetItem>
-#include <QMetaObject>
#include <QSize>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
-#include <ImageCache.h>
+// Pokemod includes
#include <Pokemod.h>
+// PokeModr includes
#include "FileDialog.h"
+
+// Header include
#include "BadgeUI.h"
-BadgeUI::BadgeUI(Badge* b, QWidget* parent) :
+BadgeUI::BadgeUI(Badge* badge, QWidget* parent) :
ObjectUI(parent),
- badge(b),
- badge_mod(new Badge(b->getPokemod(), *b, b->getId()))
+ m_badge(badge),
+ m_badge_mod(new Badge(*badge))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(badge, badge_mod);
+ setObjects(m_badge, m_badge_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -53,81 +52,67 @@ void BadgeUI::initGui()
void BadgeUI::refreshGui()
{
varStat->clear();
- const bool isSplit = badge->getPokemod()->getRules()->getSpecialSplit();
- varStat->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));}
+ const bool isSplit = m_badge->pokemod()->rules()->specialSplit();
+ varStat->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
+ varObey->setMaximum(m_badge->pokemod()->rules()->maxLevel());
+}
void BadgeUI::setGui()
{
- varName->setText(badge_mod->getName());
- varObey->setMaximum(badge->getPokemod()->getRules()->getMaxLevel());
- varObey->setValue(badge_mod->getObey());
- try
- {
- varFace->setIcon(ImageCache::open(badge_mod->getFace()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varBadge->setIcon(ImageCache::open(badge_mod->getBadge()));
- }
- catch (OpenException& e)
- {
- }
- varMultiplierNum->setValue(badge_mod->getStat(varStat->currentIndex()).getNum());
- varMultiplierDenom->setValue(badge_mod->getStat(varStat->currentIndex()).getDenom());
- varMultiplierNum->setMaximum(badge_mod->getStat(varStat->currentIndex()).getDenom());
- varMultiplier->setText(QString::number(badge_mod->getStat(varStat->currentIndex()), 'g', DBL_PREC));
+ varName->setText(m_badge_mod->name());
+ varObey->setValue(m_badge_mod->obey());
+ varFace->setIcon(m_badge_mod->face());
+ varBadge->setIcon(m_badge_mod->badge());
+ varStatMultiplier->setValue(m_badge_mod->stat(varStat->currentIndex()));
for (int i = 0; i < varHMs->count(); ++i)
- varHMs->item(i)->setSelected(badge_mod->getHm(i));
+ varHMs->item(i)->setSelected(m_badge_mod->hm(i));
}
void BadgeUI::on_buttonApply_clicked()
{
- *badge = *badge_mod;
+ *m_badge = *m_badge_mod;
emit(changed(false));
}
void BadgeUI::on_buttonDiscard_clicked()
{
- *badge_mod = *badge;
+ *m_badge_mod = *m_badge;
setGui();
emit(changed(false));
}
-void BadgeUI::on_varName_textChanged(const QString& n)
+void BadgeUI::on_varName_textChanged(const QString& name)
{
- badge_mod->setName(n);
+ m_badge_mod->setName(name);
emit(changed(true));
}
-void BadgeUI::on_varObey_valueChanged(const int o)
+void BadgeUI::on_varObey_valueChanged(const int obey)
{
try
{
- badge_mod->setObey(o);
+ m_badge_mod->setObey(obey);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
void BadgeUI::on_varFace_pressed()
{
- FileDialog dlg("*.png", QSize(64, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(64, 64));
+ if (dialog.exec())
{
try
{
- badge_mod->setFace(dlg.selectedUrl());
+ m_badge_mod->setFace(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -135,16 +120,16 @@ void BadgeUI::on_varFace_pressed()
void BadgeUI::on_varBadge_pressed()
{
- FileDialog dlg("*.png", QSize(64, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(64, 64));
+ if (dialog.exec())
{
try
{
- badge_mod->setBadge(dlg.selectedUrl());
+ m_badge_mod->setBadge(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -156,32 +141,18 @@ void BadgeUI::on_varStat_currentIndexChanged()
setGui();
}
-void BadgeUI::on_varMultiplierNum_valueChanged(const int m)
+void BadgeUI::on_varStatMultiplier_valueChanged(const Fraction& multiplier)
{
try
{
- badge_mod->setStatNum(varStat->currentIndex(), m);
+ m_badge_mod->setStat(varStat->currentIndex(), multiplier);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
- }
- setGui();
-}
-
-void BadgeUI::on_varMultiplierDenom_valueChanged(const int m)
-{
- try
- {
- badge_mod->setStatDenom(varStat->currentIndex(), m);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
+ BugCatcher::report(exception);
+ setGui();
}
- setGui();
}
void BadgeUI::on_varHMs_itemSelectionChanged()
@@ -189,12 +160,12 @@ void BadgeUI::on_varHMs_itemSelectionChanged()
try
{
for (int i = 0; i < varHMs->count(); ++i)
- badge_mod->setHm(i, varHMs->item(i)->isSelected());
+ m_badge_mod->setHm(i, varHMs->item(i)->isSelected());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/BadgeUI.h b/pokemodr/BadgeUI.h
index b1084dbf..b1d1c7e2 100644
--- a/pokemodr/BadgeUI.h
+++ b/pokemodr/BadgeUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/BadgeUI.h
-// Purpose: Badge UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:52:44 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_BADGEUI__
#define __POKEMODR_BADGEUI__
-#include <QString>
-
+// Pokemod includes
#include <Badge.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_badge.h"
class BadgeUI : public ObjectUI, private Ui::formBadge
@@ -36,29 +32,28 @@ class BadgeUI : public ObjectUI, private Ui::formBadge
Q_OBJECT
public:
- BadgeUI(Badge* b, QWidget* parent);
+ BadgeUI(Badge* badge, QWidget* parent);
~BadgeUI()
{
- delete badge_mod;
+ delete m_badge_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varObey_valueChanged(const int o);
+ void on_varName_textChanged(const QString& name);
+ void on_varObey_valueChanged(const int obey);
void on_varFace_pressed();
void on_varBadge_pressed();
void on_varStat_currentIndexChanged();
- void on_varMultiplierNum_valueChanged(const int m);
- void on_varMultiplierDenom_valueChanged(const int m);
+ void on_varStatMultiplier_valueChanged(const Fraction& multiplier);
void on_varHMs_itemSelectionChanged();
private:
void initGui();
void refreshGui();
void setGui();
- Badge* badge;
- Badge* badge_mod;
+ Badge* m_badge;
+ Badge* m_badge_mod;
};
#endif
diff --git a/pokemodr/CoinListObjectUI.cpp b/pokemodr/CoinListObjectUI.cpp
index 85953908..61fb5908 100644
--- a/pokemodr/CoinListObjectUI.cpp
+++ b/pokemodr/CoinListObjectUI.cpp
@@ -1,47 +1,45 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/CoinListObjectUI.cpp
-// Purpose: CoinListObject UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Feb 1 13:35:58 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Item.h>
#include <ItemEffect.h>
#include <Pokemod.h>
#include <Species.h>
+// Header include
#include "CoinListObjectUI.h"
-CoinListObjectUI::CoinListObjectUI(CoinListObject* c, QWidget* parent) :
+CoinListObjectUI::CoinListObjectUI(CoinListObject* coinListObject, QWidget* parent) :
ObjectUI(parent),
- lastType(-1),
- coinListObject(c),
- coinListObject_mod(new CoinListObject(c->getPokemod(), *c, c->getId()))
+ m_lastType(-1),
+ m_object(coinListObject),
+ m_object_mod(new CoinListObject(*coinListObject))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(coinListObject, coinListObject_mod);
+ setObjects(m_object, m_object_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -53,101 +51,101 @@ void CoinListObjectUI::initGui()
void CoinListObjectUI::setGui()
{
- bool resetObjects = (coinListObject_mod->getType() != lastType);
- varType->setCurrentIndex(coinListObject_mod->getType());
- lastType = coinListObject_mod->getType();
+ bool resetObjects = (m_object_mod->type() != m_lastType);
+ varType->setCurrentIndex(m_object_mod->type());
+ m_lastType = m_object_mod->type();
if (resetObjects)
{
varObject->clear();
- if (coinListObject_mod->getType() == CoinListObject::Item)
+ if (m_object_mod->type() == CoinListObject::Item)
{
- for (int i = 0; i < coinListObject->getPokemod()->getItemCount(); ++i)
+ for (int i = 0; i < m_object->pokemod()->itemCount(); ++i)
{
- const Item* it = coinListObject->getPokemod()->getItem(i);
- varObject->addItem(it->getName());
- varObject->setItemData(i, it->getId());
+ const Item* item = m_object->pokemod()->item(i);
+ varObject->addItem(item->name());
+ varObject->setItemData(i, item->id());
}
}
else
{
- for (int i = 0; i < coinListObject->getPokemod()->getSpeciesCount(); ++i)
+ for (int i = 0; i < m_object->pokemod()->speciesCount(); ++i)
{
- const Species* s = coinListObject->getPokemod()->getSpecies(i);
- varObject->addItem(s->getName());
- varObject->setItemData(i, s->getId());
+ const Species* species = m_object->pokemod()->species(i);
+ varObject->addItem(species->name());
+ varObject->setItemData(i, species->id());
}
}
}
- varObject->setCurrentIndex(varObject->findData(coinListObject_mod->getObject()));
- varAmount->setValue(coinListObject_mod->getAmount());
- varCost->setValue(coinListObject_mod->getCost());
+ varObject->setCurrentIndex(varObject->findData(m_object_mod->object()));
+ varAmount->setValue(m_object_mod->amount());
+ varCost->setValue(m_object_mod->cost());
}
void CoinListObjectUI::on_buttonApply_clicked()
{
- *coinListObject = *coinListObject_mod;
+ *m_object = *m_object_mod;
emit(changed(false));
}
void CoinListObjectUI::on_buttonDiscard_clicked()
{
- *coinListObject_mod = *coinListObject;
+ *m_object_mod = *m_object;
setGui();
emit(changed(false));
}
-void CoinListObjectUI::on_varType_currentIndexChanged(const int t)
+void CoinListObjectUI::on_varType_currentIndexChanged(const int type)
{
try
{
- coinListObject_mod->setType(t);
+ m_object_mod->setType(type);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void CoinListObjectUI::on_varObject_currentIndexChanged(const int o)
+void CoinListObjectUI::on_varObject_currentIndexChanged(const int obey)
{
try
{
- coinListObject_mod->setObject(varObject->itemData(o).toInt());
+ m_object_mod->setObject(varObject->itemData(obey).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void CoinListObjectUI::on_varAmount_valueChanged(const int a)
+void CoinListObjectUI::on_varAmount_valueChanged(const int amount)
{
try
{
- coinListObject_mod->setAmount(a);
+ m_object_mod->setAmount(amount);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void CoinListObjectUI::on_varCost_valueChanged(const int c)
+void CoinListObjectUI::on_varCost_valueChanged(const int cost)
{
try
{
- coinListObject_mod->setCost(c);
+ m_object_mod->setCost(cost);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/CoinListObjectUI.h b/pokemodr/CoinListObjectUI.h
index e108a558..ddbf1a1a 100644
--- a/pokemodr/CoinListObjectUI.h
+++ b/pokemodr/CoinListObjectUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/CoinListObjectUI.h
-// Purpose: CoinListObject UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Feb 1 13:35:58 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_COINLISTOBJECTUI__
#define __POKEMODR_COINLISTOBJECTUI__
+// Pokemod includes
#include <CoinListObject.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_coinlistobject.h"
class CoinListObjectUI : public ObjectUI, private Ui::formCoinListObject
@@ -34,26 +32,26 @@ class CoinListObjectUI : public ObjectUI, private Ui::formCoinListObject
Q_OBJECT
public:
- CoinListObjectUI(CoinListObject* c, QWidget* parent);
+ CoinListObjectUI(CoinListObject* object, QWidget* parent);
~CoinListObjectUI()
{
- delete coinListObject_mod;
+ delete m_object_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varType_currentIndexChanged(const int t);
- void on_varObject_currentIndexChanged(const int o);
- void on_varAmount_valueChanged(const int a);
- void on_varCost_valueChanged(const int c);
+ void on_varType_currentIndexChanged(const int type);
+ void on_varObject_currentIndexChanged(const int object);
+ void on_varAmount_valueChanged(const int amount);
+ void on_varCost_valueChanged(const int cost);
private:
void initGui();
void setGui();
- bool lastType;
+ bool m_lastType;
- CoinListObject* coinListObject;
- CoinListObject* coinListObject_mod;
+ CoinListObject* m_object;
+ CoinListObject* m_object_mod;
};
#endif
diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp
index 6c65f7a0..bf854781 100644
--- a/pokemodr/CoinListUI.cpp
+++ b/pokemodr/CoinListUI.cpp
@@ -1,45 +1,43 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/CoinListUI.cpp
-// Purpose: CoinList UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:31:08 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Item.h>
#include <ItemEffect.h>
#include <Pokemod.h>
+// Header include
#include "CoinListUI.h"
-CoinListUI::CoinListUI(CoinList* c, QWidget* parent) :
+CoinListUI::CoinListUI(CoinList* coinList, QWidget* parent) :
ObjectUI(parent),
- coinList(c),
- coinList_mod(new CoinList(c->getPokemod(), *c, c->getId()))
+ m_coinList(coinList),
+ m_coinList_mod(new CoinList(*coinList))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(coinList, coinList_mod);
+ setObjects(m_coinList, m_coinList_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -47,16 +45,16 @@ CoinListUI::CoinListUI(CoinList* c, QWidget* parent) :
void CoinListUI::refreshGui()
{
varValue->clear();
- for (int i = 0; i < coinList->getPokemod()->getItemCount(); ++i)
+ for (int i = 0; i < m_coinList->pokemod()->itemCount(); ++i)
{
- const Item* it = coinList->getPokemod()->getItem(i);
- for (int j = 0; j < it->getEffectCount(); ++j)
+ const Item* item = m_coinList->pokemod()->item(i);
+ for (int j = 0; j < item->effectCount(); ++j)
{
- const ItemEffect* e = it->getEffect(j);
- if (e->getEffect() == ItemEffect::E_CoinCase)
+ const ItemEffect* effect = item->effect(j);
+ if (effect->effect() == ItemEffect::E_CoinCase)
{
- varValue->addItem(it->getName());
- varValue->setItemData(varValue->count() - 1, e->getVal1());
+ varValue->addItem(item->name());
+ varValue->setItemData(varValue->count() - 1, effect->value1());
}
}
}
@@ -64,39 +62,39 @@ void CoinListUI::refreshGui()
void CoinListUI::setGui()
{
- varName->setText(coinList_mod->getName());
- varValue->setCurrentIndex(varValue->findData(coinList_mod->getValue()));
+ varName->setText(m_coinList_mod->name());
+ varValue->setCurrentIndex(varValue->findData(m_coinList_mod->value()));
}
void CoinListUI::on_buttonApply_clicked()
{
- *coinList = *coinList_mod;
+ *m_coinList = *m_coinList_mod;
emit(changed(false));
}
void CoinListUI::on_buttonDiscard_clicked()
{
- *coinList_mod = *coinList;
+ *m_coinList_mod = *m_coinList;
setGui();
emit(changed(false));
}
-void CoinListUI::on_varName_textChanged(const QString& n)
+void CoinListUI::on_varName_textChanged(const QString& name)
{
- coinList_mod->setName(n);
+ m_coinList_mod->setName(name);
emit(changed(true));
}
-void CoinListUI::on_varValue_currentIndexChanged(const int v)
+void CoinListUI::on_varValue_currentIndexChanged(const int value)
{
try
{
- coinList_mod->setValue(varValue->itemData(v).toInt());
+ m_coinList_mod->setValue(varValue->itemData(value).toInt());
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/CoinListUI.h b/pokemodr/CoinListUI.h
index 5e98d513..d5ac83dc 100644
--- a/pokemodr/CoinListUI.h
+++ b/pokemodr/CoinListUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/CoinListUI.h
-// Purpose: CoinList UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu Jan 31 14:10:45 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_COINLISTUI__
#define __POKEMODR_COINLISTUI__
-#include <QString>
-
+// Pokemod includes
#include <CoinList.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_coinlist.h"
class CoinListUI : public ObjectUI, private Ui::formCoinList
@@ -36,22 +32,22 @@ class CoinListUI : public ObjectUI, private Ui::formCoinList
Q_OBJECT
public:
- CoinListUI(CoinList* c, QWidget* parent);
+ CoinListUI(CoinList* coinList, QWidget* parent);
~CoinListUI()
{
- delete coinList_mod;
+ delete m_coinList_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varValue_currentIndexChanged(const int v);
+ void on_varName_textChanged(const QString& name);
+ void on_varValue_currentIndexChanged(const int value);
private:
void refreshGui();
void setGui();
- CoinList* coinList;
- CoinList* coinList_mod;
+ CoinList* m_coinList;
+ CoinList* m_coinList_mod;
};
#endif
diff --git a/pokemodr/EggGroupUI.cpp b/pokemodr/EggGroupUI.cpp
index 130ab022..ca67a6d9 100644
--- a/pokemodr/EggGroupUI.cpp
+++ b/pokemodr/EggGroupUI.cpp
@@ -1,61 +1,55 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/EggGroupUI.cpp
-// Purpose: EggGroup UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:31:08 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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 "EggGroupUI.h"
-EggGroupUI::EggGroupUI(EggGroup* e, QWidget* parent) :
+EggGroupUI::EggGroupUI(EggGroup* eggGroup, QWidget* parent) :
ObjectUI(parent),
- eggGroup(e),
- eggGroup_mod(new EggGroup(e->getPokemod(), *e, e->getId()))
+ m_eggGroup(eggGroup),
+ m_eggGroup_mod(new EggGroup(*eggGroup))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(eggGroup, eggGroup_mod);
+ setObjects(m_eggGroup, m_eggGroup_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
void EggGroupUI::setGui()
{
- varName->setText(eggGroup_mod->getName());
+ varName->setText(m_eggGroup_mod->name());
}
void EggGroupUI::on_buttonApply_clicked()
{
- *eggGroup = *eggGroup_mod;
+ *m_eggGroup = *m_eggGroup_mod;
emit(changed(false));
}
void EggGroupUI::on_buttonDiscard_clicked()
{
- *eggGroup_mod = *eggGroup;
+ *m_eggGroup_mod = *m_eggGroup;
setGui();
emit(changed(false));
}
-void EggGroupUI::on_varName_textChanged(const QString& n)
+void EggGroupUI::on_varName_textChanged(const QString& name)
{
- eggGroup_mod->setName(n);
+ m_eggGroup_mod->setName(name);
emit(changed(true));
}
diff --git a/pokemodr/EggGroupUI.h b/pokemodr/EggGroupUI.h
index 0f014be6..5b565b2e 100644
--- a/pokemodr/EggGroupUI.h
+++ b/pokemodr/EggGroupUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/EggGroupUI.h
-// Purpose: EggGroup UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:29:48 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_EGGGROUPUI__
#define __POKEMODR_EGGGROUPUI__
-#include <QString>
-
+// Pokemod includes
#include <EggGroup.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_egggroup.h"
class EggGroupUI : public ObjectUI, private Ui::formEggGroup
@@ -36,20 +32,20 @@ class EggGroupUI : public ObjectUI, private Ui::formEggGroup
Q_OBJECT
public:
- EggGroupUI(EggGroup* e, QWidget* parent);
+ EggGroupUI(EggGroup* eggGroup, QWidget* parent);
~EggGroupUI()
{
- delete eggGroup_mod;
+ delete m_eggGroup_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
+ void on_varName_textChanged(const QString& name);
private:
void setGui();
- EggGroup* eggGroup;
- EggGroup* eggGroup_mod;
+ EggGroup* m_eggGroup;
+ EggGroup* m_eggGroup_mod;
};
#endif
diff --git a/pokemodr/FileDialog.cpp b/pokemodr/FileDialog.cpp
index 858fbaab..3261bd9b 100644
--- a/pokemodr/FileDialog.cpp
+++ b/pokemodr/FileDialog.cpp
@@ -1,66 +1,58 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/FileDialog.cpp
-// Purpose: Dialog to open files
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Feb 1 08:34:34 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// KDE includes
#include <kdiroperator.h>
#include <kfilewidget.h>
#include <kimagefilepreview.h>
+// Qt includes
#include <QDir>
-#include <QImage>
+#include <QPixmap>
#include <QStringList>
+// Header include
#include "FileDialog.h"
-KUrl FileDialog::latestDir = KUrl();
-
-FileDialog::FileDialog(const QString& filter, const QSize& imgSize) :
- QObject(NULL),
- dlg(NULL)
+FileDialog::FileDialog(const QSize& size) :
+ KFileDialog(KUrl("kfiledialog:///image"), "", NULL)
{
- if (latestDir == "")
- latestDir = KUrl(QString("%1/.kde/share/apps/pokegen/images").arg(QDir::homePath()));
- size = imgSize;
- dlg = new KFileDialog(latestDir, filter, NULL);
- dlg->setOperationMode(KFileDialog::Opening);
- if (size.isValid())
+ m_size = size;
+ setOperationMode(KFileDialog::Opening);
+ if (m_size.isValid())
{
- dlg->setPreviewWidget(new KImageFilePreview());
- connect(static_cast<KFileWidget*>(dlg->fileWidget())->findChild<KDirOperator*>(), SIGNAL(dirActivated(const KFileItem&)), this, SLOT(sizeFilter(const FileItem&)));
+ setPreviewWidget(new KImageFilePreview());
+ // FIXME: KDirOperator is failing here on linking :(
+// connect(findChild<KDirOperator*>(), SIGNAL(dirActivated(const KFileItem&)), this, SLOT(sizeFilter(const FileItem&)));
}
}
void FileDialog::sizeFilter(const KFileItem& item)
{
QString filter;
- QStringList files(QDir(item.url().path()).entryList(QStringList() << "*.png", QDir::Files));
+ QStringList files(QDir(item.url().path()).entryList(QStringList() << "*.png" << "*.jpg" << "*.jpeg", QDir::Files));
for (int i = 0; i < files.size(); ++i)
{
- if (QImage(files.at(i)).size() == size)
+ if (QPixmap(files.at(i)).size() == m_size)
{
if (filter.length())
filter.append(" ");
filter.append(files.at(i));
}
}
- filter.append("|Valid PNG Files");
- dlg->setFilter(filter);
+ setFilter(QString("%1|Valid files").arg(filter));
}
diff --git a/pokemodr/FileDialog.h b/pokemodr/FileDialog.h
index 0057e64e..46af7175 100644
--- a/pokemodr/FileDialog.h
+++ b/pokemodr/FileDialog.h
@@ -1,66 +1,40 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/FileDialog.h
-// Purpose: Dialog to open files
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Feb 1 08:27:29 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_FILEDIALOG__
#define __POKEMODR_FILEDIALOG__
+// KDE includes
#include <kfiledialog.h>
#include <kfileitem.h>
-#include <kurl.h>
-#include <QObject>
+// Qt includes
#include <QSize>
-#include <QString>
-class FileDialog : public QObject
+class FileDialog : public KFileDialog
{
Q_OBJECT
public:
- FileDialog(const QString& filter, const QSize& size = QSize());
- ~FileDialog()
- {
- if (dlg)
- delete dlg;
- }
-
- int show()
- {
- int ret = dlg->exec();
- url = dlg->selectedFile();
- latestDir = dlg->baseUrl();
- return ret;
- }
- QString selectedUrl()
- {
- return url;
- }
+ FileDialog(const QSize& size = QSize());
public slots:
void sizeFilter(const KFileItem& item);
private:
- KFileDialog* dlg;
- QSize size;
- QString url;
- static KUrl latestDir;
+ QSize m_size;
};
#endif
diff --git a/general/FracWidget.cpp b/pokemodr/FractionWidget.cpp
index a131c82f..8ef3ff95 100644
--- a/general/FracWidget.cpp
+++ b/pokemodr/FractionWidget.cpp
@@ -20,66 +20,66 @@
#include <QString>
// Header include
-#include "FracWidget.h"
+#include "FractionWidget.h"
-FracWidget::FracWidget(const Frac& value, QWidget* parent) :
+FractionWidget::FractionWidget(QWidget* parent, const Fraction& value) :
QWidget(parent),
m_behavior(-1),
m_value(value)
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- connect(this, SIGNAL(changed(bool)), SLOT(updateValue()));
+ connect(this, SIGNAL(valueChanged(Fraction)), SLOT(updateValue()));
}
-void FracWidget::setBehavior(const int behavior)
+void FractionWidget::setBehavior(const int behavior)
{
m_behavior = behavior;
- m_value = Frac(1, 1);
+ m_value = Fraction(1, 1);
varDenominator->setValue(1);
varNumerator->setValue(1);
- emit(changed(true));
+ emit(valueChanged(m_value));
}
-void FracWidget::setValue(const Frac& value)
+void FractionWidget::setValue(const Fraction& value)
{
m_value = value;
varDenominator->setValue(m_value.denominator());
varNumerator->setValue(m_value.numerator());
- emit(changed(true));
+ emit(valueChanged(m_value));
}
-int FracWidget::behavior() const
+int FractionWidget::behavior() const
{
return m_behavior;
}
-Frac FracWidget::value() const
+Fraction FractionWidget::value() const
{
return m_value;
}
-void FracWidget::on_varNumerator_valueChanged(const int& numerator)
+void FractionWidget::on_varNumerator_valueChanged(const int& numerator)
{
m_value.setNumerator(numerator);
if (0 < m_behavior)
varDenominator->setMaximum(numerator);
else
varDenominator->setMaximum(INT_MAX);
- emit(changed(true));
+ emit(valueChanged(m_value));
}
-void FracWidget::on_varDenominator_valueChanged(const int& denominator)
+void FractionWidget::on_varDenominator_valueChanged(const int& denominator)
{
m_value.setDenominator(denominator);
if (m_behavior < 0)
varNumerator->setMaximum(denominator);
else
varNumerator->setMaximum(INT_MAX);
- emit(changed(true));
+ emit(valueChanged(m_value));
}
-void FracWidget::updateValue()
+void FractionWidget::updateValue()
{
varValue->setText(QString::number(m_value, 'g', 7));
}
diff --git a/general/FracWidget.h b/pokemodr/FractionWidget.h
index 0bb98d7e..7195460c 100644
--- a/general/FracWidget.h
+++ b/pokemodr/FractionWidget.h
@@ -23,32 +23,32 @@
#include <QWidget>
// General includes
-#include "Frac.h"
+#include "Fraction.h"
// Form include
-#include "ui_frac.h"
+#include "ui_fraction.h"
-class FracWidget : public QWidget, private Ui::formFrac
+class FractionWidget : public QWidget, private Ui::formFraction
{
Q_OBJECT
public:
- FracWidget(const Frac& value, QWidget* parent);
+ FractionWidget(QWidget* parent, const Fraction& value = Fraction(1, 1));
void setBehavior(const int behavior);
- void setValue(const Frac& value);
+ void setValue(const Fraction& value);
int behavior() const;
- Frac value() const;
+ Fraction value() const;
signals:
- void changed(bool);
+ void valueChanged(Fraction);
public slots:
void on_varNumerator_valueChanged(const int& numerator);
void on_varDenominator_valueChanged(const int& denominator);
void updateValue();
private:
int m_behavior;
- Frac m_value;
+ Fraction m_value;
};
#endif
diff --git a/pokemodr/ItemTypeUI.cpp b/pokemodr/ItemTypeUI.cpp
index b10845b3..4891e8ac 100644
--- a/pokemodr/ItemTypeUI.cpp
+++ b/pokemodr/ItemTypeUI.cpp
@@ -1,86 +1,81 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/ItemTypeUI.cpp
-// Purpose: Item Type UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Jan 25 00:30:28 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QString>
+/*
+ * 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/>.
+ */
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Header include
#include "ItemTypeUI.h"
-ItemTypeUI::ItemTypeUI(ItemType* i, QWidget* parent) :
+ItemTypeUI::ItemTypeUI(ItemType* itemType, QWidget* parent) :
ObjectUI(parent),
- itemType(i),
- itemType_mod(new ItemType(i->getPokemod(), *i, i->getId()))
+ m_itemType(itemType),
+ m_itemType_mod(new ItemType(*itemType))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(itemType, itemType_mod);
+ setObjects(m_itemType, m_itemType_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
void ItemTypeUI::setGui()
{
- varName->setText(itemType_mod->getName());
- varComputer->setValue(itemType_mod->getComputer());
- varPlayer->setValue(itemType_mod->getPlayer());
+ varName->setText(m_itemType_mod->name());
+ varComputer->setValue(m_itemType_mod->computer());
+ varPlayer->setValue(m_itemType_mod->player());
}
void ItemTypeUI::on_buttonApply_clicked()
{
- *itemType = *itemType_mod;
+ *m_itemType = *m_itemType_mod;
emit(changed(false));
}
void ItemTypeUI::on_buttonDiscard_clicked()
{
- *itemType_mod = *itemType;
+ *m_itemType_mod = *m_itemType;
setGui();
emit(changed(false));
}
-void ItemTypeUI::on_varName_textChanged(const QString& n)
+void ItemTypeUI::on_varName_textChanged(const QString& name)
{
- itemType_mod->setName(n);
+ m_itemType_mod->setName(name);
emit(changed(true));
}
-void ItemTypeUI::on_varComputer_valueChanged(const int c)
+void ItemTypeUI::on_varComputer_valueChanged(const int computer)
{
- itemType_mod->setComputer(c);
+ m_itemType_mod->setComputer(computer);
emit(changed(true));
}
-void ItemTypeUI::on_varPlayer_valueChanged(const int p)
+void ItemTypeUI::on_varPlayer_valueChanged(const int player)
{
try
{
- itemType_mod->setPlayer(p);
+ m_itemType_mod->setPlayer(player);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/ItemTypeUI.h b/pokemodr/ItemTypeUI.h
index 7b580678..752a9c8e 100644
--- a/pokemodr/ItemTypeUI.h
+++ b/pokemodr/ItemTypeUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/ItemTypeUI.h
-// Purpose: Item Type UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Jan 25 00:24:05 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_ITEMTYPEUI__
#define __POKEMODR_ITEMTYPEUI__
+// Pokemod includes
#include <ItemType.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_itemtype.h"
class ItemTypeUI : public ObjectUI, private Ui::formItemType
@@ -34,22 +32,22 @@ class ItemTypeUI : public ObjectUI, private Ui::formItemType
Q_OBJECT
public:
- ItemTypeUI(ItemType* i, QWidget* parent);
+ ItemTypeUI(ItemType* itemType, QWidget* parent);
~ItemTypeUI()
{
- delete itemType_mod;
+ delete m_itemType_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varComputer_valueChanged(const int c);
- void on_varPlayer_valueChanged(const int p);
+ void on_varName_textChanged(const QString& name);
+ void on_varComputer_valueChanged(const int computer);
+ void on_varPlayer_valueChanged(const int player);
private:
void setGui();
- ItemType* itemType;
- ItemType* itemType_mod;
+ ItemType* m_itemType;
+ ItemType* m_itemType_mod;
};
#endif
diff --git a/pokemodr/ItemUI.cpp b/pokemodr/ItemUI.cpp
index b8194a42..70cf36b5 100644
--- a/pokemodr/ItemUI.cpp
+++ b/pokemodr/ItemUI.cpp
@@ -1,43 +1,39 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/ItemUI.cpp
-// Purpose: Item UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:31:08 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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/>.
+ */
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <ItemType.h>
#include <Pokemod.h>
+// Header include
#include "ItemUI.h"
-ItemUI::ItemUI(Item* i, QWidget* parent) :
+ItemUI::ItemUI(Item* item, QWidget* parent) :
ObjectUI(parent),
- item(i),
- item_mod(new Item(i->getPokemod(), *i, i->getId()))
+ m_item(item),
+ m_item_mod(new Item(*item))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(item, item_mod);
+ setObjects(m_item, m_item_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -45,79 +41,79 @@ ItemUI::ItemUI(Item* i, QWidget* parent) :
void ItemUI::refreshGui()
{
varType->clear();
- for (int i = 0; i < item->getPokemod()->getItemTypeCount(); ++i)
+ for (int i = 0; i < m_item->pokemod()->itemTypeCount(); ++i)
{
- const ItemType* it = item->getPokemod()->getItemType(i);
- varType->addItem(it->getName());
- varType->setItemData(i, it->getId());
+ const ItemType* itemType = m_item->pokemod()->itemType(i);
+ varType->addItem(itemType->name());
+ varType->setItemData(i, itemType->id());
}
- varPrice->setMaximum(item->getPokemod()->getRules()->getMaxMoney());
+ varPrice->setMaximum(m_item->pokemod()->rules()->maxMoney());
}
void ItemUI::setGui()
{
- varName->setText(item_mod->getName());
- boxSellable->setChecked(item_mod->getSellable() ? Qt::Checked : Qt::Unchecked);
- varType->setCurrentIndex(varType->findData(item_mod->getType()));
- varPrice->setValue(item_mod->getPrice());
- varDescription->setText(item_mod->getDescription());
+ varName->setText(m_item_mod->name());
+ boxSellable->setChecked(m_item_mod->sellable() ? Qt::Checked : Qt::Unchecked);
+ varType->setCurrentIndex(varType->findData(m_item_mod->type()));
+ varPrice->setValue(m_item_mod->price());
+ varDescription->setText(m_item_mod->description());
}
void ItemUI::on_buttonApply_clicked()
{
- *item = *item_mod;
+ *m_item = *m_item_mod;
emit(changed(false));
}
void ItemUI::on_buttonDiscard_clicked()
{
- *item_mod = *item;
+ *m_item_mod = *m_item;
setGui();
emit(changed(false));
}
-void ItemUI::on_varName_textChanged(const QString& n)
+void ItemUI::on_varName_textChanged(const QString& name)
{
- item_mod->setName(n);
+ m_item_mod->setName(name);
emit(changed(true));
}
-void ItemUI::on_boxSellable_toggled(const bool s)
+void ItemUI::on_boxSellable_toggled(const bool sellable)
{
- item_mod->setSellable(s);
+ m_item_mod->setSellable(sellable);
emit(changed(true));
}
-void ItemUI::on_varType_currentIndexChanged(const int t)
+void ItemUI::on_varType_currentIndexChanged(const int type)
{
try
{
- item_mod->setType(varType->itemData(t).toInt());
+ m_item_mod->setType(varType->itemData(type).toInt());
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void ItemUI::on_varPrice_valueChanged(const int p)
+void ItemUI::on_varPrice_valueChanged(const int price)
{
try
{
- item_mod->setPrice(p);
+ m_item_mod->setPrice(price);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
void ItemUI::on_varDescription_textChanged()
{
- item_mod->setDescription(varDescription->toPlainText());
+ m_item_mod->setDescription(varDescription->toPlainText());
emit(changed(true));
}
diff --git a/pokemodr/ItemUI.h b/pokemodr/ItemUI.h
index f6ebfdca..7398738f 100644
--- a/pokemodr/ItemUI.h
+++ b/pokemodr/ItemUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/ItemUI.h
-// Purpose: Item UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:29:48 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_ITEMUI__
#define __POKEMODR_ITEMUI__
-#include <QString>
-
+// Pokemod includes
#include <Item.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_item.h"
class ItemUI : public ObjectUI, private Ui::formItem
@@ -36,25 +32,25 @@ class ItemUI : public ObjectUI, private Ui::formItem
Q_OBJECT
public:
- ItemUI(Item* i, QWidget* parent);
+ ItemUI(Item* item, QWidget* parent);
~ItemUI()
{
- delete item_mod;
+ delete m_item_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_boxSellable_toggled(const bool s);
- void on_varType_currentIndexChanged(const int t);
- void on_varPrice_valueChanged(const int p);
+ void on_varName_textChanged(const QString& name);
+ void on_boxSellable_toggled(const bool sellable);
+ void on_varType_currentIndexChanged(const int type);
+ void on_varPrice_valueChanged(const int price);
void on_varDescription_textChanged();
private:
void refreshGui();
void setGui();
- Item* item;
- Item* item_mod;
+ Item* m_item;
+ Item* m_item_mod;
};
#endif
diff --git a/pokemodr/MapTrainerTeamMemberUI.cpp b/pokemodr/MapTrainerTeamMemberUI.cpp
index 65b6a6f1..e630658f 100644
--- a/pokemodr/MapTrainerTeamMemberUI.cpp
+++ b/pokemodr/MapTrainerTeamMemberUI.cpp
@@ -1,46 +1,44 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapTrainerTeamMemberUI.cpp
-// Purpose: MapTrainerTeamMember UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 13:39:26 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// Qt includes
#include <QListWidgetItem>
-#include <QMetaObject>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Item.h>
#include <Nature.h>
#include <Pokemod.h>
#include <Species.h>
+// Header include
#include "MapTrainerTeamMemberUI.h"
-MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* t, QWidget* parent) :
+MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember, QWidget* parent) :
ObjectUI(parent),
- mapTrainerTeamMember(t),
- mapTrainerTeamMember_mod(new MapTrainerTeamMember(t->getPokemod(), *t, t->getId()))
+ m_teamMember(teamMember),
+ m_teamMember_mod(new MapTrainerTeamMember(*teamMember))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(mapTrainerTeamMember, mapTrainerTeamMember_mod);
+ setObjects(m_teamMember, m_teamMember_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -48,45 +46,45 @@ MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* t, QWidget*
void MapTrainerTeamMemberUI::refreshGui()
{
varSpecies->clear();
- for (int i = 0; i < mapTrainerTeamMember->getPokemod()->getSpeciesCount(); ++i)
+ for (int i = 0; i < m_teamMember->pokemod()->speciesCount(); ++i)
{
- const Species* s = mapTrainerTeamMember->getPokemod()->getSpecies(i);
- varSpecies->addItem(s->getName());
- varSpecies->setItemData(i, s->getId());
+ const Species* species = m_teamMember->pokemod()->species(i);
+ varSpecies->addItem(species->name());
+ varSpecies->setItemData(i, species->id());
}
- varLevel->setMaximum(mapTrainerTeamMember->getPokemod()->getRules()->getMaxLevel());
+ varLevel->setMaximum(m_teamMember->pokemod()->rules()->maxLevel());
}
void MapTrainerTeamMemberUI::setGui()
{
- varSpecies->setCurrentIndex(varSpecies->findData(mapTrainerTeamMember_mod->getSpecies()));
- varLevel->setValue(mapTrainerTeamMember_mod->getLevel());
- varNature->setCurrentIndex(varNature->findData(mapTrainerTeamMember_mod->getNature()));
+ varSpecies->setCurrentIndex(varSpecies->findData(m_teamMember_mod->species()));
+ varLevel->setValue(m_teamMember_mod->level());
+ varNature->setCurrentIndex(varNature->findData(m_teamMember_mod->nature()));
for (int i = 0; i < varItems->count(); ++i)
{
- QListWidgetItem* lwi = varItems->item(i);
- lwi->setSelected(mapTrainerTeamMember_mod->getItem(lwi->data(Qt::UserRole).toInt()));
+ QListWidgetItem* widgetItem = varItems->item(i);
+ widgetItem->setSelected(m_teamMember_mod->item(widgetItem->data(Qt::UserRole).toInt()));
}
varNature->clear();
- if (mapTrainerTeamMember->getPokemod()->getRules()->getNatureAllowed())
+ if (m_teamMember->pokemod()->rules()->natureAllowed())
{
- for (int i = 0; i < mapTrainerTeamMember->getPokemod()->getNatureCount(); ++i)
+ for (int i = 0; i < m_teamMember->pokemod()->natureCount(); ++i)
{
- const Nature* n = mapTrainerTeamMember->getPokemod()->getNature(i);
- varNature->addItem(n->getName());
- varNature->setItemData(i, n->getId());
+ const Nature* nature = m_teamMember->pokemod()->nature(i);
+ varNature->addItem(nature->name());
+ varNature->setItemData(i, nature->id());
}
}
else
boxNature->setEnabled(false);
varItems->clear();
- if (mapTrainerTeamMember->getPokemod()->getRules()->getHoldItems())
+ if (m_teamMember->pokemod()->rules()->holdItems())
{
- for (int i = 0; i < mapTrainerTeamMember->getPokemod()->getItemCount(); ++i)
+ for (int i = 0; i < m_teamMember->pokemod()->itemCount(); ++i)
{
- const Item* it = mapTrainerTeamMember->getPokemod()->getItem(i);
- QListWidgetItem* lwi = new QListWidgetItem(it->getName(), varItems);
- lwi->setData(Qt::UserRole, it->getId());
+ const Item* item = m_teamMember->pokemod()->item(i);
+ QListWidgetItem* widgetItem = new QListWidgetItem(item->name(), varItems);
+ widgetItem->setData(Qt::UserRole, item->id());
}
}
else
@@ -95,55 +93,55 @@ void MapTrainerTeamMemberUI::setGui()
void MapTrainerTeamMemberUI::on_buttonApply_clicked()
{
- *mapTrainerTeamMember = *mapTrainerTeamMember_mod;
+ *m_teamMember = *m_teamMember_mod;
emit(changed(false));
}
void MapTrainerTeamMemberUI::on_buttonDiscard_clicked()
{
- *mapTrainerTeamMember_mod = *mapTrainerTeamMember;
+ *m_teamMember_mod = *m_teamMember;
setGui();
emit(changed(false));
}
-void MapTrainerTeamMemberUI::on_varSpecies_currentIndexChanged(const int s)
+void MapTrainerTeamMemberUI::on_varSpecies_currentIndexChanged(const int species)
{
try
{
- mapTrainerTeamMember_mod->setSpecies(varSpecies->itemData(s).toInt());
+ m_teamMember_mod->setSpecies(varSpecies->itemData(species).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapTrainerTeamMemberUI::on_varLevel_valueChanged(const int l)
+void MapTrainerTeamMemberUI::on_varLevel_valueChanged(const int level)
{
try
{
- mapTrainerTeamMember_mod->setLevel(l);
+ m_teamMember_mod->setLevel(level);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void MapTrainerTeamMemberUI::on_varNature_currentIndexChanged(const int n)
+void MapTrainerTeamMemberUI::on_varNature_currentIndexChanged(const int nature)
{
try
{
- mapTrainerTeamMember_mod->setNature(varNature->itemData(n).toInt());
+ m_teamMember_mod->setNature(varNature->itemData(nature).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
@@ -154,14 +152,14 @@ void MapTrainerTeamMemberUI::on_varItems_itemSelectionChanged()
{
for (int i = 0; i < varItems->count(); ++i)
{
- const QListWidgetItem* lwi = varItems->item(i);
- mapTrainerTeamMember_mod->setItem(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ const QListWidgetItem* widgetItem = varItems->item(i);
+ m_teamMember_mod->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/MapTrainerTeamMemberUI.h b/pokemodr/MapTrainerTeamMemberUI.h
index 5fc8c405..116ce2ce 100644
--- a/pokemodr/MapTrainerTeamMemberUI.h
+++ b/pokemodr/MapTrainerTeamMemberUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapTrainerTeamMemberUI.h
-// Purpose: MapTrainerTeamMember UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 14:39:14 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_MAPTRAINERTEAMMEMBERUI__
#define __POKEMODR_MAPTRAINERTEAMMEMBERUI__
+// Pokemod includes
#include <MapTrainerTeamMember.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_maptrainerteammember.h"
class MapTrainerTeamMemberUI : public ObjectUI, private Ui::formMapTrainerTeamMember
@@ -34,24 +32,24 @@ class MapTrainerTeamMemberUI : public ObjectUI, private Ui::formMapTrainerTeamMe
Q_OBJECT
public:
- MapTrainerTeamMemberUI(MapTrainerTeamMember* t, QWidget* parent);
+ MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember, QWidget* parent);
~MapTrainerTeamMemberUI()
{
- delete mapTrainerTeamMember_mod;
+ delete m_teamMember_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varSpecies_currentIndexChanged(const int s);
- void on_varLevel_valueChanged(const int l);
- void on_varNature_currentIndexChanged(const int n);
+ void on_varSpecies_currentIndexChanged(const int species);
+ void on_varLevel_valueChanged(const int level);
+ void on_varNature_currentIndexChanged(const int nature);
void on_varItems_itemSelectionChanged();
private:
void refreshGui();
void setGui();
- MapTrainerTeamMember* mapTrainerTeamMember;
- MapTrainerTeamMember* mapTrainerTeamMember_mod;
+ MapTrainerTeamMember* m_teamMember;
+ MapTrainerTeamMember* m_teamMember_mod;
};
#endif
diff --git a/pokemodr/MapUI.cpp b/pokemodr/MapUI.cpp
index a9760c28..27bcfc6b 100644
--- a/pokemodr/MapUI.cpp
+++ b/pokemodr/MapUI.cpp
@@ -1,47 +1,45 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapUI.cpp
-// Purpose: Map UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 2 00:50:25 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
+/*
+ * 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/>.
+ */
+
+// Qt includes
#include <QHeaderView>
#include <QIcon>
-#include <QMetaObject>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <MapWarp.h>
#include <Pokemod.h>
+// Header include
#include "MapUI.h"
-MapUI::MapUI(Map* m, QWidget* parent) :
+MapUI::MapUI(Map* map, QWidget* parent) :
ObjectUI(parent),
- map(m),
- map_mod(new Map(m->getPokemod(), *m, m->getId())),
- model(new TilemapModel(this, map_mod->getMap(), map->getPokemod())),
- delegate(new TileDelegate(this))
+ m_map(map),
+ m_map_mod(new Map(*map)),
+ m_model(new TilemapModel(this, m_map_mod->map(), m_map->pokemod())),
+ m_delegate(new TileDelegate(this))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(map, map_mod);
+ setObjects(m_map, m_map_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -53,112 +51,116 @@ void MapUI::initGui()
varTilemap->verticalHeader()->setResizeMode(QHeaderView::Fixed);
varTilemap->horizontalHeader()->setDefaultSectionSize(64);
varTilemap->verticalHeader()->setDefaultSectionSize(64);
- varTilemap->setModel(model);
- varTilemap->setItemDelegate(delegate);
+ varTilemap->setModel(m_model);
+ varTilemap->setItemDelegate(m_delegate);
}
void MapUI::refreshGui()
{
varFlyWarp->clear();
- for (int i = 0; i < map->getWarpCount(); ++i)
+ for (int i = 0; i < m_map->warpCount(); ++i)
{
- const MapWarp* w = map->getWarp(i);
- varFlyWarp->addItem(w->getName());
- varFlyWarp->setItemData(i, w->getId());
+ const MapWarp* warp = m_map->warp(i);
+ varFlyWarp->addItem(warp->name());
+ varFlyWarp->setItemData(i, warp->id());
}
}
void MapUI::setGui()
{
- varName->setText(map_mod->getName());
- boxFlyWarp->setChecked((map_mod->getFlyWarp() == INT_MAX) ? Qt::Unchecked : Qt::Checked);
- varFlyWarp->setCurrentIndex(varFlyWarp->findData(map_mod->getFlyWarp()));
- varType->setCurrentIndex(map_mod->getType());
+ varName->setText(m_map_mod->name());
+ boxFlyWarp->setChecked((m_map_mod->flyWarp() == INT_MAX) ? Qt::Unchecked : Qt::Checked);
+ varFlyWarp->setCurrentIndex(varFlyWarp->findData(m_map_mod->flyWarp()));
+ varType->setCurrentIndex(m_map_mod->type());
+ buttonDeleteColumn->setEnabled(0 < m_model->columnCount());
+ buttonDeleteRow->setEnabled(0 < m_model->rowCount());
}
void MapUI::on_buttonApply_clicked()
{
- *map = *map_mod;
+ *m_map = *m_map_mod;
emit(changed(false));
}
void MapUI::on_buttonDiscard_clicked()
{
- *map_mod = *map;
+ *m_map_mod = *m_map;
setGui();
emit(changed(false));
}
-void MapUI::on_varName_textChanged(const QString& n)
+void MapUI::on_varName_textChanged(const QString& name)
{
- map_mod->setName(n);
+ m_map_mod->setName(name);
emit(changed(true));
}
void MapUI::on_boxFlyWarp_toggled()
{
- map_mod->setFlyWarp(-1);
+ m_map_mod->setFlyWarp(-1);
emit(changed(true));
}
-void MapUI::on_varFlyWarp_currentIndexChanged(const int f)
+void MapUI::on_varFlyWarp_currentIndexChanged(const int flyWarp)
{
try
{
- map_mod->setFlyWarp(varFlyWarp->itemData(f).toInt());
+ m_map_mod->setFlyWarp(varFlyWarp->itemData(flyWarp).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapUI::on_varType_currentIndexChanged(const int t)
+void MapUI::on_varType_currentIndexChanged(const int type)
{
try
{
- map_mod->setType(t);
+ m_map_mod->setType(type);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
void MapUI::on_buttonAddColumn_pressed()
{
- model->addColumn();
- buttonDeleteColumn->setEnabled(true);
+ m_model->addColumn();
+ emit(changed(true));
}
void MapUI::on_buttonAddRow_pressed()
{
- model->addRow();
- buttonDeleteRow->setEnabled(true);
+ m_model->addRow();
+ emit(changed(true));
}
void MapUI::on_buttonDeleteColumn_pressed()
{
- model->removeColumns(varTilemap->currentIndex().column(), 1);
+ m_model->removeColumns(varTilemap->currentIndex().column(), 1);
+ emit(changed(true));
}
void MapUI::on_buttonDeleteRow_pressed()
{
- model->removeRows(varTilemap->currentIndex().row(), 1);
+ m_model->removeRows(varTilemap->currentIndex().row(), 1);
+ emit(changed(true));
}
void MapUI::on_buttonInsertColumn_pressed()
{
- model->insertColumns(varTilemap->currentIndex().column(), 1);
- buttonDeleteColumn->setEnabled(true);
+ m_model->insertColumns(varTilemap->currentIndex().column(), 1);
+ emit(changed(true));
}
void MapUI::on_buttonInsertRow_pressed()
{
- model->insertRows(varTilemap->currentIndex().row(), 1);
- buttonDeleteRow->setEnabled(true);
+ m_model->insertRows(varTilemap->currentIndex().row(), 1);
+ emit(changed(true));
}
diff --git a/pokemodr/MapUI.h b/pokemodr/MapUI.h
index f365660f..85d281e6 100644
--- a/pokemodr/MapUI.h
+++ b/pokemodr/MapUI.h
@@ -1,36 +1,32 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapUI.h
-// Purpose: Map UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 2 00:50:25 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_MAPUI__
#define __POKEMODR_MAPUI__
-#include <QString>
-
+// Pokemod includes
#include <Map.h>
+// PokeModr includes
#include "ObjectUI.h"
#include "TileDelegate.h"
#include "TilemapModel.h"
+// Form include
#include "ui_map.h"
class MapUI : public ObjectUI, private Ui::formMap
@@ -38,20 +34,20 @@ class MapUI : public ObjectUI, private Ui::formMap
Q_OBJECT
public:
- MapUI(Map* m, QWidget* parent);
+ MapUI(Map* map, QWidget* parent);
~MapUI()
{
- delete model;
- delete delegate;
- delete map_mod;
+ delete m_model;
+ delete m_delegate;
+ delete m_map_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
+ void on_varName_textChanged(const QString& name);
void on_boxFlyWarp_toggled();
- void on_varFlyWarp_currentIndexChanged(const int f);
- void on_varType_currentIndexChanged(const int t);
+ void on_varFlyWarp_currentIndexChanged(const int flyWarp);
+ void on_varType_currentIndexChanged(const int type);
void on_buttonAddColumn_pressed();
void on_buttonAddRow_pressed();
void on_buttonDeleteColumn_pressed();
@@ -63,11 +59,11 @@ class MapUI : public ObjectUI, private Ui::formMap
void refreshGui();
void setGui();
- Map* map;
- Map* map_mod;
+ Map* m_map;
+ Map* m_map_mod;
- TilemapModel* model;
- TileDelegate* delegate;
+ TilemapModel* m_model;
+ TileDelegate* m_delegate;
};
#endif
diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp
index 01364df7..4d2d4f51 100644
--- a/pokemodr/MapWarpUI.cpp
+++ b/pokemodr/MapWarpUI.cpp
@@ -1,45 +1,44 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapWarpUI.cpp
-// Purpose: MapWarp UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 03:31:28 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// Qt includes
#include <QListWidgetItem>
-#include <QMetaObject>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Dialog.h>
#include <Pokemod.h>
#include <Map.h>
+// Header includeo
#include "MapWarpUI.h"
-MapWarpUI::MapWarpUI(MapWarp* w, QWidget* parent) :
+MapWarpUI::MapWarpUI(MapWarp* warp, QWidget* parent) :
ObjectUI(parent),
- mapWarp(w),
- mapWarp_mod(new MapWarp(w->getPokemod(), *w, w->getId()))
+ m_lastMap(-1),
+ m_warp(warp),
+ m_warp_mod(new MapWarp(*warp))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(mapWarp, mapWarp_mod);
+ setObjects(m_warp, m_warp_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -53,96 +52,89 @@ void MapWarpUI::initGui()
void MapWarpUI::refreshGui()
{
varToMap->clear();
- for (int i = 0; i < mapWarp->getPokemod()->getMapCount(); ++i)
+ for (int i = 0; i < m_warp->pokemod()->mapCount(); ++i)
{
- const Map* m = mapWarp->getPokemod()->getMap(i);
- varToMap->addItem(m->getName());
- varToMap->setItemData(i, m->getId());
+ const Map* map = m_warp->pokemod()->map(i);
+ varToMap->addItem(map->name());
+ varToMap->setItemData(i, map->id());
}
varDialog->clear();
- for (int i = 0; i < mapWarp->getPokemod()->getDialogCount(); ++i)
+ for (int i = 0; i < m_warp->pokemod()->dialogCount(); ++i)
{
- const Dialog* d = mapWarp->getPokemod()->getDialog(i);
- varDialog->addItem(d->getDialog().mid(0, 25));
- varDialog->setItemData(i, d->getId());
+ const Dialog* dialog = m_warp->pokemod()->dialog(i);
+ varDialog->addItem(dialog->dialog().mid(0, 25));
+ varDialog->setItemData(i, dialog->id());
}
}
void MapWarpUI::setGui()
{
- const bool resetWarps = (mapWarp_mod->getToMap() == lastMap);
- varName->setText(mapWarp_mod->getName());
- varCoordinateX->setValue(mapWarp_mod->getCoordinate().getX());
- varCoordinateY->setValue(mapWarp_mod->getCoordinate().getY());
+ const bool resetWarps = (m_warp_mod->toMap() == m_lastMap);
+ varName->setText(m_warp_mod->name());
+ varCoordinate->setValue(m_warp_mod->coordinate());
for (int i = 0; i < varActivation->count(); ++i)
- varActivation->item(i)->setSelected(mapWarp_mod->getFrom(i));
- varDirectionOut->setCurrentIndex(mapWarp_mod->getDirectionOut());
- varType->setCurrentIndex(mapWarp_mod->getWarpType());
- varBiking->setCheckState((mapWarp_mod->getIsBiking() == Flag::On) ? Qt::Checked : ((mapWarp_mod->getIsBiking() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
- varFlash->setCheckState((mapWarp_mod->getIsFlash() == Flag::On) ? Qt::Checked : ((mapWarp_mod->getIsFlash() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
- varFog->setCheckState((mapWarp_mod->getIsFoggy() == Flag::On) ? Qt::Checked : ((mapWarp_mod->getIsFoggy() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
- varToMap->setCurrentIndex(varToMap->findData(mapWarp_mod->getToMap()));
- lastMap = mapWarp_mod->getToMap();
+ varActivation->item(i)->setSelected(m_warp_mod->from(i));
+ varDirectionOut->setCurrentIndex(m_warp_mod->directionOut());
+ varType->setCurrentIndex(m_warp_mod->warpType());
+ varBiking->setCheckState((m_warp_mod->isBiking() == Flag::On) ? Qt::Checked : ((m_warp_mod->isBiking() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
+ varFlash->setCheckState((m_warp_mod->isFlash() == Flag::On) ? Qt::Checked : ((m_warp_mod->isFlash() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
+ varFog->setCheckState((m_warp_mod->isFoggy() == Flag::On) ? Qt::Checked : ((m_warp_mod->isFoggy() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked));
+ varToMap->setCurrentIndex(varToMap->findData(m_warp_mod->toMap()));
+ m_lastMap = m_warp_mod->toMap();
if (resetWarps)
{
varToWarp->clear();
- int index = mapWarp->getPokemod()->getMapIndex(mapWarp_mod->getToMap());
+ int index = m_warp->pokemod()->mapIndex(m_warp_mod->toMap());
if (index != INT_MAX)
{
try
{
- const Map* m = mapWarp->getPokemod()->getMap(index);
- for (int i = 0; i < m->getWarpCount(); ++i)
+ const Map* map = m_warp->pokemod()->map(index);
+ for (int i = 0; i < map->warpCount(); ++i)
{
- const MapWarp* w = m->getWarp(i);
- varToWarp->addItem(w->getName());
- varToWarp->setItemData(i, w->getId());
+ const MapWarp* warp = map->warp(i);
+ varToWarp->addItem(warp->name());
+ varToWarp->setItemData(i, warp->id());
}
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
}
}
- varToWarp->setCurrentIndex(varToMap->findData(mapWarp_mod->getToWarp()));
- boxFlag->setChecked((mapWarp_mod->getWorkingFlag().getStatus() == Flag::Ignore) ? Qt::Unchecked : Qt::Checked);
+ varToWarp->setCurrentIndex(varToMap->findData(m_warp_mod->toWarp()));
+ boxFlag->setChecked((m_warp_mod->workingFlag().status() == Flag::Ignore) ? Qt::Unchecked : Qt::Checked);
if (boxFlag->isChecked())
{
- varFlag->setValue(mapWarp_mod->getWorkingFlag().getFlag());
- varState->setCheckState((mapWarp_mod->getWorkingFlag().getStatus() == Flag::On) ? Qt::Checked : Qt::Unchecked);
+ varFlag->setValue(m_warp_mod->workingFlag().flag());
+ varState->setCheckState((m_warp_mod->workingFlag().status() == Flag::On) ? Qt::Checked : Qt::Unchecked);
}
- varDialog->setCurrentIndex(varDialog->findData(mapWarp_mod->getDialog()));
+ varDialog->setCurrentIndex(varDialog->findData(m_warp_mod->dialog()));
}
void MapWarpUI::on_buttonApply_clicked()
{
- *mapWarp = *mapWarp_mod;
+ *m_warp = *m_warp_mod;
emit(changed(false));
}
void MapWarpUI::on_buttonDiscard_clicked()
{
- *mapWarp_mod = *mapWarp;
+ *m_warp_mod = *m_warp;
setGui();
emit(changed(false));
}
-void MapWarpUI::on_varName_textChanged(const QString& n)
+void MapWarpUI::on_varName_textChanged(const QString& name)
{
- mapWarp_mod->setName(n);
+ m_warp_mod->setName(name);
emit(changed(true));
}
-void MapWarpUI::on_varCoordinateX_valueChanged(const int x)
+void MapWarpUI::on_varCoordinate_valueChanged(const Point& coordinate)
{
- mapWarp_mod->setCoordinateX(x);
- emit(changed(true));
-}
-
-void MapWarpUI::on_varCoordinateY_valueChanged(const int y)
-{
- mapWarp_mod->setCoordinateY(y);
+ m_warp_mod->setCoordinate(coordinate);
emit(changed(true));
}
@@ -151,144 +143,144 @@ void MapWarpUI::on_varActivation_itemSelectionChanged()
try
{
for (int i = 0; i < varActivation->count(); ++i)
- mapWarp_mod->setFrom(i, varActivation->item(i)->isSelected());
+ m_warp_mod->setFrom(i, varActivation->item(i)->isSelected());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWarpUI::on_varDirectionOut_currentIndexChanged(const int d)
+void MapWarpUI::on_varDirectionOut_currentIndexChanged(const int directionOut)
{
try
{
- mapWarp_mod->setDirectionOut(d);
+ m_warp_mod->setDirectionOut(directionOut);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWarpUI::on_varType_currentIndexChanged(const int t)
+void MapWarpUI::on_varType_currentIndexChanged(const int type)
{
try
{
- mapWarp_mod->setWarpType(t);
+ m_warp_mod->setWarpType(type);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWarpUI::on_varBiking_stateChanged(const int b)
+void MapWarpUI::on_varBiking_stateChanged(const int biking)
{
try
{
- mapWarp_mod->setIsBiking(b);
+ m_warp_mod->setIsBiking(biking);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWarpUI::on_varFlash_stateChanged(const int f)
+void MapWarpUI::on_varFlash_stateChanged(const int flash)
{
try
{
- mapWarp_mod->setIsFlash(f);
+ m_warp_mod->setIsFlash(flash);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWarpUI::on_varFog_stateChanged(const int f)
+void MapWarpUI::on_varFog_stateChanged(const int fog)
{
try
{
- mapWarp_mod->setIsFoggy(f);
+ m_warp_mod->setIsFoggy(fog);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWarpUI::on_varToMap_currentIndexChanged(const int m)
+void MapWarpUI::on_varToMap_currentIndexChanged(const int toMap)
{
try
{
- mapWarp_mod->setToMap(m);
+ m_warp_mod->setToMap(toMap);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void MapWarpUI::on_varToWarp_currentIndexChanged(const int w)
+void MapWarpUI::on_varToWarp_currentIndexChanged(const int toWarp)
{
try
{
- mapWarp_mod->setToWarp(w);
+ m_warp_mod->setToWarp(toWarp);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWarpUI::on_boxFlag_toggled(const bool f)
+void MapWarpUI::on_boxFlag_toggled(const bool flagUsed)
{
- if (!f)
- mapWarp_mod->setWorkingFlagStatus(Flag::Ignore);
+ if (!flagUsed)
+ m_warp_mod->setWorkingFlag(Flag(varFlag->value(), Flag::Ignore));
emit(changed(true));
setGui();
}
-void MapWarpUI::on_varFlag_valueChanged(const int f)
+void MapWarpUI::on_varFlag_valueChanged(const int flag)
{
- mapWarp_mod->setWorkingFlagFlag(f);
+ m_warp_mod->setWorkingFlag(Flag(flag, boxFlag->isChecked() ? Flag::Ignore : (varState->isChecked() ? Flag::On : Flag::Off)));
emit(changed(true));
}
-void MapWarpUI::on_varState_toggled(const bool s)
+void MapWarpUI::on_varState_toggled(const bool status)
{
- mapWarp_mod->setWorkingFlagStatus(s ? Flag::On : Flag::Off);
+ m_warp_mod->setWorkingFlag(Flag(varFlag->value(), status ? Flag::On : Flag::Off));
emit(changed(true));
}
-void MapWarpUI::on_varDialog_currentIndexChanged(const int d)
+void MapWarpUI::on_varDialog_currentIndexChanged(const int dialog)
{
try
{
- mapWarp_mod->setDialog(d);
+ m_warp_mod->setDialog(dialog);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/MapWarpUI.h b/pokemodr/MapWarpUI.h
index fba77f4e..899fd384 100644
--- a/pokemodr/MapWarpUI.h
+++ b/pokemodr/MapWarpUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapWarpUI.h
-// Purpose: MapWarp UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 03:20:44 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_MAPWARPUI__
#define __POKEMODR_MAPWARPUI__
-#include <QString>
-
+// Pokemod includes
#include <MapWarp.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_mapwarp.h"
class MapWarpUI : public ObjectUI, private Ui::formMapWarp
@@ -36,38 +32,37 @@ class MapWarpUI : public ObjectUI, private Ui::formMapWarp
Q_OBJECT
public:
- MapWarpUI(MapWarp* w, QWidget* parent);
+ MapWarpUI(MapWarp* warp, QWidget* parent);
~MapWarpUI()
{
- delete mapWarp_mod;
+ delete m_warp_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varCoordinateX_valueChanged(const int x);
- void on_varCoordinateY_valueChanged(const int y);
+ void on_varName_textChanged(const QString& name);
+ void on_varCoordinate_valueChanged(const Point& coordinate);
void on_varActivation_itemSelectionChanged();
- void on_varDirectionOut_currentIndexChanged(const int d);
- void on_varType_currentIndexChanged(const int t);
- void on_varBiking_stateChanged(const int b);
- void on_varFlash_stateChanged(const int f);
- void on_varFog_stateChanged(const int f);
- void on_varToMap_currentIndexChanged(const int m);
- void on_varToWarp_currentIndexChanged(const int w);
- void on_boxFlag_toggled(const bool f);
- void on_varFlag_valueChanged(const int f);
- void on_varState_toggled(const bool s);
- void on_varDialog_currentIndexChanged(const int d);
+ void on_varDirectionOut_currentIndexChanged(const int directionOut);
+ void on_varType_currentIndexChanged(const int type);
+ void on_varBiking_stateChanged(const int biking);
+ void on_varFlash_stateChanged(const int flash);
+ void on_varFog_stateChanged(const int fog);
+ void on_varToMap_currentIndexChanged(const int toMap);
+ void on_varToWarp_currentIndexChanged(const int toWarp);
+ void on_boxFlag_toggled(const bool flagUsed);
+ void on_varFlag_valueChanged(const int flag);
+ void on_varState_toggled(const bool state);
+ void on_varDialog_currentIndexChanged(const int dialog);
private:
void initGui();
void refreshGui();
void setGui();
- int lastMap;
+ int m_lastMap;
- MapWarp* mapWarp;
- MapWarp* mapWarp_mod;
+ MapWarp* m_warp;
+ MapWarp* m_warp_mod;
};
#endif
diff --git a/pokemodr/MapWildListEncounterUI.cpp b/pokemodr/MapWildListEncounterUI.cpp
index e5a1923a..4ca92481 100644
--- a/pokemodr/MapWildListEncounterUI.cpp
+++ b/pokemodr/MapWildListEncounterUI.cpp
@@ -1,43 +1,39 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapWildListEncounterUI.cpp
-// Purpose: MapWildListEncounter UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 13:10:47 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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/>.
+ */
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Pokemod.h>
#include <Species.h>
+// Header include
#include "MapWildListEncounterUI.h"
-MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* w, QWidget* parent) :
+MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* encounter, QWidget* parent) :
ObjectUI(parent),
- mapWildListEncounter(w),
- mapWildListEncounter_mod(new MapWildListEncounter(w->getPokemod(), *w, w->getId()))
+ m_encounter(encounter),
+ m_encounter_mod(new MapWildListEncounter(*encounter))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(mapWildListEncounter, mapWildListEncounter_mod);
+ setObjects(m_encounter, m_encounter_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -45,73 +41,73 @@ MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* w, QWidget*
void MapWildListEncounterUI::refreshGui()
{
varSpecies->clear();
- for (int i = 0; i < mapWildListEncounter->getPokemod()->getSpeciesCount(); ++i)
+ for (int i = 0; i < m_encounter->pokemod()->speciesCount(); ++i)
{
- const Species* s = mapWildListEncounter->getPokemod()->getSpecies(i);
- varSpecies->addItem(s->getName());
- varSpecies->setItemData(i, s->getId());
+ const Species* species = m_encounter->pokemod()->species(i);
+ varSpecies->addItem(species->name());
+ varSpecies->setItemData(i, species->id());
}
- varLevel->setMaximum(mapWildListEncounter->getPokemod()->getRules()->getMaxLevel());
+ varLevel->setMaximum(m_encounter->pokemod()->rules()->maxLevel());
}
void MapWildListEncounterUI::setGui()
{
- varSpecies->setCurrentIndex(varSpecies->findData(mapWildListEncounter_mod->getSpecies()));
- varLevel->setValue(mapWildListEncounter_mod->getLevel());
- varWeight->setValue(mapWildListEncounter_mod->getWeight());
+ varSpecies->setCurrentIndex(varSpecies->findData(m_encounter_mod->species()));
+ varLevel->setValue(m_encounter_mod->level());
+ varWeight->setValue(m_encounter_mod->weight());
}
void MapWildListEncounterUI::on_buttonApply_clicked()
{
- *mapWildListEncounter = *mapWildListEncounter_mod;
+ *m_encounter = *m_encounter_mod;
emit(changed(false));
}
void MapWildListEncounterUI::on_buttonDiscard_clicked()
{
- *mapWildListEncounter_mod = *mapWildListEncounter;
+ *m_encounter_mod = *m_encounter;
setGui();
emit(changed(false));
}
-void MapWildListEncounterUI::on_varSpecies_currentIndexChanged(const int s)
+void MapWildListEncounterUI::on_varSpecies_currentIndexChanged(const int species)
{
try
{
- mapWildListEncounter_mod->setSpecies(varSpecies->itemData(s).toInt());
+ m_encounter_mod->setSpecies(varSpecies->itemData(species).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWildListEncounterUI::on_varLevel_valueChanged(const int l)
+void MapWildListEncounterUI::on_varLevel_valueChanged(const int level)
{
try
{
- mapWildListEncounter_mod->setLevel(l);
+ m_encounter_mod->setLevel(level);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void MapWildListEncounterUI::on_varWeight_valueChanged(const int w)
+void MapWildListEncounterUI::on_varWeight_valueChanged(const int weight)
{
try
{
- mapWildListEncounter_mod->setWeight(w);
+ m_encounter_mod->setWeight(weight);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
diff --git a/pokemodr/MapWildListEncounterUI.h b/pokemodr/MapWildListEncounterUI.h
index 070ff2f9..af3e384f 100644
--- a/pokemodr/MapWildListEncounterUI.h
+++ b/pokemodr/MapWildListEncounterUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapWildListEncounterUI.h
-// Purpose: MapWildListEncounter UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 14:22:33 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_MAPWILDLISTENCOUNTERUI__
#define __POKEMODR_MAPWILDLISTENCOUNTERUI__
+// Pokemod includes
#include <MapWildListEncounter.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_mapwildlistencounter.h"
class MapWildListEncounterUI : public ObjectUI, private Ui::formMapWildListEncounter
@@ -34,23 +32,23 @@ class MapWildListEncounterUI : public ObjectUI, private Ui::formMapWildListEncou
Q_OBJECT
public:
- MapWildListEncounterUI(MapWildListEncounter* w, QWidget* parent);
+ MapWildListEncounterUI(MapWildListEncounter* encounter, QWidget* parent);
~MapWildListEncounterUI()
{
- delete mapWildListEncounter_mod;
+ delete m_encounter_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varSpecies_currentIndexChanged(const int s);
- void on_varLevel_valueChanged(const int l);
- void on_varWeight_valueChanged(const int w);
+ void on_varSpecies_currentIndexChanged(const int species);
+ void on_varLevel_valueChanged(const int level);
+ void on_varWeight_valueChanged(const int weight);
private:
void refreshGui();
void setGui();
- MapWildListEncounter* mapWildListEncounter;
- MapWildListEncounter* mapWildListEncounter_mod;
+ MapWildListEncounter* m_encounter;
+ MapWildListEncounter* m_encounter_mod;
};
#endif
diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp
index df0d2ee6..87033b29 100644
--- a/pokemodr/MapWildListUI.cpp
+++ b/pokemodr/MapWildListUI.cpp
@@ -1,48 +1,46 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapWildListUI.cpp
-// Purpose: MapWildList UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 15:12:59 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// Qt includes
#include <QListWidgetItem>
-#include <QMetaObject>
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Item.h>
#include <ItemEffect.h>
#include <Pokemod.h>
#include <MapWildList.h>
#include <Time.h>
+// Header include
#include "MapWildListUI.h"
-MapWildListUI::MapWildListUI(MapWildList* w, QWidget* parent) :
+MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) :
ObjectUI(parent),
- mapWildList(w),
- mapWildList_mod(new MapWildList(w->getPokemod(), *w, w->getId()))
+ m_wildList(wildList),
+ m_wildList_mod(new MapWildList(*wildList))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(mapWildList, mapWildList_mod);
+ setObjects(m_wildList, m_wildList_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -56,84 +54,84 @@ void MapWildListUI::refreshGui()
{
varValue->clear();
varScope->clear();
- for (int i = 0; i < mapWildList->getPokemod()->getItemCount(); ++i)
+ for (int i = 0; i < m_wildList->pokemod()->itemCount(); ++i)
{
- const Item* it = mapWildList->getPokemod()->getItem(i);
- for (int j = 0; j < it->getEffectCount(); ++j)
+ const Item* item = m_wildList->pokemod()->item(i);
+ for (int j = 0; j < item->effectCount(); ++j)
{
- const ItemEffect* e = it->getEffect(j);
- if (e->getEffect() == ItemEffect::E_Fish)
+ const ItemEffect* effect = item->effect(j);
+ if (effect->effect() == ItemEffect::E_Fish)
{
- varValue->addItem(it->getName());
- varValue->setItemData(varValue->count() - 1, e->getVal2());
+ varValue->addItem(item->name());
+ varValue->setItemData(varValue->count() - 1, effect->value2());
}
- if (e->getEffect() == ItemEffect::E_Scope)
+ else if (effect->effect() == ItemEffect::E_Scope)
{
- varScope->addItem(it->getName());
- varScope->setItemData(varScope->count() - 1, e->getVal2());
+ varScope->addItem(item->name());
+ varScope->setItemData(varScope->count() - 1, effect->value2());
}
}
}
varTimes->clear();
- for (int i = 0; i < mapWildList->getPokemod()->getTimeCount(); ++i)
+ for (int i = 0; i < m_wildList->pokemod()->timeCount(); ++i)
{
- const Time* t = mapWildList->getPokemod()->getTime(i);
- QListWidgetItem* lwi = new QListWidgetItem(t->getName(), varTimes);
- lwi->setData(Qt::UserRole, t->getId());
+ const Time* time = m_wildList->pokemod()->time(i);
+ QListWidgetItem* widgetItem = new QListWidgetItem(time->name(), varTimes);
+ widgetItem->setData(Qt::UserRole, time->id());
}
}
void MapWildListUI::setGui()
{
- varControl->setCurrentIndex(mapWildList_mod->getControl());
- varValue->setEnabled(mapWildList_mod->getControl() == MapWildList::Fishing);
- varValue->setCurrentIndex(varValue->findData(mapWildList_mod->getValue()));
+ varControl->setCurrentIndex(m_wildList_mod->control());
+ varValue->setEnabled(m_wildList_mod->control() == MapWildList::Fishing);
+ varValue->setCurrentIndex(varValue->findData(m_wildList_mod->value()));
for (int i = 0; i < varTimes->count(); ++i)
{
- QListWidgetItem* lwi = varTimes->item(i);
- lwi->setSelected(mapWildList_mod->getTime(lwi->data(Qt::UserRole).toInt()));
+ QListWidgetItem* widgetItem = varTimes->item(i);
+ widgetItem->setSelected(m_wildList_mod->time(widgetItem->data(Qt::UserRole).toInt()));
}
- boxScope->setChecked(mapWildList_mod->getScope() == INT_MAX);
- varScope->setCurrentIndex(varScope->findData(mapWildList_mod->getScope()));
+ boxScope->setChecked(m_wildList_mod->scope() == INT_MAX);
+ varScope->setCurrentIndex(varScope->findData(m_wildList_mod->scope()));
}
void MapWildListUI::on_buttonApply_clicked()
{
- *mapWildList = *mapWildList_mod;
+ *m_wildList = *m_wildList_mod;
emit(changed(false));
}
void MapWildListUI::on_buttonDiscard_clicked()
{
- *mapWildList_mod = *mapWildList;
+ *m_wildList_mod = *m_wildList;
setGui();
emit(changed(false));
}
-void MapWildListUI::on_varControl_currentIndexChanged(const int c)
+void MapWildListUI::on_varControl_currentIndexChanged(const int control)
{
try
{
- mapWildList_mod->setControl(c);
+ m_wildList_mod->setControl(control);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void MapWildListUI::on_varValue_currentIndexChanged(const int v)
+void MapWildListUI::on_varValue_currentIndexChanged(const int value)
{
try
{
- mapWildList_mod->setValue(varValue->itemData(v).toInt());
+ m_wildList_mod->setValue(varValue->itemData(value).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -144,36 +142,36 @@ void MapWildListUI::on_varTimes_itemSelectionChanged()
{
for (int i = 0; i < varTimes->count(); ++i)
{
- const QListWidgetItem* lwi = varTimes->item(i);
- mapWildList_mod->setTime(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ const QListWidgetItem* widgetItem = varTimes->item(i);
+ m_wildList_mod->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWildListUI::on_boxScope_toggled(const bool s)
+void MapWildListUI::on_boxScope_toggled(const bool scopeUsed)
{
- if (!s)
- mapWildList_mod->setScope(INT_MAX);
+ if (!scopeUsed)
+ m_wildList_mod->setScope(INT_MAX);
emit(changed(true));
setGui();
}
-void MapWildListUI::on_varScope_currentIndexChanged(const int s)
+void MapWildListUI::on_varScope_currentIndexChanged(const int scope)
{
try
{
- mapWildList_mod->setScope(varScope->itemData(s).toInt());
+ m_wildList_mod->setScope(varScope->itemData(scope).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/MapWildListUI.h b/pokemodr/MapWildListUI.h
index d133ee06..c0514605 100644
--- a/pokemodr/MapWildListUI.h
+++ b/pokemodr/MapWildListUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapWildListUI.h
-// Purpose: MapWildList UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 13:49:18 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_MAPWILDLISTUI__
#define __POKEMODR_MAPWILDLISTUI__
+// Pokemod includes
#include <MapWildList.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_mapwildlist.h"
class MapWildListUI : public ObjectUI, private Ui::formMapWildList
@@ -34,26 +32,26 @@ class MapWildListUI : public ObjectUI, private Ui::formMapWildList
Q_OBJECT
public:
- MapWildListUI(MapWildList* w, QWidget* parent);
+ MapWildListUI(MapWildList* wildList, QWidget* parent);
~MapWildListUI()
{
- delete mapWildList_mod;
+ delete m_wildList_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varControl_currentIndexChanged(const int c);
- void on_varValue_currentIndexChanged(const int v);
+ void on_varControl_currentIndexChanged(const int control);
+ void on_varValue_currentIndexChanged(const int value);
void on_varTimes_itemSelectionChanged();
- void on_boxScope_toggled(const bool s);
- void on_varScope_currentIndexChanged(const int s);
+ void on_boxScope_toggled(const bool scopeUsed);
+ void on_varScope_currentIndexChanged(const int scope);
private:
void initGui();
void refreshGui();
void setGui();
- MapWildList* mapWildList;
- MapWildList* mapWildList_mod;
+ MapWildList* m_wildList;
+ MapWildList* m_wildList_mod;
};
#endif
diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp
index 563bfc8f..c9d2ba76 100644
--- a/pokemodr/MoveUI.cpp
+++ b/pokemodr/MoveUI.cpp
@@ -1,43 +1,39 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MoveUI.cpp
-// Purpose: Move UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 23:52:48 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
-
+/*
+ * 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/>.
+ */
+
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Pokemod.h>
#include <Type.h>
+// Header include
#include "MoveUI.h"
-MoveUI::MoveUI(Move* m, QWidget* parent) :
+MoveUI::MoveUI(Move* move, QWidget* parent) :
ObjectUI(parent),
- move(m),
- move_mod(new Move(m->getPokemod(), *m, m->getId()))
+ m_move(move),
+ m_move_mod(new Move(*move))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(move, move_mod);
+ setObjects(m_move, m_move_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -51,190 +47,173 @@ void MoveUI::initGui()
void MoveUI::refreshGui()
{
varType->clear();
- for (int i = 0; i < move->getPokemod()->getTypeCount(); ++i)
+ for (int i = 0; i < m_move->pokemod()->typeCount(); ++i)
{
- const Type* t = move->getPokemod()->getType(i);
- varType->addItem(t->getName());
- varType->setItemData(i, t->getId());
+ const Type* type = m_move->pokemod()->type(i);
+ varType->addItem(type->name());
+ varType->setItemData(i, type->id());
}
- varNumTargets->setMaximum(move->getPokemod()->getRules()->getMaxFight());
+ varNumTargets->setMaximum(m_move->pokemod()->rules()->maxFight());
}
void MoveUI::setGui()
{
- varName->setText(move_mod->getName());
- varAccuracyNum->setValue(move_mod->getAccuracy().getNum());
- varAccuracyDenom->setValue(move_mod->getAccuracy().getDenom());
- varAccuracyNum->setMaximum(move_mod->getAccuracy().getDenom());
- varAccuracy->setText(QString::number(move_mod->getAccuracy(), 'g', DBL_PREC));
- varType->setCurrentIndex(varType->findData(move_mod->getType()));
- varTarget->setCurrentIndex(move_mod->getTarget());
- varNumTargets->setValue(move_mod->getNumTargets());
- varTargetChoice->setCurrentIndex(move_mod->getTargetChoice());
- varSpecial->setChecked(move_mod->getSpecial() ? Qt::Checked : Qt::Unchecked);
- varIgnoreAccuracy->setChecked(move_mod->getIgnoreAccuracy() ? Qt::Checked : Qt::Unchecked);
- varCanFlinch->setChecked(move_mod->getCanFlinch() ? Qt::Checked : Qt::Unchecked);
- varCanRandom->setChecked(move_mod->getCanRandom() ? Qt::Checked : Qt::Unchecked);
- varCanSnatch->setChecked(move_mod->getCanSnatch() ? Qt::Checked : Qt::Unchecked);
- varMakesSound->setChecked(move_mod->getSound() ? Qt::Checked : Qt::Unchecked);
- varDescription->setText(move_mod->getDescription());
+ varName->setText(m_move_mod->name());
+ varAccuracy->setValue(m_move_mod->accuracy());
+ varType->setCurrentIndex(varType->findData(m_move_mod->type()));
+ varTarget->setCurrentIndex(m_move_mod->target());
+ varNumTargets->setValue(m_move_mod->numTargets());
+ varTargetChoice->setCurrentIndex(m_move_mod->targetChoice());
+ varSpecial->setChecked(m_move_mod->special() ? Qt::Checked : Qt::Unchecked);
+ varIgnoreAccuracy->setChecked(m_move_mod->ignoreAccuracy() ? Qt::Checked : Qt::Unchecked);
+ varCanFlinch->setChecked(m_move_mod->canFlinch() ? Qt::Checked : Qt::Unchecked);
+ varCanRandom->setChecked(m_move_mod->canRandom() ? Qt::Checked : Qt::Unchecked);
+ varCanSnatch->setChecked(m_move_mod->canSnatch() ? Qt::Checked : Qt::Unchecked);
+ varMakesSound->setChecked(m_move_mod->sound() ? Qt::Checked : Qt::Unchecked);
+ varDescription->setText(m_move_mod->description());
}
void MoveUI::on_buttonApply_clicked()
{
- *move = *move_mod;
+ *m_move = *m_move_mod;
emit(changed(false));
}
void MoveUI::on_buttonDiscard_clicked()
{
- *move_mod = *move;
+ *m_move_mod = *m_move;
setGui();
emit(changed(false));
}
-void MoveUI::on_varName_textChanged(const QString& n)
+void MoveUI::on_varName_textChanged(const QString& name)
{
- move_mod->setName(n);
+ m_move_mod->setName(name);
emit(changed(true));
}
-void MoveUI::on_varAccuracyNum_valueChanged(const int a)
+void MoveUI::on_varAccuracy_valueChanged(const Fraction& accuracy)
{
try
{
- move_mod->setAccuracyNum(a);
+ m_move_mod->setAccuracy(accuracy);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
- }
- setGui();
-}
-
-void MoveUI::on_varAccuracyDenom_valueChanged(const int a)
-{
- try
- {
- move_mod->setAccuracyDenom(a);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
+ BugCatcher::report(exception);
+ setGui();
}
- setGui();
}
-void MoveUI::on_varType_currentIndexChanged(const int t)
+void MoveUI::on_varType_currentIndexChanged(const int type)
{
try
{
- move_mod->setType(varType->itemData(t).toInt());
+ m_move_mod->setType(varType->itemData(type).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MoveUI::on_varPowerPoints_valueChanged(const int p)
+void MoveUI::on_varPowerPoints_valueChanged(const int powerPoints)
{
try
{
- move_mod->setPowerPoints(p);
+ m_move_mod->setPowerPoints(powerPoints);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MoveUI::on_varTarget_currentIndexChanged(const int t)
+void MoveUI::on_varTarget_currentIndexChanged(const int target)
{
try
{
- move_mod->setTarget(t);
+ m_move_mod->setTarget(target);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MoveUI::on_varNumTargets_valueChanged(const int n)
+void MoveUI::on_varNumTargets_valueChanged(const int numTargets)
{
try
{
- move_mod->setNumTargets(n);
+ m_move_mod->setNumTargets(numTargets);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MoveUI::on_varTargetChoice_currentIndexChanged(const int t)
+void MoveUI::on_varTargetChoice_currentIndexChanged(const int targetChoice)
{
try
{
- move_mod->setTargetChoice(t);
+ m_move_mod->setTargetChoice(targetChoice);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MoveUI::on_varSpecial_toggled(const bool s)
+void MoveUI::on_varSpecial_toggled(const bool special)
{
- move_mod->setSpecial(s);
+ m_move_mod->setSpecial(special);
emit(changed(true));
}
-void MoveUI::on_varIgnoreAccuracy_toggled(const bool i)
+void MoveUI::on_varIgnoreAccuracy_toggled(const bool ignoreAccuracy)
{
- move_mod->setIgnoreAccuracy(i);
+ m_move_mod->setIgnoreAccuracy(ignoreAccuracy);
emit(changed(true));
}
-void MoveUI::on_varCanFlinch_toggled(const bool c)
+void MoveUI::on_varCanFlinch_toggled(const bool canFlinch)
{
- move_mod->setCanFlinch(c);
+ m_move_mod->setCanFlinch(canFlinch);
emit(changed(true));
}
-void MoveUI::on_varCanRandom_toggled(const bool c)
+void MoveUI::on_varCanRandom_toggled(const bool canRandom)
{
- move_mod->setCanRandom(c);
+ m_move_mod->setCanRandom(canRandom);
emit(changed(true));
}
-void MoveUI::on_varCanSnatch_toggled(const bool c)
+void MoveUI::on_varCanSnatch_toggled(const bool canSnatch)
{
- move_mod->setCanSnatch(c);
+ m_move_mod->setCanSnatch(canSnatch);
emit(changed(true));
}
-void MoveUI::on_varSound_toggled(const bool s)
+void MoveUI::on_varSound_toggled(const bool sound)
{
- move_mod->setSound(s);
+ m_move_mod->setSound(sound);
emit(changed(true));
}
void MoveUI::on_varDescription_textChanged()
{
- move_mod->setDescription(varDescription->toPlainText());
+ m_move_mod->setDescription(varDescription->toPlainText());
emit(changed(true));
}
diff --git a/pokemodr/MoveUI.h b/pokemodr/MoveUI.h
index 83d3146b..1dbf9142 100644
--- a/pokemodr/MoveUI.h
+++ b/pokemodr/MoveUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MoveUI.h
-// Purpose: Move UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 23:52:16 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_MOVEUI__
#define __POKEMODR_MOVEUI__
-#include <QString>
-
+// Pokemod includes
#include <Move.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_move.h"
class MoveUI : public ObjectUI, private Ui::formMove
@@ -36,36 +32,35 @@ class MoveUI : public ObjectUI, private Ui::formMove
Q_OBJECT
public:
- MoveUI(Move* m, QWidget* parent);
+ MoveUI(Move* move, QWidget* parent);
~MoveUI()
{
- delete move_mod;
+ delete m_move_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varAccuracyNum_valueChanged(const int a);
- void on_varAccuracyDenom_valueChanged(const int a);
- void on_varType_currentIndexChanged(const int t);
- void on_varPowerPoints_valueChanged(const int p);
- void on_varTarget_currentIndexChanged(const int t);
- void on_varNumTargets_valueChanged(const int n);
- void on_varTargetChoice_currentIndexChanged(const int t);
- void on_varSpecial_toggled(const bool s);
- void on_varIgnoreAccuracy_toggled(const bool i);
- void on_varCanFlinch_toggled(const bool c);
- void on_varCanRandom_toggled(const bool c);
- void on_varCanSnatch_toggled(const bool c);
- void on_varSound_toggled(const bool s);
+ void on_varName_textChanged(const QString& name);
+ void on_varAccuracy_valueChanged(const Fraction& accuracy);
+ void on_varType_currentIndexChanged(const int type);
+ void on_varPowerPoints_valueChanged(const int powerPoints);
+ void on_varTarget_currentIndexChanged(const int target);
+ void on_varNumTargets_valueChanged(const int numTargets);
+ void on_varTargetChoice_currentIndexChanged(const int targetChoice);
+ void on_varSpecial_toggled(const bool special);
+ void on_varIgnoreAccuracy_toggled(const bool ignoreAccuracy);
+ void on_varCanFlinch_toggled(const bool canFlinch);
+ void on_varCanRandom_toggled(const bool canRandom);
+ void on_varCanSnatch_toggled(const bool canSnatch);
+ void on_varSound_toggled(const bool sound);
void on_varDescription_textChanged();
private:
void initGui();
void refreshGui();
void setGui();
- Move* move;
- Move* move_mod;
+ Move* m_move;
+ Move* m_move_mod;
};
#endif
diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp
index 09275220..775ba15a 100644
--- a/pokemodr/NatureUI.cpp
+++ b/pokemodr/NatureUI.cpp
@@ -1,43 +1,41 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/NatureUI.cpp
-// Purpose: Nature UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Jan 25 15:19:04 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QStringList>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Pokemod.h>
+// Header include
#include "NatureUI.h"
-NatureUI::NatureUI(Nature* n, QWidget* parent) :
+NatureUI::NatureUI(Nature* nature, QWidget* parent) :
ObjectUI(parent),
- nature(n),
- nature_mod(new Nature(n->getPokemod(), *n, n->getId()))
+ m_nature(nature),
+ m_nature_mod(new Nature(*nature))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(nature, nature_mod);
+ setObjects(m_nature, m_nature_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -45,36 +43,33 @@ NatureUI::NatureUI(Nature* n, QWidget* parent) :
void NatureUI::refreshGui()
{
varStat->clear();
- const bool isSplit = nature->getPokemod()->getRules()->getSpecialSplit();
+ const bool isSplit = m_nature->pokemod()->rules()->specialSplit();
varStat->addItems((isSplit ? Pokemod::StatRBYStr : Pokemod::StatGSCStr).mid(0, isSplit ? Pokemod::ST_End_RBY : Pokemod::ST_End_GSC));
}
void NatureUI::setGui()
{
- varName->setText(nature_mod->getName());
- varStatMultiplierNum->setValue(nature_mod->getStat(varStat->currentIndex()).getNum());
- varStatMultiplierDenom->setValue(nature_mod->getStat(varStat->currentIndex()).getDenom());
- varStatMultiplierNum->setMaximum(nature_mod->getStat(varStat->currentIndex()).getDenom());
- varStatMultiplier->setText(QString::number(nature_mod->getStat(varStat->currentIndex()), 'g', DBL_PREC));
- varWeight->setValue(nature_mod->getWeight());
+ varName->setText(m_nature_mod->name());
+ varStatMultiplier->setValue(m_nature_mod->stat(varStat->currentIndex()));
+ varWeight->setValue(m_nature_mod->weight());
}
void NatureUI::on_buttonApply_clicked()
{
- *nature = *nature_mod;
+ *m_nature = *m_nature_mod;
emit(changed(false));
}
void NatureUI::on_buttonDiscard_clicked()
{
- *nature_mod = *nature;
+ *m_nature_mod = *m_nature;
setGui();
emit(changed(false));
}
-void NatureUI::on_varName_textChanged(const QString& n)
+void NatureUI::on_varName_textChanged(const QString& name)
{
- nature_mod->setName(n);
+ m_nature_mod->setName(name);
emit(changed(true));
}
@@ -84,44 +79,30 @@ void NatureUI::on_varStat_currentIndexChanged()
emit(changed(true));
}
-void NatureUI::on_varStatMultiplierNum_valueChanged(const int s)
+void NatureUI::on_varStatMultiplier_valueChanged(const Fraction& statMultiplier)
{
try
{
- nature_mod->setStatNum(varStat->currentIndex(), s);
+ m_nature_mod->setStat(varStat->currentIndex(), statMultiplier);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
- }
- setGui();
-}
-
-void NatureUI::on_varStatMultiplierDenom_valueChanged(const int s)
-{
- try
- {
- nature_mod->setStatDenom(varStat->currentIndex(), s);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
+ BugCatcher::report(exception);
+ setGui();
}
- setGui();
}
-void NatureUI::on_varWeight_valueChanged(const int w)
+void NatureUI::on_varWeight_valueChanged(const int weight)
{
try
{
- nature_mod->setWeight(w);
+ m_nature_mod->setWeight(weight);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/NatureUI.h b/pokemodr/NatureUI.h
index d0a1ec0d..2f3cb1fb 100644
--- a/pokemodr/NatureUI.h
+++ b/pokemodr/NatureUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/NatureUI.h
-// Purpose: Nature UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Jan 25 15:14:07 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_NATUREUI__
#define __POKEMODR_NATUREUI__
-#include <QString>
-
+// Pokemod includes
#include <Nature.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_nature.h"
class NatureUI : public ObjectUI, private Ui::formNature
@@ -36,25 +32,24 @@ class NatureUI : public ObjectUI, private Ui::formNature
Q_OBJECT
public:
- NatureUI(Nature* n, QWidget* parent);
+ NatureUI(Nature* nature, QWidget* parent);
~NatureUI()
{
- delete nature_mod;
+ delete m_nature_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
+ void on_varName_textChanged(const QString& name);
void on_varStat_currentIndexChanged();
- void on_varStatMultiplierNum_valueChanged(const int s);
- void on_varStatMultiplierDenom_valueChanged(const int s);
- void on_varWeight_valueChanged(const int w);
+ void on_varStatMultiplier_valueChanged(const Fraction& statMultiplier);
+ void on_varWeight_valueChanged(const int weight);
private:
void refreshGui();
void setGui();
- Nature* nature;
- Nature* nature_mod;
+ Nature* m_nature;
+ Nature* m_nature_mod;
};
#endif
diff --git a/pokemodr/ObjectUI.h b/pokemodr/ObjectUI.h
index 0c689b09..a37b6987 100644
--- a/pokemodr/ObjectUI.h
+++ b/pokemodr/ObjectUI.h
@@ -1,38 +1,38 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/ObjectUI.h
-// Purpose: Generic UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu Jan 24 16:15:40 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_OBJECTUI__
#define __POKEMODR_OBJECTUI__
+// KDE includes
#include <kmessagebox.h>
+// Qt includes
#include <QCloseEvent>
#include <QLabel>
+#include <QMetaObject>
#include <QObject>
#include <QWidget>
+// Pokemod includes
#include <Object.h>
#include <Pokemod.h>
+// PokeModr includes
#include "PokeModrUI.h"
#define DBL_PREC 7
@@ -45,8 +45,8 @@ class ObjectUI : public QWidget
ObjectUI(QWidget* parent) :
QWidget(parent),
m_changed(false),
- obj(NULL),
- obj_mod(NULL)
+ m_object(NULL),
+ m_object_mod(NULL)
{
connect(this, SIGNAL(changed(bool)), static_cast<PokeModrUI*>(parent->parent()->parent()->parent()), SLOT(setChangedTitle(bool)));
connect(this, SIGNAL(changed(bool)), SLOT(setChanged(bool)));
@@ -59,7 +59,7 @@ class ObjectUI : public QWidget
{
if (m_changed)
{
- switch (KMessageBox::questionYesNoCancel(this, "You have unsaved changes, would you like to save them?", QString("Unsaved %1").arg(obj->getClassName())))
+ 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();
@@ -86,36 +86,36 @@ class ObjectUI : public QWidget
return m_changed;
}
- const Object* getOriginal() const
+ const Object* original() const
{
- return obj;
+ return m_object;
}
- Object* getOriginal()
+ Object* original()
{
- return obj;
+ return m_object;
}
- const Object* getModified() const
+ const Object* modified() const
{
- return obj_mod;
+ return m_object_mod;
}
- Object* getModified()
+ Object* modified()
{
- return obj_mod;
+ return m_object_mod;
}
signals:
void changed(bool);
public slots:
- void setChanged(const bool c)
+ void setChanged(const bool changed)
{
- m_changed = c;
+ m_changed = changed;
}
virtual void on_buttonApply_clicked() = 0;
virtual void on_buttonDiscard_clicked() = 0;
protected:
- void setObjects(Object* orig, Object* mod)
+ void setObjects(Object* original, Object* modified)
{
- obj = orig;
- obj_mod = mod;
+ m_object = original;
+ m_object_mod = modified;
}
void init()
@@ -135,8 +135,8 @@ class ObjectUI : public QWidget
private:
bool m_changed;
- Object* obj;
- Object* obj_mod;
+ Object* m_object;
+ Object* m_object_mod;
};
#endif
diff --git a/general/PointWidget.cpp b/pokemodr/PointWidget.cpp
index 571db71d..d3694d7b 100644
--- a/general/PointWidget.cpp
+++ b/pokemodr/PointWidget.cpp
@@ -15,14 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Qt includes
-#include <QMetaObject>
-#include <QString>
-
// Header include
#include "PointWidget.h"
-PointWidget::PointWidget(const Point& value, QWidget* parent) :
+PointWidget::PointWidget(QWidget* parent, const Point& value) :
QWidget(parent),
m_value(value)
{
@@ -35,7 +31,7 @@ void PointWidget::setValue(const Point& value)
m_value = value;
varX->setValue(m_value.x());
varY->setValue(m_value.y());
- emit(changed(true));
+ emit(valueChanged(true));
}
Point PointWidget::value() const
@@ -46,11 +42,11 @@ Point PointWidget::value() const
void PointWidget::on_varX_valueChanged(const int& x)
{
m_value.setX(x);
- emit(changed(true));
+ emit(valueChanged(true));
}
void PointWidget::on_varY_valueChanged(const int& y)
{
m_value.setY(y);
- emit(changed(true));
+ emit(valueChanged(true));
}
diff --git a/general/PointWidget.h b/pokemodr/PointWidget.h
index 3519679d..24574e86 100644
--- a/general/PointWidget.h
+++ b/pokemodr/PointWidget.h
@@ -33,13 +33,13 @@ class PointWidget : public QWidget, private Ui::formPoint
Q_OBJECT
public:
- PointWidget(const Point& value, QWidget* parent);
+ PointWidget(QWidget* parent, const Point& value = Point(0, 0));
void setValue(const Point& value);
Point value() const;
signals:
- void changed(bool);
+ void valueChanged(bool);
public slots:
void on_varX_valueChanged(const int& x);
void on_varY_valueChanged(const int& y);
diff --git a/pokemodr/PokeModTreeItem.cpp b/pokemodr/PokeModTreeItem.cpp
index 5a237f70..bfed8e1b 100644
--- a/pokemodr/PokeModTreeItem.cpp
+++ b/pokemodr/PokeModTreeItem.cpp
@@ -1,32 +1,29 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/PokeModTreeItem.cpp
-// Purpose: Subclass of QTreeWidgetItem that allows information to be
-// tacked on as well
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 18:44:25 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// KDE includes
#include <kaction.h>
#include <kmenu.h>
+// Qt includes
#include <QPoint>
#include <QString>
+// Pokemod includes
#include <Ability.h>
#include <AbilityEffect.h>
#include <Author.h>
@@ -61,6 +58,7 @@
#include <Trainer.h>
#include <Type.h>
+// PokeModr includes
#include "AbilityUI.h"
// #include "AbilityEffectUI.h"
#include "AuthorUI.h"
@@ -95,211 +93,215 @@
#include "TrainerUI.h"
#include "TypeUI.h"
+// Header include
#include "PokeModTreeItem.h"
+// FIXME: scrap for a better solution
+
+/*
void PokeModTreeItem::update()
{
if (text(0).isEmpty())
{
- QString name(obj->getClassName());
+ QString name(m_object->className());
if (name == "Ability")
- new PokeModTreeItem(this, obj, "Effects");
+ new PokeModTreeItem(this, m_object, "Effects");
else if (name == "CoinList")
- new PokeModTreeItem(this, obj, "Objects");
+ new PokeModTreeItem(this, m_object, "Objects");
else if (name == "Item")
- new PokeModTreeItem(this, obj, "Effects");
+ new PokeModTreeItem(this, m_object, "Effects");
else if (name == "Map")
{
- new PokeModTreeItem(this, obj, "Effects");
- new PokeModTreeItem(this, obj, "Trainers");
- new PokeModTreeItem(this, obj, "Warps");
- new PokeModTreeItem(this, obj, "Wild Lists");
+ new PokeModTreeItem(this, m_object, "Effects");
+ new PokeModTreeItem(this, m_object, "Trainers");
+ new PokeModTreeItem(this, m_object, "Warps");
+ new PokeModTreeItem(this, m_object, "Wild Lists");
}
else if (name == "MapTrainer")
- new PokeModTreeItem(this, obj, "Team Members");
+ new PokeModTreeItem(this, m_object, "Team Members");
else if (name == "MapWildList")
- new PokeModTreeItem(this, obj, "Encounters");
+ new PokeModTreeItem(this, m_object, "Encounters");
else if (name == "Move")
- new PokeModTreeItem(this, obj, "Effects");
+ new PokeModTreeItem(this, m_object, "Effects");
else if (name == "Pokemod")
{
- new PokeModTreeItem(this, static_cast<Pokemod*>(obj)->getRules());
- new PokeModTreeItem(this, obj, "Abilities");
- new PokeModTreeItem(this, obj, "Authors");
- new PokeModTreeItem(this, obj, "Badges");
- new PokeModTreeItem(this, obj, "Coin Lists");
- new PokeModTreeItem(this, obj, "Dialogs");
- new PokeModTreeItem(this, obj, "Egg Groups");
- new PokeModTreeItem(this, obj, "Items");
- new PokeModTreeItem(this, obj, "Item Types");
- new PokeModTreeItem(this, obj, "Maps");
- new PokeModTreeItem(this, obj, "Moves");
- new PokeModTreeItem(this, obj, "Natures");
- new PokeModTreeItem(this, obj, "Species");
- new PokeModTreeItem(this, obj, "Stores");
- new PokeModTreeItem(this, obj, "Tiles");
- new PokeModTreeItem(this, obj, "Times");
- new PokeModTreeItem(this, obj, "Trainers");
- new PokeModTreeItem(this, obj, "Types");
+ new PokeModTreeItem(this, static_cast<Pokemod*>(m_object)->rules());
+ new PokeModTreeItem(this, m_object, "Abilities");
+ new PokeModTreeItem(this, m_object, "Authors");
+ new PokeModTreeItem(this, m_object, "Badges");
+ new PokeModTreeItem(this, m_object, "Coin Lists");
+ new PokeModTreeItem(this, m_object, "Dialogs");
+ new PokeModTreeItem(this, m_object, "Egg Groups");
+ new PokeModTreeItem(this, m_object, "Items");
+ new PokeModTreeItem(this, m_object, "Item Types");
+ new PokeModTreeItem(this, m_object, "Maps");
+ new PokeModTreeItem(this, m_object, "Moves");
+ new PokeModTreeItem(this, m_object, "Natures");
+ new PokeModTreeItem(this, m_object, "Species");
+ new PokeModTreeItem(this, m_object, "Stores");
+ new PokeModTreeItem(this, m_object, "Tiles");
+ new PokeModTreeItem(this, m_object, "Times");
+ new PokeModTreeItem(this, m_object, "Trainers");
+ new PokeModTreeItem(this, m_object, "Types");
}
else if (name == "Species")
{
- new PokeModTreeItem(this, obj, "Abilities");
- new PokeModTreeItem(this, obj, "Evolutions");
- new PokeModTreeItem(this, obj, "Items");
- new PokeModTreeItem(this, obj, "Moves");
+ new PokeModTreeItem(this, m_object, "Abilities");
+ new PokeModTreeItem(this, m_object, "Evolutions");
+ new PokeModTreeItem(this, m_object, "Items");
+ new PokeModTreeItem(this, m_object, "Moves");
}
}
else
{
- QString name(obj->getClassName());
+ QString name(obj->className());
if (name == "Ability")
{
- Ability* a = static_cast<Ability*>(obj);
- for (int i = 0; i < a->getEffectCount(); ++i)
- new PokeModTreeItem(this, a->getEffect(i));
+ Ability* ability = static_cast<Ability*>(m_object);
+ for (int i = 0; i < ability->effectCount(); ++i)
+ new PokeModTreeItem(this, ability->effect(i));
}
else if (name == "CoinList")
{
- CoinList* c = static_cast<CoinList*>(obj);
- for (int i = 0; i < c->getItemCount(); ++i)
- new PokeModTreeItem(this, c->getItem(i));
+ CoinList* coinList = static_cast<CoinList*>(m_object);
+ for (int i = 0; i < coinList->itemCount(); ++i)
+ new PokeModTreeItem(this, coinList->item(i));
}
else if (name == "Item")
{
- Item* it = static_cast<Item*>(obj);
- for (int i = 0; i < it->getEffectCount(); ++i)
- new PokeModTreeItem(this, it->getEffect(i));
+ Item* item = static_cast<Item*>(m_object);
+ for (int i = 0; i < item->effectCount(); ++i)
+ new PokeModTreeItem(this, item->effect(i));
}
else if (name == "Map")
{
- Map* m = static_cast<Map*>(obj);
+ Map* map = static_cast<Map*>(m_object);
if (text(0) == "Effects")
{
- for (int i = 0; i < m->getEffectCount(); ++i)
- new PokeModTreeItem(this, m->getEffect(i));
+ for (int i = 0; i < map->effectCount(); ++i)
+ new PokeModTreeItem(this, map->effect(i));
}
else if (text(0) == "Trainers")
{
- for (int i = 0; i < m->getTrainerCount(); ++i)
- new PokeModTreeItem(this, m->getTrainer(i));
+ for (int i = 0; i < map->trainerCount(); ++i)
+ new PokeModTreeItem(this, map->trainer(i));
}
else if (text(0) == "Warps")
{
- for (int i = 0; i < m->getWarpCount(); ++i)
- new PokeModTreeItem(this, m->getWarp(i));
+ for (int i = 0; i < m->warpCount(); ++i)
+ new PokeModTreeItem(this, m->warp(i));
}
else if (text(0) == "Wild Lists")
{
- for (int i = 0; i < m->getWildListCount(); ++i)
- new PokeModTreeItem(this, m->getWildList(i));
+ for (int i = 0; i < m->wildListCount(); ++i)
+ new PokeModTreeItem(this, m->wildList(i));
}
}
else if (name == "MapTrainer")
{
MapTrainer* t = static_cast<MapTrainer*>(obj);
- for (int i = 0; i < t->getTeamMemberCount(); ++i)
- new PokeModTreeItem(this, t->getTeamMember(i));
+ for (int i = 0; i < t->teamMemberCount(); ++i)
+ new PokeModTreeItem(this, t->teamMember(i));
}
else if (name == "MapWildList")
{
MapWildList* w = static_cast<MapWildList*>(obj);
- for (int i = 0; i < w->getEncounterCount(); ++i)
- new PokeModTreeItem(this, w->getEncounter(i));
+ for (int i = 0; i < w->encounterCount(); ++i)
+ new PokeModTreeItem(this, w->encounter(i));
}
else if (name == "Move")
{
Move* m = static_cast<Move*>(obj);
- for (int i = 0; i < m->getEffectCount(); ++i)
- new PokeModTreeItem(this, m->getEffect(i));
+ for (int i = 0; i < m->effectCount(); ++i)
+ new PokeModTreeItem(this, m->effect(i));
}
else if (name == "Pokemod")
{
Pokemod* p = static_cast<Pokemod*>(obj);
if (text(0) == "Abilities")
{
- for (int i = 0; i < p->getAbilityCount(); ++i)
- new PokeModTreeItem(this, p->getAbility(i));
+ for (int i = 0; i < p->abilityCount(); ++i)
+ new PokeModTreeItem(this, p->ability(i));
}
else if (text(0) == "Authors")
{
- for (int i = 0; i < p->getAuthorCount(); ++i)
- new PokeModTreeItem(this, p->getAuthor(i));
+ for (int i = 0; i < p->authorCount(); ++i)
+ new PokeModTreeItem(this, p->author(i));
}
else if (text(0) == "Badges")
{
- for (int i = 0; i < p->getBadgeCount(); ++i)
- new PokeModTreeItem(this, p->getBadge(i));
+ for (int i = 0; i < p->badgeCount(); ++i)
+ new PokeModTreeItem(this, p->badge(i));
}
else if (text(0) == "Coin Lists")
{
- for (int i = 0; i < p->getCoinListCount(); ++i)
- new PokeModTreeItem(this, p->getCoinList(i));
+ for (int i = 0; i < p->coinListCount(); ++i)
+ new PokeModTreeItem(this, p->coinList(i));
}
else if (text(0) == "Dialogs")
{
- for (int i = 0; i < p->getDialogCount(); ++i)
- new PokeModTreeItem(this, p->getDialog(i));
+ for (int i = 0; i < p->dialogCount(); ++i)
+ new PokeModTreeItem(this, p->dialog(i));
}
else if (text(0) == "Egg Groups")
{
- for (int i = 0; i < p->getEggGroupCount(); ++i)
- new PokeModTreeItem(this, p->getEggGroup(i));
+ for (int i = 0; i < p->eggGroupCount(); ++i)
+ new PokeModTreeItem(this, p->eggGroup(i));
}
else if (text(0) == "Items")
{
- for (int i = 0; i < p->getItemCount(); ++i)
- new PokeModTreeItem(this, p->getItem(i));
+ for (int i = 0; i < p->itemCount(); ++i)
+ new PokeModTreeItem(this, p->item(i));
}
else if (text(0) == "Item Types")
{
- for (int i = 0; i < p->getItemTypeCount(); ++i)
- new PokeModTreeItem(this, p->getItemType(i));
+ for (int i = 0; i < p->itemTypeCount(); ++i)
+ new PokeModTreeItem(this, p->itemType(i));
}
else if (text(0) == "Maps")
{
- for (int i = 0; i < p->getMapCount(); ++i)
- new PokeModTreeItem(this, p->getMap(i));
+ for (int i = 0; i < p->mapCount(); ++i)
+ new PokeModTreeItem(this, p->map(i));
}
else if (text(0) == "Moves")
{
- for (int i = 0; i < p->getMoveCount(); ++i)
- new PokeModTreeItem(this, p->getMove(i));
+ for (int i = 0; i < p->moveCount(); ++i)
+ new PokeModTreeItem(this, p->move(i));
}
else if (text(0) == "Natures")
{
- for (int i = 0; i < p->getNatureCount(); ++i)
- new PokeModTreeItem(this, p->getNature(i));
+ for (int i = 0; i < p->natureCount(); ++i)
+ new PokeModTreeItem(this, p->nature(i));
}
else if (text(0) == "Species")
{
- for (int i = 0; i < p->getSpeciesCount(); ++i)
- new PokeModTreeItem(this, p->getSpecies(i));
+ for (int i = 0; i < p->speciesCount(); ++i)
+ new PokeModTreeItem(this, p->species(i));
}
else if (text(0) == "Stores")
{
- for (int i = 0; i < p->getStoreCount(); ++i)
- new PokeModTreeItem(this, p->getStore(i));
+ for (int i = 0; i < p->storeCount(); ++i)
+ new PokeModTreeItem(this, p->store(i));
}
else if (text(0) == "Tiles")
{
- for (int i = 0; i < p->getTileCount(); ++i)
- new PokeModTreeItem(this, p->getTile(i));
+ for (int i = 0; i < p->tileCount(); ++i)
+ new PokeModTreeItem(this, p->tile(i));
}
else if (text(0) == "Times")
{
- for (int i = 0; i < p->getTimeCount(); ++i)
- new PokeModTreeItem(this, p->getTime(i));
+ for (int i = 0; i < p->timeCount(); ++i)
+ new PokeModTreeItem(this, p->time(i));
}
else if (text(0) == "Trainers")
{
- for (int i = 0; i < p->getTrainerCount(); ++i)
- new PokeModTreeItem(this, p->getTrainer(i));
+ for (int i = 0; i < p->trainerCount(); ++i)
+ new PokeModTreeItem(this, p->trainer(i));
}
else if (text(0) == "Types")
{
- for (int i = 0; i < p->getTypeCount(); ++i)
- new PokeModTreeItem(this, p->getType(i));
+ for (int i = 0; i < p->typeCount(); ++i)
+ new PokeModTreeItem(this, p->type(i));
}
}
else if (name == "Species")
@@ -307,23 +309,23 @@ void PokeModTreeItem::update()
Species* s = static_cast<Species*>(obj);
if (text(0) == "Abilities")
{
- for (int i = 0; i < s->getAbilityCount(); ++i)
- new PokeModTreeItem(this, s->getAbility(i));
+ for (int i = 0; i < s->abilityCount(); ++i)
+ new PokeModTreeItem(this, s->ability(i));
}
else if (text(0) == "Evolutions")
{
- for (int i = 0; i < s->getEvolutionCount(); ++i)
- new PokeModTreeItem(this, s->getEvolution(i));
+ for (int i = 0; i < s->evolutionCount(); ++i)
+ new PokeModTreeItem(this, s->evolution(i));
}
else if (text(0) == "Items")
{
- for (int i = 0; i < s->getItemCount(); ++i)
- new PokeModTreeItem(this, s->getItem(i));
+ for (int i = 0; i < s->itemCount(); ++i)
+ new PokeModTreeItem(this, s->item(i));
}
else if (text(0) == "Moves")
{
- for (int i = 0; i < s->getMoveCount(); ++i)
- new PokeModTreeItem(this, s->getMove(i));
+ for (int i = 0; i < s->moveCount(); ++i)
+ new PokeModTreeItem(this, s->move(i));
}
}
obj = NULL;
@@ -337,7 +339,7 @@ void PokeModTreeItem::init(QWidget* pnt)
setChildIndicatorPolicy(QTreeWidgetItem::QTreeWidgetItem::DontShowIndicatorWhenChildless);
if (obj)
{
- QString name(obj->getClassName());
+ QString name(obj->className());
#define IF_IS_CLASS(class) if (name == #class) ui = new class##UI(static_cast< ::class* >(obj), pnt);
IF_IS_CLASS(Ability)
// else IF_IS_CLASS(AbilityEffect)
@@ -383,86 +385,86 @@ void PokeModTreeItem::updateName()
{
if (!obj)
return;
- QString name(obj->getClassName());
+ QString name(obj->className());
QString text;
if (name == "Ability")
- text = static_cast<Ability*>(obj)->getName();
+ text = static_cast<Ability*>(obj)->name();
else if (name == "AbilityEffect")
- text = AbilityEffect::EffectStr.at(static_cast<AbilityEffect*>(obj)->getEffect());
+ text = AbilityEffect::EffectStr.at(static_cast<AbilityEffect*>(obj)->effect());
else if (name == "Author")
- text = static_cast<Author*>(obj)->getName();
+ text = static_cast<Author*>(obj)->name();
else if (name == "Badge")
- text = static_cast<Badge*>(obj)->getName();
+ text = static_cast<Badge*>(obj)->name();
else if (name == "CoinList")
- text = static_cast<CoinList*>(obj)->getName();
+ text = static_cast<CoinList*>(obj)->name();
else if (name == "CoinListObject")
{
const CoinListObject* o = static_cast<CoinListObject*>(obj);
- if (o->getType() == CoinListObject::Item)
- text = obj->getPokemod()->getItem(o->getObject())->getName();
+ if (o->type() == CoinListObject::Item)
+ text = obj->pokemod()->item(o->object())->name();
else
- text = obj->getPokemod()->getSpecies(o->getObject())->getName();
+ text = obj->pokemod()->species(o->object())->name();
}
else if (name == "Dialog")
- text = static_cast<Dialog*>(obj)->getDialog().mid(0, 25);
+ text = static_cast<Dialog*>(obj)->dialog().mid(0, 25);
else if (name == "EggGroup")
- text = static_cast<EggGroup*>(obj)->getName();
+ text = static_cast<EggGroup*>(obj)->name();
else if (name == "Item")
- text = static_cast<Item*>(obj)->getName();
+ text = static_cast<Item*>(obj)->name();
else if (name == "ItemEffect")
- text = ItemEffect::EffectStr.at(static_cast<ItemEffect*>(obj)->getEffect());
+ text = ItemEffect::EffectStr.at(static_cast<ItemEffect*>(obj)->effect());
else if (name == "ItemType")
- text = static_cast< ::ItemType* >(obj)->getName();
+ text = static_cast< ::ItemType* >(obj)->name();
else if (name == "Map")
- text = static_cast<Map*>(obj)->getName();
+ text = static_cast<Map*>(obj)->name();
else if (name == "MapEffect")
- text = static_cast<MapEffect*>(obj)->getName();
+ text = static_cast<MapEffect*>(obj)->name();
else if (name == "MapTrainer")
- text = static_cast<MapTrainer*>(obj)->getName();
+ text = static_cast<MapTrainer*>(obj)->name();
else if (name == "MapTrainerTeamMember")
{
const MapTrainerTeamMember* t = static_cast<MapTrainerTeamMember*>(obj);
- text = QString("Lv. %1 %2").arg(t->getLevel()).arg(obj->getPokemod()->getSpecies(t->getSpecies())->getName());
+ text = QString("Lv. %1 %2").arg(t->level()).arg(obj->pokemod()->species(t->species())->name());
}
else if (name == "MapWarp")
- text = static_cast<MapWarp*>(obj)->getName();
+ text = static_cast<MapWarp*>(obj)->name();
else if (name == "MapWildList")
- text = MapWildList::ControlStr.at(static_cast<MapWildList*>(obj)->getControl());
+ text = MapWildList::ControlStr.at(static_cast<MapWildList*>(obj)->control());
else if (name == "MapWildListEncounter")
{
const MapWildListEncounter* e = static_cast<MapWildListEncounter*>(obj);
- text = QString("Lv. %1 %2").arg(e->getLevel()).arg(obj->getPokemod()->getSpecies(e->getSpecies())->getName());
+ text = QString("Lv. %1 %2").arg(e->level()).arg(obj->pokemod()->species(e->species())->name());
}
else if (name == "Move")
- text = static_cast<Move*>(obj)->getName();
+ text = static_cast<Move*>(obj)->name();
else if (name == "MoveEffect")
- text = MoveEffect::EffectStr.at(static_cast<MoveEffect*>(obj)->getEffect());
+ text = MoveEffect::EffectStr.at(static_cast<MoveEffect*>(obj)->effect());
else if (name == "Nature")
- text = static_cast<Nature*>(obj)->getName();
+ text = static_cast<Nature*>(obj)->name();
else if (name == "Pokemod")
- text = static_cast<Pokemod*>(obj)->getTitle();
+ text = static_cast<Pokemod*>(obj)->title();
else if (name == "Rules")
text = "Rules";
else if (name == "Species")
- text = static_cast<Species*>(obj)->getName();
+ text = static_cast<Species*>(obj)->name();
else if (name == "SpeciesAbility")
- text = obj->getPokemod()->getAbility(static_cast<SpeciesAbility*>(obj)->getAbility())->getName();
+ text = obj->pokemod()->ability(static_cast<SpeciesAbility*>(obj)->ability())->name();
else if (name == "SpeciesEvolution")
- text = obj->getPokemod()->getSpecies(static_cast<SpeciesEvolution*>(obj)->getSpecies())->getName();
+ text = obj->pokemod()->species(static_cast<SpeciesEvolution*>(obj)->species())->name();
else if (name == "SpeciesItem")
- text = obj->getPokemod()->getItem(static_cast<SpeciesItem*>(obj)->getItem())->getName();
+ text = obj->pokemod()->item(static_cast<SpeciesItem*>(obj)->item())->name();
else if (name == "SpeciesMove")
- text = obj->getPokemod()->getMove(static_cast<SpeciesMove*>(obj)->getMove())->getName();
+ text = obj->pokemod()->move(static_cast<SpeciesMove*>(obj)->move())->name();
else if (name == "Store")
- text = static_cast<Store*>(obj)->getName();
+ text = static_cast<Store*>(obj)->name();
else if (name == "Tile")
- text = static_cast<Tile*>(obj)->getName();
+ text = static_cast<Tile*>(obj)->name();
else if (name == "Time")
- text = static_cast<Time*>(obj)->getName();
+ text = static_cast<Time*>(obj)->name();
else if (name == "Trainer")
- text = static_cast<Trainer*>(obj)->getName();
+ text = static_cast<Trainer*>(obj)->name();
else if (name == "Type")
- text = static_cast< ::Type* >(obj)->getName();
+ text = static_cast< ::Type* >(obj)->name();
setText(0, text);
}
@@ -474,8 +476,8 @@ Object* PokeModTreeItem::copy()
{
if (obj)
{
- QString name(obj->getClassName());
-#define IF_IS_CLASS(class) if (name == #class) return new ::class(obj->getPokemod(), *static_cast< ::class* >(obj), obj->getId());
+ QString name(obj->className());
+#define IF_IS_CLASS(class) if (name == #class) return new ::class(obj->pokemod(), *static_cast< ::class* >(obj), obj->id());
IF_IS_CLASS(Ability)
else IF_IS_CLASS(AbilityEffect)
else IF_IS_CLASS(Author)
@@ -498,7 +500,7 @@ Object* PokeModTreeItem::copy()
else IF_IS_CLASS(MoveEffect)
else IF_IS_CLASS(Nature)
else if (name == "Pokemod") return new Pokemod(*static_cast<Pokemod*>(obj));
- else if (name == "Rules") return new Rules(obj->getPokemod());
+ else if (name == "Rules") return new Rules(obj->pokemod());
else IF_IS_CLASS(Species)
else IF_IS_CLASS(SpeciesAbility)
else IF_IS_CLASS(SpeciesEvolution)
@@ -519,8 +521,8 @@ Object* PokeModTreeItem::cut()
// TODO: actually cut the item
if (obj)
{
- QString name(obj->getClassName());
-#define IF_IS_CLASS(class) if (name == #class) return new ::class(obj->getPokemod(), *static_cast< ::class* >(obj), obj->getId());
+ QString name(obj->className());
+#define IF_IS_CLASS(class) if (name == #class) return new ::class(obj->pokemod(), *static_cast< ::class* >(obj), obj->id());
IF_IS_CLASS(Ability)
else IF_IS_CLASS(AbilityEffect)
else IF_IS_CLASS(Author)
@@ -543,7 +545,7 @@ Object* PokeModTreeItem::cut()
else IF_IS_CLASS(MoveEffect)
else IF_IS_CLASS(Nature)
else if (name == "Pokemod") return new Pokemod(*static_cast<Pokemod*>(obj));
- else if (name == "Rules") return new Rules(obj->getPokemod());
+ else if (name == "Rules") return new Rules(obj->pokemod());
else IF_IS_CLASS(Species)
else IF_IS_CLASS(SpeciesAbility)
else IF_IS_CLASS(SpeciesEvolution)
@@ -557,4 +559,4 @@ Object* PokeModTreeItem::cut()
#undef IF_IS_CLASS
}
return NULL;
-}
+}*/
diff --git a/pokemodr/PokeModTreeItem.h b/pokemodr/PokeModTreeItem.h
index 48326536..8239e277 100644
--- a/pokemodr/PokeModTreeItem.h
+++ b/pokemodr/PokeModTreeItem.h
@@ -1,35 +1,32 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/PokeModTreeItem.h
-// Purpose: Subclass of QTreeWidgetItem that allows information to be
-// tacked on as well
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Jan 22 19:12:17 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_POKEMODTREEITEM__
#define __POKEMODR_POKEMODTREEITEM__
+// Qt includes
#include <QColor>
#include <QObject>
#include <QTreeWidgetItem>
+// Pokemod includes
#include <Object.h>
+// PokeModr includes
#include "ObjectUI.h"
class PokeModTreeItem : public QObject, public QTreeWidgetItem
@@ -37,43 +34,36 @@ class PokeModTreeItem : public QObject, public QTreeWidgetItem
Q_OBJECT
public:
- PokeModTreeItem(QTreeWidget* parent, Object* o, const QString& txt = "", QWidget* pnt = NULL) :
- QTreeWidgetItem(parent, QTreeWidgetItem::UserType),
- obj(o),
- ui(NULL)
+ PokeModTreeItem(QTreeWidget* parentBranch, Object* object, const QString& text = "") :
+ QTreeWidgetItem(parentBranch, QTreeWidgetItem::UserType),
+ m_object(object),
+ m_objectUi(NULL)
{
- setText(0, txt);
- init(pnt);
- }
- PokeModTreeItem(QTreeWidgetItem* parent, Object* o, const QString& txt = "", QWidget* pnt = NULL) :
- QTreeWidgetItem(parent, QTreeWidgetItem::UserType),
- obj(o),
- ui(NULL)
- {
- setText(0, txt);
- init(pnt);
+ setText(0, text);
+ init();
}
~PokeModTreeItem()
{
- if (ui)
- delete ui;
+ if (m_objectUi)
+ delete m_objectUi;
}
- void makeMenu(const QPoint& pos);
+ void makeMenu(const QPoint& position);
void save()
{
- ui->on_buttonApply_clicked();
+ m_objectUi->on_buttonApply_clicked();
}
Object* copy();
Object* cut();
- void paste(Object* o)
+ void paste(Object* object)
{
- if (obj)
+ if (object)
{
- if (obj->getClassName() == o->getClassName())
+ if (m_object->className() == object->className())
{
- obj = o;
- ui->on_buttonDiscard_clicked();
+ // FIXME: class determination hell
+ m_object = object;
+ m_objectUi->on_buttonDiscard_clicked();
update();
}
}
@@ -81,43 +71,40 @@ class PokeModTreeItem : public QObject, public QTreeWidgetItem
ObjectUI* getUi()
{
- return ui;
+ return m_objectUi;
}
- QString getObjectType()
+ QString objectType()
{
- if (obj)
- return obj->getClassName();
+ if (m_object)
+ return m_object->className();
return "";
}
- const Object* getObject() const
+ const Object* object() const
{
- return obj;
+ return m_object;
}
- Object* getObject()
+ Object* object()
{
- return obj;
+ return m_object;
}
- Pokemod* getPokemod()
+ const Pokemod* pokemod() const
{
- if (obj)
- {
- if (obj->getClassName() == "Pokemod")
- return static_cast<Pokemod*>(obj);
- }
- return static_cast<PokeModTreeItem*>(QTreeWidgetItem::parent())->getPokemod();
+ if (m_object)
+ return m_object->pokemod();
+ return static_cast<PokeModTreeItem*>(QTreeWidgetItem::parent())->pokemod();
}
public slots:
void updateName();
- void changed(const bool c)
+ void changed(const bool changed)
{
- setBackgroundColor(0, QColor(c ? 255 : 0, 0, 0));
+ setBackgroundColor(0, QColor(changed ? 255 : 0, 0, 0));
}
private:
void update();
- void init(QWidget* pnt);
+ void init();
- Object* obj;
- ObjectUI* ui;
+ Object* m_object;
+ ObjectUI* m_objectUi;
};
#endif
diff --git a/pokemodr/PokeModr.cpp b/pokemodr/PokeModr.cpp
index 80b50e66..7a50630c 100644
--- a/pokemodr/PokeModr.cpp
+++ b/pokemodr/PokeModr.cpp
@@ -1,24 +1,19 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokemodr/PokeModr.cpp
-// Purpose: Main function for PokéModr
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Jan 22 14:51:38 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#include <kaboutdata.h>
#include <kapplication.h>
@@ -59,9 +54,9 @@ int main(int argc, char* argv[])
mainWindow.show();
app.exec();
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
BugCatcher::report(Exception("PokeModr", "Uncaught exception"));
ret = 1;
}
diff --git a/pokemodr/PokeModr.h b/pokemodr/PokeModr.h
index 44076f61..7ff0a99b 100644
--- a/pokemodr/PokeModr.h
+++ b/pokemodr/PokeModr.h
@@ -1,24 +1,19 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokemodr/PokeModr.h
-// Purpose: Main window for PokéModr
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu Jan 16 17:48:13 2007
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * Copyright 2007-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/>.
+ */
#ifndef __POKEMODR_MAIN__
#define __POKEMODR_MAIN__
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index adc1e2b2..134f5d64 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -1,25 +1,21 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/PokeModrUI.cpp
-// Purpose: Main window handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Wed Jan 23 10:42:50 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// KDE includes
#include <kaction.h>
#include <kfiledialog.h>
#include <kicon.h>
@@ -32,30 +28,35 @@
#include <ktoolbar.h>
#include <kurl.h>
-#include <QListIterator>
-#include <QMetaObject>
+// Qt includes
#include <QMutableListIterator>
#include <QString>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Pokemod.h>
-#include "PokeModrUI.h"
+// PokeModr includes
#include "PokeModTreeItem.h"
+// Header include
+#include "PokeModrUI.h"
+
+// STL includes
#include <iostream>
-PokeModrUI::PokeModrUI(KConfigGroup cfg, KConfigGroup history, QWidget* parent) :
+PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* parent) :
KMainWindow(parent),
- config(cfg),
- recent("&Recent Files...", NULL),
- clipboard(NULL)
+ m_config(config),
+ m_recent("&Recent Files...", NULL),
+ m_clipboard(NULL)
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- recent.loadEntries(history);
+ m_recent.loadEntries(history);
KMenuBar* menubar = new KMenuBar(this);
KMenu* menuFile = new KMenu("&File", menubar);
menuFile->addAction(KStandardAction::openNew(this, SLOT(on_actionNew_triggered()), menuFile));
@@ -115,10 +116,10 @@ PokeModrUI::PokeModrUI(KConfigGroup cfg, KConfigGroup history, QWidget* parent)
toolbar->addSeparator();
toolbar->addAction(KStandardAction::quit(this, SLOT(on_actionQuit_triggered()), toolbar));
addToolBar(toolbar);
- splitter->setSizes(QList<int>() << cfg.readEntry("treeWidth", 100) << cfg.readEntry("panelWidth", 100));
-// if (cfg.readEntry("reloadOnStart", false))
+ splitter->setSizes(QList<int>() << config.readEntry("treeWidth", 100) << config.readEntry("panelWidth", 100));
+// if (config.readEntry("reloadOnStart", false))
// {
-// for (int i = 0; i < cfg.readEntry("openedFiles", 0); ++i)
+// for (int i = 0; i < config.readEntry("openedFiles", 0); ++i)
// openPokeMod(recent.urls().at(i));
// }
setAutoSaveSettings("MainWindow", true);
@@ -133,17 +134,17 @@ PokeModrUI::~PokeModrUI()
void PokeModrUI::rebuildTree()
{
treePokemod->clear();
- for (QMutableListIterator<Pokemod*> i(pokemods); i.hasNext(); )
- new PokeModTreeItem(treePokemod, i.next());
+ foreach (Pokemod* pokemod, m_pokemods)
+ new PokeModTreeItem(treePokemod, pokemod);
}
void PokeModrUI::openPokeMod(const KUrl& path)
{
if (path.isLocalFile())
{
- pokemods.append(new Pokemod(path.path()));
- recent.addUrl(path);
- recent.saveEntries(config);
+// m_pokemods.append(new Pokemod(path.path()));
+ m_recent.addUrl(path);
+ m_recent.saveEntries(m_config);
rebuildTree();
}
}
@@ -151,7 +152,7 @@ void PokeModrUI::openPokeMod(const KUrl& path)
void PokeModrUI::savePokeMod()
{
if (formPanel->widget())
- static_cast<ObjectUI*>(formPanel->widget())->getOriginal()->getPokemod()->save();
+ static_cast<ObjectUI*>(formPanel->widget())->original()->pokemod()->save();
}
void PokeModrUI::closePokeMod()
@@ -159,7 +160,7 @@ void PokeModrUI::closePokeMod()
if (formPanel->widget())
{
ObjectUI* o = static_cast<ObjectUI*>(formPanel->widget());
- const Pokemod* p = o->getOriginal()->getPokemod();
+ const Pokemod* p = o->original()->pokemod();
if (!o->close())
return;
switch (KMessageBox::questionYesNoCancel(this, "You have unsaved changes, would you like to save them?", "Unsaved PokéMod"))
@@ -171,7 +172,7 @@ void PokeModrUI::closePokeMod()
case KMessageBox::Cancel:
return;
}
- for (QMutableListIterator<Pokemod*> i(pokemods); i.hasNext(); i.next())
+ for (QMutableListIterator<Pokemod*> i(m_pokemods); i.hasNext(); i.next())
{
if (i.value() == p)
{
@@ -193,23 +194,23 @@ void PokeModrUI::closeEvent(QCloseEvent* event)
void PokeModrUI::setChangedTitle(const bool c)
{
if (formPanel->widget())
- setWindowTitle(QString::fromUtf8("%1%2 - PokéModr").arg(static_cast<ObjectUI*>(formPanel->widget())->getOriginal()->getPokemod()->getTitle()).arg(c ? "*" : ""));
+ setWindowTitle(QString::fromUtf8("%1%2 - PokéModr").arg(static_cast<ObjectUI*>(formPanel->widget())->original()->pokemod()->title()).arg(c ? "*" : ""));
else
setWindowTitle(QString::fromUtf8("PokéModr"));
}
void PokeModrUI::on_actionNew_triggered()
{
- QString dir = KFileDialog::getExistingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("New PokéMod"));
- if (dir != "")
- openPokeMod(KUrl(dir));
+// QString dir = KFileDialog::existingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("New PokéMod"));
+// if (dir != "")
+// openPokeMod(KUrl(dir));
}
void PokeModrUI::on_actionOpen_triggered()
{
- QString dir = KFileDialog::getExistingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod"));
- if (dir != "")
- openPokeMod(KUrl(dir));
+// QString dir = KFileDialog::existingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod"));
+// if (dir != "")
+// openPokeMod(KUrl(dir));
}
void PokeModrUI::on_actionSave_triggered()
@@ -217,27 +218,27 @@ void PokeModrUI::on_actionSave_triggered()
if (!treePokemod->currentItem())
return;
static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save();
- static_cast<Pokemod*>(static_cast<PokeModTreeItem*>(treePokemod->currentItem())->getObject())->getPokemod()->save();
+ static_cast<Pokemod*>(static_cast<PokeModTreeItem*>(treePokemod->currentItem())->object())->pokemod()->save();
}
void PokeModrUI::on_actionSaveAs_triggered()
{
if (!treePokemod->currentItem())
return;
- QString dir = KFileDialog::getExistingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod"));
- if (dir != "")
- {
- static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save();
- static_cast<PokeModTreeItem*>(treePokemod->currentItem())->getPokemod()->setPath(dir);
- }
+// QString dir = KFileDialog::existingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod"));
+// if (dir != "")
+// {
+// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save();
+// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->pokemod()->setPath(dir);
+// }
}
void PokeModrUI::on_actionQuit_triggered()
{
- while (pokemods.size())
+ while (m_pokemods.size())
closePokeMod();
- if (clipboard)
- delete clipboard;
+ if (m_clipboard)
+ delete m_clipboard;
close();
}
@@ -245,25 +246,25 @@ void PokeModrUI::on_actionCut_triggered()
{
if (!treePokemod->currentItem())
return;
- if (clipboard)
- delete clipboard;
- clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->cut();
+ if (m_clipboard)
+ delete m_clipboard;
+ m_clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->cut();
}
void PokeModrUI::on_actionCopy_triggered()
{
if (!treePokemod->currentItem())
return;
- if (clipboard)
- delete clipboard;
- clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->copy();
+ if (m_clipboard)
+ delete m_clipboard;
+ m_clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->copy();
}
void PokeModrUI::on_actionPaste_triggered()
{
- if (!clipboard || !treePokemod->currentItem())
+ if (!m_clipboard || !treePokemod->currentItem())
return;
- static_cast<PokeModTreeItem*>(treePokemod->currentItem())->paste(clipboard);
+ static_cast<PokeModTreeItem*>(treePokemod->currentItem())->paste(m_clipboard);
}
void PokeModrUI::on_actionPreferences_triggered()
@@ -272,8 +273,8 @@ void PokeModrUI::on_actionPreferences_triggered()
void PokeModrUI::on_splitter_splitterMoved()
{
- config.writeEntry("treeWidth", splitter->sizes()[0]);
- config.writeEntry("panelWidth", splitter->sizes()[1]);
+ m_config.writeEntry("treeWidth", splitter->sizes()[0]);
+ m_config.writeEntry("panelWidth", splitter->sizes()[1]);
}
void PokeModrUI::on_treePokemod_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous)
@@ -294,10 +295,10 @@ void PokeModrUI::on_treePokemod_currentItemChanged(QTreeWidgetItem* current, QTr
formPanel->show();
}
-void PokeModrUI::on_treePokemod_customContextMenuRequested(const QPoint& pos)
+void PokeModrUI::on_treePokemod_customContextMenuRequested(const QPoint& position)
{
- if (treePokemod->itemAt(pos))
- static_cast<PokeModTreeItem*>(treePokemod->itemAt(pos))->makeMenu(pos);
+ if (treePokemod->itemAt(position))
+ static_cast<PokeModTreeItem*>(treePokemod->itemAt(position))->makeMenu(position);
else
{
}
diff --git a/pokemodr/PokeModrUI.h b/pokemodr/PokeModrUI.h
index a5a6d41b..5cc1d466 100644
--- a/pokemodr/PokeModrUI.h
+++ b/pokemodr/PokeModrUI.h
@@ -1,39 +1,38 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/PokeModrUI.h
-// Purpose: Main window handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Jan 22 19:12:17 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_POKEMODRUI__
#define __POKEMODR_POKEMODRUI__
+// KDE includes
#include <kconfiggroup.h>
#include <kmainwindow.h>
#include <krecentfilesaction.h>
#include <kurl.h>
+// Qt includes
#include <QList>
#include <QObject>
#include <QWidget>
+// Pokemod includes
#include <Pokemod.h>
+// Form include
#include "ui_pokemodr.h"
class PokeModrUI : public KMainWindow, private Ui::formPokeModr
@@ -41,7 +40,7 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr
Q_OBJECT
public:
- PokeModrUI(KConfigGroup cfg, KConfigGroup history, QWidget* parent = 0);
+ PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* parent = 0);
~PokeModrUI();
public slots:
@@ -51,7 +50,7 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr
void closeEvent(QCloseEvent* event);
- void setChangedTitle(const bool c);
+ void setChangedTitle(const bool changed);
void on_actionNew_triggered();
void on_actionOpen_triggered();
@@ -64,14 +63,14 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr
void on_actionPreferences_triggered();
void on_splitter_splitterMoved();
void on_treePokemod_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
- void on_treePokemod_customContextMenuRequested(const QPoint& pos);
+ void on_treePokemod_customContextMenuRequested(const QPoint& position);
private:
void rebuildTree();
- KConfigGroup config;
- KRecentFilesAction recent;
- QList<Pokemod*> pokemods;
- Object* clipboard;
+ KConfigGroup m_config;
+ KRecentFilesAction m_recent;
+ QList<Pokemod*> m_pokemods;
+ Object* m_clipboard;
};
#endif
diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp
index 57ec83ea..63561a2e 100644
--- a/pokemodr/PokemodUI.cpp
+++ b/pokemodr/PokemodUI.cpp
@@ -1,49 +1,48 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/PokemodUI.cpp
-// Purpose: Pokemod UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Feb 22 16:30:10 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QSize>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
-#include <ImageCache.h>
+// Pokemod includes
#include <Item.h>
#include <Map.h>
#include <MapWarp.h>
+// PokeModr includes
#include "FileDialog.h"
-#include "PokemodUI.h"
#include "TypechartWidgetItem.h"
-PokemodUI::PokemodUI(Pokemod* p, QWidget* parent) :
+// Header include
+#include "PokemodUI.h"
+
+PokemodUI::PokemodUI(Pokemod* pokemod, QWidget* parent) :
ObjectUI(parent),
- lastMap(-1),
- pokemod(p),
- pokemod_mod(new Pokemod(*p))
+ m_lastMap(-1),
+ m_pokemod(pokemod),
+ m_pokemod_mod(new Pokemod(*pokemod))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(pokemod, pokemod_mod);
+ setObjects(m_pokemod, m_pokemod_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -51,21 +50,21 @@ PokemodUI::PokemodUI(Pokemod* p, QWidget* parent) :
void PokemodUI::refreshGui()
{
varMap->clear();
- for (int i = 0; i < pokemod->getPokemod()->getMapCount(); ++i)
+ for (int i = 0; i < m_pokemod->mapCount(); ++i)
{
- const Map* m = pokemod->getPokemod()->getMap(i);
- varMap->addItem(m->getName());
- varMap->setItemData(i, m->getId());
+ const Map* map = m_pokemod->map(i);
+ varMap->addItem(map->name());
+ varMap->setItemData(i, map->id());
}
- varTypechart->setRowCount(pokemod->getTypeCount());
- varTypechart->setColumnCount(pokemod->getTypeCount());
+ varTypechart->setRowCount(m_pokemod->typeCount());
+ varTypechart->setColumnCount(m_pokemod->typeCount());
QStringList types;
- Matrix<Frac>* tc = pokemod->getTypeChart();
- for (int i = 0; i < pokemod->getTypeCount(); ++i)
+ Matrix<Fraction>* typeChart = m_pokemod->typeChart();
+ for (int i = 0; i < m_pokemod->typeCount(); ++i)
{
- types << pokemod->getItem(i)->getName();
- for (int j = 0; j < pokemod->getTypeCount(); ++j)
- static_cast<TypechartWidgetItem*>(varTypechart->item(i, j))->setData(Qt::EditRole, qVariantFromValue(static_cast<void*>(&(*tc)(i, j))));
+ types << m_pokemod->item(i)->name();
+// for (int j = 0; j < m_pokemod->typeCount(); ++j)
+// static_cast<TypechartWidgetItem*>(varTypechart->item(i, j))->setData(Qt::EditRole, QVariant::fromValue((*typeChart)(i, j)));
}
varTypechart->setVerticalHeaderLabels(types);
varTypechart->setHorizontalHeaderLabels(types);
@@ -73,164 +72,128 @@ void PokemodUI::refreshGui()
void PokemodUI::setGui()
{
- const bool resetWarps = (pokemod_mod->getStartMap() == lastMap);
- varTitle->setText(pokemod_mod->getTitle());
- varVersion->setText(pokemod_mod->getVersion());
- varDescription->setText(pokemod_mod->getDescription());
- varMap->setCurrentIndex(varMap->findData(pokemod_mod->getStartMap()));
- lastMap = pokemod_mod->getStartMap();
+ const bool resetWarps = (m_pokemod_mod->startMap() == m_lastMap);
+ varTitle->setText(m_pokemod_mod->title());
+ varVersion->setText(m_pokemod_mod->version());
+ varDescription->setText(m_pokemod_mod->description());
+ varMap->setCurrentIndex(varMap->findData(m_pokemod_mod->startMap()));
+ m_lastMap = m_pokemod_mod->startMap();
if (resetWarps)
{
varWarp->clear();
- int index = pokemod->getMapIndex(pokemod_mod->getStartMap());
+ int index = m_pokemod->mapIndex(m_pokemod_mod->startMap());
if (index != INT_MAX)
{
try
{
- const Map* m = pokemod->getMap(index);
- for (int i = 0; i < m->getWarpCount(); ++i)
+ const Map* map = m_pokemod->map(index);
+ for (int i = 0; i < map->warpCount(); ++i)
{
- const MapWarp* w = m->getWarp(i);
- varWarp->addItem(w->getName());
- varWarp->setItemData(i, w->getId());
+ const MapWarp* warp = map->warp(i);
+ varWarp->addItem(warp->name());
+ varWarp->setItemData(i, warp->id());
}
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
}
}
- varWarp->setCurrentIndex(varWarp->findData(pokemod_mod->getStartWarp()));
- varSuperPCUsername->setText(pokemod_mod->getSuperPCUname());
- varSuperPCPassword->setText(pokemod_mod->getSuperPCPasswd());
- try
- {
- varWalkSkin->setIcon(ImageCache::open(pokemod->getWalkSkin()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varBikeSkin->setIcon(ImageCache::open(pokemod->getBikeSkin()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varFlySkin->setIcon(ImageCache::open(pokemod->getFlySkin()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varSurfSkin->setIcon(ImageCache::open(pokemod->getSurfSkin()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varFishSkin->setIcon(ImageCache::open(pokemod->getFishSkin()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varSurfFishSkin->setIcon(ImageCache::open(pokemod->getSurfFishSkin()));
- }
- catch (OpenException& e)
- {
- }
+ varWarp->setCurrentIndex(varWarp->findData(m_pokemod_mod->startWarp()));
+ varSuperPCUsername->setText(m_pokemod_mod->superPCUname());
+ varSuperPCPassword->setText(m_pokemod_mod->superPCPasswd());
+ varWalkSkin->setIcon(m_pokemod->walkSkin());
+ varBikeSkin->setIcon(m_pokemod->bikeSkin());
+ varFlySkin->setIcon(m_pokemod->flySkin());
+ varSurfSkin->setIcon(m_pokemod->surfSkin());
+ varFishSkin->setIcon(m_pokemod->fishSkin());
+ varSurfFishSkin->setIcon(m_pokemod->surfFishSkin());
}
void PokemodUI::on_buttonApply_clicked()
{
- *pokemod = *pokemod_mod;
+ *m_pokemod = *m_pokemod_mod;
emit(changed(false));
}
void PokemodUI::on_buttonDiscard_clicked()
{
- *pokemod_mod = *pokemod;
+ *m_pokemod_mod = *m_pokemod;
setGui();
emit(changed(false));
}
-void PokemodUI::on_varTitle_textChanged(const QString& t)
+void PokemodUI::on_varTitle_textChanged(const QString& title)
{
- pokemod_mod->setTitle(t);
+ m_pokemod_mod->setTitle(title);
emit(changed(true));
}
-void PokemodUI::on_varVersion_textChanged(const QString& v)
+void PokemodUI::on_varVersion_textChanged(const QString& version)
{
- pokemod_mod->setVersion(v);
+ m_pokemod_mod->setVersion(version);
emit(changed(true));
}
void PokemodUI::on_varDescription_textChanged()
{
- pokemod_mod->setDescription(varDescription->toPlainText());
+ m_pokemod_mod->setDescription(varDescription->toPlainText());
emit(changed(true));
}
-void PokemodUI::on_varMap_currentIndexChanged(const int s)
+void PokemodUI::on_varMap_currentIndexChanged(const int map)
{
try
{
- pokemod_mod->setStartMap(s);
+ m_pokemod_mod->setStartMap(map);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void PokemodUI::on_varWarp_currentIndexChanged(const int s)
+void PokemodUI::on_varWarp_currentIndexChanged(const int warp)
{
try
{
- pokemod_mod->setStartWarp(s);
+ m_pokemod_mod->setStartWarp(warp);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void PokemodUI::on_varSuperPCUsername_textChanged(const QString& u)
+void PokemodUI::on_varSuperPCUsername_textChanged(const QString& username)
{
- pokemod_mod->setSuperPCUname(u);
+ m_pokemod_mod->setSuperPCUname(username);
emit(changed(true));
}
-void PokemodUI::on_varSuperPCPassword_textChanged(const QString& p)
+void PokemodUI::on_varSuperPCPassword_textChanged(const QString& password)
{
- pokemod_mod->setSuperPCPasswd(p);
+ m_pokemod_mod->setSuperPCPasswd(password);
emit(changed(true));
}
void PokemodUI::on_varWalkSkin_pressed()
{
- FileDialog dlg("*.png", QSize(192, 168));
- if (dlg.show())
+ FileDialog dialog(QSize(192, 168));
+ if (dialog.exec())
{
try
{
- pokemod->setWalkSkin(dlg.selectedUrl());
+ m_pokemod->setWalkSkin(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -238,16 +201,16 @@ void PokemodUI::on_varWalkSkin_pressed()
void PokemodUI::on_varBikeSkin_pressed()
{
- FileDialog dlg("*.png", QSize(192, 168));
- if (dlg.show())
+ FileDialog dialog(QSize(192, 168));
+ if (dialog.exec())
{
try
{
- pokemod->setBikeSkin(dlg.selectedUrl());
+ m_pokemod->setBikeSkin(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -255,16 +218,16 @@ void PokemodUI::on_varBikeSkin_pressed()
void PokemodUI::on_varFlySkin_pressed()
{
- FileDialog dlg("*.png", QSize(192, 168));
- if (dlg.show())
+ FileDialog dialog(QSize(192, 168));
+ if (dialog.exec())
{
try
{
- pokemod->setFlySkin(dlg.selectedUrl());
+ m_pokemod->setFlySkin(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -272,16 +235,16 @@ void PokemodUI::on_varFlySkin_pressed()
void PokemodUI::on_varSurfSkin_pressed()
{
- FileDialog dlg("*.png", QSize(192, 168));
- if (dlg.show())
+ FileDialog dialog(QSize(192, 168));
+ if (dialog.exec())
{
try
{
- pokemod->setSurfSkin(dlg.selectedUrl());
+ m_pokemod->setSurfSkin(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -289,16 +252,16 @@ void PokemodUI::on_varSurfSkin_pressed()
void PokemodUI::on_varFishSkin_pressed()
{
- FileDialog dlg("*.png", QSize(192, 168));
- if (dlg.show())
+ FileDialog dialog(QSize(192, 168));
+ if (dialog.exec())
{
try
{
- pokemod->setFishSkin(dlg.selectedUrl());
+ m_pokemod->setFishSkin(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -306,16 +269,16 @@ void PokemodUI::on_varFishSkin_pressed()
void PokemodUI::on_varSurfFishSkin_pressed()
{
- FileDialog dlg("*.png", QSize(192, 168));
- if (dlg.show())
+ FileDialog dialog(QSize(192, 168));
+ if (dialog.exec())
{
try
{
- pokemod->setSurfFishSkin(dlg.selectedUrl());
+ m_pokemod->setSurfFishSkin(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -323,23 +286,13 @@ void PokemodUI::on_varSurfFishSkin_pressed()
void PokemodUI::on_varTypechart_currentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous)
{
- disconnect(varEffectivenessNum, SIGNAL(valueChanged(int)), static_cast<TypechartWidgetItem*>(previous), SLOT(setNum(int)));
- disconnect(varEffectivenessDenom, SIGNAL(valueChanged(int)), static_cast<TypechartWidgetItem*>(previous), SLOT(setDenom(int)));
- TypechartWidgetItem* twi = static_cast<TypechartWidgetItem*>(current);
- varEffectivenessNum->setValue(static_cast<Frac*>(twi->data(Qt::EditRole).value<void*>())->getNum());
- varEffectivenessNum->setMaximum(static_cast<Frac*>(twi->data(Qt::EditRole).value<void*>())->getDenom());
- varEffectivenessDenom->setValue(static_cast<Frac*>(twi->data(Qt::EditRole).value<void*>())->getDenom());
- connect(varEffectivenessNum, SIGNAL(valueChanged(int)), twi, SLOT(setNum(int)));
- connect(varEffectivenessDenom, SIGNAL(valueChanged(int)), twi, SLOT(setDenom(int)));
-}
-
-void PokemodUI::on_varEffectivenessNum_valueChanged()
-{
- emit(changed(true));
+ disconnect(varEffectiveness, SIGNAL(valueChanged(Fraction)), static_cast<TypechartWidgetItem*>(previous), SLOT(setValue(Fraction)));
+ TypechartWidgetItem* widgetItem = static_cast<TypechartWidgetItem*>(current);
+// varEffectiveness->setValue(widgetItem->data(Qt::EditRole).value<Fraction>());
+ connect(varEffectiveness, SIGNAL(valueChanged(Fraction)), widgetItem, SLOT(setValue(Fraction)));
}
-void PokemodUI::on_varEffectivenessDenom_valueChanged(const int e)
+void PokemodUI::on_varEffectiveness_valueChanged()
{
- varEffectivenessNum->setMaximum(e);
emit(changed(true));
}
diff --git a/pokemodr/PokemodUI.h b/pokemodr/PokemodUI.h
index ed242cba..10a7cdd0 100644
--- a/pokemodr/PokemodUI.h
+++ b/pokemodr/PokemodUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/PokemodUI.h
-// Purpose: Pokemod UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Fri Feb 22 16:27:02 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_POKEMODUI__
#define __POKEMODR_POKEMODUI__
-#include <QString>
-
+// Pokemod includes
#include <Pokemod.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_pokemod.h"
class PokemodUI : public ObjectUI, private Ui::formPokemod
@@ -36,21 +32,21 @@ class PokemodUI : public ObjectUI, private Ui::formPokemod
Q_OBJECT
public:
- PokemodUI(Pokemod* p, QWidget* parent);
+ PokemodUI(Pokemod* pokemod, QWidget* parent);
~PokemodUI()
{
- delete pokemod_mod;
+ delete m_pokemod_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varTitle_textChanged(const QString& t);
- void on_varVersion_textChanged(const QString& v);
+ void on_varTitle_textChanged(const QString& title);
+ void on_varVersion_textChanged(const QString& version);
void on_varDescription_textChanged();
- void on_varMap_currentIndexChanged(const int s);
- void on_varWarp_currentIndexChanged(const int s);
- void on_varSuperPCUsername_textChanged(const QString& u);
- void on_varSuperPCPassword_textChanged(const QString& p);
+ void on_varMap_currentIndexChanged(const int map);
+ void on_varWarp_currentIndexChanged(const int warp);
+ void on_varSuperPCUsername_textChanged(const QString& username);
+ void on_varSuperPCPassword_textChanged(const QString& password);
void on_varWalkSkin_pressed();
void on_varBikeSkin_pressed();
void on_varFlySkin_pressed();
@@ -58,16 +54,15 @@ 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_varEffectivenessNum_valueChanged();
- void on_varEffectivenessDenom_valueChanged(const int e);
+ void on_varEffectiveness_valueChanged();
private:
void refreshGui();
void setGui();
- int lastMap;
+ int m_lastMap;
- Pokemod* pokemod;
- Pokemod* pokemod_mod;
+ Pokemod* m_pokemod;
+ Pokemod* m_pokemod_mod;
};
#endif
diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp
index 24b79ea0..ae66439f 100644
--- a/pokemodr/RulesUI.cpp
+++ b/pokemodr/RulesUI.cpp
@@ -1,40 +1,35 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/RulesUI.cpp
-// Purpose: Rules UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Jan 21 13:04:20 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
-
+/*
+ * 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/>.
+ */
+
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Header include
#include "RulesUI.h"
-RulesUI::RulesUI(Rules* r, QWidget* parent) :
+RulesUI::RulesUI(Rules* rules, QWidget* parent) :
ObjectUI(parent),
- rules(r),
- rules_mod(new Rules(r->getPokemod(), *r))
+ m_rules(rules),
+ m_rules_mod(new Rules(*rules))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(rules, rules_mod);
+ setObjects(m_rules, m_rules_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -46,273 +41,256 @@ void RulesUI::initGui()
void RulesUI::setGui()
{
- boxGenders->setChecked(rules_mod->getGenderAllowed() ? Qt::Checked : Qt::Unchecked);
- varBreeding->setCheckState(rules_mod->getBreedingAllowed() ? Qt::Checked : Qt::Unchecked);
- varHeldItems->setValue(rules_mod->getHoldItems());
- boxCriticalDomains->setChecked(rules_mod->getCriticalDomains() ? Qt::Checked : Qt::Unchecked);
- boxAllowAbilities->setChecked(rules_mod->getAbilityAllowed() ? Qt::Checked : Qt::Unchecked);
- boxAllowNatures->setChecked(rules_mod->getNatureAllowed() ? Qt::Checked : Qt::Unchecked);
- varBoxes->setValue(rules_mod->getNumBoxes());
- if (rules_mod->getNumBoxes())
+ boxGenders->setChecked(m_rules_mod->genderAllowed() ? Qt::Checked : Qt::Unchecked);
+ varBreeding->setCheckState(m_rules_mod->breedingAllowed() ? Qt::Checked : Qt::Unchecked);
+ varHeldItems->setValue(m_rules_mod->holdItems());
+ boxCriticalDomains->setChecked(m_rules_mod->criticalDomains() ? Qt::Checked : Qt::Unchecked);
+ boxAllowAbilities->setChecked(m_rules_mod->abilityAllowed() ? Qt::Checked : Qt::Unchecked);
+ boxAllowNatures->setChecked(m_rules_mod->natureAllowed() ? Qt::Checked : Qt::Unchecked);
+ varBoxes->setValue(m_rules_mod->numBoxes());
+ if (m_rules_mod->numBoxes())
varBoxSize->setEnabled(true);
else
varBoxSize->setEnabled(false);
- varBoxSize->setValue(rules_mod->getBoxSize());
- varMaxParty->setValue(rules_mod->getMaxParty());
- varMaxFight->setMaximum(rules_mod->getMaxParty());
- varMaxFight->setValue(rules_mod->getMaxFight());
- varMaxMoves->setValue(rules_mod->getMaxMoves());
- varMaxLevel->setValue(rules_mod->getMaxLevel());
- varMaxMoney->setValue(rules_mod->getMaxMoney());
- boxHardCash->setChecked(rules_mod->getHardCash() ? Qt::Checked : Qt::Unchecked);
- boxSplitSpecial->setChecked(rules_mod->getSpecialSplit() ? Qt::Checked : Qt::Unchecked);
- varSplitSpecialDV->setCheckState(rules_mod->getSpecialDVSplit() ? Qt::Checked : Qt::Unchecked);
- varMaxDV->setCurrentIndex(rules_mod->getMaxDVValue());
- boxHappiness->setChecked(rules_mod->getHappiness() ? Qt::Checked : Qt::Unchecked);
- varFaintLoss->setValue(rules_mod->getHappyFaintLoss());
- varLevelGain->setValue(rules_mod->getHappyLevelGain());
- varNumSteps->setValue(rules_mod->getHappySteps());
- boxEffortValues->setChecked(rules_mod->getEffortValuesAllowed() ? Qt::Checked : Qt::Unchecked);
- varMaxEV->setValue(rules_mod->getMaxTotalEV());
- varMaxEVPerStat->setMaximum(rules_mod->getMaxTotalEV());
- varMaxEVPerStat->setValue(rules_mod->getMaxEVPerStat());
- varPokerusNum->setValue(rules_mod->getPokerusChance().getNum());
- varPokerusDenom->setValue(rules_mod->getPokerusChance().getDenom());
- varPokerusNum->setMaximum(rules_mod->getPokerusChance().getDenom() - 1);
- varPokerus->setText(QString::number(rules_mod->getPokerusChance(), 'g', DBL_PREC));
+ varBoxSize->setValue(m_rules_mod->boxSize());
+ varMaxParty->setValue(m_rules_mod->maxParty());
+ varMaxFight->setMaximum(m_rules_mod->maxParty());
+ varMaxFight->setValue(m_rules_mod->maxFight());
+ varMaxMoves->setValue(m_rules_mod->maxMoves());
+ varMaxLevel->setValue(m_rules_mod->maxLevel());
+ varMaxMoney->setValue(m_rules_mod->maxMoney());
+ boxHardCash->setChecked(m_rules_mod->hardCash() ? Qt::Checked : Qt::Unchecked);
+ boxSplitSpecial->setChecked(m_rules_mod->specialSplit() ? Qt::Checked : Qt::Unchecked);
+ varSplitSpecialDV->setCheckState(m_rules_mod->specialDVSplit() ? Qt::Checked : Qt::Unchecked);
+ varMaxDV->setCurrentIndex(m_rules_mod->maxDVValue());
+ boxHappiness->setChecked(m_rules_mod->happiness() ? Qt::Checked : Qt::Unchecked);
+ varFaintLoss->setValue(m_rules_mod->happyFaintLoss());
+ varLevelGain->setValue(m_rules_mod->happyLevelGain());
+ varNumSteps->setValue(m_rules_mod->happySteps());
+ boxEffortValues->setChecked(m_rules_mod->effortValuesAllowed() ? Qt::Checked : Qt::Unchecked);
+ varMaxEV->setValue(m_rules_mod->maxTotalEV());
+ varMaxEVPerStat->setMaximum(m_rules_mod->maxTotalEV());
+ varMaxEVPerStat->setValue(m_rules_mod->maxEVPerStat());
+ varPokerus->setValue(m_rules_mod->pokerusChance());
}
void RulesUI::on_buttonApply_clicked()
{
- *rules = *rules_mod;
+ *m_rules = *m_rules_mod;
emit(changed(false));
}
void RulesUI::on_buttonDiscard_clicked()
{
- *rules_mod = *rules;
+ *m_rules_mod = *m_rules;
setGui();
emit(changed(false));
}
-void RulesUI::on_boxGenders_toggled(const bool g)
+void RulesUI::on_boxGenders_toggled(const bool genders)
{
- rules_mod->setGenderAllowed(g);
+ m_rules_mod->setGenderAllowed(genders);
emit(changed(true));
}
-void RulesUI::on_varBreeding_toggled(const bool b)
+void RulesUI::on_varBreeding_toggled(const bool breeding)
{
- rules_mod->setBreedingAllowed(b);
+ m_rules_mod->setBreedingAllowed(breeding);
emit(changed(true));
}
-void RulesUI::on_varHeldItems_valueChanged(const int h)
+void RulesUI::on_varHeldItems_valueChanged(const int heldItems)
{
- rules_mod->setHoldItems(h);
+ m_rules_mod->setHoldItems(heldItems);
emit(changed(true));
}
-void RulesUI::on_boxCriticalDomains_toggled(const bool c)
+void RulesUI::on_boxCriticalDomains_toggled(const bool criticalDomains)
{
- rules_mod->setCriticalDomains(c);
+ m_rules_mod->setCriticalDomains(criticalDomains);
emit(changed(true));
}
-void RulesUI::on_boxAllowAbilities_toggled(const bool a)
+void RulesUI::on_boxAllowAbilities_toggled(const bool allowAbilities)
{
- rules_mod->setAbilityAllowed(a);
+ m_rules_mod->setAbilityAllowed(allowAbilities);
emit(changed(true));
}
-void RulesUI::on_boxAllowNatures_toggled(const bool a)
+void RulesUI::on_boxAllowNatures_toggled(const bool allowNatures)
{
- rules_mod->setNatureAllowed(a);
+ m_rules_mod->setNatureAllowed(allowNatures);
emit(changed(true));
}
-void RulesUI::on_varBoxes_valueChanged(const int b)
+void RulesUI::on_varBoxes_valueChanged(const int boxes)
{
- rules_mod->setNumBoxes(b);
+ m_rules_mod->setNumBoxes(boxes);
emit(changed(true));
setGui();
}
-void RulesUI::on_varBoxSize_valueChanged(const int b)
+void RulesUI::on_varBoxSize_valueChanged(const int boxSize)
{
- rules_mod->setBoxSize(b);
+ m_rules_mod->setBoxSize(boxSize);
emit(changed(true));
}
-void RulesUI::on_varMaxParty_valueChanged(const int m)
+void RulesUI::on_varMaxParty_valueChanged(const int maxParty)
{
- rules_mod->setMaxParty(m);
+ m_rules_mod->setMaxParty(maxParty);
emit(changed(true));
setGui();
}
-void RulesUI::on_varMaxFight_valueChanged(const int m)
+void RulesUI::on_varMaxFight_valueChanged(const int maxFight)
{
try
{
- rules_mod->setMaxFight(m);
+ m_rules_mod->setMaxFight(maxFight);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void RulesUI::on_varMaxMoves_valueChanged(const int m)
+void RulesUI::on_varMaxMoves_valueChanged(const int maxMoves)
{
try
{
- rules_mod->setMaxMoves(m);
+ m_rules_mod->setMaxMoves(maxMoves);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void RulesUI::on_varMaxLevel_valueChanged(const int m)
+void RulesUI::on_varMaxLevel_valueChanged(const int maxLevel)
{
try
{
- rules_mod->setMaxLevel(m);
+ m_rules_mod->setMaxLevel(maxLevel);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void RulesUI::on_varMaxMoney_valueChanged(const int m)
+void RulesUI::on_varMaxMoney_valueChanged(const int maxMoney)
{
- rules_mod->setMaxMoney(m);
+ m_rules_mod->setMaxMoney(maxMoney);
emit(changed(true));
}
-void RulesUI::on_boxHardCash_toggled(const bool h)
+void RulesUI::on_boxHardCash_toggled(const bool hardCash)
{
- rules_mod->setHardCash(h);
+ m_rules_mod->setHardCash(hardCash);
emit(changed(true));
}
-void RulesUI::on_boxSplitSpecial_toggled(const bool s)
+void RulesUI::on_boxSplitSpecial_toggled(const bool splitSpecial)
{
- rules_mod->setSpecialSplit(s);
+ m_rules_mod->setSpecialSplit(splitSpecial);
emit(changed(true));
}
-void RulesUI::on_varSplitSpecialDV_toggled(const bool s)
+void RulesUI::on_varSplitSpecialDV_toggled(const bool splitSpecialDV)
{
- rules_mod->setSpecialDVSplit(s);
+ m_rules_mod->setSpecialDVSplit(splitSpecialDV);
emit(changed(true));
}
-void RulesUI::on_varMaxDV_currentIndexChanged(const int m)
+void RulesUI::on_varMaxDV_currentIndexChanged(const int maxDV)
{
try
{
- rules_mod->setMaxDVValue(m);
+ m_rules_mod->setMaxDVValue(maxDV);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void RulesUI::on_boxHappiness_toggled(const bool h)
+void RulesUI::on_boxHappiness_toggled(const bool happiness)
{
- rules_mod->setHappiness(h);
+ m_rules_mod->setHappiness(happiness);
emit(changed(true));
}
-void RulesUI::on_varFaintLoss_valueChanged(const int f)
+void RulesUI::on_varFaintLoss_valueChanged(const int faintLoss)
{
- rules_mod->setHappyFaintLoss(f);
+ m_rules_mod->setHappyFaintLoss(faintLoss);
emit(changed(true));
}
-void RulesUI::on_varLevelGain_valueChanged(const int l)
+void RulesUI::on_varLevelGain_valueChanged(const int levelGain)
{
- rules_mod->setHappyLevelGain(l);
+ m_rules_mod->setHappyLevelGain(levelGain);
emit(changed(true));
}
-void RulesUI::on_varNumSteps_valueChanged(const int n)
+void RulesUI::on_varNumSteps_valueChanged(const int numSteps)
{
- rules_mod->setHappySteps(n);
+ m_rules_mod->setHappySteps(numSteps);
emit(changed(true));
}
-void RulesUI::on_boxEffortValues_toggled(const bool e)
+void RulesUI::on_boxEffortValues_toggled(const bool effortValues)
{
- rules_mod->setEffortValuesAllowed(e);
+ m_rules_mod->setEffortValuesAllowed(effortValues);
emit(changed(true));
}
-void RulesUI::on_varMaxEV_valueChanged(const int m)
+void RulesUI::on_varMaxEV_valueChanged(const int maxEV)
{
try
{
- rules_mod->setMaxTotalEV(m);
+ m_rules_mod->setMaxTotalEV(maxEV);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void RulesUI::on_varMaxEVPerStat_valueChanged(const int m)
+void RulesUI::on_varMaxEVPerStat_valueChanged(const int maxEVPerStat)
{
try
{
- rules_mod->setMaxEVPerStat(m);
+ m_rules_mod->setMaxEVPerStat(maxEVPerStat);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void RulesUI::on_varPokerusNum_valueChanged(const int p)
+void RulesUI::on_varPokerus_valueChanged(const Fraction& pokerusChance)
{
try
{
- rules_mod->setPokerusChanceNum(p);
+ m_rules_mod->setPokerusChance(pokerusChance);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
- }
- setGui();
-}
-
-void RulesUI::on_varPokerusDenom_valueChanged(const int p)
-{
- try
- {
- rules_mod->setPokerusChanceDenom(p);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
+ BugCatcher::report(exception);
+ setGui();
}
- setGui();
}
diff --git a/pokemodr/RulesUI.h b/pokemodr/RulesUI.h
index 16775bce..b3408e97 100644
--- a/pokemodr/RulesUI.h
+++ b/pokemodr/RulesUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/RulesUI.h
-// Purpose: Rules UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Jan 21 13:03:16 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_RULESUI__
#define __POKEMODR_RULESUI__
+// Pokemod includes
#include <Rules.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_rules.h"
class RulesUI : public ObjectUI, private Ui::formRules
@@ -34,46 +32,45 @@ class RulesUI : public ObjectUI, private Ui::formRules
Q_OBJECT
public:
- RulesUI(Rules* r, QWidget* parent);
+ RulesUI(Rules* rules, QWidget* parent);
~RulesUI()
{
- delete rules_mod;
+ delete m_rules_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_boxGenders_toggled(const bool g);
- void on_varBreeding_toggled(const bool b);
- void on_varHeldItems_valueChanged(const int h);
- void on_boxCriticalDomains_toggled(const bool c);
- void on_boxAllowAbilities_toggled(const bool a);
- void on_boxAllowNatures_toggled(const bool a);
- void on_varBoxes_valueChanged(const int b);
- void on_varBoxSize_valueChanged(const int b);
- void on_varMaxParty_valueChanged(const int m);
- void on_varMaxFight_valueChanged(const int m);
- void on_varMaxMoves_valueChanged(const int m);
- void on_varMaxLevel_valueChanged(const int m);
- void on_varMaxMoney_valueChanged(const int m);
- void on_boxHardCash_toggled(const bool h);
- void on_boxSplitSpecial_toggled(const bool s);
- void on_varSplitSpecialDV_toggled(const bool s);
- void on_varMaxDV_currentIndexChanged(const int m);
- void on_boxHappiness_toggled(const bool h);
- void on_varFaintLoss_valueChanged(const int f);
- void on_varLevelGain_valueChanged(const int l);
- void on_varNumSteps_valueChanged(const int n);
- void on_boxEffortValues_toggled(const bool e);
- void on_varMaxEV_valueChanged(const int m);
- void on_varMaxEVPerStat_valueChanged(const int m);
- void on_varPokerusNum_valueChanged(const int p);
- void on_varPokerusDenom_valueChanged(const int p);
+ void on_boxGenders_toggled(const bool genders);
+ void on_varBreeding_toggled(const bool breeding);
+ void on_varHeldItems_valueChanged(const int heldItems);
+ void on_boxCriticalDomains_toggled(const bool criticalDomains);
+ void on_boxAllowAbilities_toggled(const bool allowAbilities);
+ void on_boxAllowNatures_toggled(const bool allowNatures);
+ void on_varBoxes_valueChanged(const int boxes);
+ void on_varBoxSize_valueChanged(const int boxSize);
+ void on_varMaxParty_valueChanged(const int maxParty);
+ void on_varMaxFight_valueChanged(const int maxFight);
+ void on_varMaxMoves_valueChanged(const int maxMoves);
+ void on_varMaxLevel_valueChanged(const int maxLevel);
+ void on_varMaxMoney_valueChanged(const int maxMoney);
+ void on_boxHardCash_toggled(const bool hardCash);
+ void on_boxSplitSpecial_toggled(const bool specialSplit);
+ void on_varSplitSpecialDV_toggled(const bool specialSplitDV);
+ void on_varMaxDV_currentIndexChanged(const int maxDV);
+ void on_boxHappiness_toggled(const bool happiness);
+ void on_varFaintLoss_valueChanged(const int faintLoss);
+ void on_varLevelGain_valueChanged(const int levelGain);
+ void on_varNumSteps_valueChanged(const int numSteps);
+ void on_boxEffortValues_toggled(const bool effortValues);
+ void on_varMaxEV_valueChanged(const int maxEV);
+ void on_varMaxEVPerStat_valueChanged(const int maxEVPerStat);
+ void on_varPokerus_valueChanged(const Fraction& pokerusChance);
private:
void initGui();
void setGui();
- Rules* rules;
- Rules* rules_mod;
+ Rules* m_rules;
+ Rules* m_rules_mod;
};
#endif
diff --git a/pokemodr/SpeciesAbilityUI.cpp b/pokemodr/SpeciesAbilityUI.cpp
index ba127f4f..f6426f54 100644
--- a/pokemodr/SpeciesAbilityUI.cpp
+++ b/pokemodr/SpeciesAbilityUI.cpp
@@ -1,45 +1,43 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesAbilityUI.cpp
-// Purpose: SpeciesAbility UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 20:20:36 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Ability.h>
#include <Pokemod.h>
#include <SpeciesAbility.h>
+// Header include
#include "SpeciesAbilityUI.h"
-SpeciesAbilityUI::SpeciesAbilityUI(SpeciesAbility* s, QWidget* parent) :
+SpeciesAbilityUI::SpeciesAbilityUI(SpeciesAbility* ability, QWidget* parent) :
ObjectUI(parent),
- speciesAbility(s),
- speciesAbility_mod(new SpeciesAbility(s->getPokemod(), *s, s->getId()))
+ m_ability(ability),
+ m_ability_mod(new SpeciesAbility(*ability))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(speciesAbility, speciesAbility_mod);
+ setObjects(m_ability, m_ability_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -47,57 +45,57 @@ SpeciesAbilityUI::SpeciesAbilityUI(SpeciesAbility* s, QWidget* parent) :
void SpeciesAbilityUI::refreshGui()
{
varAbility->clear();
- for (int i = 0; i < speciesAbility->getPokemod()->getAbilityCount(); ++i)
+ for (int i = 0; i < m_ability->pokemod()->abilityCount(); ++i)
{
- const Ability* a = speciesAbility->getPokemod()->getAbility(i);
- varAbility->addItem(a->getName());
- varAbility->setItemData(i, a->getId());
+ const Ability* a = m_ability->pokemod()->ability(i);
+ varAbility->addItem(a->name());
+ varAbility->setItemData(i, a->id());
}
}
void SpeciesAbilityUI::setGui()
{
- varAbility->setCurrentIndex(varAbility->findData(speciesAbility_mod->getAbility()));
- varWeight->setValue(speciesAbility_mod->getWeight());
+ varAbility->setCurrentIndex(varAbility->findData(m_ability_mod->ability()));
+ varWeight->setValue(m_ability_mod->weight());
}
void SpeciesAbilityUI::on_buttonApply_clicked()
{
- *speciesAbility = *speciesAbility_mod;
+ *m_ability = *m_ability_mod;
emit(changed(false));
}
void SpeciesAbilityUI::on_buttonDiscard_clicked()
{
- *speciesAbility_mod = *speciesAbility;
+ *m_ability_mod = *m_ability;
setGui();
emit(changed(false));
}
-void SpeciesAbilityUI::on_varAbility_currentIndexChanged(const int m)
+void SpeciesAbilityUI::on_varAbility_currentIndexChanged(const int ability)
{
try
{
- speciesAbility_mod->setAbility(varAbility->itemData(m).toInt());
+ m_ability_mod->setAbility(varAbility->itemData(ability).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesAbilityUI::on_varWeight_valueChanged(const int w)
+void SpeciesAbilityUI::on_varWeight_valueChanged(const int weight)
{
try
{
- speciesAbility_mod->setWeight(w);
+ m_ability_mod->setWeight(weight);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/SpeciesAbilityUI.h b/pokemodr/SpeciesAbilityUI.h
index 3c84f46a..fa780b80 100644
--- a/pokemodr/SpeciesAbilityUI.h
+++ b/pokemodr/SpeciesAbilityUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesAbilityUI.h
-// Purpose: SpeciesAbility UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 20:20:17 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_SPECIESABILITYUI__
#define __POKEMODR_SPECIESABILITYUI__
+// Pokemod includes
#include <SpeciesAbility.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_speciesability.h"
class SpeciesAbilityUI : public ObjectUI, private Ui::formSpeciesAbility
@@ -34,23 +32,23 @@ class SpeciesAbilityUI : public ObjectUI, private Ui::formSpeciesAbility
Q_OBJECT
public:
- SpeciesAbilityUI(SpeciesAbility* s, QWidget* parent);
+ SpeciesAbilityUI(SpeciesAbility* ability, QWidget* parent);
~SpeciesAbilityUI()
{
- delete speciesAbility_mod;
+ delete m_ability_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varAbility_currentIndexChanged(const int a);
- void on_varWeight_valueChanged(const int w);
+ void on_varAbility_currentIndexChanged(const int ability);
+ void on_varWeight_valueChanged(const int weight);
private:
void initGui();
void refreshGui();
void setGui();
- SpeciesAbility* speciesAbility;
- SpeciesAbility* speciesAbility_mod;
+ SpeciesAbility* m_ability;
+ SpeciesAbility* m_ability_mod;
};
#endif
diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp
index 93694b2f..e04834a9 100644
--- a/pokemodr/SpeciesEvolutionUI.cpp
+++ b/pokemodr/SpeciesEvolutionUI.cpp
@@ -1,48 +1,46 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesEvolutionUI.cpp
-// Purpose: SpeciesEvolution UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Feb 19 19:08:26 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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/>.
+ */
+
+// Qt includes
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Item.h>
#include <ItemEffect.h>
#include <Pokemod.h>
#include <Species.h>
#include <SpeciesEvolution.h>
+// Header include
#include "SpeciesEvolutionUI.h"
-SpeciesEvolutionUI::SpeciesEvolutionUI(SpeciesEvolution* s, QWidget* parent) :
+SpeciesEvolutionUI::SpeciesEvolutionUI(SpeciesEvolution* evolution, QWidget* parent) :
ObjectUI(parent),
- lastStyle(-1),
- speciesEvolution(s),
- speciesEvolution_mod(new SpeciesEvolution(s->getPokemod(), *s, s->getId()))
+ m_lastStyle(-1),
+ m_evolution(evolution),
+ m_evolution_mod(new SpeciesEvolution(*evolution))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(speciesEvolution, speciesEvolution_mod);
+ setObjects(m_evolution, m_evolution_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -55,180 +53,180 @@ void SpeciesEvolutionUI::initGui()
void SpeciesEvolutionUI::refreshGui()
{
varSpecies->clear();
- for (int i = 0; i < speciesEvolution->getPokemod()->getSpeciesCount(); ++i)
+ for (int i = 0; i < m_evolution->pokemod()->speciesCount(); ++i)
{
- const Species* s = speciesEvolution->getPokemod()->getSpecies(i);
- varSpecies->addItem(s->getName());
- varSpecies->setItemData(i, s->getId());
+ const Species* species = m_evolution->pokemod()->species(i);
+ varSpecies->addItem(species->name());
+ varSpecies->setItemData(i, species->id());
}
}
void SpeciesEvolutionUI::setGui()
{
- const bool styleChanged = (speciesEvolution_mod->getStyle() != lastStyle);
- varSpecies->setCurrentIndex(varSpecies->findData(speciesEvolution_mod->getSpecies()));
- varStyle->setCurrentIndex(speciesEvolution_mod->getStyle());
- lastStyle = speciesEvolution_mod->getStyle();
+ const bool styleChanged = (m_evolution_mod->style() != m_lastStyle);
+ varSpecies->setCurrentIndex(varSpecies->findData(m_evolution_mod->species()));
+ varStyle->setCurrentIndex(m_evolution_mod->style());
+ m_lastStyle = m_evolution_mod->style();
if (styleChanged)
{
- varVal1->clear();
- varVal1->setEnabled(false);
- varVal2->clear();
- varVal2->setEnabled(false);
- varVal3->setEnabled(false);
- switch (speciesEvolution_mod->getStyle())
+ varValue1->clear();
+ varValue1->setEnabled(false);
+ varValue2->clear();
+ varValue2->setEnabled(false);
+ varValue3->setEnabled(false);
+ switch (m_evolution_mod->style())
{
case SpeciesEvolution::S_Level:
case SpeciesEvolution::S_Happiness:
case SpeciesEvolution::S_Stat:
case SpeciesEvolution::S_Personality:
- varVal1->setEnabled(true);
- varVal1->addItems(Pokemod::RelativeStr);
+ varValue1->setEnabled(true);
+ varValue1->addItems(Pokemod::RelativeStr);
break;
case SpeciesEvolution::S_Item:
case SpeciesEvolution::S_TradeItem:
- varVal1->setEnabled(true);
- for (int i = 0; i < speciesEvolution->getPokemod()->getItemCount(); ++i)
+ varValue1->setEnabled(true);
+ for (int i = 0; i < m_evolution->pokemod()->itemCount(); ++i)
{
- const Item* it = speciesEvolution->getPokemod()->getItem(i);
- for (int j = 0; j < it->getEffectCount(); ++j)
+ const Item* item = m_evolution->pokemod()->item(i);
+ for (int j = 0; j < item->effectCount(); ++j)
{
- if (it->getEffect(i)->getEffect() == ItemEffect::E_Evolution)
+ if (item->effect(i)->effect() == ItemEffect::E_Evolution)
{
- varVal1->addItem(it->getName());
- varVal1->setItemData(i, it->getId());
+ varValue1->addItem(item->name());
+ varValue1->setItemData(i, item->id());
}
}
}
break;
}
- const bool isSplit = speciesEvolution->getPokemod()->getRules()->getSpecialSplit();
- switch (speciesEvolution_mod->getStyle())
+ const bool isSplit = m_evolution->pokemod()->rules()->specialSplit();
+ switch (m_evolution_mod->style())
{
case SpeciesEvolution::S_Stat:
- varVal2->setEnabled(true);
- varVal2->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
+ varValue2->setEnabled(true);
+ varValue2->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
break;
case SpeciesEvolution::S_Item:
- varVal2->setEnabled(true);
- varVal2->addItems(SpeciesEvolution::GiveHoldStr);
+ varValue2->setEnabled(true);
+ varValue2->addItems(SpeciesEvolution::GiveHoldStr);
break;
}
- switch (speciesEvolution_mod->getStyle())
+ switch (m_evolution_mod->style())
{
case SpeciesEvolution::S_Happiness:
case SpeciesEvolution::S_Stat:
case SpeciesEvolution::S_Item:
case SpeciesEvolution::S_Personality:
- varVal3->setEnabled(true);
+ varValue3->setEnabled(true);
break;
}
}
- if ((speciesEvolution_mod->getStyle() == SpeciesEvolution::S_Item) ||(speciesEvolution_mod->getStyle() == SpeciesEvolution::S_TradeItem))
- varVal1->setCurrentIndex(varVal1->findData(speciesEvolution_mod->getVal1()));
+ if ((m_evolution_mod->style() == SpeciesEvolution::S_Item) ||(m_evolution_mod->style() == SpeciesEvolution::S_TradeItem))
+ varValue1->setCurrentIndex(varValue1->findData(m_evolution_mod->value1()));
else
- varVal1->setCurrentIndex(speciesEvolution_mod->getVal1());
- varVal2->setCurrentIndex(speciesEvolution_mod->getVal2());
- varVal3->setValue(speciesEvolution_mod->getVal3());
- varLevel->setValue(speciesEvolution_mod->getLevel());
+ varValue1->setCurrentIndex(m_evolution_mod->value1());
+ varValue2->setCurrentIndex(m_evolution_mod->value2());
+ varValue3->setValue(m_evolution_mod->value3());
+ varLevel->setValue(m_evolution_mod->level());
}
void SpeciesEvolutionUI::on_buttonApply_clicked()
{
- *speciesEvolution = *speciesEvolution_mod;
+ *m_evolution = *m_evolution_mod;
emit(changed(false));
}
void SpeciesEvolutionUI::on_buttonDiscard_clicked()
{
- *speciesEvolution_mod = *speciesEvolution;
+ *m_evolution_mod = *m_evolution;
setGui();
emit(changed(false));
}
-void SpeciesEvolutionUI::on_varSpecies_currentIndexChanged(const int s)
+void SpeciesEvolutionUI::on_varSpecies_currentIndexChanged(const int species)
{
try
{
- speciesEvolution_mod->setSpecies(varSpecies->itemData(s).toInt());
+ m_evolution_mod->setSpecies(varSpecies->itemData(species).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesEvolutionUI::on_varStyle_currentIndexChanged(const int s)
+void SpeciesEvolutionUI::on_varStyle_currentIndexChanged(const int style)
{
try
{
- speciesEvolution_mod->setStyle(s);
+ m_evolution_mod->setStyle(style);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesEvolutionUI::on_varVal1_currentIndexChanged(const int v)
+void SpeciesEvolutionUI::on_varValue1_currentIndexChanged(const int value1)
{
try
{
- if ((speciesEvolution_mod->getStyle() == SpeciesEvolution::S_Item) ||(speciesEvolution_mod->getStyle() == SpeciesEvolution::S_TradeItem))
- speciesEvolution_mod->setVal1(varVal1->itemData(v).toInt());
+ if ((m_evolution_mod->style() == SpeciesEvolution::S_Item) ||(m_evolution_mod->style() == SpeciesEvolution::S_TradeItem))
+ m_evolution_mod->setValue1(varValue1->itemData(value1).toInt());
else
- speciesEvolution_mod->setVal1(v);
+ m_evolution_mod->setValue1(value1);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesEvolutionUI::on_varVal2_currentIndexChanged(const int v)
+void SpeciesEvolutionUI::on_varValue2_currentIndexChanged(const int value2)
{
try
{
- speciesEvolution_mod->setVal3(v);
+ m_evolution_mod->setValue2(value2);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesEvolutionUI::on_varVal3_valueChanged(const int v)
+void SpeciesEvolutionUI::on_varValue3_valueChanged(const int value3)
{
try
{
- speciesEvolution_mod->setVal3(v);
+ m_evolution_mod->setValue3(value3);
emit(changed(true));
}
- catch (UnusedException& e)
+ catch (UnusedException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesEvolutionUI::on_varLevel_valueChanged(const int l)
+void SpeciesEvolutionUI::on_varLevel_valueChanged(const int level)
{
try
{
- speciesEvolution_mod->setLevel(l);
+ m_evolution_mod->setLevel(level);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
diff --git a/pokemodr/SpeciesEvolutionUI.h b/pokemodr/SpeciesEvolutionUI.h
index 95c7e83d..2f8b4818 100644
--- a/pokemodr/SpeciesEvolutionUI.h
+++ b/pokemodr/SpeciesEvolutionUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesEvolutionUI.h
-// Purpose: SpeciesEvolution UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Feb 19 19:08:58 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_SPECIESEVOLUTIONUI__
#define __POKEMODR_SPECIESEVOLUTIONUI__
-#include <ktoolbar.h>
-
+// Pokemod includes
#include <SpeciesEvolution.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_speciesevolution.h"
class SpeciesEvolutionUI : public ObjectUI, private Ui::formSpeciesEvolution
@@ -36,29 +32,29 @@ class SpeciesEvolutionUI : public ObjectUI, private Ui::formSpeciesEvolution
Q_OBJECT
public:
- SpeciesEvolutionUI(SpeciesEvolution* s, QWidget* parent);
+ SpeciesEvolutionUI(SpeciesEvolution* evolution, QWidget* parent);
~SpeciesEvolutionUI()
{
- delete speciesEvolution_mod;
+ delete m_evolution_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varSpecies_currentIndexChanged(const int s);
- void on_varStyle_currentIndexChanged(const int s);
- void on_varVal1_currentIndexChanged(const int v);
- void on_varVal2_currentIndexChanged(const int v);
- void on_varVal3_valueChanged(const int v);
- void on_varLevel_valueChanged(const int l);
+ void on_varSpecies_currentIndexChanged(const int species);
+ void on_varStyle_currentIndexChanged(const int style);
+ void on_varValue1_currentIndexChanged(const int value1);
+ void on_varValue2_currentIndexChanged(const int value2);
+ void on_varValue3_valueChanged(const int value3);
+ void on_varLevel_valueChanged(const int level);
private:
void initGui();
void refreshGui();
void setGui();
- int lastStyle;
+ int m_lastStyle;
- SpeciesEvolution* speciesEvolution;
- SpeciesEvolution* speciesEvolution_mod;
+ SpeciesEvolution* m_evolution;
+ SpeciesEvolution* m_evolution_mod;
};
#endif
diff --git a/pokemodr/SpeciesItemUI.cpp b/pokemodr/SpeciesItemUI.cpp
index 36450ef6..09eaa43c 100644
--- a/pokemodr/SpeciesItemUI.cpp
+++ b/pokemodr/SpeciesItemUI.cpp
@@ -1,45 +1,43 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesItemUI.cpp
-// Purpose: SpeciesItem UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 18:08:04 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Item.h>
#include <Pokemod.h>
#include <SpeciesItem.h>
+// Header include
#include "SpeciesItemUI.h"
-SpeciesItemUI::SpeciesItemUI(SpeciesItem* s, QWidget* parent) :
+SpeciesItemUI::SpeciesItemUI(SpeciesItem* item, QWidget* parent) :
ObjectUI(parent),
- speciesItem(s),
- speciesItem_mod(new SpeciesItem(s->getPokemod(), *s, s->getId()))
+ m_item(item),
+ m_item_mod(new SpeciesItem(*item))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(speciesItem, speciesItem_mod);
+ setObjects(m_item, m_item_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -47,57 +45,57 @@ SpeciesItemUI::SpeciesItemUI(SpeciesItem* s, QWidget* parent) :
void SpeciesItemUI::refreshGui()
{
varItem->clear();
- for (int i = 0; i < speciesItem->getPokemod()->getItemCount(); ++i)
+ for (int i = 0; i < m_item->pokemod()->itemCount(); ++i)
{
- const Item* it = speciesItem->getPokemod()->getItem(i);
- varItem->addItem(it->getName());
- varItem->setItemData(i, it->getId());
+ const Item* item = m_item->pokemod()->item(i);
+ varItem->addItem(item->name());
+ varItem->setItemData(i, item->id());
}
}
void SpeciesItemUI::setGui()
{
- varItem->setCurrentIndex(varItem->findData(speciesItem_mod->getItem()));
- varWeight->setValue(speciesItem_mod->getWeight());
+ varItem->setCurrentIndex(varItem->findData(m_item_mod->item()));
+ varWeight->setValue(m_item_mod->weight());
}
void SpeciesItemUI::on_buttonApply_clicked()
{
- *speciesItem = *speciesItem_mod;
+ *m_item = *m_item_mod;
emit(changed(false));
}
void SpeciesItemUI::on_buttonDiscard_clicked()
{
- *speciesItem_mod = *speciesItem;
+ *m_item_mod = *m_item;
setGui();
emit(changed(false));
}
-void SpeciesItemUI::on_varItem_currentIndexChanged(const int i)
+void SpeciesItemUI::on_varItem_currentIndexChanged(const int item)
{
try
{
- speciesItem_mod->setItem(varItem->itemData(i).toInt());
+ m_item_mod->setItem(varItem->itemData(item).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesItemUI::on_varWeight_valueChanged(const int w)
+void SpeciesItemUI::on_varWeight_valueChanged(const int weight)
{
try
{
- speciesItem_mod->setWeight(w);
+ m_item_mod->setWeight(weight);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/SpeciesItemUI.h b/pokemodr/SpeciesItemUI.h
index 033cbdb6..bd1099c0 100644
--- a/pokemodr/SpeciesItemUI.h
+++ b/pokemodr/SpeciesItemUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesItemUI.h
-// Purpose: SpeciesItem UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 18:08:04 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_SPECIESITEMUI__
#define __POKEMODR_SPECIESITEMUI__
+// Pokemod includes
#include <SpeciesItem.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_speciesitem.h"
class SpeciesItemUI : public ObjectUI, private Ui::formSpeciesItem
@@ -34,22 +32,22 @@ class SpeciesItemUI : public ObjectUI, private Ui::formSpeciesItem
Q_OBJECT
public:
- SpeciesItemUI(SpeciesItem* s, QWidget* parent);
+ SpeciesItemUI(SpeciesItem* item, QWidget* parent);
~SpeciesItemUI()
{
- delete speciesItem_mod;
+ delete m_item_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varItem_currentIndexChanged(const int i);
- void on_varWeight_valueChanged(const int w);
+ void on_varItem_currentIndexChanged(const int item);
+ void on_varWeight_valueChanged(const int weight);
private:
void refreshGui();
void setGui();
- SpeciesItem* speciesItem;
- SpeciesItem* speciesItem_mod;
+ SpeciesItem* m_item;
+ SpeciesItem* m_item_mod;
};
#endif
diff --git a/pokemodr/SpeciesMoveUI.cpp b/pokemodr/SpeciesMoveUI.cpp
index 1b8c1375..9f74fff2 100644
--- a/pokemodr/SpeciesMoveUI.cpp
+++ b/pokemodr/SpeciesMoveUI.cpp
@@ -1,45 +1,43 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesMoveUI.cpp
-// Purpose: SpeciesMove UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 18:08:16 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Move.h>
#include <Pokemod.h>
#include <SpeciesMove.h>
+// Header include
#include "SpeciesMoveUI.h"
-SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* s, QWidget* parent) :
+SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* move, QWidget* parent) :
ObjectUI(parent),
- speciesMove(s),
- speciesMove_mod(new SpeciesMove(s->getPokemod(), *s, s->getId()))
+ m_move(move),
+ m_move_mod(new SpeciesMove(*move))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(speciesMove, speciesMove_mod);
+ setObjects(m_move, m_move_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -47,74 +45,74 @@ SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* s, QWidget* parent) :
void SpeciesMoveUI::refreshGui()
{
varMove->clear();
- for (int i = 0; i < speciesMove->getPokemod()->getMoveCount(); ++i)
+ for (int i = 0; i < m_move->pokemod()->moveCount(); ++i)
{
- const Move* m = speciesMove->getPokemod()->getMove(i);
- varMove->addItem(m->getName());
- varMove->setItemData(i, m->getId());
+ const Move* move = m_move->pokemod()->move(i);
+ varMove->addItem(move->name());
+ varMove->setItemData(i, move->id());
}
- varLevel->setMaximum(speciesMove->getPokemod()->getRules()->getMaxLevel());
- varWildLevel->setMaximum(speciesMove->getPokemod()->getRules()->getMaxLevel());
+ varLevel->setMaximum(m_move->pokemod()->rules()->maxLevel());
+ varWildLevel->setMaximum(m_move->pokemod()->rules()->maxLevel());
}
void SpeciesMoveUI::setGui()
{
- varMove->setCurrentIndex(varMove->findData(speciesMove_mod->getMove()));
- varLevel->setValue(speciesMove_mod->getLevel());
- varWildLevel->setValue(speciesMove_mod->getWild());
+ varMove->setCurrentIndex(varMove->findData(m_move_mod->move()));
+ varLevel->setValue(m_move_mod->level());
+ varWildLevel->setValue(m_move_mod->wild());
}
void SpeciesMoveUI::on_buttonApply_clicked()
{
- *speciesMove = *speciesMove_mod;
+ *m_move = *m_move_mod;
emit(changed(false));
}
void SpeciesMoveUI::on_buttonDiscard_clicked()
{
- *speciesMove_mod = *speciesMove;
+ *m_move_mod = *m_move;
setGui();
emit(changed(false));
}
-void SpeciesMoveUI::on_varMove_currentIndexChanged(const int m)
+void SpeciesMoveUI::on_varMove_currentIndexChanged(const int move)
{
try
{
- speciesMove_mod->setMove(varMove->itemData(m).toInt());
+ m_move_mod->setMove(varMove->itemData(move).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void SpeciesMoveUI::on_varLevel_valueChanged(const int l)
+void SpeciesMoveUI::on_varLevel_valueChanged(const int level)
{
try
{
- speciesMove_mod->setLevel(l);
+ m_move_mod->setLevel(level);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void SpeciesMoveUI::on_varWildLevel_valueChanged(const int w)
+void SpeciesMoveUI::on_varWildLevel_valueChanged(const int wildLevel)
{
try
{
- speciesMove_mod->setWild(w);
+ m_move_mod->setWild(wildLevel);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/SpeciesMoveUI.h b/pokemodr/SpeciesMoveUI.h
index 98132c46..36ff2a3b 100644
--- a/pokemodr/SpeciesMoveUI.h
+++ b/pokemodr/SpeciesMoveUI.h
@@ -1,32 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesMoveUI.h
-// Purpose: SpeciesMove UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 18 18:12:16 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_SPECIESMOVEUI__
#define __POKEMODR_SPECIESMOVEUI__
+// Pokemod includes
#include <SpeciesMove.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_speciesmove.h"
class SpeciesMoveUI : public ObjectUI, private Ui::formSpeciesMove
@@ -34,23 +32,23 @@ class SpeciesMoveUI : public ObjectUI, private Ui::formSpeciesMove
Q_OBJECT
public:
- SpeciesMoveUI(SpeciesMove* s, QWidget* parent);
+ SpeciesMoveUI(SpeciesMove* move, QWidget* parent);
~SpeciesMoveUI()
{
- delete speciesMove_mod;
+ delete m_move_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varMove_currentIndexChanged(const int m);
- void on_varLevel_valueChanged(const int l);
- void on_varWildLevel_valueChanged(const int w);
+ void on_varMove_currentIndexChanged(const int move);
+ void on_varLevel_valueChanged(const int level);
+ void on_varWildLevel_valueChanged(const int wildLevel);
private:
void refreshGui();
void setGui();
- SpeciesMove* speciesMove;
- SpeciesMove* speciesMove_mod;
+ SpeciesMove* m_move;
+ SpeciesMove* m_move_mod;
};
#endif
diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp
index 1c147d29..ed4ae584 100644
--- a/pokemodr/SpeciesUI.cpp
+++ b/pokemodr/SpeciesUI.cpp
@@ -1,49 +1,48 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesUI.cpp
-// Purpose: Species UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu Feb 21 12:55:08 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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/>.
+ */
+
+// Qt includes
#include <QSize>
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
-#include <ImageCache.h>
+// Pokemod includes
#include <EggGroup.h>
#include <Pokemod.h>
#include <Species.h>
#include <Type.h>
+// PokeModr includes
#include "FileDialog.h"
+
+// Header include
#include "SpeciesUI.h"
-SpeciesUI::SpeciesUI(Species* s, QWidget* parent) :
+SpeciesUI::SpeciesUI(Species* species, QWidget* parent) :
ObjectUI(parent),
- species(s),
- species_mod(new Species(s->getPokemod(), *s, s->getId()))
+ m_species(species),
+ m_species_mod(new Species(*species))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(species, species_mod);
+ setObjects(m_species, m_species_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -57,31 +56,31 @@ void SpeciesUI::refreshGui()
{
varBaseStat->clear();
varEVStat->clear();
- const bool isSplit = species->getPokemod()->getRules()->getSpecialSplit();
+ const bool isSplit = m_species->pokemod()->rules()->specialSplit();
varBaseStat->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
- if (species->getPokemod()->getRules()->getEffortValuesAllowed())
+ if (m_species->pokemod()->rules()->effortValuesAllowed())
varEVStat->addItems((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr).mid(0, isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY));
else
boxEffortValues->setEnabled(false);
- if (!species->getPokemod()->getRules()->getHoldItems())
+ if (!m_species->pokemod()->rules()->holdItems())
boxItemChance->setEnabled(false);
- if (species->getPokemod()->getRules()->getGenderAllowed())
+ if (m_species->pokemod()->rules()->genderAllowed())
{
varEggSpecies->clear();
varEggGroups->clear();
- if (species->getPokemod()->getRules()->getBreedingAllowed())
+ if (m_species->pokemod()->rules()->breedingAllowed())
{
- for (int i = 0; i < species->getPokemod()->getSpeciesCount(); ++i)
+ for (int i = 0; i < m_species->pokemod()->speciesCount(); ++i)
{
- const Species* s = species->getPokemod()->getSpecies(i);
- varEggSpecies->addItem(s->getName());
- varEggSpecies->setItemData(i, s->getId());
+ const Species* species = m_species->pokemod()->species(i);
+ varEggSpecies->addItem(species->name());
+ varEggSpecies->setItemData(i, species->id());
}
- for (int i = 0; i < species->getPokemod()->getEggGroupCount(); ++i)
+ for (int i = 0; i < m_species->pokemod()->eggGroupCount(); ++i)
{
- const EggGroup* e = species->getPokemod()->getEggGroup(i);
- QListWidgetItem* lwi = new QListWidgetItem(e->getName(), varEggGroups);
- lwi->setData(Qt::UserRole, e->getId());
+ const EggGroup* eggGroup = m_species->pokemod()->eggGroup(i);
+ QListWidgetItem* widgetItem = new QListWidgetItem(eggGroup->name(), varEggGroups);
+ widgetItem->setData(Qt::UserRole, eggGroup->id());
}
}
else
@@ -98,109 +97,70 @@ void SpeciesUI::refreshGui()
boxFemaleSprites->setEnabled(false);
}
varTypes->clear();
- for (int i = 0; i < species->getPokemod()->getTypeCount(); ++i)
+ for (int i = 0; i < m_species->pokemod()->typeCount(); ++i)
{
- const Type* t = species->getPokemod()->getType(i);
- QListWidgetItem* lwi = new QListWidgetItem(t->getName(), varTypes);
- lwi->setData(Qt::UserRole, t->getId());
+ const Type* type = m_species->pokemod()->type(i);
+ QListWidgetItem* widgetItem = new QListWidgetItem(type->name(), varTypes);
+ widgetItem->setData(Qt::UserRole, type->id());
}
}
void SpeciesUI::setGui()
{
- varName->setText(species_mod->getName());
- varBaseStatValue->setValue(species_mod->getBaseStat(varBaseStat->currentIndex()));
- varEffortValue->setValue(species_mod->getEffortValue(varBaseStat->currentIndex()));
- varGrowth->setCurrentIndex(species_mod->getGrowth());
- varExperienceValue->setValue(species_mod->getExperienceValue());
- varCatchValue->setValue(species_mod->getCatchValue());
- varRunChanceNum->setValue(species_mod->getRunChance().getNum());
- varRunChanceDenom->setValue(species_mod->getRunChance().getDenom());
- varRunChanceNum->setMaximum(species_mod->getRunChance().getDenom());
- varRunChance->setText(QString::number(species_mod->getRunChance(), 'g', DBL_PREC));
- varItemChanceNum->setValue(species_mod->getItemChance().getNum());
- varItemChanceDenom->setValue(species_mod->getItemChance().getDenom());
- varItemChanceNum->setMaximum(species_mod->getItemChance().getDenom());
- varItemChance->setText(QString::number(species_mod->getItemChance(), 'g', DBL_PREC));
- varPokedexNumber->setValue(species_mod->getPokedexNumber());
- varWeight->setValue(species_mod->getWeight());
- varHeightFeet->setValue(species_mod->getHeightFeet());
- varHeightInches->setValue(species_mod->getHeightInches());
- varPokedexEntry->setText(species_mod->getPokedexEntry());
- try
- {
- varMaleFront->setIcon(ImageCache::open(species_mod->getFrontMaleSprite()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varMaleBack->setIcon(ImageCache::open(species_mod->getBackMaleSprite()));
- }
- catch (OpenException& e)
- {
- }
- if (species->getPokemod()->getRules()->getGenderAllowed())
- {
- try
- {
- varFemaleFront->setIcon(ImageCache::open(species_mod->getFrontFemaleSprite()));
- }
- catch (OpenException& e)
- {
- }
- try
- {
- varFemaleBack->setIcon(ImageCache::open(species_mod->getBackFemaleSprite()));
- }
- catch (OpenException& e)
- {
- }
- }
- try
- {
- varList->setIcon(ImageCache::open(species_mod->getListSprite()));
- }
- catch (OpenException& e)
- {
- }
- boxGenderChance->setChecked(species_mod->getGenderFactor().getNum() == INT_MAX);
- varGenderChanceNum->setValue(species_mod->getGenderFactor().getNum());
- varGenderChanceDenom->setValue(species_mod->getGenderFactor().getDenom());
- varGenderChanceNum->setMaximum(species_mod->getGenderFactor().getDenom());
- varGenderChance->setText(QString::number(species_mod->getGenderFactor(), 'g', DBL_PREC));
- varEggSpecies->setCurrentIndex(varEggSpecies->findData(species_mod->getEggSpecies()));
- varEggSteps->setValue(species_mod->getEggSteps());
- varNidoranGroup->setValue(species_mod->getNidoranGroup());
+ varName->setText(m_species_mod->name());
+ varBaseStatValue->setValue(m_species_mod->baseStat(varBaseStat->currentIndex()));
+ varEffortValue->setValue(m_species_mod->effortValue(varBaseStat->currentIndex()));
+ varGrowth->setCurrentIndex(m_species_mod->growth());
+ varExperienceValue->setValue(m_species_mod->experienceValue());
+ varCatchValue->setValue(m_species_mod->catchValue());
+ varRunChance->setValue(m_species_mod->runChance());
+ varItemChance->setValue(m_species_mod->itemChance());
+ varPokedexNumber->setValue(m_species_mod->pokedexNumber());
+ varWeight->setValue(m_species_mod->weight());
+ varHeightFeet->setValue(m_species_mod->heightFeet());
+ varHeightInches->setValue(m_species_mod->heightInches());
+ varPokedexEntry->setText(m_species_mod->pokedexEntry());
+ varMaleFront->setIcon(m_species_mod->frontMaleSprite());
+ varMaleBack->setIcon(m_species_mod->backMaleSprite());
+ if (m_species->pokemod()->rules()->genderAllowed())
+ {
+ varFemaleFront->setIcon(m_species_mod->frontFemaleSprite());
+ varFemaleBack->setIcon(m_species_mod->backFemaleSprite());
+ }
+ varList->setIcon(m_species_mod->listSprite());
+ boxGenderChance->setChecked(m_species_mod->genderFactor() == -1);
+ varGenderChance->setValue(m_species_mod->genderFactor());
+ varEggSpecies->setCurrentIndex(varEggSpecies->findData(m_species_mod->eggSpecies()));
+ varEggSteps->setValue(m_species_mod->eggSteps());
+ varNidoranGroup->setValue(m_species_mod->nidoranGroup());
for (int i = 0; i < varTypes->count(); ++i)
{
- QListWidgetItem* lwi = varTypes->item(i);
- lwi->setSelected(species_mod->getItem(lwi->data(Qt::UserRole).toInt()));
+ QListWidgetItem* widgetItem = varTypes->item(i);
+ widgetItem->setSelected(m_species_mod->item(widgetItem->data(Qt::UserRole).toInt()));
}
for (int i = 0; i < varEggGroups->count(); ++i)
{
- QListWidgetItem* lwi = varEggGroups->item(i);
- lwi->setSelected(species_mod->getItem(lwi->data(Qt::UserRole).toInt()));
+ QListWidgetItem* widgetItem = varEggGroups->item(i);
+ widgetItem->setSelected(m_species_mod->item(widgetItem->data(Qt::UserRole).toInt()));
}
}
void SpeciesUI::on_buttonApply_clicked()
{
- *species = *species_mod;
+ *m_species = *m_species_mod;
emit(changed(false));
}
void SpeciesUI::on_buttonDiscard_clicked()
{
- *species_mod = *species;
+ *m_species_mod = *m_species;
setGui();
emit(changed(false));
}
-void SpeciesUI::on_varName_textChanged(const QString& n)
+void SpeciesUI::on_varName_textChanged(const QString& name)
{
- species_mod->setName(n);
+ m_species_mod->setName(name);
emit(changed(true));
}
@@ -210,16 +170,16 @@ void SpeciesUI::on_varBaseStat_currentIndexChanged()
setGui();
}
-void SpeciesUI::on_varBaseStatValue_valueChanged(const int b)
+void SpeciesUI::on_varBaseStatValue_valueChanged(const int baseStat)
{
try
{
- species_mod->setBaseStat(varBaseStat->currentIndex(), b);
+ m_species_mod->setBaseStat(varBaseStat->currentIndex(), baseStat);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
@@ -230,153 +190,125 @@ void SpeciesUI::on_varEVStat_currentIndexChanged()
setGui();
}
-void SpeciesUI::on_varEffortValue_valueChanged(const int e)
+void SpeciesUI::on_varEffortValue_valueChanged(const int effortValue)
{
try
{
- species_mod->setEffortValue(varEVStat->currentIndex(), e);
+ m_species_mod->setEffortValue(varEVStat->currentIndex(), effortValue);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void SpeciesUI::on_varGrowth_currentIndexChanged(const int g)
+void SpeciesUI::on_varGrowth_currentIndexChanged(const int growth)
{
try
{
- species_mod->setGrowth(g);
+ m_species_mod->setGrowth(growth);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void SpeciesUI::on_varExperienceValue_valueChanged(const int e)
+void SpeciesUI::on_varExperienceValue_valueChanged(const int experienceValue)
{
- species_mod->setExperienceValue(e);
+ m_species_mod->setExperienceValue(experienceValue);
emit(changed(true));
}
-void SpeciesUI::on_varCatchValue_valueChanged(const int c)
+void SpeciesUI::on_varCatchValue_valueChanged(const int catchValue)
{
- species_mod->setCatchValue(c);
+ m_species_mod->setCatchValue(catchValue);
emit(changed(true));
}
-void SpeciesUI::on_varRunChanceNum_valueChanged(const int r)
-{
- try
- {
- species_mod->setRunChanceNum(r);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
- setGui();
- }
-}
-
-void SpeciesUI::on_varRunChanceDenom_valueChanged(const int r)
+void SpeciesUI::on_varRunChance_valueChanged(const Fraction& runChance)
{
try
{
- species_mod->setRunChanceDenom(r);
+ m_species_mod->setRunChance(runChance);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void SpeciesUI::on_varItemChanceNum_valueChanged(const int i)
+void SpeciesUI::on_varItemChance_valueChanged(const Fraction& itemChance)
{
try
{
- species_mod->setItemChanceNum(i);
+ m_species_mod->setItemChance(itemChance);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
- setGui();
- }
-}
-
-void SpeciesUI::on_varItemChanceDenom_valueChanged(const int i)
-{
- try
- {
- species_mod->setItemChanceDenom(i);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void SpeciesUI::on_varPokedexNumber_valueChanged(const int p)
+void SpeciesUI::on_varPokedexNumber_valueChanged(const int pokedexNumber)
{
- species_mod->setPokedexNumber(p);
+ m_species_mod->setPokedexNumber(pokedexNumber);
emit(changed(true));
}
-void SpeciesUI::on_varWeight_valueChanged(const int w)
+void SpeciesUI::on_varWeight_valueChanged(const int weight)
{
- species_mod->setWeight(w);
+ m_species_mod->setWeight(weight);
emit(changed(true));
}
-void SpeciesUI::on_varHeightFeet_valueChanged(const int h)
+void SpeciesUI::on_varHeightFeet_valueChanged(const int feet)
{
- species_mod->setHeightFeet(h);
+ m_species_mod->setHeightFeet(feet);
emit(changed(true));
}
-void SpeciesUI::on_varHeightInches_valueChanged(const int h)
+void SpeciesUI::on_varHeightInches_valueChanged(const int inches)
{
try
{
- species_mod->setHeightInches(h);
+ m_species_mod->setHeightInches(inches);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
void SpeciesUI::on_varPokedexEntry_textChanged()
{
- species_mod->setPokedexEntry(varPokedexEntry->toPlainText());
+ m_species_mod->setPokedexEntry(varPokedexEntry->toPlainText());
emit(changed(true));
}
void SpeciesUI::on_varFrontMaleSprite_pressed()
{
- FileDialog dlg("*.png", QSize(64, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(64, 64));
+ if (dialog.exec())
{
try
{
- species_mod->setBackMaleSprite(dlg.selectedUrl());
+ m_species_mod->setFrontMaleSprite(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -384,16 +316,16 @@ void SpeciesUI::on_varFrontMaleSprite_pressed()
void SpeciesUI::on_varBackMaleSprite_pressed()
{
- FileDialog dlg("*.png", QSize(64, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(64, 64));
+ if (dialog.exec())
{
try
{
- species_mod->setBackMaleSprite(dlg.selectedUrl());
+ m_species_mod->setBackMaleSprite(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -401,16 +333,16 @@ void SpeciesUI::on_varBackMaleSprite_pressed()
void SpeciesUI::on_varFrontFemaleSprite_pressed()
{
- FileDialog dlg("*.png", QSize(64, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(64, 64));
+ if (dialog.exec())
{
try
{
- species_mod->setFrontFemaleSprite(dlg.selectedUrl());
+ m_species_mod->setFrontFemaleSprite(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -418,16 +350,16 @@ void SpeciesUI::on_varFrontFemaleSprite_pressed()
void SpeciesUI::on_varBackFemaleSprite_pressed()
{
- FileDialog dlg("*.png", QSize(64, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(64, 64));
+ if (dialog.exec())
{
try
{
- species_mod->setBackFemaleSprite(dlg.selectedUrl());
+ m_species_mod->setBackFemaleSprite(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -435,79 +367,65 @@ void SpeciesUI::on_varBackFemaleSprite_pressed()
void SpeciesUI::on_varListSprite_pressed()
{
- FileDialog dlg("*.png", QSize(128, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(128, 64));
+ if (dialog.exec())
{
try
{
- species_mod->setListSprite(dlg.selectedUrl());
+ m_species_mod->setListSprite(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
}
-void SpeciesUI::on_boxGenderChance_toggled(const bool g)
+void SpeciesUI::on_boxGenderChance_toggled(const bool genderChance)
{
- species_mod->setGenderFactor(g ? 1 : INT_MAX, 1);
+ m_species_mod->setGenderFactor(Fraction(genderChance ? 1 : -1, 1));
emit(changed(true));
setGui();
}
-void SpeciesUI::on_varGenderChanceNum_valueChanged(const int g)
-{
- try
- {
- species_mod->setGenderFactorNum(g);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
- setGui();
- }
-}
-
-void SpeciesUI::on_varGenderChanceDenom_valueChanged(const int g)
+void SpeciesUI::on_varGenderChance_valueChanged(const Fraction& genderChance)
{
try
{
- species_mod->setGenderFactorDenom(g);
+ m_species_mod->setGenderFactor(genderChance);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void SpeciesUI::on_varEggSpecies_currentIndexChanged(const int e)
+void SpeciesUI::on_varEggSpecies_currentIndexChanged(const int eggSpecies)
{
try
{
- species_mod->setEggSpecies(varEggSpecies->itemData(e).toInt());
+ m_species_mod->setEggSpecies(varEggSpecies->itemData(eggSpecies).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void SpeciesUI::on_varEggSteps_valueChanged(const int e)
+void SpeciesUI::on_varEggSteps_valueChanged(const int eggSteps)
{
- species_mod->setEggSteps(e);
+ m_species_mod->setEggSteps(eggSteps);
emit(changed(true));
}
-void SpeciesUI::on_varNidoranGroup_valueChanged(const int n)
+void SpeciesUI::on_varNidoranGroup_valueChanged(const int nidoranGroup)
{
- species_mod->setNidoranGroup(n);
+ m_species_mod->setNidoranGroup(nidoranGroup);
emit(changed(true));
}
@@ -517,14 +435,14 @@ void SpeciesUI::on_varTypes_itemSelectionChanged()
{
for (int i = 0; i < varTypes->count(); ++i)
{
- const QListWidgetItem* lwi = varTypes->item(i);
- species_mod->setType(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ const QListWidgetItem* widgetItem = varTypes->item(i);
+ m_species_mod->setType(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
@@ -535,14 +453,14 @@ void SpeciesUI::on_varEggGroups_itemSelectionChanged()
{
for (int i = 0; i < varEggGroups->count(); ++i)
{
- const QListWidgetItem* lwi = varEggGroups->item(i);
- species_mod->setEggGroup(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ const QListWidgetItem* widgetItem = varEggGroups->item(i);
+ m_species_mod->setEggGroup(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/SpeciesUI.h b/pokemodr/SpeciesUI.h
index 73793cd0..9b076f86 100644
--- a/pokemodr/SpeciesUI.h
+++ b/pokemodr/SpeciesUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/SpeciesUI.h
-// Purpose: Species UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu Feb 21 12:33:04 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_SPECIESUI__
#define __POKEMODR_SPECIESUI__
-#include <QString>
-
+// Pokemod includes
#include <Species.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_species.h"
class SpeciesUI : public ObjectUI, private Ui::formSpecies
@@ -36,42 +32,39 @@ class SpeciesUI : public ObjectUI, private Ui::formSpecies
Q_OBJECT
public:
- SpeciesUI(Species* s, QWidget* parent);
+ SpeciesUI(Species* species, QWidget* parent);
~SpeciesUI()
{
- delete species_mod;
+ delete m_species_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
+ void on_varName_textChanged(const QString& name);
void on_varBaseStat_currentIndexChanged();
- void on_varBaseStatValue_valueChanged(const int b);
+ void on_varBaseStatValue_valueChanged(const int baseStat);
void on_varEVStat_currentIndexChanged();
- void on_varEffortValue_valueChanged(const int e);
- void on_varGrowth_currentIndexChanged(const int g);
- void on_varExperienceValue_valueChanged(const int e);
- void on_varCatchValue_valueChanged(const int c);
- void on_varRunChanceNum_valueChanged(const int r);
- void on_varRunChanceDenom_valueChanged(const int r);
- void on_varItemChanceNum_valueChanged(const int i);
- void on_varItemChanceDenom_valueChanged(const int i);
- void on_varPokedexNumber_valueChanged(const int p);
- void on_varWeight_valueChanged(const int w);
- void on_varHeightFeet_valueChanged(const int h);
- void on_varHeightInches_valueChanged(const int h);
+ void on_varEffortValue_valueChanged(const int effortValue);
+ void on_varGrowth_currentIndexChanged(const int growth);
+ void on_varExperienceValue_valueChanged(const int experienceValue);
+ void on_varCatchValue_valueChanged(const int catchValue);
+ void on_varRunChance_valueChanged(const Fraction& runChance);
+ void on_varItemChance_valueChanged(const Fraction& itemChance);
+ void on_varPokedexNumber_valueChanged(const int pokedexNumber);
+ void on_varWeight_valueChanged(const int weight);
+ void on_varHeightFeet_valueChanged(const int feet);
+ void on_varHeightInches_valueChanged(const int inches);
void on_varPokedexEntry_textChanged();
void on_varFrontMaleSprite_pressed();
void on_varBackMaleSprite_pressed();
void on_varFrontFemaleSprite_pressed();
void on_varBackFemaleSprite_pressed();
void on_varListSprite_pressed();
- void on_boxGenderChance_toggled(const bool g);
- void on_varGenderChanceNum_valueChanged(const int g);
- void on_varGenderChanceDenom_valueChanged(const int g);
- void on_varEggSpecies_currentIndexChanged(const int e);
- void on_varEggSteps_valueChanged(const int e);
- void on_varNidoranGroup_valueChanged(const int n);
+ void on_boxGenderChance_toggled(const bool genderUsed);
+ void on_varGenderChance_valueChanged(const Fraction& genderChance);
+ void on_varEggSpecies_currentIndexChanged(const int eggSpecies);
+ void on_varEggSteps_valueChanged(const int eggSteps);
+ void on_varNidoranGroup_valueChanged(const int nidoranGroup);
void on_varTypes_itemSelectionChanged();
void on_varEggGroups_itemSelectionChanged();
private:
@@ -79,8 +72,8 @@ class SpeciesUI : public ObjectUI, private Ui::formSpecies
void refreshGui();
void setGui();
- Species* species;
- Species* species_mod;
+ Species* m_species;
+ Species* m_species_mod;
};
#endif
diff --git a/pokemodr/StoreUI.cpp b/pokemodr/StoreUI.cpp
index 61957593..713563e4 100644
--- a/pokemodr/StoreUI.cpp
+++ b/pokemodr/StoreUI.cpp
@@ -1,46 +1,44 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/StoreUI.cpp
-// Purpose: Store UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 11 22:59:48 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
+// Qt includes
#include <QListWidgetItem>
-#include <QMetaObject>
#include <QVariant>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Pokemod includes
#include <Item.h>
#include <Pokemod.h>
#include <Store.h>
+// Header include
#include "StoreUI.h"
-StoreUI::StoreUI(Store* s, QWidget* parent) :
+StoreUI::StoreUI(Store* store, QWidget* parent) :
ObjectUI(parent),
- store(s),
- store_mod(new Store(s->getPokemod(), *s, s->getId()))
+ m_store(store),
+ m_store_mod(new Store(*store))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(store, store_mod);
+ setObjects(m_store, m_store_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -48,40 +46,40 @@ StoreUI::StoreUI(Store* s, QWidget* parent) :
void StoreUI::refreshGui()
{
varItems->clear();
- for (int i = 0; i < store->getPokemod()->getItemCount(); ++i)
+ for (int i = 0; i < m_store->pokemod()->itemCount(); ++i)
{
- const Item* it = store->getPokemod()->getItem(i);
- QListWidgetItem* lwi = new QListWidgetItem(it->getName(), varItems);
- lwi->setData(Qt::UserRole, it->getId());
+ const Item* item = m_store->pokemod()->item(i);
+ QListWidgetItem* widgetItem = new QListWidgetItem(item->name(), varItems);
+ widgetItem->setData(Qt::UserRole, item->id());
}
}
void StoreUI::setGui()
{
- varName->setText(store_mod->getName());
+ varName->setText(m_store_mod->name());
for (int i = 0; i < varItems->count(); ++i)
{
- QListWidgetItem* lwi = varItems->item(i);
- lwi->setSelected(store_mod->getItem(lwi->data(Qt::UserRole).toInt()));
+ QListWidgetItem* widgetItem = varItems->item(i);
+ widgetItem->setSelected(m_store_mod->item(widgetItem->data(Qt::UserRole).toInt()));
}
}
void StoreUI::on_buttonApply_clicked()
{
- *store = *store_mod;
+ *m_store = *m_store_mod;
emit(changed(false));
}
void StoreUI::on_buttonDiscard_clicked()
{
- *store_mod = *store;
+ *m_store_mod = *m_store;
setGui();
emit(changed(false));
}
-void StoreUI::on_varName_textChanged(const QString& n)
+void StoreUI::on_varName_textChanged(const QString& name)
{
- store_mod->setName(n);
+ m_store_mod->setName(name);
emit(changed(true));
}
@@ -91,14 +89,14 @@ void StoreUI::on_varItems_itemSelectionChanged()
{
for (int i = 0; i < varItems->count(); ++i)
{
- const QListWidgetItem* lwi = varItems->item(i);
- store_mod->setItem(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ const QListWidgetItem* widgetItem = varItems->item(i);
+ m_store_mod->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/StoreUI.h b/pokemodr/StoreUI.h
index da251e75..45266df3 100644
--- a/pokemodr/StoreUI.h
+++ b/pokemodr/StoreUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/StoreUI.h
-// Purpose: Store UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Mon Feb 11 22:58:12 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_STOREUI__
#define __POKEMODR_STOREUI__
-#include <QString>
-
+// Pokemod includes
#include <Store.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_store.h"
class StoreUI : public ObjectUI, private Ui::formStore
@@ -36,22 +32,22 @@ class StoreUI : public ObjectUI, private Ui::formStore
Q_OBJECT
public:
- StoreUI(Store* s, QWidget* parent);
+ StoreUI(Store* store, QWidget* parent);
~StoreUI()
{
- delete store_mod;
+ delete m_store_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
+ void on_varName_textChanged(const QString& name);
void on_varItems_itemSelectionChanged();
private:
void refreshGui();
void setGui();
- Store* store;
- Store* store_mod;
+ Store* m_store;
+ Store* m_store_mod;
};
#endif
diff --git a/pokemodr/TODO b/pokemodr/TODO
index ec295589..25746717 100644
--- a/pokemodr/TODO
+++ b/pokemodr/TODO
@@ -4,3 +4,7 @@ ItemEffect
MapEffect
MapTrainer
MoveEffect
+
+Fix up to match new Pokemod API/style
+Frac, Flag, and Coordinate widgets
+Fix widget tree (should be nicer with the new loading/saving XML)
diff --git a/pokemodr/TileDelegate.cpp b/pokemodr/TileDelegate.cpp
index d86bcfb4..756edc66 100644
--- a/pokemodr/TileDelegate.cpp
+++ b/pokemodr/TileDelegate.cpp
@@ -1,37 +1,35 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TileDelegate.cpp
-// Purpose: Provides an editor for tiles in the tilemap editor
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 2 01:31:30 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
+/*
+ * 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/>.
+ */
+
+// KDE includes
#include <kcombobox.h>
-#include "../general/ImageCache.h"
-
+// Pokemod includes
#include <Pokemod.h>
#include <Tile.h>
+// PokeModr includes
#include "ObjectUI.h"
#include "MapUI.h"
-#include "TileDelegate.h"
#include "TilemapModel.h"
+// Header include
+#include "TileDelegate.h"
+
QWidget* TileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem&, const QModelIndex&) const
{
KComboBox* editor = new KComboBox(parent);
@@ -40,11 +38,11 @@ QWidget* TileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem&
void TileDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
- for (int i = 0; i < static_cast<ObjectUI*>(editor->parent())->getOriginal()->getPokemod()->getTileCount(); ++i)
+ for (int i = 0; i < static_cast<ObjectUI*>(editor->parent())->original()->pokemod()->tileCount(); ++i)
{
- const Tile* t = static_cast<ObjectUI*>(editor->parent())->getOriginal()->getPokemod()->getTile(i);
- static_cast<KComboBox*>(editor)->addItem(ImageCache::open(t->getPic()), t->getName());
- static_cast<KComboBox*>(editor)->setItemData(i, t->getId());
+ const Tile* tile = static_cast<ObjectUI*>(editor->parent())->original()->pokemod()->tile(i);
+ static_cast<KComboBox*>(editor)->addItem(tile->sprite(), tile->name());
+ static_cast<KComboBox*>(editor)->setItemData(i, tile->id());
}
static_cast<KComboBox*>(editor)->setCurrentIndex(index.data(Qt::EditRole).toInt());
}
diff --git a/pokemodr/TileDelegate.h b/pokemodr/TileDelegate.h
index 65184b92..03cf22d6 100644
--- a/pokemodr/TileDelegate.h
+++ b/pokemodr/TileDelegate.h
@@ -1,28 +1,24 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TileDelegate.h
-// Purpose: Provides an editor for tiles in the tilemap editor
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 2 01:28:27 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_TILEDELEGATE__
#define __POKEMODR_TILEDELEGATE__
+// Qt includes
#include <QItemDelegate>
#include <QObject>
diff --git a/pokemodr/TileUI.cpp b/pokemodr/TileUI.cpp
index 7b910e17..46e1fc20 100644
--- a/pokemodr/TileUI.cpp
+++ b/pokemodr/TileUI.cpp
@@ -1,48 +1,46 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TileUI.cpp
-// Purpose: Tile UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Wed Feb 6 14:22:36 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
+/*
+ * 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/>.
+ */
+
+// Qt includes
#include <QList>
-#include <QListIterator>
#include <QListWidgetItem>
-#include <QMetaObject>
#include <QSize>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
-#include <ImageCache.h>
+// Pokemod includes
#include <Pokemod.h>
+// PokeModr includes
#include "FileDialog.h"
+
+// Header include
#include "TileUI.h"
-TileUI::TileUI(Tile* t, QWidget* parent) :
+TileUI::TileUI(Tile* tile, QWidget* parent) :
ObjectUI(parent),
- tile(t),
- tile_mod(new Tile(t->getPokemod(), *t, t->getId()))
+ m_tile(tile),
+ m_tile_mod(new Tile(*tile))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(tile, tile_mod);
+ setObjects(m_tile, m_tile_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -58,103 +56,80 @@ void TileUI::initGui()
void TileUI::refreshGui()
{
varHMUnder->clear();
- for (int i = 0; i < tile->getPokemod()->getTileCount(); ++i)
+ for (int i = 0; i < m_tile->pokemod()->tileCount(); ++i)
{
- const Tile* t = tile->getPokemod()->getTile(i);
- if (t->getId() != tile->getId())
+ const Tile* tile = m_tile->pokemod()->tile(i);
+ if (tile->id() != m_tile->id())
{
- varHMUnder->addItem(ImageCache::open(t->getPic()), t->getName());
- varHMUnder->setItemData(varHMUnder->count() - 1, t->getId());
+ varHMUnder->addItem(tile->sprite(), tile->name());
+ varHMUnder->setItemData(varHMUnder->count() - 1, tile->id());
}
}
}
void TileUI::setGui()
{
- varName->setText(tile_mod->getName());
- try
- {
- varImage->setIcon(ImageCache::open(tile_mod->getPic()));
- }
- catch (OpenException& e)
- {
- }
+ varName->setText(m_tile_mod->name());
+ varImage->setIcon(m_tile_mod->sprite());
for (int i = 0; i < varAccessibility->count(); ++i)
- varAccessibility->item(i)->setSelected(tile_mod->getFrom(i));
- varWildNum->setValue(tile_mod->getWildChance().getNum());
- varWildDenom->setValue(tile_mod->getWildChance().getDenom());
- varWildNum->setMaximum(tile_mod->getWildChance().getDenom());
- varWild->setText(QString::number(tile_mod->getWildChance(), 'g', DBL_PREC));
- boxHMs->setChecked((tile_mod->getHMType() == INT_MAX) ? Qt::Unchecked : Qt::Checked);
- varHMType->setCurrentIndex(tile_mod->getHMType());
- varHMUnder->setCurrentIndex(varHMUnder->findData(tile_mod->getUnder()));
- varHMUnder->setEnabled((tile_mod->getHMType() == Pokemod::HM_Whirlpool) || (tile_mod->getHMType() == Pokemod::HM_Cut) || (tile_mod->getHMType() == Pokemod::HM_RockSmash));
- boxForces->setChecked((tile_mod->getForceType() == INT_MAX) ? Qt::Unchecked : Qt::Checked);
- varForce->setCurrentIndex(tile_mod->getForceType());
- varDirection->setCurrentIndex(tile_mod->getForceDirection());
- varDirection->setEnabled((tile_mod->getForceType() != Tile::Stop) && (tile_mod->getForceType() != Tile::Slip));
+ varAccessibility->item(i)->setSelected(m_tile_mod->from(i));
+ varWildChance->setValue(m_tile_mod->wildChance());
+ boxHMs->setChecked((m_tile_mod->hmType() == INT_MAX) ? Qt::Unchecked : Qt::Checked);
+ varHMType->setCurrentIndex(m_tile_mod->hmType());
+ varHMUnder->setCurrentIndex(varHMUnder->findData(m_tile_mod->under()));
+ varHMUnder->setEnabled((m_tile_mod->hmType() == Pokemod::HM_Whirlpool) || (m_tile_mod->hmType() == Pokemod::HM_Cut) || (m_tile_mod->hmType() == Pokemod::HM_RockSmash));
+ boxForces->setChecked((m_tile_mod->forceType() == INT_MAX) ? Qt::Unchecked : Qt::Checked);
+ varForce->setCurrentIndex(m_tile_mod->forceType());
+ varDirection->setCurrentIndex(m_tile_mod->forceDirection());
+ varDirection->setEnabled((m_tile_mod->forceType() != Tile::Stop) && (m_tile_mod->forceType() != Tile::Slip));
}
void TileUI::on_buttonApply_clicked()
{
- *tile = *tile_mod;
+ *m_tile = *m_tile_mod;
emit(changed(false));
}
void TileUI::on_buttonDiscard_clicked()
{
- *tile_mod = *tile;
+ *m_tile_mod = *m_tile;
setGui();
emit(changed(false));
}
-void TileUI::on_varName_textChanged(const QString& n)
+void TileUI::on_varName_textChanged(const QString& name)
{
- tile_mod->setName(n);
+ m_tile_mod->setName(name);
emit(changed(true));
}
void TileUI::on_varImage_pressed()
{
- FileDialog dlg("*.png", QSize(64, 64));
- if (dlg.show())
+ FileDialog dialog(QSize(64, 64));
+ if (dialog.exec())
{
try
{
- tile_mod->setPic(dlg.selectedUrl());
+ m_tile_mod->setSprite(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
}
-void TileUI::on_varWildNum_valueChanged(const int m)
-{
- try
- {
- tile_mod->setWildChanceNum(m);
- emit(changed(true));
- }
- catch (BoundsException& e)
- {
- BugCatcher::report(e);
- setGui();
- }
-}
-
-void TileUI::on_varWildDenom_valueChanged(const int m)
+void TileUI::on_varWild_valueChanged(const Fraction& wildChance)
{
try
{
- tile_mod->setWildChanceDenom(m);
+ m_tile_mod->setWildChance(wildChance);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
@@ -165,21 +140,21 @@ void TileUI::on_varAccessibility_itemSelectionChanged()
{
for (int i = 0; i < varAccessibility->count(); ++i)
{
- const QListWidgetItem* lwi = varAccessibility->item(i);
- tile_mod->setFrom(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ const QListWidgetItem* widgetItem = varAccessibility->item(i);
+ m_tile_mod->setFrom(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void TileUI::on_boxHMs_toggled(const bool h)
+void TileUI::on_boxHMs_toggled(const bool hm)
{
- if (!h)
+ if (!hm)
{
varHMType->setCurrentIndex(-1);
varHMUnder->setCurrentIndex(-1);
@@ -188,35 +163,35 @@ void TileUI::on_boxHMs_toggled(const bool h)
}
}
-void TileUI::on_varHMType_currentIndexChanged(const int h)
+void TileUI::on_varHMType_currentIndexChanged(const int hmType)
{
try
{
- tile_mod->setHMType(h);
+ m_tile_mod->setHMType(hmType);
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void TileUI::on_varHMUnder_currentIndexChanged(const int h)
+void TileUI::on_varHMUnder_currentIndexChanged(const int hmUnder)
{
try
{
- tile_mod->setUnder(varHMUnder->itemData(h, Qt::UserRole).toInt());
+ m_tile_mod->setUnder(varHMUnder->itemData(hmUnder, Qt::UserRole).toInt());
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void TileUI::on_boxForces_toggled(const bool f)
+void TileUI::on_boxForces_toggled(const bool forces)
{
- if (!f)
+ if (!forces)
{
varForce->setCurrentIndex(-1);
varDirection->setCurrentIndex(-1);
@@ -225,28 +200,28 @@ void TileUI::on_boxForces_toggled(const bool f)
}
}
-void TileUI::on_varForce_currentIndexChanged(const int f)
+void TileUI::on_varForce_currentIndexChanged(const int force)
{
try
{
- tile_mod->setForceType(f);
+ m_tile_mod->setForceType(force);
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void TileUI::on_varDirection_currentIndexChanged(const int d)
+void TileUI::on_varDirection_currentIndexChanged(const int direction)
{
try
{
- tile_mod->setForceDirection(d);
+ m_tile_mod->setForceDirection(direction);
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/TileUI.h b/pokemodr/TileUI.h
index bb888a20..88e93067 100644
--- a/pokemodr/TileUI.h
+++ b/pokemodr/TileUI.h
@@ -1,35 +1,33 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TileUI.h
-// Purpose: Tile UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Jan 27 12:52:44 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_TILEUI__
#define __POKEMODR_TILEUI__
-#include <QListIterator>
+// Qt includes
#include <QString>
+// Pokemod includes
#include <Tile.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_tile.h"
class TileUI : public ObjectUI, private Ui::formTile
@@ -37,32 +35,31 @@ class TileUI : public ObjectUI, private Ui::formTile
Q_OBJECT
public:
- TileUI(Tile* t, QWidget* parent);
+ TileUI(Tile* tile, QWidget* parent);
~TileUI()
{
- delete tile_mod;
+ delete m_tile_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
+ void on_varName_textChanged(const QString& name);
void on_varImage_pressed();
void on_varAccessibility_itemSelectionChanged();
- void on_varWildNum_valueChanged(const int w);
- void on_varWildDenom_valueChanged(const int w);
- void on_boxHMs_toggled(const bool h);
- void on_varHMType_currentIndexChanged(const int h);
- void on_varHMUnder_currentIndexChanged(const int h);
- void on_boxForces_toggled(const bool f);
- void on_varForce_currentIndexChanged(const int f);
- void on_varDirection_currentIndexChanged(const int d);
+ void on_varWild_valueChanged(const Fraction& wild);
+ void on_boxHMs_toggled(const bool hm);
+ void on_varHMType_currentIndexChanged(const int hmType);
+ void on_varHMUnder_currentIndexChanged(const int hmUnder);
+ void on_boxForces_toggled(const bool forces);
+ void on_varForce_currentIndexChanged(const int force);
+ void on_varDirection_currentIndexChanged(const int direction);
private:
void initGui();
void refreshGui();
void setGui();
- Tile* tile;
- Tile* tile_mod;
+ Tile* m_tile;
+ Tile* m_tile_mod;
};
#endif
diff --git a/pokemodr/TilemapModel.cpp b/pokemodr/TilemapModel.cpp
index 1e4e8ec5..22c57aba 100644
--- a/pokemodr/TilemapModel.cpp
+++ b/pokemodr/TilemapModel.cpp
@@ -1,50 +1,48 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TilemapModel.cpp
-// Purpose: Provides a model for tiles in the tilemap editor
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Feb 5 19:43:22 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
+/*
+ * 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/>.
+ */
+
+// KDE includes
#include <kcombobox.h>
-#include <ImageCache.h>
-
+// Pokemod includes
#include <Tile.h>
+// PokeModr includes
#include "ObjectUI.h"
#include "MapUI.h"
+
+// Header include
#include "TilemapModel.h"
-TilemapModel::TilemapModel(QObject* parent, Matrix<int>* tilemap, const Pokemod* mod) :
+TilemapModel::TilemapModel(QObject* parent, Matrix<int>* map, const Pokemod* pokemod) :
QAbstractTableModel(parent),
- map(tilemap),
- pokemod(mod)
+ m_map(map),
+ m_pokemod(pokemod)
{
}
int TilemapModel::rowCount(const QModelIndex&) const
{
- return map->getHeight();
+ return m_map->height();
}
int TilemapModel::columnCount(const QModelIndex&) const
{
- return map->getWidth();
+ return m_map->width();
}
QVariant TilemapModel::data(const QModelIndex& index, int role) const
@@ -53,17 +51,17 @@ QVariant TilemapModel::data(const QModelIndex& index, int role) const
return QVariant();
if (role == Qt::DisplayRole)
{
- int idx = pokemod->getTileIndex(map->at(index.row(), index.column()));
+ int idx = m_pokemod->tileIndex(m_map->at(index.row(), index.column()));
if (idx != INT_MAX)
- return ImageCache::open(pokemod->getTile(idx)->getPic());
+ return m_pokemod->tile(idx)->sprite();
}
if (role == Qt::EditRole)
- map->at(index.row(), index.column());
+ m_map->at(index.row(), index.column());
if (role == Qt::ToolTipRole)
{
- int idx = pokemod->getTileIndex(map->at(index.row(), index.column()));
+ int idx = m_pokemod->tileIndex(m_map->at(index.row(), index.column()));
if (idx != INT_MAX)
- return pokemod->getTile(idx)->getName();
+ return m_pokemod->tile(idx)->name();
}
return QVariant();
}
@@ -79,7 +77,7 @@ bool TilemapModel::setData(const QModelIndex& index, const QVariant& value, int
{
if (role != Qt::EditRole)
return false;
- map->set(index.row(), index.column(), pokemod->getTile(value.toInt())->getId());
+ (*m_map)(index.row(), index.column()) = m_pokemod->tile(value.toInt())->id();
emit(dataChanged(index, index));
return true;
}
@@ -91,25 +89,25 @@ Qt::ItemFlags TilemapModel::flags(const QModelIndex&) const
bool TilemapModel::addRow()
{
- return insertRows(map->getHeight(), 1);
+ return insertRows(m_map->height(), 1);
}
bool TilemapModel::addColumn()
{
- return insertColumns(map->getWidth(), 1);
+ return insertColumns(m_map->width(), 1);
}
bool TilemapModel::insertRows(int row, int count, const QModelIndex&)
{
emit(beginInsertRows(QModelIndex(), row, row + count));
- if (map->getWidth())
+ if (m_map->width())
{
for (int i = 0; i < count; ++i)
- map->insertRow(row);
+ m_map->insertRow(row);
}
else
{
- map->addCol();
+ m_map->addColumn();
insertColumns(0, 0);
}
emit(endInsertRows());
@@ -119,14 +117,14 @@ bool TilemapModel::insertRows(int row, int count, const QModelIndex&)
bool TilemapModel::insertColumns(int column, int count, const QModelIndex&)
{
emit(beginInsertColumns(QModelIndex(), column, column + count));
- if (map->getHeight())
+ if (m_map->height())
{
for (int i = 0; i < count; ++i)
- map->insertCol(column);
+ m_map->insertColumn(column);
}
else
{
- map->addRow();
+ m_map->addRow();
insertRows(0, 0);
}
emit(endInsertColumns());
@@ -135,22 +133,22 @@ bool TilemapModel::insertColumns(int column, int count, const QModelIndex&)
bool TilemapModel::removeRows(int row, int count, const QModelIndex&)
{
- if (map->getHeight() == 1)
- removeColumns(0, map->getWidth());
+ if (m_map->height() == 1)
+ removeColumns(0, m_map->width());
emit(beginRemoveRows(QModelIndex(), row, row + count - 1));
for (int i = 0; i < count; ++i)
- map->deleteRow(row);
+ m_map->deleteRow(row);
emit(endRemoveRows());
return true;
}
bool TilemapModel::removeColumns(int column, int count, const QModelIndex&)
{
- if (map->getWidth() == 1)
- removeRows(0, map->getHeight());
+ if (m_map->width() == 1)
+ removeRows(0, m_map->height());
emit(beginRemoveColumns(QModelIndex(), column, column + count - 1));
for (int i = 0; i < count; ++i)
- map->deleteCol(column);
+ m_map->deleteColumn(column);
emit(endRemoveColumns());
return true;
}
diff --git a/pokemodr/TilemapModel.h b/pokemodr/TilemapModel.h
index 6babe40d..26438b41 100644
--- a/pokemodr/TilemapModel.h
+++ b/pokemodr/TilemapModel.h
@@ -1,34 +1,32 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TilemapModel.h
-// Purpose: Provides a model for tiles in the tilemap editor
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Tue Feb 5 18:40:57 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_TILEMAPMODEL__
#define __POKEMODR_TILEMAPMODEL__
+// Qt includes
#include <QAbstractTableModel>
#include <QObject>
#include <QVariant>
+// General includes
#include <Matrix.h>
+// Pokemod includes
#include <Pokemod.h>
class TilemapModel : public QAbstractTableModel
@@ -36,7 +34,7 @@ class TilemapModel : public QAbstractTableModel
Q_OBJECT
public:
- TilemapModel(QObject* parent, Matrix<int>* tilemap, const Pokemod* mod);
+ TilemapModel(QObject* parent, Matrix<int>* map, const Pokemod* pokemod);
void apply();
void discard();
@@ -58,8 +56,8 @@ class TilemapModel : public QAbstractTableModel
bool removeRows(int row, int count, const QModelIndex& = QModelIndex());
bool removeColumns(int column, int count, const QModelIndex& = QModelIndex());
private:
- Matrix<int>* map;
- const Pokemod* pokemod;
+ Matrix<int>* m_map;
+ const Pokemod* m_pokemod;
};
#endif
diff --git a/pokemodr/TimeUI.cpp b/pokemodr/TimeUI.cpp
index e186c117..0554fc5b 100644
--- a/pokemodr/TimeUI.cpp
+++ b/pokemodr/TimeUI.cpp
@@ -1,80 +1,75 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TimeUI.cpp
-// Purpose: Time UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu Jan 24 15:41:30 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
-
-#include <QMetaObject>
+/*
+ * 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/>.
+ */
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Gheaer include
#include "TimeUI.h"
-TimeUI::TimeUI(Time* t, QWidget* parent) :
+TimeUI::TimeUI(Time* time, QWidget* parent) :
ObjectUI(parent),
- time(t),
- time_mod(new Time(t->getPokemod(), *t, t->getId()))
+ m_time(time),
+ m_time_mod(new Time(*time))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(time, time_mod);
+ setObjects(m_time, m_time_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
void TimeUI::setGui()
{
- varName->setText(time_mod->getName());
- varTime->setTime(QTime(time_mod->getStartHour(), time_mod->getStartMinute()));
+ varName->setText(m_time_mod->name());
+ varTime->setTime(QTime(m_time_mod->hour(), m_time_mod->minute()));
}
void TimeUI::on_buttonApply_clicked()
{
- *time = *time_mod;
+ *m_time = *m_time_mod;
emit(changed(false));
}
void TimeUI::on_buttonDiscard_clicked()
{
- *time_mod = *time;
+ *m_time_mod = *m_time;
setGui();
emit(changed(false));
}
-void TimeUI::on_varName_textChanged(const QString& n)
+void TimeUI::on_varName_textChanged(const QString& name)
{
- time_mod->setName(n);
+ m_time_mod->setName(name);
emit(changed(true));
}
-void TimeUI::on_varTime_timeChanged(const QTime& t)
+void TimeUI::on_varTime_timeChanged(const QTime& time)
{
try
{
- time_mod->setStartHour(t.hour());
- time_mod->setStartMinute(t.minute());
+ m_time_mod->setHour(time.hour());
+ m_time_mod->setMinute(time.minute());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
diff --git a/pokemodr/TimeUI.h b/pokemodr/TimeUI.h
index c94b23f5..a1ee5f09 100644
--- a/pokemodr/TimeUI.h
+++ b/pokemodr/TimeUI.h
@@ -1,35 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TimeUI.h
-// Purpose: Time UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Thu Jan 24 15:41:30 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_TIMEUI__
#define __POKEMODR_TIMEUI__
-#include <QString>
-#include <QTime>
-
+// Pokemod includes
#include <Time.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_time.h"
class TimeUI : public ObjectUI, private Ui::formTime
@@ -37,10 +32,10 @@ class TimeUI : public ObjectUI, private Ui::formTime
Q_OBJECT
public:
- TimeUI(Time* t, QWidget* parent);
+ TimeUI(Time* time, QWidget* parent);
~TimeUI()
{
- delete time_mod;
+ delete m_time_mod;
}
public slots:
void on_buttonApply_clicked();
@@ -50,8 +45,8 @@ class TimeUI : public ObjectUI, private Ui::formTime
private:
void setGui();
- Time* time;
- Time* time_mod;
+ Time* m_time;
+ Time* m_time_mod;
};
#endif
diff --git a/pokemodr/TrainerUI.cpp b/pokemodr/TrainerUI.cpp
index 9d77af36..4b5d0d26 100644
--- a/pokemodr/TrainerUI.cpp
+++ b/pokemodr/TrainerUI.cpp
@@ -1,123 +1,115 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TrainerUI.cpp
-// Purpose: Trainer UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Mar 9 18:41:24 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QSize>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
-#include <ImageCache.h>
+// PokeModr includes
#include "FileDialog.h"
+
+// Header include
#include "TrainerUI.h"
-TrainerUI::TrainerUI(Trainer * t, QWidget * parent) :
+TrainerUI::TrainerUI(Trainer * trainer, QWidget * parent) :
ObjectUI(parent),
- trainer(t),
- trainer_mod(new Trainer(t->getPokemod(), *t, t->getId()))
+ m_trainer(trainer),
+ m_trainer_mod(new Trainer(*trainer))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(trainer, trainer_mod);
+ setObjects(m_trainer, m_trainer_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
void TrainerUI::setGui()
{
- varName->setText(trainer_mod->getName());
- varMoneyFactor->setValue(trainer_mod->getMoneyFactor());
- try
- {
- varSkin->setIcon(ImageCache::open(trainer_mod->getSkin()));
- }
- catch (OpenException& e)
- {
- }
- varAI->setText(QFile::exists(trainer_mod->getAi()) ? "Valid" : "Invalid");
+ varName->setText(m_trainer_mod->name());
+ varMoneyFactor->setValue(m_trainer_mod->moneyFactor());
+ varSkin->setIcon(m_trainer_mod->skin());
+// varAI->setText(QFile::exists(trainer_mod->ai()) ? "Valid" : "Invalid");
}
void TrainerUI::on_buttonApply_clicked()
{
- *trainer = *trainer_mod;
+ *m_trainer = *m_trainer_mod;
emit(changed(false));
}
void TrainerUI::on_buttonDiscard_clicked()
{
- *trainer_mod = *trainer;
+ *m_trainer_mod = *m_trainer;
emit(changed(false));
}
-void TrainerUI::on_varName_textChanged(const QString & n)
+void TrainerUI::on_varName_textChanged(const QString & name)
{
- trainer_mod->setName(n);
+ m_trainer_mod->setName(name);
emit(changed(true));
}
-void TrainerUI::on_varMoneyFactor_valueChaged(const int m)
+void TrainerUI::on_varMoneyFactor_valueChaged(const int moneyFactor)
{
try
{
- trainer_mod->setMoneyFactor(m);
+ m_trainer_mod->setMoneyFactor(moneyFactor);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
void TrainerUI::on_varSkin_pressed()
{
- FileDialog dlg("*.png", QSize(192, 168));
- if (dlg.show())
+ FileDialog dialog(QSize(192, 168));
+ if (dialog.exec())
{
try
{
- trainer_mod->setSkin(dlg.selectedUrl());
+ m_trainer_mod->setSkin(QPixmap(dialog.selectedFile()));
}
- catch (SaveException& e)
+ catch (SaveException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
}
-void TrainerUI::on_varAI_pressed()
-{
- FileDialog dlg(QString::fromUtf8("*.pai|PokéMod AI Files"));
- if (dlg.show())
- {
- try
- {
- trainer_mod->setAi(dlg.selectedUrl());
- }
- catch (SaveException& e)
- {
- BugCatcher::report(e);
- }
- setGui();
- }
-}
+// void TrainerUI::on_varAI_pressed()
+// {
+// FileDialog dialog(QString::fromUtf8("*.pai|PokéMod AI Files"));
+// if (dlg.show())
+// {
+// try
+// {
+// trainer_mod->setAi(dlg.selectedUrl());
+// }
+// catch (SaveException& exception)
+// {
+// BugCatcher::report(exception);
+// }
+// setGui();
+// }
+// }
diff --git a/pokemodr/TrainerUI.h b/pokemodr/TrainerUI.h
index 8aff783a..70087bae 100644
--- a/pokemodr/TrainerUI.h
+++ b/pokemodr/TrainerUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TrainerUI.h
-// Purpose: Trainer UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Mar 9 18:37:58 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_TRAINERUI__
#define __POKEMODR_TRAINERUI__
-#include <QString>
-
+// Pokemod includes
#include <Trainer.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_trainer.h"
class TrainerUI : public ObjectUI, private Ui::formTrainer
@@ -36,23 +32,23 @@ class TrainerUI : public ObjectUI, private Ui::formTrainer
Q_OBJECT
public:
- TrainerUI(Trainer* t, QWidget* parent);
+ TrainerUI(Trainer* trainer, QWidget* parent);
~TrainerUI()
{
- delete trainer_mod;
+ delete m_trainer_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varMoneyFactor_valueChaged(const int m);
+ void on_varName_textChanged(const QString& name);
+ void on_varMoneyFactor_valueChaged(const int moneyFactor);
void on_varSkin_pressed();
void on_varAI_pressed();
private:
void setGui();
- Trainer* trainer;
- Trainer* trainer_mod;
+ Trainer* m_trainer;
+ Trainer* m_trainer_mod;
};
#endif
diff --git a/pokemodr/TypeUI.cpp b/pokemodr/TypeUI.cpp
index d695ff77..3d0b6f76 100644
--- a/pokemodr/TypeUI.cpp
+++ b/pokemodr/TypeUI.cpp
@@ -1,96 +1,76 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TypeUI.cpp
-// Purpose: Type UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Wed Feb 6 14:09:47 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
-#include <QMetaObject>
+// Qt includes
#include <QStringList>
+// General includes
#include <BugCatcher.h>
#include <Exception.h>
+// Header include
#include "TypeUI.h"
-TypeUI::TypeUI(Type* t, QWidget* parent) :
+TypeUI::TypeUI(Type* type, QWidget* parent) :
ObjectUI(parent),
- type(t),
- type_mod(new Type(t->getPokemod(), *t, t->getId()))
+ m_type(type),
+ m_type_mod(new Type(*type))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(type, type_mod);
+ setObjects(m_type, m_type_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
void TypeUI::setGui()
{
- varName->setText(type_mod->getName());
- varSTABNum->setValue(type_mod->getStab().getNum());
- varSTABDenom->setValue(type_mod->getStab().getDenom());
- varSTABNum->setMaximum(type_mod->getStab().getDenom());
- varSTAB->setText(QString::number(type_mod->getStab(), 'g', DBL_PREC));
+ varName->setText(m_type_mod->name());
+ varSTAB->setValue(m_type_mod->stab());
}
void TypeUI::on_buttonApply_clicked()
{
- *type = *type_mod;
+ *m_type = *m_type_mod;
emit(changed(false));
}
void TypeUI::on_buttonDiscard_clicked()
{
- *type_mod = *type;
+ *m_type_mod = *m_type;
setGui();
emit(changed(false));
}
-void TypeUI::on_varName_textChanged(const QString& n)
+void TypeUI::on_varName_textChanged(const QString& name)
{
- type_mod->setName(n);
+ m_type_mod->setName(name);
}
-void TypeUI::on_varSTABNum_valueChanged(const int s)
+void TypeUI::on_varSTAB_valueChanged(const Fraction& stab)
{
try
{
- type_mod->setStabNum(s);
+ m_type_mod->setStab(stab);
emit(changed(true));
}
- catch (Exception& e)
+ catch (Exception& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
+ setGui();
}
- setGui();
-}
-
-void TypeUI::on_varSTABDenom_valueChanged(const int s)
-{
- try
- {
- type_mod->setStabDenom(s);
- emit(changed(true));
- }
- catch (Exception& e)
- {
- BugCatcher::report(e);
- }
- setGui();
}
diff --git a/pokemodr/TypeUI.h b/pokemodr/TypeUI.h
index de4e558a..616629cf 100644
--- a/pokemodr/TypeUI.h
+++ b/pokemodr/TypeUI.h
@@ -1,34 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TypeUI.h
-// Purpose: Type UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Wed Feb 6 14:03:01 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __POKEMODR_TYPEUI__
#define __POKEMODR_TYPEUI__
-#include <QString>
-
+// Pokemod includes
#include <Type.h>
+// PokeModr includes
#include "ObjectUI.h"
+// Form include
#include "ui_type.h"
class TypeUI : public ObjectUI, private Ui::formType
@@ -36,24 +32,23 @@ class TypeUI : public ObjectUI, private Ui::formType
Q_OBJECT
public:
- TypeUI(Type* t, QWidget* parent);
+ TypeUI(Type* type, QWidget* parent);
~TypeUI()
{
- delete type_mod;
+ delete m_type_mod;
}
public slots:
void on_buttonApply_clicked();
void on_buttonDiscard_clicked();
- void on_varName_textChanged(const QString& n);
- void on_varSTABNum_valueChanged(const int s);
- void on_varSTABDenom_valueChanged(const int s);
+ void on_varName_textChanged(const QString& name);
+ void on_varSTAB_valueChanged(const Fraction& stab);
private:
void initGui();
void refreshGui();
void setGui();
- Type* type;
- Type* type_mod;
+ Type* m_type;
+ Type* m_type_mod;
};
#endif
diff --git a/pokemodr/TypechartWidgetItem.h b/pokemodr/TypechartWidgetItem.h
index 3e463d4f..a49b268c 100644
--- a/pokemodr/TypechartWidgetItem.h
+++ b/pokemodr/TypechartWidgetItem.h
@@ -1,33 +1,30 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/TypechartWidgetItem.h
-// Purpose: Provides an editor for tiles in the tilemap editor
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sun Feb 24 04:28:24 2008
-// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions
-// Licence:
-// 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/>.
-/////////////////////////////////////////////////////////////////////////////
+/*
+ * 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/>.
+ */
#ifndef __TYPECHARTWIDGETITEM__
#define __TYPECHARTWIDGETITEM__
+// Qt includes
#include <QObject>
#include <QTableWidgetItem>
#include <QVariant>
-#include <Frac.h>
+// General includes
+#include <Fraction.h>
#define DBL_PREC_SHORT 3
@@ -36,36 +33,34 @@ class TypechartWidgetItem : public QObject, public QTableWidgetItem
Q_OBJECT
public:
- TypechartWidgetItem(Frac* mult) :
+ TypechartWidgetItem(Fraction& multiplier) :
QTableWidgetItem(QTableWidgetItem::UserType),
- multiplier(mult)
+ m_multiplier(multiplier)
{
}
QVariant data(const int role)
{
- if (role == Qt::EditRole)
- return qVariantFromValue(static_cast<void*>(multiplier));
- else if (role == Qt::DisplayRole)
- return QString::number(*multiplier, 'g', DBL_PREC_SHORT);
+ // FIXME: Fraction in QVariant
+ /*if (role == Qt::EditRole)
+ return QVariant::fromValue(m_multiplier);
+ else*/ if (role == Qt::DisplayRole)
+ return QString::number(m_multiplier, 'g', DBL_PREC_SHORT);
return QVariant();
}
void setData(int role, const QVariant& value)
{
- if (role == Qt::EditRole)
- multiplier = static_cast<Frac*>(value.value<void*>());
+ // FIXME: Fraction in QVariant
+// if (role == Qt::EditRole)
+// m_multiplier = value.value<Fraction>();
}
public slots:
- void setNum(int n)
+ void setValue(const Fraction& multiplier)
{
- multiplier->setNum(n);
- }
- void setDenom(int d)
- {
- multiplier->setDenom(d);
+ m_multiplier = multiplier;
}
private:
- Frac* multiplier;
+ Fraction& m_multiplier;
};
#endif
diff --git a/pokemodr/gui/abilityeffect.ui b/pokemodr/gui/abilityeffect.ui
index 729d1e42..067c74a4 100644
--- a/pokemodr/gui/abilityeffect.ui
+++ b/pokemodr/gui/abilityeffect.ui
@@ -35,29 +35,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varChance" >
+ <widget class="FractionWidget" name="varChance" >
<property name="toolTip" >
- <string>Chance the effect is activated</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varChanceNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varChanceDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>The chance that the effect happens</string>
</property>
</widget>
</item>
@@ -167,32 +147,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varTval2" >
+ <widget class="FractionWidget" name="varTriggerValue2" >
<property name="toolTip" >
- <string>Trigger value 2</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varTval2Num" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varTval2Denom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>Trigger Value 2</string>
</property>
</widget>
</item>
@@ -216,15 +173,15 @@
<header>knuminput.h</header>
</customwidget>
<customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/badge.ui b/pokemodr/gui/badge.ui
index 7d18f367..41fc47ea 100644
--- a/pokemodr/gui/badge.ui
+++ b/pokemodr/gui/badge.ui
@@ -77,6 +77,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
<item>
@@ -94,6 +100,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
<item>
@@ -111,6 +123,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
</layout>
@@ -136,32 +154,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varMultiplier" >
+ <widget class="FractionWidget" name="varStatMultiplier" >
<property name="toolTip" >
- <string>The multiplier the badge gives to the stat (internal battles only)</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varMultiplierNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varMultiplierDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>The multiplier to the stat in-game battles</string>
</property>
</widget>
</item>
@@ -215,6 +210,11 @@
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/general/gui/frac.ui b/pokemodr/gui/fraction.ui
index 2b410a47..d3eb9587 100644
--- a/general/gui/frac.ui
+++ b/pokemodr/gui/fraction.ui
@@ -1,6 +1,6 @@
<ui version="4.0" >
- <class>formFrac</class>
- <widget class="QWidget" name="formFrac" >
+ <class>formFraction</class>
+ <widget class="QWidget" name="formFraction" >
<layout class="QVBoxLayout" >
<item>
<widget class="KLineEdit" name="varValue" >
diff --git a/pokemodr/gui/itemeffect.ui b/pokemodr/gui/itemeffect.ui
index 31f6d2a2..089c3032 100644
--- a/pokemodr/gui/itemeffect.ui
+++ b/pokemodr/gui/itemeffect.ui
@@ -138,33 +138,10 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varVal4" >
+ <widget class="FractionWidget" name="varValue4" >
<property name="toolTip" >
<string>Value 4</string>
</property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varVal4Num" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varVal4Denom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
- </property>
</widget>
</item>
</layout>
@@ -187,15 +164,15 @@
<header>knuminput.h</header>
</customwidget>
<customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/mapeffect.ui b/pokemodr/gui/mapeffect.ui
index ae017d76..d504b9c2 100644
--- a/pokemodr/gui/mapeffect.ui
+++ b/pokemodr/gui/mapeffect.ui
@@ -57,28 +57,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KIntNumInput" name="varXCoordinate" >
+ <widget class="PointWidget" native="1" name="varCoordinate" >
<property name="toolTip" >
- <string>x coordinate of the effect</string>
- </property>
- <property name="label" >
- <string>x</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varYCoordinate" >
- <property name="toolTip" >
- <string>y coordinate of the effect</string>
- </property>
- <property name="label" >
- <string>y</string>
- </property>
- <property name="minimum" >
- <number>0</number>
+ <string>The coordinate of the effect</string>
</property>
</widget>
</item>
@@ -128,6 +109,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
<item>
@@ -148,6 +135,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
</layout>
diff --git a/pokemodr/gui/mapwarp.ui b/pokemodr/gui/mapwarp.ui
index b9713f64..fa6e1b18 100644
--- a/pokemodr/gui/mapwarp.ui
+++ b/pokemodr/gui/mapwarp.ui
@@ -54,28 +54,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KIntNumInput" name="varCoordinateX" >
+ <widget class="PointWidget" name="varCoordinate" >
<property name="toolTip" >
- <string>x coordinate of the warp</string>
- </property>
- <property name="label" >
- <string>x</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varCoordinateY" >
- <property name="toolTip" >
- <string>y coordinate of the warp</string>
- </property>
- <property name="label" >
- <string>y</string>
- </property>
- <property name="minimum" >
- <number>0</number>
+ <string>The coordinate of the warp</string>
</property>
</widget>
</item>
@@ -286,6 +267,11 @@
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>PointWidget</class>
+ <extends>QWidget</extends>
+ <header>PointWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/move.ui b/pokemodr/gui/move.ui
index 3d84e53c..7b7432fd 100644
--- a/pokemodr/gui/move.ui
+++ b/pokemodr/gui/move.ui
@@ -54,32 +54,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varAccuracy" >
+ <widget class="FractionWidget" name="varAccuracy" >
<property name="toolTip" >
- <string>Chance the move hits</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varAccuracyNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varAccuracyDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>The chance that the move hits</string>
</property>
</widget>
</item>
@@ -317,6 +294,11 @@
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/moveeffect.ui b/pokemodr/gui/moveeffect.ui
index fcadca53..b620cda4 100644
--- a/pokemodr/gui/moveeffect.ui
+++ b/pokemodr/gui/moveeffect.ui
@@ -35,32 +35,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varChance" >
+ <widget class="QWidget" native="1" name="varChance" >
<property name="toolTip" >
- <string>Chance the effect is applied</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varChanceNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varChanceDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>The chance the effect occurs</string>
</property>
</widget>
</item>
@@ -74,7 +51,7 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KCombobox" name="varEffect" >
+ <widget class="KCombobox" native="1" name="varEffect" >
<property name="toolTip" >
<string>The effect</string>
</property>
@@ -87,7 +64,7 @@
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KCombobox" name="varVal1" >
+ <widget class="KCombobox" native="1" name="varVal1" >
<property name="toolTip" >
<string>Value 1 of the effect</string>
</property>
@@ -103,7 +80,7 @@
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KCombobox" name="varVal2" >
+ <widget class="KCombobox" native="1" name="varVal2" >
<property name="toolTip" >
<string>Value 2 of the effect</string>
</property>
@@ -135,29 +112,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varVal4" >
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varVal4Num" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varVal4Denom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <widget class="QWidget" native="1" name="varValue4" >
+ <property name="toolTip" >
+ <string>Value 4</string>
</property>
</widget>
</item>
@@ -171,25 +128,20 @@
</widget>
<customwidgets>
<customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- <customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>KCombobox</class>
+ <extends>QWidget</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/nature.ui b/pokemodr/gui/nature.ui
index 099bec8a..f40afceb 100644
--- a/pokemodr/gui/nature.ui
+++ b/pokemodr/gui/nature.ui
@@ -64,32 +64,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varStatMultiplier" >
+ <widget class="FractionWidget" name="varStatMultiplier" >
<property name="toolTip" >
- <string>Stat multiplier</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varStatMultiplierNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varStatMultiplierDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>The multiplier of the stat</string>
</property>
</widget>
</item>
@@ -141,6 +118,11 @@
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/general/gui/point.ui b/pokemodr/gui/point.ui
index d310ae96..d310ae96 100644
--- a/general/gui/point.ui
+++ b/pokemodr/gui/point.ui
diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui
index 846794d3..570132b4 100644
--- a/pokemodr/gui/pokemod.ui
+++ b/pokemodr/gui/pokemod.ui
@@ -416,16 +416,9 @@
<widget class="QGroupBox" name="boxEffectiveness" >
<layout class="QVBoxLayout" >
<item>
- <widget class="KIntNumInput" name="varEffectivenessNum" >
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varEffectivenessDenom" >
- <property name="minimum" >
- <number>1</number>
+ <widget class="FractionWidget" name="varEffectiveness" >
+ <property name="toolTip" >
+ <string>Multiplier for attacks of the attacking type against the defending type</string>
</property>
</widget>
</item>
@@ -487,6 +480,11 @@
<extends>QTabWidget</extends>
<header>ktabwidget.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/pokemodr.ui b/pokemodr/gui/pokemodr.ui
index fd0ff169..4f8d64a6 100644
--- a/pokemodr/gui/pokemodr.ui
+++ b/pokemodr/gui/pokemodr.ui
@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>782</width>
- <height>566</height>
+ <width>800</width>
+ <height>600</height>
</rect>
</property>
<property name="windowTitle" >
diff --git a/pokemodr/gui/rules.ui b/pokemodr/gui/rules.ui
index af06d33a..75ce5735 100644
--- a/pokemodr/gui/rules.ui
+++ b/pokemodr/gui/rules.ui
@@ -444,33 +444,10 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varPokerus" >
+ <widget class="FractionWidget" name="varPokerus" >
<property name="toolTip" >
<string>The chance of contracting the Pokérus virus</string>
</property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varPokerusNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varPokerusDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
- </property>
</widget>
</item>
</layout>
@@ -521,6 +498,11 @@
<extends>QTabWidget</extends>
<header>ktabwidget.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui
index 37db392a..1ec00b0d 100644
--- a/pokemodr/gui/species.ui
+++ b/pokemodr/gui/species.ui
@@ -84,32 +84,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varRunChance" >
+ <widget class="FractionWidget" name="varRunChance" >
<property name="toolTip" >
- <string>Chance the species runs from a wild battle</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varRunChanceNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varRunChanceDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>The chance that the species runs in a wild battle</string>
</property>
</widget>
</item>
@@ -123,33 +100,10 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varFleeChance" >
+ <widget class="FractionWidget" name="varFleeChance" >
<property name="toolTip" >
<string>Chance that the player can flee from a wild battle</string>
</property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varFleeChanceNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varFleeChanceDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
- </property>
</widget>
</item>
</layout>
@@ -162,33 +116,10 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varItemChance" >
+ <widget class="FractionWidget" name="varItemChance" >
<property name="toolTip" >
<string>Chance the species is carrying an item in a wild battle</string>
</property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varItemChanceNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varItemChanceDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
- </property>
</widget>
</item>
</layout>
@@ -449,33 +380,10 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varGenderChance" >
+ <widget class="FractionWidget" name="varGenderChance" >
<property name="toolTip" >
<string>Chance of getting a female version of the species (negative is genderless)</string>
</property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varGenderChanceNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varGenderChanceDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
- </property>
</widget>
</item>
</layout>
@@ -751,6 +659,11 @@
<extends>QTabWidget</extends>
<header>ktabwidget.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/speciesevolution.ui b/pokemodr/gui/speciesevolution.ui
index c5d8f15a..9b7b6de9 100644
--- a/pokemodr/gui/speciesevolution.ui
+++ b/pokemodr/gui/speciesevolution.ui
@@ -58,13 +58,13 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="boxVal1" >
+ <widget class="QGroupBox" name="boxValue1" >
<property name="title" >
<string>Value 1</string>
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KComboBox" name="varVal1" >
+ <widget class="KComboBox" name="varValue1" >
<property name="toolTip" >
<string>Value 1</string>
</property>
@@ -74,13 +74,13 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="boxVal2" >
+ <widget class="QGroupBox" name="boxValue2" >
<property name="title" >
<string>Value 2</string>
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KComboBox" name="varVal2" >
+ <widget class="KComboBox" name="varValue2" >
<property name="toolTip" >
<string>Value 2</string>
</property>
@@ -90,13 +90,13 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="boxVal3" >
+ <widget class="QGroupBox" name="boxValue3" >
<property name="title" >
<string>Value 3</string>
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KIntNumInput" name="varVal3" >
+ <widget class="KIntNumInput" name="varValue3" >
<property name="minimum" >
<number>0</number>
</property>
diff --git a/pokemodr/gui/tile.ui b/pokemodr/gui/tile.ui
index 7ce875b7..3025e0ba 100644
--- a/pokemodr/gui/tile.ui
+++ b/pokemodr/gui/tile.ui
@@ -58,6 +58,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
<item>
@@ -78,6 +84,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
</layout>
@@ -103,38 +115,15 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="boxWild" >
+ <widget class="QGroupBox" name="boxWildChance" >
<property name="title" >
<string>Wild</string>
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varWild" >
+ <widget class="FractionWidget" name="varWildChance" >
<property name="toolTip" >
- <string>Chance of having a wild encounter on the tile</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varWildNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varWildDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>The chance a wild encounter happens on this tile</string>
</property>
</widget>
</item>
@@ -238,11 +227,6 @@
<header>kcombobox.h</header>
</customwidget>
<customwidget>
- <class>KIntNumInput</class>
- <extends>QWidget</extends>
- <header>knuminput.h</header>
- </customwidget>
- <customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
@@ -257,6 +241,11 @@
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/gui/trainer.ui b/pokemodr/gui/trainer.ui
index 7c5bc964..3652c327 100644
--- a/pokemodr/gui/trainer.ui
+++ b/pokemodr/gui/trainer.ui
@@ -71,6 +71,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
<item>
@@ -91,6 +97,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
</layout>
@@ -107,6 +119,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
<item>
@@ -121,6 +139,12 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
</spacer>
</item>
</layout>
diff --git a/pokemodr/gui/type.ui b/pokemodr/gui/type.ui
index 404e6925..2c058e0a 100644
--- a/pokemodr/gui/type.ui
+++ b/pokemodr/gui/type.ui
@@ -54,32 +54,9 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KLineEdit" name="varSTAB" >
+ <widget class="FractionWidget" name="varSTAB" >
<property name="toolTip" >
- <string>Multiplier for STAB (Same Type Attack Bonus)</string>
- </property>
- <property name="readOnly" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varSTABNum" >
- <property name="label" >
- <string>Numerator</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varSTABDenom" >
- <property name="label" >
- <string>Denominator</string>
- </property>
- <property name="minimum" >
- <number>1</number>
+ <string>Multiplier for species with this type for using a move of this type</string>
</property>
</widget>
</item>
@@ -90,11 +67,6 @@
</widget>
<customwidgets>
<customwidget>
- <class>KIntNumInput</class>
- <extends>QWidget</extends>
- <header>knuminput.h</header>
- </customwidget>
- <customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
@@ -104,6 +76,11 @@
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
+ <customwidget>
+ <class>FractionWidget</class>
+ <extends>QWidget</extends>
+ <header>FractionWidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro
index a5a48382..a0177807 100644
--- a/pokemodr/pokemodr.pro
+++ b/pokemodr/pokemodr.pro
@@ -13,6 +13,7 @@ LIBS += -L../../bin \
CONFIG += qt gui warn_on exceptions debug
CONFIG -= release
+QT += xml
INCLUDEPATH += ../pokemod ../general
@@ -71,6 +72,7 @@ SOURCES += AbilityUI.cpp \
CoinListObjectUI.cpp \
EggGroupUI.cpp \
FileDialog.cpp \
+ FractionWidget.cpp \
ItemUI.cpp \
ItemTypeUI.cpp \
MapUI.cpp \
@@ -80,6 +82,7 @@ SOURCES += AbilityUI.cpp \
MapWildListEncounterUI.cpp \
MoveUI.cpp \
NatureUI.cpp \
+ PointWidget.cpp \
PokemodUI.cpp \
PokeModr.cpp \
PokeModrUI.cpp \
@@ -105,6 +108,7 @@ HEADERS += AbilityUI.h \
CoinListObjectUI.h \
EggGroupUI.h \
FileDialog.h \
+ FractionWidget.h \
ItemUI.h \
ItemTypeUI.h \
MapUI.h \
@@ -115,6 +119,7 @@ HEADERS += AbilityUI.h \
MoveUI.h \
NatureUI.h \
ObjectUI.h \
+ PointWidget.h \
PokemodUI.h \
PokeModr.h \
PokeModrUI.h \
@@ -142,6 +147,7 @@ FORMS += gui/ability.ui \
gui/coinlistobject.ui \
gui/dialog.ui \
gui/egggroup.ui \
+ gui/fraction.ui \
gui/item.ui \
gui/itemeffect.ui \
gui/itemtype.ui \
@@ -155,6 +161,7 @@ FORMS += gui/ability.ui \
gui/move.ui \
gui/moveeffect.ui \
gui/nature.ui \
+ gui/point.ui \
gui/pokemod.ui \
gui/pokemodr.ui \
gui/rules.ui \