summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-01-22 04:45:02 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-01-22 04:45:02 +0000
commitefa80ce427e40070e36e5ab86d2f6dbf4ad50648 (patch)
treef7443dd268aa82e1819d00c141d98395b7a4a5a7
parenta1fff27395d1930820e6c007fdedd8e9dc58f0b3 (diff)
downloadsigen-efa80ce427e40070e36e5ab86d2f6dbf4ad50648.tar.gz
sigen-efa80ce427e40070e36e5ab86d2f6dbf4ad50648.tar.xz
sigen-efa80ce427e40070e36e5ab86d2f6dbf4ad50648.zip
[FIX] Some linker errors in pokemod and general
[FIX] More enum char*[] to QStringList [FIX] Widgets in PokéModr gui [ADD] Rules GUI logic git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@39 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog10
-rw-r--r--general/BugCatcher.h47
-rw-r--r--general/Flag.cpp2
-rw-r--r--general/Flag.h5
-rw-r--r--general/Frac.h2
-rw-r--r--general/ImageCache.cpp4
-rw-r--r--general/ImageCache.h1
-rw-r--r--general/Ini.cpp8
-rw-r--r--general/Ini.h4
-rw-r--r--general/Ref.cpp14
-rw-r--r--general/Ref.h8
-rw-r--r--pokemod/MapTrainerTeamMember.cpp6
-rw-r--r--pokemod/MapTrainerTeamMember.h2
-rw-r--r--pokemod/Object.h10
-rw-r--r--pokemod/Pokemod.cpp154
-rw-r--r--pokemod/Pokemod.h13
-rw-r--r--pokemod/Rules.cpp8
-rw-r--r--pokemod/Rules.h8
-rw-r--r--pokemodr/PokeModr.h2
-rw-r--r--pokemodr/RulesUI.cpp279
-rw-r--r--pokemodr/RulesUI.h76
-rw-r--r--pokemodr/gui/rules.ui8
-rw-r--r--pokemodr/gui/time.ui42
-rw-r--r--pokemodr/pokemodr.pro2
24 files changed, 636 insertions, 79 deletions
diff --git a/Changelog b/Changelog
index 94d4e275..9683be8b 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,14 @@
-----------------
+Rev: 39
+Date: 21 January 2008
+User: MathStuf
+-----------------
+[FIX] Some linker errors in pokemod and general
+[FIX] More enum cahr*[] to QStringList
+[FIX] Widgets in PokéModr gui
+[ADD] Rules GUI logic
+
+-----------------
Rev: 38
Date: 21 January 2008
User: MathStuf
diff --git a/general/BugCatcher.h b/general/BugCatcher.h
new file mode 100644
index 00000000..9249d677
--- /dev/null
+++ b/general/BugCatcher.h
@@ -0,0 +1,47 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: general/BugCatcher.h
+// Purpose: Exceptions get sent here
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Mon Jan 21 15:57: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/>.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __BUGCATCHER__
+#define __BUGCATCHER__
+
+#include <kaboutdata.h>
+#include <kbugreport.h>
+#include "Exception.h"
+
+class BugCatcher
+{
+ public:
+ BugCatcher(KAboutData* data) :
+ about(data)
+ {
+ }
+ void report(const Exception& e)
+ {
+ KBugReport bug(NULL, true, about);
+ bug.setMessageBody(e.getMsg());
+ bug.exec();
+ }
+ private:
+ KAboutData* about;
+};
+
+#endif
diff --git a/general/Flag.cpp b/general/Flag.cpp
index ab86fa1b..f2002f5a 100644
--- a/general/Flag.cpp
+++ b/general/Flag.cpp
@@ -22,4 +22,4 @@
#include "Flag.h"
-const char* Flag::ValueStr[Flag::End] = {"Off", "On", "Ignore"};
+const QStringList Flag::ValueStr = QStringList() << "Off" << "On" << "Ignore";
diff --git a/general/Flag.h b/general/Flag.h
index 0aae7fda..b4d3b5f1 100644
--- a/general/Flag.h
+++ b/general/Flag.h
@@ -23,8 +23,7 @@
#ifndef __FLAG__
#define __FLAG__
-#include <QFile>
-#include <QString>
+#include <QStringList>
#include "Ref.h"
class Flag
@@ -37,7 +36,7 @@ class Flag
Ignore,
End
};
- static const char* ValueStr[End];
+ static const QStringList ValueStr;
Flag(const unsigned f = 0, const unsigned s = 0) :
flag(f)
diff --git a/general/Frac.h b/general/Frac.h
index f5b178b1..f419eee5 100644
--- a/general/Frac.h
+++ b/general/Frac.h
@@ -68,7 +68,7 @@ class Frac
void reduce();
- operator float() const
+ operator double() const
{
return (num / denom);
}
diff --git a/general/ImageCache.cpp b/general/ImageCache.cpp
index f4cf6d4f..ca10456e 100644
--- a/general/ImageCache.cpp
+++ b/general/ImageCache.cpp
@@ -20,9 +20,11 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
+#include <QFile>
+#include <QString>
#include "ImageCache.h"
-static KPixmapCache ImageCache::cache("pokegen");
+KPixmapCache ImageCache::cache("pokegen");
QPixmap ImageCache::open(const QString& fname, const bool force) throw(OpenException)
{
diff --git a/general/ImageCache.h b/general/ImageCache.h
index 7114abe7..93ef558e 100644
--- a/general/ImageCache.h
+++ b/general/ImageCache.h
@@ -24,7 +24,6 @@
#define __IMAGECACHE__
#include <QPixmap>
-#include <QString>
#include <kpixmapcache.h>
#include "Exception.h"
diff --git a/general/Ini.cpp b/general/Ini.cpp
index b829b115..0e65f2b1 100644
--- a/general/Ini.cpp
+++ b/general/Ini.cpp
@@ -20,8 +20,16 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
+#include <QDir>
+#include <QFile>
+#include <QStringList>
+#include <QTextStream>
#include "Ini.h"
+Ini::Ini()
+{
+}
+
Ini::Ini(const QString& fname)
{
load(fname);
diff --git a/general/Ini.h b/general/Ini.h
index c56060a3..2a3da696 100644
--- a/general/Ini.h
+++ b/general/Ini.h
@@ -23,12 +23,8 @@
#ifndef __INI__
#define __INI__
-#include <QDir>
-#include <QFile>
#include <QMap>
#include <QString>
-#include <QStringList>
-#include <QTextStream>
#include "Exception.h"
class Ini
diff --git a/general/Ref.cpp b/general/Ref.cpp
index 9424cf93..78a73bfb 100644
--- a/general/Ref.cpp
+++ b/general/Ref.cpp
@@ -22,17 +22,17 @@
#include "Ref.h"
-const QStringList StatRBYStr = QStringList() << "HP", "Attack", "Defense", "Speed", "Special", "Special", "Accuracy", "Evasion";
-const QStringList StatGSCStr = QStringList() << "HP", "Attack", "Defense", "Speed", "Special Attack", "Special Defense", "Accuracy", "Evasion";
+const QStringList StatRBYStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special" << "Special" << "Accuracy" << "Evasion";
+const QStringList StatGSCStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special Attack" << "Special Defense" << "Accuracy" << "Evasion";
-const QStringList BattleMemberStr = QStringList() << "Player", "Enemy";
+const QStringList BattleMemberStr = QStringList() << "Player" << "Enemy";
-const QStringList WeatherStr = QStringList() << "Ice", "Rain", "Sun", "Sand", "All";
+const QStringList WeatherStr = QStringList() << "Ice" << "Rain" << "Sun" << "Sand" << "All";
-const QStringList DirectionStr = QStringList() << "Up", "Down", "Left", "Right", "None";
+const QStringList DirectionStr = QStringList() << "Up" << "Down" << "Left" << "Right" << "None";
-const QStringList RelativeStr = QStringList() << "Less", "Less or Equal", "Equal", "Greater or Equal", "Greater", "Not Equal";
+const QStringList RelativeStr = QStringList() << "Less" << "Less or Equal" << "Equal" << "Greater or Equal" << "Greater" << "Not Equal";
-const QStringList StatusStr = QStringList() << "Freeze", "Paralyze", "Sleep", "Poison", "Toxic Poison", "Burn", "Any";
+const QStringList StatusStr = QStringList() << "Freeze" << "Paralyze" << "Sleep" << "Poison" << "Toxic Poison" << "Burn" << "Any";
const QStringList HMStr = QStringList() << "Cut" << "Fly" << "Surf" << "Strength" << "Flash" << "Whirlpool" << "Waterfall" << "Dive" << "Headbutt" << "Rock Smash" << "Defog" << "Rock Climb";
diff --git a/general/Ref.h b/general/Ref.h
index 6f17a86e..7dd32769 100644
--- a/general/Ref.h
+++ b/general/Ref.h
@@ -40,8 +40,6 @@ enum EnumStat
ST_Evasion = 7,
ST_End_Battle = 8,
};
-extern const QStringList StatRBYStr;
-extern const QStringList StatGSCStr;
enum EnumBattleMember
{
@@ -49,7 +47,6 @@ enum EnumBattleMember
BM_Enemy = 1,
BM_End = 2
};
-extern const QStringList BattleMemberStr;
enum EnumWeather
{
@@ -61,7 +58,6 @@ enum EnumWeather
W_All = 4,
W_End_All = 5
};
-extern const QStringList WeatherStr;
enum EnumDirection
{
@@ -73,7 +69,6 @@ enum EnumDirection
D_None = 4,
D_End_None = 5
};
-extern const QStringList DirectionStr;
enum EnumRelative
{
@@ -85,7 +80,6 @@ enum EnumRelative
REL_NotEqual = 5,
REL_End = 6
};
-extern const QStringList RelativeStr;
enum EnumStatus
{
@@ -98,7 +92,6 @@ enum EnumStatus
STS_Any = 6,
STS_End = 7
};
-extern const QStringList StatusStr;
enum HMMove
{
@@ -117,6 +110,5 @@ enum HMMove
HM_Flash = 11,
HM_End_All = 12
};
-extern const QStringList HMStr;
#endif
diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp
index 8097766f..45e84bb3 100644
--- a/pokemod/MapTrainerTeamMember.cpp
+++ b/pokemod/MapTrainerTeamMember.cpp
@@ -35,6 +35,12 @@ MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const unsigned _i
{
}
+MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const MapTrainerTeamMember& t, const unsigned _id) :
+ Object(par, _id)
+{
+ *this = t;
+}
+
MapTrainerTeamMember::MapTrainerTeamMember(const Pokemod& par, const QString& fname, const unsigned _id) :
Object(par, _id)
{
diff --git a/pokemod/MapTrainerTeamMember.h b/pokemod/MapTrainerTeamMember.h
index 95c4463b..943399e4 100644
--- a/pokemod/MapTrainerTeamMember.h
+++ b/pokemod/MapTrainerTeamMember.h
@@ -33,7 +33,7 @@ class MapTrainerTeamMember : public Object
{
public:
MapTrainerTeamMember(const Pokemod& par, const unsigned _id);
- MapTrainerTeamMember(const Pokemod& par, const MapTrainerTeamMember& p, const unsigned _id);
+ MapTrainerTeamMember(const Pokemod& par, const MapTrainerTeamMember& t, const unsigned _id);
MapTrainerTeamMember(const Pokemod& par, const QString& fname, const unsigned _id = UINT_MAX);
void load(const QString& fname, const unsigned _id = UINT_MAX) throw(Exception);
diff --git a/pokemod/Object.h b/pokemod/Object.h
index 60621756..038e448f 100644
--- a/pokemod/Object.h
+++ b/pokemod/Object.h
@@ -35,8 +35,14 @@ class Object
pokemod(par)
{
}
- virtual ~Object();
- virtual void load(const QString& fname, const unsigned _id) throw(Exception);
+ virtual ~Object()
+ {
+ }
+
+ const Pokemod& getPokemod() const
+ {
+ return pokemod;
+ }
unsigned getId() const
{
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index ea8f7528..5e76ad79 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -24,14 +24,17 @@
#include <QListIterator>
#include <QMap>
#include <QMapIterator>
-#include <QStringList>
#include <QStringListIterator>
+#include <QTextStream>
+#include <QTime>
#include "../general/Ref.h"
#include "Pokemod.h"
+const QStringList Pokemod::ValidationStr = QStringList() << "Message" << "Warn" << "Error";
+
Pokemod::Pokemod(const QString& fname) :
Object(*this, 0),
- valstream(NULL),
+ valOutput(NULL),
title(""),
version(""),
description(""),
@@ -599,11 +602,130 @@ bool Pokemod::validate() const
return valid;
}
-QString Pokemod::getPath() const
+unsigned Pokemod::getNewAbilityId() const
{
- return path;
+ unsigned i = 0;
+ for (; (i < getAbilityCount()) && (getAbilityIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewAuthorId() const
+{
+ unsigned i = 0;
+ for (; (i < getAuthorCount()) && (getAuthorIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewBadgeId() const
+{
+ unsigned i = 0;
+ for (; (i < getBadgeCount()) && (getBadgeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewCoinListId() const
+{
+ unsigned i = 0;
+ for (; (i < getCoinListCount()) && (getCoinListIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewDialogId() const
+{
+ unsigned i = 0;
+ for (; (i < getDialogCount()) && (getDialogIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewEggGroupId() const
+{
+ unsigned i = 0;
+ for (; (i < getEggGroupCount()) && (getEggGroupIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewItemId() const
+{
+ unsigned i = 0;
+ for (; (i < getItemCount()) && (getItemIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewItemTypeId() const
+{
+ unsigned i = 0;
+ for (; (i < getItemTypeCount()) && (getItemTypeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewMapId() const
+{
+ unsigned i = 0;
+ for (; (i < getMapCount()) && (getMapIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewMoveId() const
+{
+ unsigned i = 0;
+ for (; (i < getMoveCount()) && (getMoveIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewNatureId() const
+{
+ unsigned i = 0;
+ for (; (i < getNatureCount()) && (getNatureIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
}
+unsigned Pokemod::getNewSpeciesId() const
+{
+ unsigned i = 0;
+ for (; (i < getSpeciesCount()) && (getSpeciesIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+
+unsigned Pokemod::getNewStoreId() const
+{
+ unsigned i = 0;
+ for (; (i < getStoreCount()) && (getStoreIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+unsigned Pokemod::getNewTileId() const
+{
+ unsigned i = 0;
+ for (; (i < getTileCount()) && (getTileIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+unsigned Pokemod::getNewTimeId() const
+{
+ unsigned i = 0;
+ for (; (i < getTimeCount()) && (getTimeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
+unsigned Pokemod::getNewTypeId() const
+{
+ unsigned i = 0;
+ for (; (i < getTypeCount()) && (getTypeIndex(i) != UINT_MAX); ++i)
+ ;
+ return i;
+}
void Pokemod::load(const QString& fname) throw(Exception)
{
Ini ini(fname);
@@ -798,11 +920,35 @@ void Pokemod::save() const throw(Exception)
i.next().save();
}
+QString Pokemod::getPath() const
+{
+ return path;
+}
+
unsigned Pokemod::maxCompatability(const Pokemod& p) const
{
// TODO (Ben #1#): MaxCompatability between two versions
}
+void Pokemod::validationMsg(const QString& msg, Validation val) const throw(Exception)
+{
+ if (!valOutput)
+ throw(Exception("Pokemod", "valOutput isn\'t set"));
+ if (V_End < val)
+ throw(BoundsException("Pokemod", "val"));
+ (*valOutput) << ValidationStr[val] << QDateTime::currentDateTime().toString(" (yyyyMMdd hh:mm:ss.zzz ddd): ") << msg;
+}
+
+void Pokemod::setValOutput(QStringList& s)
+{
+ valOutput = &s;
+}
+
+void Pokemod::unsetValOutput()
+{
+ valOutput = NULL;
+}
+
void Pokemod::setTitle(const QString& t)
{
title = t;
diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h
index cd366c9b..c2be36a0 100644
--- a/pokemod/Pokemod.h
+++ b/pokemod/Pokemod.h
@@ -23,9 +23,9 @@
#ifndef __POKEMOD_POKEMOD__
#define __POKEMOD_POKEMOD__
-#include <QIODevice>
#include <QList>
#include <QString>
+#include <QStringList>
#include "../general/Exception.h"
#include "../general/FracMatrix.h"
#include "../general/Point.h"
@@ -55,8 +55,10 @@ class Pokemod : public Object
{
V_Msg = 0,
V_Warn = 1,
- V_Error = 2
+ V_Error = 2,
+ V_End = 3
};
+ static const QStringList ValidationStr;
Pokemod(const QString& fpath);
@@ -67,8 +69,9 @@ class Pokemod : public Object
unsigned maxCompatability(const Pokemod& p) const;
- void validationMsg(const QString& msg, Validation val = V_Error) const;
- void setValidationOutput(QIODevice& s);
+ void validationMsg(const QString& msg, Validation val = V_Error) const throw(Exception);
+ void setValOutput(QStringList& s);
+ void unsetValOutput();
void setTitle(const QString& t);
void setVersion(const QString& v);
@@ -278,7 +281,7 @@ class Pokemod : public Object
Type& newType(const Type& t);
void deleteType(const unsigned i) throw(IndexException);
private:
- QIODevice* valstream;
+ QStringList* valOutput;
bool validate() const;
unsigned getNewAbilityId() const;
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index dfb4a09f..3e82f599 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -23,6 +23,8 @@
#include "Pokemod.h"
#include "Rules.h"
+const QStringList Rules::DVStr = QStringList() << "16" << "32";
+
Rules::Rules(const Pokemod& par) :
Object(par, 0),
genderAllowed(false),
@@ -53,6 +55,12 @@ Rules::Rules(const Pokemod& par) :
{
}
+Rules::Rules(const Pokemod& par, const Rules& r) :
+ Object(par, 0)
+{
+ *this = r;
+}
+
Rules::Rules(const Pokemod& par, const QString& fname) :
Object(par, 0)
{
diff --git a/pokemod/Rules.h b/pokemod/Rules.h
index 9eb34930..baeff901 100644
--- a/pokemod/Rules.h
+++ b/pokemod/Rules.h
@@ -33,9 +33,11 @@ class Pokemod;
class Rules : public Object
{
public:
- Rules(const Pokemod& pokemod);
- Rules(const Pokemod& pokemod, const QString& fname);
- Rules(const Pokemod& pokemod, const Rules& r);
+ static const QStringList DVStr;
+
+ Rules(const Pokemod& par);
+ Rules(const Pokemod& par, const Rules& r);
+ Rules(const Pokemod& par, const QString& fname);
void load(const QString& fname) throw(Exception);
void save() const throw(Exception);
diff --git a/pokemodr/PokeModr.h b/pokemodr/PokeModr.h
index 0a63235f..9259056f 100644
--- a/pokemodr/PokeModr.h
+++ b/pokemodr/PokeModr.h
@@ -23,4 +23,6 @@
#ifndef __POKEMODR_MAIN__
#define __POKEMODR_MAIN__
+
+
#endif
diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp
new file mode 100644
index 00000000..9742fbe4
--- /dev/null
+++ b/pokemodr/RulesUI.cpp
@@ -0,0 +1,279 @@
+/////////////////////////////////////////////////////////////////////////////
+// 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>
+#include "../general/BugCatcher.h"
+#include "RulesUI.h"
+
+extern BugCatcher bugs;
+
+RulesUI::RulesUI(Rules& r, QWidget* parent) :
+ QWidget(parent),
+ rules(r.getPokemod(), r),
+ rules_mod(r.getPokemod(), r)
+{
+ setupUi(this);
+ QMetaObject::connectSlotsByName(this);
+ varMaxDV->addItems(Rules::DVStr);
+ setGui();
+}
+
+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());
+ varBoxSize->setValue(rules_mod.getBoxSize());
+ varMaxParty->setValue(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->setCurrentItem(Rules::DVStr[rules_mod.getMaxDVValue() >> 5]);
+ 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->setValue(rules_mod.getMaxEVPerStat());
+ varPokerusNum->setValue(rules_mod.getPokerusChance().getNum());
+ varPokerusDenom->setValue(rules_mod.getPokerusChance().getDenom());
+}
+
+void RulesUI::on_buttonApply_clicked()
+{
+ rules = rules_mod;
+}
+
+void RulesUI::on_buttonDiscard_clicked()
+{
+ rules_mod = rules;
+}
+
+void RulesUI::on_boxGenders_toggled(const bool g)
+{
+ rules_mod.setGenderAllowed(g);
+ if (!g)
+ varBreeding->setCheckState(Qt::Unchecked);
+}
+
+void RulesUI::on_varBreeding_toggled(const bool b) throw(Exception)
+{
+ try
+ {
+ rules_mod.setBreedingAllowed(b);
+ }
+ catch (Exception& e)
+ {
+ bugs.report(e);
+ setGui();
+ }
+}
+
+void RulesUI::on_varHeldItems_valueChanged(const int h)
+{
+ rules_mod.setHoldItems(h);
+}
+
+void RulesUI::on_boxCriticalDomains_toggled(const bool c)
+{
+ rules_mod.setCriticalDomains(c);
+}
+
+void RulesUI::on_boxAllowAbilities_toggled(const bool a)
+{
+ rules_mod.setAbilityAllowed(a);
+}
+
+void RulesUI::on_boxAllowNatures_toggled(const bool a)
+{
+ rules_mod.setNatureAllowed(a);
+}
+
+void RulesUI::on_varBoxes_valueChanged(const int b)
+{
+ rules_mod.setNumBoxes(b);
+}
+
+void RulesUI::on_varBoxSize_valueChanged(const int b)
+{
+ rules_mod.setBoxSize(b);
+}
+
+void RulesUI::on_varMaxPartySize_valueChanged(const int m) throw(BoundsException)
+{
+ if (rules_mod.getMaxFight() < unsigned(m))
+ varMaxFight->setValue(m);
+ rules_mod.setMaxParty(m);
+ varMaxFight->setMaximum(m);
+}
+
+void RulesUI::on_varMaxFight_valueChanged(const int m) throw(BoundsException)
+{
+ try
+ {
+ rules_mod.setMaxFight(m);
+ }
+ catch (BoundsException& e)
+ {
+ setGui();
+ }
+}
+
+void RulesUI::on_varMaxMoves_valueChanged(const int m) throw(BoundsException)
+{
+ try
+ {
+ rules_mod.setMaxMoves(m);
+ }
+ catch (BoundsException& e)
+ {
+ bugs.report(e);
+ setGui();
+ }
+}
+
+void RulesUI::on_varMaxLevel_valueChanged(const int m) throw(BoundsException)
+{
+ try
+ {
+ rules_mod.setMaxLevel(m);
+ }
+ catch (BoundsException& e)
+ {
+ bugs.report(e);
+ setGui();
+ }
+}
+
+void RulesUI::on_varMaxMoney_valueChanged(const int m)
+{
+ rules_mod.setMaxMoney(m);
+}
+
+void RulesUI::on_boxHardCash_toggled(const int h)
+{
+ rules_mod.setHardCash(h);
+}
+
+void RulesUI::on_boxSplitSpecial_toggled(const bool s)
+{
+ rules_mod.setSpecialSplit(s);
+ if (!s)
+ varSplitSpecialDV->setCheckState(Qt::Unchecked);
+}
+
+void RulesUI::on_varSplitSpecialDV_toggled(const bool s)
+{
+ rules_mod.setSpecialDVSplit(s);
+}
+
+void RulesUI::on_varMaxDV_currentIndexChanged(const QString& m) throw(BoundsException)
+{
+ try
+ {
+ if (Rules::DVStr.contains(m))
+ rules_mod.setMaxDVValue((Rules::DVStr.indexOf(m) << 4) + 16);
+ else
+ throw(BoundsException("RulesUI", "maxDVValue"));
+ }
+ catch (BoundsException& e)
+ {
+ bugs.report(e);
+ setGui();
+ }
+}
+
+void RulesUI::on_boxHappiness_toggled(const bool h)
+{
+ rules_mod.setHappiness(h);
+}
+
+void RulesUI::on_varFaintLoss_valueChanged(const int f)
+{
+ rules_mod.setHappyFaintLoss(f);
+}
+
+void RulesUI::on_varLevelGain_valueChanged(const int l)
+{
+ rules_mod.setHappyLevelGain(l);
+}
+
+void RulesUI::on_varNumSteps_valueChanged(const int n)
+{
+ rules_mod.setHappySteps(n);
+}
+
+void RulesUI::on_boxEffortValues_toggled(const int e)
+{
+ rules_mod.setEffortValuesAllowed(e);
+}
+
+void RulesUI::on_varMaxEV_valueChanged(const int m) throw(Exception)
+{
+ if (rules_mod.getMaxEVPerStat() < unsigned(m))
+ varMaxEVPerStat->setValue(m);
+ rules_mod.setMaxTotalEV(m);
+ varMaxEVPerStat->setMaximum(m);
+}
+
+void RulesUI::on_varMaxEVPerStat_valueChanged(const int m) throw(Exception)
+{
+ rules_mod.setMaxEVPerStat(m);
+}
+
+void RulesUI::on_varPokerusNum_valueChanged(const int p) throw(Exception)
+{
+ try
+ {
+ rules_mod.setPokerusChanceNum(p);
+ varPokerus->setText(QString::number(rules_mod.getPokerusChance()));
+ }
+ catch (Exception& e)
+ {
+ bugs.report(e);
+ setGui();
+ }
+}
+
+void RulesUI::on_varPokerusDenom_valueChanged(const int p) throw(Exception)
+{
+ try
+ {
+ rules_mod.setPokerusChanceDenom(p);
+ varPokerusNum->setMaximum(p - 1);
+ varPokerus->setText(QString::number(rules_mod.getPokerusChance()));
+ }
+ catch (Exception& e)
+ {
+ bugs.report(e);
+ setGui();
+ }
+}
diff --git a/pokemodr/RulesUI.h b/pokemodr/RulesUI.h
new file mode 100644
index 00000000..7f4ca5f9
--- /dev/null
+++ b/pokemodr/RulesUI.h
@@ -0,0 +1,76 @@
+/////////////////////////////////////////////////////////////////////////////
+// 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/>.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMODR_RULESUI__
+#define __POKEMODR_RULESUI__
+
+#include <QObject>
+#include <QWidget>
+#include "../general/Exception.h"
+#include "../pokemod/Rules.h"
+#include "ui_rules.h"
+
+class RulesUI : public QWidget, private Ui::formRules
+{
+ Q_OBJECT
+
+ public:
+ RulesUI(Rules& r, QWidget* parent = 0);
+ public slots:
+ void on_buttonApply_clicked();
+ void on_buttonDiscard_clicked();
+ void on_boxGenders_toggled(const bool g);
+ void on_varBreeding_toggled(const bool b) throw(Exception);
+ 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_varMaxPartySize_valueChanged(const int m) throw(BoundsException);
+ void on_varMaxFight_valueChanged(const int m) throw(BoundsException);
+ void on_varMaxMoves_valueChanged(const int m) throw(BoundsException);
+ void on_varMaxLevel_valueChanged(const int m) throw(BoundsException);
+ void on_varMaxMoney_valueChanged(const int m);
+ void on_boxHardCash_toggled(const int h);
+ void on_boxSplitSpecial_toggled(const bool s);
+ void on_varSplitSpecialDV_toggled(const bool s);
+ void on_varMaxDV_currentIndexChanged(const QString& m) throw(BoundsException);
+ 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 int e);
+ void on_varMaxEV_valueChanged(const int m) throw(Exception);
+ void on_varMaxEVPerStat_valueChanged(const int m) throw(Exception);
+ void on_varPokerusNum_valueChanged(const int p) throw(Exception);
+ void on_varPokerusDenom_valueChanged(const int p) throw(Exception);
+ private:
+ void setGui();
+
+ Rules rules;
+ Rules rules_mod;
+
+ friend class Object;
+};
+
+#endif
diff --git a/pokemodr/gui/rules.ui b/pokemodr/gui/rules.ui
index 473ec1a6..8be92e27 100644
--- a/pokemodr/gui/rules.ui
+++ b/pokemodr/gui/rules.ui
@@ -40,9 +40,9 @@
</widget>
</item>
<item>
- <widget class="KTabWidget" name="notebookRules" >
+ <widget class="QTabWidget" name="notebookRules" >
<property name="currentIndex" >
- <number>2</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="tabGeneral" >
<attribute name="title" >
@@ -193,7 +193,7 @@
</widget>
</item>
<item>
- <widget class="KIntNumInput" name="varPokemonPerBox" >
+ <widget class="KIntNumInput" name="varBoxSize" >
<property name="label" >
<string>Box Size</string>
</property>
@@ -444,7 +444,7 @@
</widget>
</item>
<item>
- <widget class="KIntNumInput" name="varMaxSteps" >
+ <widget class="KIntNumInput" name="varNumSteps" >
<property name="toolTip" >
<string>The number of steps it takes to raise happiness by 1</string>
</property>
diff --git a/pokemodr/gui/time.ui b/pokemodr/gui/time.ui
index 9d6f0db3..358ac5ba 100644
--- a/pokemodr/gui/time.ui
+++ b/pokemodr/gui/time.ui
@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>226</width>
- <height>316</height>
+ <width>191</width>
+ <height>234</height>
</rect>
</property>
<layout class="QVBoxLayout" >
@@ -65,34 +65,15 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KIntNumInput" name="varHour" >
- <property name="toolTip" >
- <string>Hour the time period starts</string>
- </property>
- <property name="label" >
- <string>Hour</string>
- </property>
- <property name="minimum" >
- <number>0</number>
- </property>
- <property name="maximum" >
- <number>23</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntNumInput" name="varMinute" >
- <property name="toolTip" >
- <string>Minute the time period starts</string>
- </property>
- <property name="label" >
- <string>Minute</string>
+ <widget class="QTimeEdit" name="varTime" >
+ <property name="wrapping" >
+ <bool>true</bool>
</property>
- <property name="minimum" >
- <number>0</number>
+ <property name="accelerated" >
+ <bool>true</bool>
</property>
- <property name="maximum" >
- <number>59</number>
+ <property name="displayFormat" >
+ <string>hh:mm</string>
</property>
</widget>
</item>
@@ -116,11 +97,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>
diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro
index d1ffe65e..b2991a5c 100644
--- a/pokemodr/pokemodr.pro
+++ b/pokemodr/pokemodr.pro
@@ -1,7 +1,7 @@
OBJECTS_DIR = ../../obj/pokemodr
DESTDIR = ../../bin
TEMPLATE = app
-LIBS += -L../../lib -lgeneral -lpokemod -laudio
+LIBS += -L/usr/lib64/kde4/devel -lkdecore -lkdeui -L../../lib -lgeneral -lpokemod
CONFIG += qt gui warn_on dll