summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-07-26 21:15:33 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-07-26 21:15:33 +0000
commit227d31690824c44d4e92dc4fed07a8c43ea8cfb9 (patch)
treed670b44e51da56d0f232e99a4270648b51164640
parente260085a116271e49c3d1d835eac1df70424f4c6 (diff)
[FIX] Fixed an infinite loop in Fraction::reduce
[FIX] FractionWidget's behavior is now an enum [FIX] Fixed up some stuff in KAboutData for pokemodr [FIX] ScriptWidget value is set at construction now [DEL] Removed Pokemodr.h (nothing useful) git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@230 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--CMakeLists.txt1
-rw-r--r--Changelog11
-rw-r--r--pokemod/Fraction.cpp2
-rw-r--r--pokemodr/CMakeLists.txt4
-rw-r--r--pokemodr/FractionWidget.cpp10
-rw-r--r--pokemodr/FractionWidget.h16
-rw-r--r--pokemodr/Pokemodr.cpp18
-rw-r--r--pokemodr/Pokemodr.h25
-rw-r--r--pokemodr/PokemodrUI.cpp7
-rw-r--r--pokemodr/PokemodrUI.h2
-rw-r--r--pokemodr/ScriptWidget.cpp4
-rw-r--r--pokemodr/gui/badge.ui2
-rw-r--r--pokemodr/gui/move.ui2
-rw-r--r--pokemodr/gui/nature.ui2
-rw-r--r--pokemodr/gui/pokemod.ui2
-rw-r--r--pokemodr/gui/species.ui6
-rw-r--r--pokemodr/gui/type.ui2
17 files changed, 64 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8e4eb1e..6c7e9de8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,7 @@ SET(POKEGEN_VERSION
SET(POKEGEN_SOVERSION
"0"
)
+ADD_DEFINITIONS(-DVERSION=${POKEGEN_VERSION})
SET(BUILD_SHARED_LIBS
ON
diff --git a/Changelog b/Changelog
index ac2a5082..ddc56943 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,15 @@
-----------------
+Rev: 230
+Date: 26 July 2008
+User: MathStuf
+-----------------
+[FIX] Fixed an infinite loop in Fraction::reduce
+[FIX] FractionWidget's behavior is now an enum
+[FIX] Fixed up some stuff in KAboutData for pokemodr
+[FIX] ScriptWidget value is set at construction now
+[DEL] Removed Pokemodr.h (nothing useful)
+
+-----------------
Rev: 229
Date: 26 July 2008
User: MathStuf
diff --git a/pokemod/Fraction.cpp b/pokemod/Fraction.cpp
index 0d69a889..a3075775 100644
--- a/pokemod/Fraction.cpp
+++ b/pokemod/Fraction.cpp
@@ -20,6 +20,8 @@
void Pokemod::Fraction::reduce()
{
+ if (!m_numerator || !m_denominator)
+ return;
int i = m_numerator;
int j = m_denominator;
if (i < 0)
diff --git a/pokemodr/CMakeLists.txt b/pokemodr/CMakeLists.txt
index d8ce5883..8b4e3e11 100644
--- a/pokemodr/CMakeLists.txt
+++ b/pokemodr/CMakeLists.txt
@@ -178,15 +178,13 @@ SET(pokemodr_MOC_HEADERS
${pokemodr_MODEL_HEADERS}
)
QT4_WRAP_CPP(pokemodr_MOC_SRCS ${pokemodr_MOC_HEADERS})
-SET(pokemodr_MAIN_HEADERS
+SET(pokemodr_HEADERS
${pokemodr_WIDGET_HEADERS}
${pokemodr_MODEL_HEADERS}
- Pokemodr.h
)
SET(pokemodr_DEVEL
${pokemodr_MAIN_HEADERS}
${pokemodr_UI_HEADERS}
- Pokemodr.h
)
SET(pokemodr_WIDGET_SRCS
AbilityUI.cpp
diff --git a/pokemodr/FractionWidget.cpp b/pokemodr/FractionWidget.cpp
index f4df8a9a..16eac461 100644
--- a/pokemodr/FractionWidget.cpp
+++ b/pokemodr/FractionWidget.cpp
@@ -27,7 +27,7 @@ Pokemodr::FractionWidget::FractionWidget(QWidget* parent, const Pokemod::Fractio
setValue(value);
}
-int Pokemodr::FractionWidget::behavior() const
+Pokemodr::FractionWidget::Behavior Pokemodr::FractionWidget::behavior() const
{
return m_behavior;
}
@@ -37,10 +37,10 @@ Pokemod::Fraction Pokemodr::FractionWidget::value() const
return m_value;
}
-void Pokemodr::FractionWidget::setBehavior(const int behavior)
+void Pokemodr::FractionWidget::setBehavior(const Behavior behavior)
{
m_behavior = behavior;
- emit(valueChanged(m_value));
+ resetRanges();
}
void Pokemodr::FractionWidget::setValue(const Pokemod::Fraction& value)
@@ -71,12 +71,12 @@ void Pokemodr::FractionWidget::on_varDenominator_valueChanged(const int denomina
void Pokemodr::FractionWidget::resetRanges()
{
varNumerator->setValue(m_value.numerator());
- if (-1 < m_behavior)
+ if (m_behavior != Proper)
varNumerator->setMaximum(INT_MAX);
else
varNumerator->setMaximum(m_value.denominator());
varDenominator->setValue(m_value.denominator());
- if (m_behavior < 1)
+ if (m_behavior != Improper)
varDenominator->setMaximum(INT_MAX);
else
varDenominator->setMaximum(m_value.numerator());
diff --git a/pokemodr/FractionWidget.h b/pokemodr/FractionWidget.h
index 5b0ef944..7829aaf1 100644
--- a/pokemodr/FractionWidget.h
+++ b/pokemodr/FractionWidget.h
@@ -32,17 +32,25 @@ namespace Pokemodr
class FractionWidget : public QWidget, private Ui::formFraction
{
Q_OBJECT
- Q_PROPERTY(int behavior READ behavior WRITE setBehavior)
+ Q_PROPERTY(Behavior behavior READ behavior WRITE setBehavior)
+ Q_ENUMS(Behavior)
public:
+ enum Behavior
+ {
+ Proper = -1,
+ Any = 0,
+ Improper = 1
+ };
+
explicit FractionWidget(QWidget* parent, const Pokemod::Fraction& value = Pokemod::Fraction(1, 1));
- int behavior() const;
+ Behavior behavior() const;
Pokemod::Fraction value() const;
signals:
void valueChanged(const Pokemod::Fraction&);
public slots:
- void setBehavior(const int behavior);
+ void setBehavior(const Behavior behavior);
void setValue(const Pokemod::Fraction& value);
void updateValue();
@@ -52,7 +60,7 @@ class FractionWidget : public QWidget, private Ui::formFraction
void resetRanges();
private:
- int m_behavior;
+ Behavior m_behavior;
Pokemod::Fraction m_value;
};
}
diff --git a/pokemodr/Pokemodr.cpp b/pokemodr/Pokemodr.cpp
index bfee9d63..0f83f96e 100644
--- a/pokemodr/Pokemodr.cpp
+++ b/pokemodr/Pokemodr.cpp
@@ -15,9 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Header include
-#include "Pokemodr.h"
-
// Pokemodr includes
#include "PokemodrUI.h"
@@ -26,6 +23,8 @@
#include <KApplication>
#include <KCmdLineArgs>
+#define stringify(x) #x
+
static void messageHandler(QtMsgType type, const char* message)
{
switch (type)
@@ -49,13 +48,22 @@ int main(int argc, char* argv[])
{
qInstallMsgHandler(messageHandler);
- KAboutData about("pokemodr", "pokemodr", ki18n("Pokémodr"), VERSION_STRING, ki18n(""), KAboutData::License_Custom, ki18n("©2007-2008 Ben Boeckel"), ki18n("This program offers an easy interface so that Pokémods can be easily created."), "http://sourceforge.net/projects/pokegen");
+ // TODO: update to KAboutData::License_GPL_V3 (KDE 4.1)
+ KAboutData about("pokemodr", "pokemodr", ki18n("Pokémodr"), stringify(VERSION), ki18n(""), KAboutData::License_Unknown, ki18n("©2007-2008 Ben Boeckel"), ki18n("This program offers an easy interface so that Pokémods can be easily created."), "http://sourceforge.net/projects/pokegen");
about.setLicenseTextFile("LICENSE");
about.setProgramName(ki18n("Pokémodr"));
about.addAuthor(ki18n("Ben Boeckel"), ki18n("Lead Programmer"), "MathStuf@gmail.com", "");
about.addCredit(ki18n("Peter Fernandes"), ki18n("Ideas, "), "supersonicandtails@gmail.com", "http://www.hypersonicsoft.org");
about.addCredit(ki18n("Kevin Kofler"), ki18n("Qt, KDE, debugging help"), "kevin.kofler@chello.at", "http://www.tigen.org/kevin.kofler");
- about.addCredit(ki18n("Luke Greco"), ki18n("Ideas, debugging"), "sirlewk@gmail.com", "");
+ about.addCredit(ki18n("Luke Greco"), ki18n("Ideas, Tester"), "sirlewk@gmail.com", "");
+// about.addCredit(ki18n("Mike Roberts"), ki18n("Testing code, Tester"), "", "");
+ about.setBugAddress("http://sourceforge.net/tracker/?group_id=189309&atid=928809");
+ about.setCopyrightStatement(ki18n("©2007-2008, Ben Boeckel"));
+ about.setOrganizationDomain("");
+ // TODO: Need one of these...
+// about.setProgramLogo();
+ // TODO: And some of these...
+ about.setTranslator(ki18nc("NAME OF TRANSLATORS", "Your names"), ki18nc("EMAIL OF TRANSLATORS", "Your emails"));
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
diff --git a/pokemodr/Pokemodr.h b/pokemodr/Pokemodr.h
deleted file mode 100644
index 7ff0a99b..00000000
--- a/pokemodr/Pokemodr.h
+++ /dev/null
@@ -1,25 +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 __POKEMODR_MAIN__
-#define __POKEMODR_MAIN__
-
-#define VERSION_STRING "0.0.1"
-
-int main(int argc, char* argv[]);
-
-#endif
diff --git a/pokemodr/PokemodrUI.cpp b/pokemodr/PokemodrUI.cpp
index b3b45025..31c3567b 100644
--- a/pokemodr/PokemodrUI.cpp
+++ b/pokemodr/PokemodrUI.cpp
@@ -366,6 +366,11 @@ void Pokemodr::PokemodrUI::on_treePokemod_customContextMenuRequested(const QPoin
}
}
+void Pokemodr::PokemodrUI::showAboutApplication()
+{
+ // TODO: Need to make an about...
+}
+
void Pokemodr::PokemodrUI::setupActions()
{
KActionCollection* collection = new KActionCollection(this);
@@ -400,7 +405,7 @@ void Pokemodr::PokemodrUI::setupActions()
menuEdit->addSeparator();
menuEdit->addAction(preferences);
menubar->addMenu(menuEdit);
- menubar->addMenu(customHelpMenu(false));
+ menubar->addMenu(customHelpMenu());
setMenuBar(menubar);
KToolBar* toolbar = new KToolBar("toolbar", this, Qt::TopToolBarArea, false, true, true);
toolbar->addAction(openNew);
diff --git a/pokemodr/PokemodrUI.h b/pokemodr/PokemodrUI.h
index eb790562..1c7483aa 100644
--- a/pokemodr/PokemodrUI.h
+++ b/pokemodr/PokemodrUI.h
@@ -73,6 +73,8 @@ class PokemodrUI : public KMainWindow, private Ui::formPokemodr
void on_splitter_splitterMoved();
void on_treePokemod_clicked(const QModelIndex& index);
void on_treePokemod_customContextMenuRequested(const QPoint& position);
+
+ void showAboutApplication();
private:
void setupActions();
diff --git a/pokemodr/ScriptWidget.cpp b/pokemodr/ScriptWidget.cpp
index b6d5753a..456f5249 100644
--- a/pokemodr/ScriptWidget.cpp
+++ b/pokemodr/ScriptWidget.cpp
@@ -29,6 +29,7 @@
Pokemodr::ScriptWidget::ScriptWidget(QWidget* parent, const Pokemod::Script& value) :
QWidget(parent),
+ m_value(value),
m_document(NULL)
{
setupUi(this);
@@ -59,13 +60,14 @@ Pokemodr::ScriptWidget::ScriptWidget(QWidget* parent, const Pokemod::Script& val
m_view->action(KStandardAction::name(KStandardAction::Cut))->setShortcuts(QKeySequence::UnknownKey);
m_view->action(KStandardAction::name(KStandardAction::Copy))->setShortcuts(QKeySequence::UnknownKey);
m_view->action(KStandardAction::name(KStandardAction::PasteText))->setShortcuts(QKeySequence::UnknownKey);
- // FIXME: Needs KDE4 4.0.98 or higher (maybe less, but 98 should be enough)
+ // FIXME: Uncomment to get copy/paste to work in KatePart (KDE 4.1)
// QList<KActionCollection*> collections = KActionCollection::allCollections();
// foreach (KActionCollection* collection, collections)
// {
// // FIXME: Nothing else should have a Preferences action right?
// if (collection->action(KStandardAction::name(KStandardAction::Preferences)))
// {
+// // TODO: Works like crap since it doesnt check to see if the widget is focused
// connect(collection->action(KStandardAction::name(KStandardAction::Cut)), SIGNAL(triggered()), m_view->action(KStandardAction::name(KStandardAction::Cut)), SIGNAL(triggered()));
// connect(collection->action(KStandardAction::name(KStandardAction::Copy)), SIGNAL(triggered()), m_view->action(KStandardAction::name(KStandardAction::Copy)), SIGNAL(triggered()));
// connect(collection->action(KStandardAction::name(KStandardAction::PasteText)), SIGNAL(triggered()), m_view->action(KStandardAction::name(KStandardAction::PasteText)), SIGNAL(triggered()));
diff --git a/pokemodr/gui/badge.ui b/pokemodr/gui/badge.ui
index 74cc80df..17435471 100644
--- a/pokemodr/gui/badge.ui
+++ b/pokemodr/gui/badge.ui
@@ -193,7 +193,7 @@
<item>
<widget class="Pokemodr::FractionWidget" name="varStatMultiplier" >
<property name="behavior" >
- <number>1</number>
+ <enum>Pokemodr::FractionWidget::Improper</enum>
</property>
</widget>
</item>
diff --git a/pokemodr/gui/move.ui b/pokemodr/gui/move.ui
index 7a7ee446..68699499 100644
--- a/pokemodr/gui/move.ui
+++ b/pokemodr/gui/move.ui
@@ -66,7 +66,7 @@
<item>
<widget class="Pokemodr::FractionWidget" name="varAccuracy" >
<property name="behavior" >
- <number>-1</number>
+ <enum>Pokemodr::FractionWidget::Proper</enum>
</property>
</widget>
</item>
diff --git a/pokemodr/gui/nature.ui b/pokemodr/gui/nature.ui
index 43e6f25b..d9f0681e 100644
--- a/pokemodr/gui/nature.ui
+++ b/pokemodr/gui/nature.ui
@@ -73,7 +73,7 @@
<item>
<widget class="Pokemodr::FractionWidget" name="varStatMultiplier" >
<property name="behavior" >
- <number>1</number>
+ <enum>Pokemodr::FractionWidget::Improper</enum>
</property>
</widget>
</item>
diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui
index 5cc04245..f066110d 100644
--- a/pokemodr/gui/pokemod.ui
+++ b/pokemodr/gui/pokemod.ui
@@ -194,7 +194,7 @@
<string>Multiplier for attacks of the attacking type against the defending type</string>
</property>
<property name="behavior" >
- <number>0</number>
+ <enum>Pokemodr::FractionWidget::Any</enum>
</property>
</widget>
</item>
diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui
index f36c4d6e..d745deb8 100644
--- a/pokemodr/gui/species.ui
+++ b/pokemodr/gui/species.ui
@@ -77,7 +77,7 @@
<item>
<widget class="Pokemodr::FractionWidget" name="varRunChance" >
<property name="behavior" >
- <number>-1</number>
+ <enum>Pokemodr::FractionWidget::Proper</enum>
</property>
</widget>
</item>
@@ -102,7 +102,7 @@
<item>
<widget class="Pokemodr::FractionWidget" name="varFleeChance" >
<property name="behavior" >
- <number>-1</number>
+ <enum>Pokemodr::FractionWidget::Proper</enum>
</property>
</widget>
</item>
@@ -127,7 +127,7 @@
<item>
<widget class="Pokemodr::FractionWidget" name="varItemChance" >
<property name="behavior" >
- <number>-1</number>
+ <enum>Pokemodr::FractionWidget::Proper</enum>
</property>
</widget>
</item>
diff --git a/pokemodr/gui/type.ui b/pokemodr/gui/type.ui
index 635a6b73..c5c5c0e4 100644
--- a/pokemodr/gui/type.ui
+++ b/pokemodr/gui/type.ui
@@ -45,7 +45,7 @@
<item>
<widget class="Pokemodr::FractionWidget" name="varSTAB" >
<property name="behavior" >
- <number>1</number>
+ <enum>Pokemodr::FractionWidget::Improper</enum>
</property>
</widget>
</item>