summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-30 20:38:35 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-30 20:38:35 +0000
commit6ffec6899f70ecffe5f1584adbf680f43d6ea662 (patch)
tree3b94f67c2c5d54f524c9b84809cdd3cb226f6748
parent539cee929d3a04a655a4f63801de1ab6d392886a (diff)
downloadsigen-6ffec6899f70ecffe5f1584adbf680f43d6ea662.tar.gz
sigen-6ffec6899f70ecffe5f1584adbf680f43d6ea662.tar.xz
sigen-6ffec6899f70ecffe5f1584adbf680f43d6ea662.zip
[FIX] Fixed up some FractionWidget code
[FIX] Got rid of more unneeded enumerations [FIX] MoveUI fixed up a bit git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@186 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog9
-rw-r--r--pokemod/Pokemod.cpp1
-rw-r--r--pokemod/Pokemod.h12
-rw-r--r--pokemodr/FractionWidget.cpp33
-rw-r--r--pokemodr/FractionWidget.h3
-rw-r--r--pokemodr/MoveUI.cpp2
-rw-r--r--pokemodr/PokeModrUI.cpp2
-rw-r--r--pokemodr/gui/badge.ui8
-rw-r--r--pokemodr/gui/item.ui2
-rw-r--r--pokemodr/gui/mapeffect.ui4
-rw-r--r--pokemodr/gui/nature.ui2
-rw-r--r--pokemodr/gui/pokemod.ui41
-rw-r--r--pokemodr/gui/species.ui26
-rw-r--r--pokemodr/gui/sprite.ui4
-rw-r--r--pokemodr/gui/tile.ui4
-rw-r--r--pokemodr/gui/trainer.ui4
-rw-r--r--pokemodr/gui/type.ui2
17 files changed, 72 insertions, 87 deletions
diff --git a/Changelog b/Changelog
index 2f5cd306..6815c631 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,13 @@
-----------------
+Rev: 186
+Date: 28 May 2008
+User: MathStuf
+-----------------
+[FIX] Fixed up some FractionWidget code
+[FIX] Got rid of more unneeded enumerations
+[FIX] MoveUI fixed up a bit
+
+-----------------
Rev: 185
Date: 28 May 2008
User: MathStuf
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index dd342ce7..88d244dc 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -49,7 +49,6 @@
const QStringList Pokemod::StatRBYStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special" << "Special" << "Accuracy" << "Evasion";
const QStringList Pokemod::StatGSCStr = QStringList() << "HP" << "Attack" << "Defense" << "Speed" << "Special Attack" << "Special Defense" << "Accuracy" << "Evasion";
const QStringList Pokemod::DirectionStr = QStringList() << "Up" << "Down" << "Left" << "Right" << "None";
-const QStringList Pokemod::RelativeStr = QStringList() << "Less" << "Less or Equal" << "Greater or Equal" << "Greater" << "Equal" << "Not Equal";
Pokemod::Pokemod() :
Object("Pokemod", NULL, 0),
diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h
index 522f5a49..3ebcb746 100644
--- a/pokemod/Pokemod.h
+++ b/pokemod/Pokemod.h
@@ -90,18 +90,6 @@ class Pokemod : public Object
};
static const QStringList DirectionStr;
- enum Relative
- {
- REL_Less = 0,
- REL_LessOrEqual = 1,
- REL_GreaterOrEqual = 2,
- REL_Greater = 3,
- REL_Equal = 4,
- REL_NotEqual = 5,
- REL_End = 6
- };
- static const QStringList RelativeStr;
-
Pokemod();
Pokemod(const Pokemod& pokemod);
Pokemod(const QDomElement& xml);
diff --git a/pokemodr/FractionWidget.cpp b/pokemodr/FractionWidget.cpp
index 371af316..1b9171f3 100644
--- a/pokemodr/FractionWidget.cpp
+++ b/pokemodr/FractionWidget.cpp
@@ -23,6 +23,7 @@ FractionWidget::FractionWidget(QWidget* parent, const Fraction& value) :
{
setupUi(this);
connect(this, SIGNAL(valueChanged(const Fraction&)), SLOT(updateValue()));
+ connect(this, SIGNAL(valueChanged(const Fraction&)), SLOT(resetRanges()));
setValue(value);
}
@@ -49,38 +50,34 @@ void FractionWidget::setValue(const Fraction& value)
m_value = value;
varDenominator->setValue(m_value.denominator());
varNumerator->setValue(m_value.numerator());
- if (-1 < m_behavior)
- varNumerator->setMaximum(INT_MAX);
- else
- varNumerator->setMaximum(m_value.denominator());
- if (m_behavior < 1)
- varDenominator->setMaximum(INT_MAX);
- else
- varDenominator->setMaximum(m_value.numerator());
emit(valueChanged(m_value));
}
+void FractionWidget::updateValue()
+{
+ varValue->setText(QString::number(m_value, 'g', 7));
+}
+
void FractionWidget::on_varNumerator_valueChanged(const int numerator)
{
m_value.setNumerator(numerator);
- if (m_behavior < 1)
- varDenominator->setMaximum(INT_MAX);
- else
- varDenominator->setMaximum(m_value.numerator());
emit(valueChanged(m_value));
}
void FractionWidget::on_varDenominator_valueChanged(const int denominator)
{
m_value.setDenominator(denominator);
- if (-1 < m_behavior)
- varNumerator->setMaximum(INT_MAX);
- else
- varNumerator->setMaximum(m_value.denominator());
emit(valueChanged(m_value));
}
-void FractionWidget::updateValue()
+void FractionWidget::resetRanges()
{
- varValue->setText(QString::number(m_value, 'g', 7));
+ if (-1 < m_behavior)
+ varNumerator->setMaximum(INT_MAX);
+ else
+ varNumerator->setMaximum(m_value.denominator());
+ if (m_behavior < 1)
+ varDenominator->setMaximum(INT_MAX);
+ else
+ varDenominator->setMaximum(m_value.numerator());
}
diff --git a/pokemodr/FractionWidget.h b/pokemodr/FractionWidget.h
index f20e8dc9..b989d1c3 100644
--- a/pokemodr/FractionWidget.h
+++ b/pokemodr/FractionWidget.h
@@ -30,6 +30,7 @@
class FractionWidget : public QWidget, private Ui::formFraction
{
Q_OBJECT
+ Q_PROPERTY(int behavior READ behavior WRITE setBehavior)
public:
FractionWidget(QWidget* parent, const Fraction& value = Fraction(1, 1));
@@ -46,6 +47,8 @@ class FractionWidget : public QWidget, private Ui::formFraction
protected slots:
void on_varNumerator_valueChanged(const int numerator);
void on_varDenominator_valueChanged(const int denominator);
+
+ void resetRanges();
private:
int m_behavior;
Fraction m_value;
diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp
index 4ce9216c..921ec34b 100644
--- a/pokemodr/MoveUI.cpp
+++ b/pokemodr/MoveUI.cpp
@@ -109,7 +109,9 @@ void MoveUI::on_varOverworld_toggled(const bool overworld)
void MoveUI::on_varDescription_textChanged(const QString& description)
{
+ const int cursor = varDescription->cursorPosition();
static_cast<Move*>(modified())->setDescription(description);
+ varName->setCursorPosition(cursor);
}
void MoveUI::on_varScript_valueChanged(const Script& script)
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index fd1ed594..debb95bf 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -186,7 +186,7 @@ bool PokeModrUI::savePokemod(const Pokemod* pokemod, const KUrl& url)
if (url.isLocalFile())
{
QFile file(url.path());
- if (file.open(QIODevice::ReadWrite))
+ if (file.open(QIODevice::WriteOnly))
{
file.write(Object::xml(pokemod).toByteArray());
treePokemod->setDirty(pokemod, false);
diff --git a/pokemodr/gui/badge.ui b/pokemodr/gui/badge.ui
index 85ebad21..60568d39 100644
--- a/pokemodr/gui/badge.ui
+++ b/pokemodr/gui/badge.ui
@@ -51,7 +51,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -74,7 +74,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -97,7 +97,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -132,7 +132,7 @@
<property name="toolTip" >
<string>The multiplier to the stat in-game battles</string>
</property>
- <property name="behavior" stdset="0" >
+ <property name="behavior" >
<number>1</number>
</property>
</widget>
diff --git a/pokemodr/gui/item.ui b/pokemodr/gui/item.ui
index 09113394..989fe497 100644
--- a/pokemodr/gui/item.ui
+++ b/pokemodr/gui/item.ui
@@ -102,7 +102,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
diff --git a/pokemodr/gui/mapeffect.ui b/pokemodr/gui/mapeffect.ui
index a4c4375a..f5beb3bd 100644
--- a/pokemodr/gui/mapeffect.ui
+++ b/pokemodr/gui/mapeffect.ui
@@ -51,7 +51,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -77,7 +77,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
diff --git a/pokemodr/gui/nature.ui b/pokemodr/gui/nature.ui
index 13271169..98aeb4f2 100644
--- a/pokemodr/gui/nature.ui
+++ b/pokemodr/gui/nature.ui
@@ -42,7 +42,7 @@
<property name="toolTip" >
<string>The multiplier of the stat</string>
</property>
- <property name="behavior" stdset="0" >
+ <property name="behavior" >
<number>1</number>
</property>
</widget>
diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui
index 5e173383..7d54564f 100644
--- a/pokemodr/gui/pokemod.ui
+++ b/pokemodr/gui/pokemod.ui
@@ -103,7 +103,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -129,7 +129,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -152,7 +152,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -174,7 +174,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -197,7 +197,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -219,7 +219,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -242,7 +242,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -264,7 +264,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -287,7 +287,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -309,7 +309,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -332,7 +332,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -354,7 +354,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -377,7 +377,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -393,7 +393,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -430,19 +430,6 @@
</layout>
</widget>
</item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
</widget>
diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui
index 79dac9ba..c57fa0d3 100644
--- a/pokemodr/gui/species.ui
+++ b/pokemodr/gui/species.ui
@@ -103,7 +103,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -232,7 +232,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -332,7 +332,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -444,7 +444,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -470,7 +470,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -493,7 +493,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -516,7 +516,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -538,7 +538,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -561,7 +561,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -584,7 +584,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -606,7 +606,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -629,7 +629,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
@@ -645,7 +645,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
diff --git a/pokemodr/gui/sprite.ui b/pokemodr/gui/sprite.ui
index 94630b76..b47564d0 100644
--- a/pokemodr/gui/sprite.ui
+++ b/pokemodr/gui/sprite.ui
@@ -32,7 +32,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -48,7 +48,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
diff --git a/pokemodr/gui/tile.ui b/pokemodr/gui/tile.ui
index fbb52ba7..d078db82 100644
--- a/pokemodr/gui/tile.ui
+++ b/pokemodr/gui/tile.ui
@@ -32,7 +32,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -58,7 +58,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
diff --git a/pokemodr/gui/trainer.ui b/pokemodr/gui/trainer.ui
index 7a6ef271..d95a72d5 100644
--- a/pokemodr/gui/trainer.ui
+++ b/pokemodr/gui/trainer.ui
@@ -45,7 +45,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
@@ -71,7 +71,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
diff --git a/pokemodr/gui/type.ui b/pokemodr/gui/type.ui
index 8327759b..34bba667 100644
--- a/pokemodr/gui/type.ui
+++ b/pokemodr/gui/type.ui
@@ -32,7 +32,7 @@
<property name="toolTip" >
<string>Multiplier for species with this type for using a move of this type</string>
</property>
- <property name="behavior" stdset="0" >
+ <property name="behavior" >
<number>1</number>
</property>
</widget>