diff options
-rw-r--r-- | Changelog | 8 | ||||
-rw-r--r-- | general/BugCatcher.h | 2 | ||||
-rw-r--r-- | general/Exception.h | 2 | ||||
-rw-r--r-- | general/FracWidget.cpp | 85 | ||||
-rw-r--r-- | general/FracWidget.h | 54 | ||||
-rw-r--r-- | general/PointWidget.cpp | 56 | ||||
-rw-r--r-- | general/PointWidget.h | 50 | ||||
-rw-r--r-- | general/TODO | 1 | ||||
-rw-r--r-- | general/general.pro | 9 | ||||
-rw-r--r-- | general/gui/frac.ui | 48 | ||||
-rw-r--r-- | general/gui/point.ui | 53 | ||||
-rw-r--r-- | pokemod/Nature.h | 4 | ||||
-rw-r--r-- | pokemod/TODO | 3 |
13 files changed, 369 insertions, 6 deletions
@@ -1,4 +1,12 @@ ----------------- +Rev: 98 +Date: 16 April 2008 +User: MathStuf +----------------- +[ADD] Added Frac and Point widgets to general +[FIX] Minor fixes + +----------------- Rev: 97 Date: 15 April 2008 User: MathStuf diff --git a/general/BugCatcher.h b/general/BugCatcher.h index 8d1bc1e0..4664be0e 100644 --- a/general/BugCatcher.h +++ b/general/BugCatcher.h @@ -42,7 +42,7 @@ class BugCatcher if (!m_aboutData) return; KBugReport bug(NULL, true, m_aboutData); - if (KMessageBox::questionYesNo(&bug, "Missed an error catching spot. Please email me (MathStuf@gmail.com) with the error and \"PokeModr - error\" as the subject.", exception.getMsg()) == KMessageBox::Yes) + if (KMessageBox::questionYesNo(&bug, "Missed an error catching spot. Please email me (MathStuf@gmail.com) with the error and \"PokeModr - error\" as the subject.", exception.message()) == KMessageBox::Yes) bug.exec(); } private: diff --git a/general/Exception.h b/general/Exception.h index c5eacd4e..96788567 100644 --- a/general/Exception.h +++ b/general/Exception.h @@ -30,7 +30,7 @@ class Exception { } - QString getMsg() const + QString message() const { return QString("%1: %2").arg(m_className).arg(m_error); } diff --git a/general/FracWidget.cpp b/general/FracWidget.cpp new file mode 100644 index 00000000..a131c82f --- /dev/null +++ b/general/FracWidget.cpp @@ -0,0 +1,85 @@ +/* + * 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 <QMetaObject> +#include <QString> + +// Header include +#include "FracWidget.h" + +FracWidget::FracWidget(const Frac& value, QWidget* parent) : + QWidget(parent), + m_behavior(-1), + m_value(value) +{ + setupUi(this); + QMetaObject::connectSlotsByName(this); + connect(this, SIGNAL(changed(bool)), SLOT(updateValue())); +} + +void FracWidget::setBehavior(const int behavior) +{ + m_behavior = behavior; + m_value = Frac(1, 1); + varDenominator->setValue(1); + varNumerator->setValue(1); + emit(changed(true)); +} + +void FracWidget::setValue(const Frac& value) +{ + m_value = value; + varDenominator->setValue(m_value.denominator()); + varNumerator->setValue(m_value.numerator()); + emit(changed(true)); +} + +int FracWidget::behavior() const +{ + return m_behavior; +} + +Frac FracWidget::value() const +{ + return m_value; +} + +void FracWidget::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)); +} + +void FracWidget::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)); +} + +void FracWidget::updateValue() +{ + varValue->setText(QString::number(m_value, 'g', 7)); +} diff --git a/general/FracWidget.h b/general/FracWidget.h new file mode 100644 index 00000000..0bb98d7e --- /dev/null +++ b/general/FracWidget.h @@ -0,0 +1,54 @@ +/* + * 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 __FRACWIDGET__ +#define __FRACWIDGET__ + +// Qt includes +#include <QObject> +#include <QWidget> + +// General includes +#include "Frac.h" + +// Form include +#include "ui_frac.h" + +class FracWidget : public QWidget, private Ui::formFrac +{ + Q_OBJECT + + public: + FracWidget(const Frac& value, QWidget* parent); + + void setBehavior(const int behavior); + void setValue(const Frac& value); + + int behavior() const; + Frac value() const; + signals: + void changed(bool); + 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; +}; + +#endif diff --git a/general/PointWidget.cpp b/general/PointWidget.cpp new file mode 100644 index 00000000..571db71d --- /dev/null +++ b/general/PointWidget.cpp @@ -0,0 +1,56 @@ +/* + * 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 <QMetaObject> +#include <QString> + +// Header include +#include "PointWidget.h" + +PointWidget::PointWidget(const Point& value, QWidget* parent) : + QWidget(parent), + m_value(value) +{ + setupUi(this); + QMetaObject::connectSlotsByName(this); +} + +void PointWidget::setValue(const Point& value) +{ + m_value = value; + varX->setValue(m_value.x()); + varY->setValue(m_value.y()); + emit(changed(true)); +} + +Point PointWidget::value() const +{ + return m_value; +} + +void PointWidget::on_varX_valueChanged(const int& x) +{ + m_value.setX(x); + emit(changed(true)); +} + +void PointWidget::on_varY_valueChanged(const int& y) +{ + m_value.setY(y); + emit(changed(true)); +} diff --git a/general/PointWidget.h b/general/PointWidget.h new file mode 100644 index 00000000..3519679d --- /dev/null +++ b/general/PointWidget.h @@ -0,0 +1,50 @@ +/* + * 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 __POINTWIDGET__ +#define __POINTWIDGET__ + +// Qt includes +#include <QObject> +#include <QWidget> + +// General includes +#include "Point.h" + +// Form include +#include "ui_point.h" + +class PointWidget : public QWidget, private Ui::formPoint +{ + Q_OBJECT + + public: + PointWidget(const Point& value, QWidget* parent); + + void setValue(const Point& value); + + Point value() const; + signals: + void changed(bool); + public slots: + void on_varX_valueChanged(const int& x); + void on_varY_valueChanged(const int& y); + private: + Point m_value; +}; + +#endif diff --git a/general/TODO b/general/TODO index e69de29b..ccc403c1 100644 --- a/general/TODO +++ b/general/TODO @@ -0,0 +1 @@ +FlagWidget diff --git a/general/general.pro b/general/general.pro index 1b774ecf..4f55f095 100644 --- a/general/general.pro +++ b/general/general.pro @@ -1,5 +1,6 @@ TEMPLATE = lib OBJECTS_DIR = .obj +UI_DIR = .ui MOC_DIR = .moc DESTDIR = ../../bin LIBS += -lphonon -lkdeui -lkdecore @@ -51,6 +52,7 @@ SOURCES += Audio.cpp \ BugCatcher.cpp \ Flag.cpp \ Frac.cpp \ + FracWidget.cpp \ ImageCache.cpp \ Ini.cpp @@ -59,11 +61,16 @@ HEADERS += Audio.h \ Exception.h \ Flag.h \ Frac.h \ + FracWidget.h \ Hat.h \ ImageCache.h \ Ini.h \ Matrix.h \ - Point.h + Point.h \ + PointWidget.h + +FORMS += gui/frac.ui \ + gui/point.ui INSTALLS += target target.path = /usr/lib`kde4-config --libsuffix` diff --git a/general/gui/frac.ui b/general/gui/frac.ui new file mode 100644 index 00000000..2b410a47 --- /dev/null +++ b/general/gui/frac.ui @@ -0,0 +1,48 @@ +<ui version="4.0" > + <class>formFrac</class> + <widget class="QWidget" name="formFrac" > + <layout class="QVBoxLayout" > + <item> + <widget class="KLineEdit" name="varValue" > + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="KIntNumInput" name="varNumerator" > + <property name="label" > + <string>Numerator</string> + </property> + <property name="minimum" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="KIntNumInput" name="varDenominator" > + <property name="label" > + <string>Denominator</string> + </property> + <property name="minimum" > + <number>1</number> + </property> + </widget> + </item> + </layout> + </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> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/general/gui/point.ui b/general/gui/point.ui new file mode 100644 index 00000000..d310ae96 --- /dev/null +++ b/general/gui/point.ui @@ -0,0 +1,53 @@ +<ui version="4.0" > + <class>formPoint</class> + <widget class="QWidget" name="formPoint" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>128</width> + <height>112</height> + </rect> + </property> + <property name="windowTitle" > + <string/> + </property> + <layout class="QVBoxLayout" > + <item> + <widget class="KIntNumInput" name="varX" > + <property name="label" > + <string>x</string> + </property> + <property name="minimum" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="KIntNumInput" name="varY" > + <property name="label" > + <string>y</string> + </property> + <property name="value" > + <number>0</number> + </property> + <property name="minimum" > + <number>0</number> + </property> + <property name="referencePoint" > + <number>0</number> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>KIntNumInput</class> + <extends>QWidget</extends> + <header>knuminput.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/pokemod/Nature.h b/pokemod/Nature.h index b4c4319a..47bcb2d4 100644 --- a/pokemod/Nature.h +++ b/pokemod/Nature.h @@ -27,9 +27,7 @@ // Pokemod includes #include "Object.h" - -// Forward declarations -class Pokemod; +#include "Pokemod.h" class Nature : public Object { diff --git a/pokemod/TODO b/pokemod/TODO index b94e6e1f..cb1977d0 100644 --- a/pokemod/TODO +++ b/pokemod/TODO @@ -2,8 +2,11 @@ MoveEffects (Validation, GSC+) Figure out what makes 2 PokéMods incompatable
+Validation crap
+
General cleanup
Frac range checking where needed
+Trainer AI stuff
Refactor whatever possible
cleanup of subclasses
|