summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog11
-rw-r--r--general/BugCatcher.h9
-rw-r--r--general/Exception.h4
-rw-r--r--pokemod/Dialog.cpp2
-rw-r--r--pokemod/Rules.cpp2
-rw-r--r--pokemodr/PokeModrUI.cpp14
-rw-r--r--pokemodr/PokeModrUI.h4
-rw-r--r--pokemodr/RulesUI.cpp34
-rw-r--r--pokemodr/RulesUI.h24
-rw-r--r--pokemodr/gui/pokemodr.ui2
10 files changed, 62 insertions, 44 deletions
diff --git a/Changelog b/Changelog
index be4e33c4..166c7b59 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,15 @@
-----------------
+Rev: 42
+Date: 23 January 2008
+User: MathStuf
+-----------------
+[FIX] BugCatcher now asks if the user wants to open KBugReport
+[FIX] Exception members are now const
+[FIX] map was uninitialized in Dialog validation
+[FIX] (un)setting Breeding in Rules
+[FIX] GUI now works (though with QMainWindow and QTabWidget in Rules)
+
+-----------------
Rev: 41
Date: 23 January 2008
User: MathStuf
diff --git a/general/BugCatcher.h b/general/BugCatcher.h
index ba002634..9b629a0c 100644
--- a/general/BugCatcher.h
+++ b/general/BugCatcher.h
@@ -25,10 +25,9 @@
#include <kaboutdata.h>
#include <kbugreport.h>
+#include <kmessagebox.h>
#include "Exception.h"
-#include <iostream>
-
class BugCatcher
{
public:
@@ -42,13 +41,11 @@ class BugCatcher
}
static void report(const Exception& e)
{
- std::cout << "FOOBAR" << std::endl;
if (!about)
return;
- std::cout << "FOOBAR" << std::endl;
KBugReport bug(NULL, true, about);
- bug.setMessageBody(e.getMsg());
- bug.exec();
+ if (KMessageBox::questionYesNo(&bug, "Missed an error catching spot. Please email me (MathStuf@gmail.com) with the error and \"PokeModr - error\" as the subject.", e.getMsg()) == KMessageBox::Yes)
+ bug.exec();
}
private:
static KAboutData* about;
diff --git a/general/Exception.h b/general/Exception.h
index 29d31115..ea8b314a 100644
--- a/general/Exception.h
+++ b/general/Exception.h
@@ -39,8 +39,8 @@ class Exception
return QString("%1: %2").arg(cls).arg(error);
}
private:
- QString cls;
- QString error;
+ const QString cls;
+ const QString error;
};
class UnusedException : public Exception
diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp
index a907fb2b..b1c164f3 100644
--- a/pokemod/Dialog.cpp
+++ b/pokemod/Dialog.cpp
@@ -120,7 +120,7 @@ bool Dialog::validate() const
unsigned tempU = arg.toUInt(&okU);
unsigned long tempUL = arg.toULong(&okUL);
unsigned invError = 0;
- const Map* map;
+ const Map* map = NULL;
++numArgs;
switch (curCmd)
{
diff --git a/pokemod/Rules.cpp b/pokemod/Rules.cpp
index 48f885b5..7f031eb6 100644
--- a/pokemod/Rules.cpp
+++ b/pokemod/Rules.cpp
@@ -188,7 +188,7 @@ void Rules::setGenderAllowed(const bool g)
void Rules::setBreedingAllowed(const bool b) throw(Exception)
{
- if (!genderAllowed)
+ if (b && !genderAllowed)
throw(Exception(className, "cannot breed without genders"));
breedingAllowed = b;
}
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index f43f4f5e..d36f5977 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -28,19 +28,20 @@
#include "../general/Exception.h"
#include "PokeModrUI.h"
+#include <iostream>
#include "../pokemod/Pokemod.h"
#include "RulesUI.h"
PokeModrUI::PokeModrUI(KConfigGroup cfg, KConfigGroup history, QWidget* parent) :
- KMainWindow(parent),
+ QMainWindow(parent),
recent("&Recent Files...", NULL)
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- recent.loadEntries(history);
- menuBar()->addMenu(helpMenu("", false));
- restoreWindowSize(cfg);
- cfg.readEntry("splitterPos", QVariant(100));
+// recent.loadEntries(history);
+// menuBar()->addMenu(helpMenu("", false));
+// restoreWindowSize(cfg);
+// cfg.readEntry("splitterPos", QVariant(100));
// if (cfg.readEntry("reloadOnStart", QVariant(false)).toBool())
// open(recent.urls().at(0));
@@ -49,10 +50,11 @@ PokeModrUI::PokeModrUI(KConfigGroup cfg, KConfigGroup history, QWidget* parent)
try
{
Pokemod foo;
- RulesUI(foo.getRules(), formPanel);
+ formPanel->setViewport(new RulesUI(foo.getRules()));
}
catch (Exception& e)
{
+ std::cout << e.getMsg().toStdString();
BugCatcher::report(e);
}
}
diff --git a/pokemodr/PokeModrUI.h b/pokemodr/PokeModrUI.h
index 6925a51f..1b576492 100644
--- a/pokemodr/PokeModrUI.h
+++ b/pokemodr/PokeModrUI.h
@@ -24,12 +24,14 @@
#define __POKEMODR_POKEMODRUI__
#include <kconfiggroup.h>
+#include <kmainwindow.h>
#include <krecentfilesaction.h>
+#include <QMainWindow>
#include <QObject>
#include <QWidget>
#include "ui_pokemodr.h"
-class PokeModrUI : public KMainWindow, private Ui::formPokeModr
+class PokeModrUI : public QMainWindow, private Ui::formPokeModr
{
Q_OBJECT
diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp
index 0d729ff5..de1cf584 100644
--- a/pokemodr/RulesUI.cpp
+++ b/pokemodr/RulesUI.cpp
@@ -52,6 +52,7 @@ void RulesUI::setGui()
varBoxes->setValue(rules_mod.getNumBoxes());
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());
@@ -67,20 +68,24 @@ void RulesUI::setGui()
boxEffortValues->setChecked(rules_mod.getEffortValuesAllowed() ? Qt::Checked : Qt::Unchecked);
varMaxEV->setValue(rules_mod.getMaxTotalEV());
varMaxEVPerStat->setValue(rules_mod.getMaxEVPerStat());
+ varMaxEVPerStat->setMaximum(rules_mod.getMaxTotalEV());
varPokerusNum->setValue(rules_mod.getPokerusChance().getNum());
varPokerusDenom->setValue(rules_mod.getPokerusChance().getDenom());
+ varPokerusNum->setMaximum(rules_mod.getPokerusChance().getDenom() - 1);
}
void RulesUI::on_buttonApply_clicked()
{
rules = rules_mod;
changed = false;
+ setGui();
}
void RulesUI::on_buttonDiscard_clicked()
{
rules_mod = rules;
changed = false;
+ setGui();
}
void RulesUI::on_boxGenders_toggled(const bool g)
@@ -91,7 +96,7 @@ void RulesUI::on_boxGenders_toggled(const bool g)
changed = true;
}
-void RulesUI::on_varBreeding_toggled(const bool b) throw(Exception)
+void RulesUI::on_varBreeding_toggled(const bool b)
{
try
{
@@ -141,16 +146,16 @@ void RulesUI::on_varBoxSize_valueChanged(const int b)
changed = true;
}
-void RulesUI::on_varMaxPartySize_valueChanged(const int m) throw(BoundsException)
+void RulesUI::on_varMaxParty_valueChanged(const int m)
{
- if (rules_mod.getMaxFight() < unsigned(m))
+ if (unsigned(m) < rules_mod.getMaxFight())
varMaxFight->setValue(m);
rules_mod.setMaxParty(m);
varMaxFight->setMaximum(m);
changed = true;
}
-void RulesUI::on_varMaxFight_valueChanged(const int m) throw(BoundsException)
+void RulesUI::on_varMaxFight_valueChanged(const int m)
{
try
{
@@ -159,11 +164,12 @@ void RulesUI::on_varMaxFight_valueChanged(const int m) throw(BoundsException)
}
catch (BoundsException& e)
{
+ BugCatcher::report(e);
setGui();
}
}
-void RulesUI::on_varMaxMoves_valueChanged(const int m) throw(BoundsException)
+void RulesUI::on_varMaxMoves_valueChanged(const int m)
{
try
{
@@ -177,7 +183,7 @@ void RulesUI::on_varMaxMoves_valueChanged(const int m) throw(BoundsException)
}
}
-void RulesUI::on_varMaxLevel_valueChanged(const int m) throw(BoundsException)
+void RulesUI::on_varMaxLevel_valueChanged(const int m)
{
try
{
@@ -197,7 +203,7 @@ void RulesUI::on_varMaxMoney_valueChanged(const int m)
changed = true;
}
-void RulesUI::on_boxHardCash_toggled(const int h)
+void RulesUI::on_boxHardCash_toggled(const bool h)
{
rules_mod.setHardCash(h);
changed = true;
@@ -217,7 +223,7 @@ void RulesUI::on_varSplitSpecialDV_toggled(const bool s)
changed = true;
}
-void RulesUI::on_varMaxDV_currentIndexChanged(const QString& m) throw(BoundsException)
+void RulesUI::on_varMaxDV_currentIndexChanged(const QString& m)
{
try
{
@@ -260,28 +266,28 @@ void RulesUI::on_varNumSteps_valueChanged(const int n)
changed = true;
}
-void RulesUI::on_boxEffortValues_toggled(const int e)
+void RulesUI::on_boxEffortValues_toggled(const bool e)
{
rules_mod.setEffortValuesAllowed(e);
changed = true;
}
-void RulesUI::on_varMaxEV_valueChanged(const int m) throw(Exception)
+void RulesUI::on_varMaxEV_valueChanged(const int m)
{
- if (rules_mod.getMaxEVPerStat() < unsigned(m))
+ if (unsigned(m) < rules_mod.getMaxEVPerStat())
varMaxEVPerStat->setValue(m);
rules_mod.setMaxTotalEV(m);
varMaxEVPerStat->setMaximum(m);
changed = true;
}
-void RulesUI::on_varMaxEVPerStat_valueChanged(const int m) throw(Exception)
+void RulesUI::on_varMaxEVPerStat_valueChanged(const int m)
{
rules_mod.setMaxEVPerStat(m);
changed = true;
}
-void RulesUI::on_varPokerusNum_valueChanged(const int p) throw(Exception)
+void RulesUI::on_varPokerusNum_valueChanged(const int p)
{
try
{
@@ -296,7 +302,7 @@ void RulesUI::on_varPokerusNum_valueChanged(const int p) throw(Exception)
}
}
-void RulesUI::on_varPokerusDenom_valueChanged(const int p) throw(Exception)
+void RulesUI::on_varPokerusDenom_valueChanged(const int p)
{
try
{
diff --git a/pokemodr/RulesUI.h b/pokemodr/RulesUI.h
index 854f2f4e..e5b6c9d0 100644
--- a/pokemodr/RulesUI.h
+++ b/pokemodr/RulesUI.h
@@ -42,31 +42,31 @@ class RulesUI : public QWidget, private Ui::formRules
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_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_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_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 int h);
+ 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 QString& m) throw(BoundsException);
+ void on_varMaxDV_currentIndexChanged(const QString& 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 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);
+ 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);
private:
void setGui();
diff --git a/pokemodr/gui/pokemodr.ui b/pokemodr/gui/pokemodr.ui
index 6536a1c9..ca69fdfe 100644
--- a/pokemodr/gui/pokemodr.ui
+++ b/pokemodr/gui/pokemodr.ui
@@ -1,6 +1,6 @@
<ui version="4.0" >
<class>formPokeModr</class>
- <widget class="KMainWindow" name="mainWindow" >
+ <widget class="QMainWindow" name="mainWindow" >
<property name="geometry" >
<rect>
<x>0</x>