summaryrefslogtreecommitdiffstats
path: root/pokemodr
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr')
-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
6 files changed, 371 insertions, 38 deletions
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