summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-27 14:04:01 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-27 14:04:01 +0000
commit8cbe19a3e1845657ccdfddbd3c4fffcaadb9ff55 (patch)
tree72b3f2d493d1cfc76814a27c3df3d7dabdee8d29
parent00fecef0aebaa379dfc176ddc5d6488fae0e8272 (diff)
[FIX] Item widget works better
[FIX] FractionWidget value is updated at ctor [FIX] Non-script KTextEdit is now a KLineEdit [FIX] Rules not being set git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@179 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog10
-rwxr-xr-xpokegen.pro2
-rw-r--r--pokemod/Object.h4
-rw-r--r--pokemod/Pokemod.cpp1
-rw-r--r--pokemodr/AbilityUI.cpp8
-rw-r--r--pokemodr/AbilityUI.h2
-rw-r--r--pokemodr/FractionWidget.cpp6
-rw-r--r--pokemodr/ItemUI.cpp14
-rw-r--r--pokemodr/ItemUI.h5
-rw-r--r--pokemodr/MoveUI.cpp9
-rw-r--r--pokemodr/MoveUI.h2
-rw-r--r--pokemodr/PokeModrUI.cpp4
-rw-r--r--pokemodr/PokemodTree.h2
-rw-r--r--pokemodr/PokemodUI.cpp8
-rw-r--r--pokemodr/PokemodUI.h2
-rw-r--r--pokemodr/ScriptWidget.cpp4
-rw-r--r--pokemodr/SpeciesUI.cpp8
-rw-r--r--pokemodr/SpeciesUI.h2
-rw-r--r--pokemodr/gui/ability.ui7
-rw-r--r--pokemodr/gui/item.ui10
-rw-r--r--pokemodr/gui/move.ui10
-rw-r--r--pokemodr/gui/pokemod.ui10
-rw-r--r--pokemodr/gui/species.ui10
23 files changed, 57 insertions, 83 deletions
diff --git a/Changelog b/Changelog
index d43535c3..9070ca49 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,14 @@
-----------------
+Rev: 179
+Date: 27 May 2008
+User: MathStuf
+-----------------
+[FIX] Item widget works better
+[FIX] FractionWidget value is updated at ctor
+[FIX] Non-script KTextEdit is now a KLineEdit
+[FIX] Rules not being set
+
+-----------------
Rev: 178
Date: 26 May 2008
User: MathStuf
diff --git a/pokegen.pro b/pokegen.pro
index d34c40f9..71555cb1 100755
--- a/pokegen.pro
+++ b/pokegen.pro
@@ -38,7 +38,7 @@ win32 {
} mac {
} else {
rpm.target = rpm
- rpm.commands = su -c "rpmbuild -ta releases/pokegen-$${VERSION}.tar.bz2"
+ rpm.commands = su -c \"rpmbuild -ta releases/pokegen-$${VERSION}.tar.bz2\"
rpm.depends = distsrc
; deb.target = deb
; deb.commands = dpkg -b
diff --git a/pokemod/Object.h b/pokemod/Object.h
index 0a1cab43..503d562e 100644
--- a/pokemod/Object.h
+++ b/pokemod/Object.h
@@ -91,7 +91,7 @@ class Object : public QObject
// FIXME: QPixmap::fromData static member would be nice
#define LOAD_QPixmap(node) QPixmap::fromImage(QImage::fromData(QByteArray::fromBase64(LOAD_DATA(node).toUtf8())))
#define LOAD_QByteArray(node) QByteArray::fromBase64(LOAD_DATA(node).toUtf8())
-#define LOAD_Rules() m_rules = new Rules(xml.firstChildElement("Rules"), this)
+#define LOAD_Rules() m_rules->load(xml.firstChildElement("Rules"))
#define LOAD_Script(node) Script(node.attribute("interpreter", ""), LOAD_DATA(node))
#define LOAD_ARRAY(type, variable, size) \
QDomElement xml_##variable = LOAD_NODE(#variable).firstChildElement("element"); \
@@ -208,7 +208,7 @@ class Object : public QObject
xml.appendChild(sub->save())
#define COPY(variable) m_##variable = rhs.m_##variable
-#define COPY_Rules(variable) *m_##variable= *rhs.m_##variable
+#define COPY_Rules(variable) *m_##variable = *rhs.m_##variable
#define COPY_ARRAY(variable, size) \
for (int i = 0; i < size; ++i) \
COPY(variable[i])
diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp
index 6a76b081..414cb578 100644
--- a/pokemod/Pokemod.cpp
+++ b/pokemod/Pokemod.cpp
@@ -2440,7 +2440,6 @@ Pokemod& Pokemod::operator=(const Pokemod& rhs)
void Pokemod::clear()
{
- delete m_rules;
while (abilityCount())
deleteAbility(0);
while (authorCount())
diff --git a/pokemodr/AbilityUI.cpp b/pokemodr/AbilityUI.cpp
index 82992136..ff7d76c6 100644
--- a/pokemodr/AbilityUI.cpp
+++ b/pokemodr/AbilityUI.cpp
@@ -35,7 +35,7 @@ AbilityUI::~AbilityUI()
void AbilityUI::setGui()
{
varName->setText(static_cast<Ability*>(modified())->name());
- varDescription->setPlainText(static_cast<Ability*>(modified())->description());
+ varDescription->setText(static_cast<Ability*>(modified())->description());
varScript->setValue(static_cast<Ability*>(modified())->script());
}
@@ -59,11 +59,9 @@ void AbilityUI::on_varName_textChanged(const QString& name)
varName->setCursorPosition(cursor);
}
-void AbilityUI::on_varDescription_textChanged()
+void AbilityUI::on_varDescription_textChanged(const QString& description)
{
- QTextCursor cursor = varDescription->textCursor();
- static_cast<Ability*>(modified())->setDescription(varDescription->toPlainText());
- varDescription->setTextCursor(cursor);
+ static_cast<Ability*>(modified())->setDescription(description);
}
void AbilityUI::on_varScript_valueChanged(const Script& script)
diff --git a/pokemodr/AbilityUI.h b/pokemodr/AbilityUI.h
index d9f39dcc..5825e1b2 100644
--- a/pokemodr/AbilityUI.h
+++ b/pokemodr/AbilityUI.h
@@ -39,7 +39,7 @@ class AbilityUI : public ObjectUI, private Ui::formAbility
void discard();
protected slots:
void on_varName_textChanged(const QString& name);
- void on_varDescription_textChanged();
+ void on_varDescription_textChanged(const QString& description);
void on_varScript_valueChanged(const Script& script);
private slots:
void setGui();
diff --git a/pokemodr/FractionWidget.cpp b/pokemodr/FractionWidget.cpp
index fa63641f..c1e818ec 100644
--- a/pokemodr/FractionWidget.cpp
+++ b/pokemodr/FractionWidget.cpp
@@ -20,11 +20,11 @@
FractionWidget::FractionWidget(QWidget* parent, const Fraction& value) :
QWidget(parent),
- m_behavior(-1),
- m_value(value)
+ m_behavior(-1)
{
setupUi(this);
connect(this, SIGNAL(valueChanged(const Fraction&)), SLOT(updateValue()));
+ setValue(value);
}
int FractionWidget::behavior() const
@@ -48,7 +48,7 @@ void FractionWidget::setBehavior(const int behavior)
void FractionWidget::setValue(const Fraction& value)
{
- if (m_value == value)
+ if ((m_value == value) && !varValue->text().isEmpty())
return;
m_value = value;
varDenominator->setValue(m_value.denominator());
diff --git a/pokemodr/ItemUI.cpp b/pokemodr/ItemUI.cpp
index ca2d05b3..ceac9c03 100644
--- a/pokemodr/ItemUI.cpp
+++ b/pokemodr/ItemUI.cpp
@@ -52,7 +52,8 @@ void ItemUI::setGui()
boxSellable->setChecked(static_cast<Item*>(modified())->sellable() ? Qt::Checked : Qt::Unchecked);
varType->setCurrentIndex(varType->findData(static_cast<Item*>(modified())->type()));
varPrice->setValue(static_cast<Item*>(modified())->price());
- varDescription->setPlainText(static_cast<Item*>(modified())->description());
+ varDescription->setText(static_cast<Item*>(modified())->description());
+ varScript->setValue(static_cast<Item*>(modified())->script());
}
void ItemUI::apply()
@@ -90,9 +91,12 @@ void ItemUI::on_varPrice_valueChanged(const int price)
static_cast<Item*>(modified())->setPrice(price);
}
-void ItemUI::on_varDescription_textChanged()
+void ItemUI::on_varDescription_textChanged(const QString& description)
{
- QTextCursor cursor = varDescription->textCursor();
- static_cast<Item*>(modified())->setDescription(varDescription->toPlainText());
- varDescription->setTextCursor(cursor);
+ static_cast<Item*>(modified())->setDescription(description);
+}
+
+void ItemUI::on_varScript_valueChanged(const Script& script)
+{
+ static_cast<Item*>(modified())->setScript(script);
}
diff --git a/pokemodr/ItemUI.h b/pokemodr/ItemUI.h
index 05ed904e..2a7ad62e 100644
--- a/pokemodr/ItemUI.h
+++ b/pokemodr/ItemUI.h
@@ -42,10 +42,13 @@ class ItemUI : public ObjectUI, private Ui::formItem
void on_boxSellable_toggled(const bool sellable);
void on_varType_activated(const int type);
void on_varPrice_valueChanged(const int price);
- void on_varDescription_textChanged();
+ void on_varDescription_textChanged(const QString& description);
+ void on_varScript_valueChanged(const Script& script);
private slots:
void refreshGui();
void setGui();
+ private:
+ QTextCursor m_cursor;
};
#endif
diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp
index e306cfbe..652b2491 100644
--- a/pokemodr/MoveUI.cpp
+++ b/pokemodr/MoveUI.cpp
@@ -64,7 +64,8 @@ void MoveUI::setGui()
varNumTargets->setValue(static_cast<Move*>(modified())->numTargets());
varSpecial->setChecked(static_cast<Move*>(modified())->special() ? Qt::Checked : Qt::Unchecked);
varOverworld->setChecked(static_cast<Move*>(modified())->overworld() ? Qt::Checked : Qt::Unchecked);
- varDescription->setPlainText(static_cast<Move*>(modified())->description());
+ varDescription->setText(static_cast<Move*>(modified())->description());
+ varScript->setValue(static_cast<Move*>(modified())->script());
}
void MoveUI::apply()
@@ -132,11 +133,9 @@ void MoveUI::on_varOverworld_toggled(const bool overworld)
static_cast<Move*>(modified())->setOverworld(overworld);
}
-void MoveUI::on_varDescription_textChanged()
+void MoveUI::on_varDescription_textChanged(const QString& description)
{
- QTextCursor cursor = varDescription->textCursor();
- static_cast<Move*>(modified())->setDescription(varDescription->toPlainText());
- varDescription->setTextCursor(cursor);
+ static_cast<Move*>(modified())->setDescription(description);
}
void MoveUI::on_varScript_valueChanged(const Script& script)
diff --git a/pokemodr/MoveUI.h b/pokemodr/MoveUI.h
index 53745c54..2ac707a5 100644
--- a/pokemodr/MoveUI.h
+++ b/pokemodr/MoveUI.h
@@ -48,7 +48,7 @@ class MoveUI : public ObjectUI, private Ui::formMove
void on_varTargetChoice_activated(const int targetChoice);
void on_varSpecial_toggled(const bool special);
void on_varOverworld_toggled(const bool overworld);
- void on_varDescription_textChanged();
+ void on_varDescription_textChanged(const QString& description);
void on_varScript_valueChanged(const Script& script);
private slots:
void initGui();
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index 7e007ce5..214eb673 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -102,7 +102,7 @@ void PokeModrUI::setDirty(const bool dirty)
void PokeModrUI::newPokemod()
{
- treePokemod->addPokemod(new Pokemod());
+ treePokemod->addPokemod(new Pokemod);
}
void PokeModrUI::openPokemod()
@@ -325,6 +325,7 @@ void PokeModrUI::on_treePokemod_clicked(const QModelIndex& index)
connect(widget, SIGNAL(changed(bool)), this, SLOT(setChangedTitle(bool)));
connect(widget, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
connect(buttonApply, SIGNAL(clicked()), widget, SLOT(apply()));
+ connect(buttonApply, SIGNAL(clicked()), treePokemod, SLOT(setDirty()));
connect(buttonDiscard, SIGNAL(clicked()), widget, SLOT(discard()));
setChangedTitle(false);
formPanel->setWidget(widget);
@@ -350,6 +351,7 @@ void PokeModrUI::on_treePokemod_customContextMenuRequested(const QPoint& positio
paste->setEnabled(m_clipboard.doctype().name() == type);
}
menu->addAction(paste);
+ connect(menu, SIGNAL(triggered(QAction*)), treePokemod, SLOT(setDirty()));
menu->popup(treePokemod->mapToGlobal(position));
}
}
diff --git a/pokemodr/PokemodTree.h b/pokemodr/PokemodTree.h
index 07a312b1..cfdd151a 100644
--- a/pokemodr/PokemodTree.h
+++ b/pokemodr/PokemodTree.h
@@ -57,7 +57,7 @@ class PokemodTree : public QTreeView
void setUrl(const Pokemod* pokemod, const KUrl& url);
bool dirty(const Pokemod* pokemod) const;
- void setDirty(const Pokemod*, const bool dirty);
+ void setDirty(const Pokemod* pokemod, const bool dirty);
private slots:
void setDirty();
private:
diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp
index ddfd101a..88d7111b 100644
--- a/pokemodr/PokemodUI.cpp
+++ b/pokemodr/PokemodUI.cpp
@@ -68,7 +68,7 @@ void PokemodUI::setGui()
const bool resetWarps = (static_cast<Pokemod*>(modified())->startMap() != m_lastMap);
varTitle->setText(static_cast<Pokemod*>(modified())->title());
varVersion->setText(static_cast<Pokemod*>(modified())->version());
- varDescription->setPlainText(static_cast<Pokemod*>(modified())->description());
+ varDescription->setText(static_cast<Pokemod*>(modified())->description());
varMap->setCurrentIndex(varMap->findData(static_cast<Pokemod*>(modified())->startMap()));
m_lastMap = static_cast<Pokemod*>(modified())->startMap();
if (resetWarps)
@@ -120,11 +120,9 @@ void PokemodUI::on_varVersion_textChanged(const QString& version)
varVersion->setCursorPosition(cursor);
}
-void PokemodUI::on_varDescription_textChanged()
+void PokemodUI::on_varDescription_textChanged(const QString& description)
{
- QTextCursor cursor = varDescription->textCursor();
- static_cast<Pokemod*>(modified())->setDescription(varDescription->toPlainText());
- varDescription->setTextCursor(cursor);
+ static_cast<Pokemod*>(modified())->setDescription(description);
}
void PokemodUI::on_varMap_activated(const int map)
diff --git a/pokemodr/PokemodUI.h b/pokemodr/PokemodUI.h
index 63038a0b..12f4f913 100644
--- a/pokemodr/PokemodUI.h
+++ b/pokemodr/PokemodUI.h
@@ -39,7 +39,7 @@ class PokemodUI : public ObjectUI, private Ui::formPokemod
protected slots:
void on_varTitle_textChanged(const QString& title);
void on_varVersion_textChanged(const QString& version);
- void on_varDescription_textChanged();
+ void on_varDescription_textChanged(const QString& description);
void on_varMap_activated(const int map);
void on_varWarp_activated(const int warp);
void on_varWalkSkin_pressed();
diff --git a/pokemodr/ScriptWidget.cpp b/pokemodr/ScriptWidget.cpp
index addb14ba..cdde5c83 100644
--- a/pokemodr/ScriptWidget.cpp
+++ b/pokemodr/ScriptWidget.cpp
@@ -39,7 +39,9 @@ void ScriptWidget::setValue(const Script& value)
return;
m_value = value;
varInterpreter->setEditText(m_value.interpreter());
+ QTextCursor cursor = varScript->textCursor();
varScript->setPlainText(m_value.script());
+ varScript->setTextCursor(cursor);
emit(valueChanged(m_value));
}
@@ -51,8 +53,6 @@ void ScriptWidget::on_varInterpreter_activated(const QString& interpreter)
void ScriptWidget::on_varScript_textChanged()
{
- QTextCursor cursor = varScript->textCursor();
m_value.setScript(varScript->toPlainText());
- varScript->setTextCursor(cursor);
emit(valueChanged(m_value));
}
diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp
index c5f5b4fe..4ba1bc3e 100644
--- a/pokemodr/SpeciesUI.cpp
+++ b/pokemodr/SpeciesUI.cpp
@@ -112,7 +112,7 @@ void SpeciesUI::setGui()
varWeight->setValue(static_cast<Species*>(modified())->weight());
varHeightFeet->setValue(static_cast<Species*>(modified())->heightFeet());
varHeightInches->setValue(static_cast<Species*>(modified())->heightInches());
- varPokedexEntry->setPlainText(static_cast<Species*>(modified())->pokedexEntry());
+ varPokedexEntry->setText(static_cast<Species*>(modified())->pokedexEntry());
varMaleFront->setIcon(static_cast<Species*>(modified())->frontMaleSprite());
varMaleBack->setIcon(static_cast<Species*>(modified())->backMaleSprite());
if (pokemod()->rules()->genderAllowed())
@@ -213,11 +213,9 @@ void SpeciesUI::on_varHeightInches_valueChanged(const int inches)
static_cast<Species*>(modified())->setHeightInches(inches);
}
-void SpeciesUI::on_varPokedexEntry_textChanged()
+void SpeciesUI::on_varPokedexEntry_textChanged(const QString& pokedexEntry)
{
- QTextCursor cursor = varPokedexEntry->textCursor();
- static_cast<Species*>(modified())->setPokedexEntry(varPokedexEntry->toPlainText());
- varPokedexEntry->setTextCursor(cursor);
+ static_cast<Species*>(modified())->setPokedexEntry(pokedexEntry);
}
void SpeciesUI::on_varMaleFront_pressed()
diff --git a/pokemodr/SpeciesUI.h b/pokemodr/SpeciesUI.h
index 53a8877b..dd4aafe8 100644
--- a/pokemodr/SpeciesUI.h
+++ b/pokemodr/SpeciesUI.h
@@ -50,7 +50,7 @@ class SpeciesUI : public ObjectUI, private Ui::formSpecies
void on_varWeight_valueChanged(const int weight);
void on_varHeightFeet_valueChanged(const int feet);
void on_varHeightInches_valueChanged(const int inches);
- void on_varPokedexEntry_textChanged();
+ void on_varPokedexEntry_textChanged(const QString& pokedexEntry);
void on_varMaleFront_pressed();
void on_varMaleBack_pressed();
void on_varFemaleFront_pressed();
diff --git a/pokemodr/gui/ability.ui b/pokemodr/gui/ability.ui
index 3a82d380..12f9cee6 100644
--- a/pokemodr/gui/ability.ui
+++ b/pokemodr/gui/ability.ui
@@ -28,7 +28,7 @@
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KTextEdit" name="varDescription" />
+ <widget class="KLineEdit" name="varDescription" />
</item>
</layout>
</widget>
@@ -54,11 +54,6 @@
<header>klineedit.h</header>
</customwidget>
<customwidget>
- <class>KTextEdit</class>
- <extends>QTextEdit</extends>
- <header>ktextedit.h</header>
- </customwidget>
- <customwidget>
<class>ScriptWidget</class>
<extends>QWidget</extends>
<header>../ScriptWidget.h</header>
diff --git a/pokemodr/gui/item.ui b/pokemodr/gui/item.ui
index e3732693..09113394 100644
--- a/pokemodr/gui/item.ui
+++ b/pokemodr/gui/item.ui
@@ -76,13 +76,10 @@
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KTextEdit" name="varDescription" >
+ <widget class="KLineEdit" name="varDescription" >
<property name="toolTip" >
<string>Description of the item</string>
</property>
- <property name="acceptRichText" >
- <bool>false</bool>
- </property>
</widget>
</item>
</layout>
@@ -132,11 +129,6 @@
<header>klineedit.h</header>
</customwidget>
<customwidget>
- <class>KTextEdit</class>
- <extends>QTextEdit</extends>
- <header>ktextedit.h</header>
- </customwidget>
- <customwidget>
<class>ScriptWidget</class>
<extends>QWidget</extends>
<header>../ScriptWidget.h</header>
diff --git a/pokemodr/gui/move.ui b/pokemodr/gui/move.ui
index 856aca37..3d33571c 100644
--- a/pokemodr/gui/move.ui
+++ b/pokemodr/gui/move.ui
@@ -175,13 +175,10 @@
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KTextEdit" name="varDescription" >
+ <widget class="KLineEdit" name="varDescription" >
<property name="toolTip" >
<string>Description of the move</string>
</property>
- <property name="acceptRichText" >
- <bool>false</bool>
- </property>
</widget>
</item>
</layout>
@@ -218,11 +215,6 @@
<header>klineedit.h</header>
</customwidget>
<customwidget>
- <class>KTextEdit</class>
- <extends>QTextEdit</extends>
- <header>ktextedit.h</header>
- </customwidget>
- <customwidget>
<class>FractionWidget</class>
<extends>QWidget</extends>
<header>../FractionWidget.h</header>
diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui
index 1660f9e8..30463316 100644
--- a/pokemodr/gui/pokemod.ui
+++ b/pokemodr/gui/pokemod.ui
@@ -57,13 +57,10 @@
</property>
<layout class="QHBoxLayout" >
<item>
- <widget class="KTextEdit" name="varDescription" >
+ <widget class="KLineEdit" name="varDescription" >
<property name="toolTip" >
<string>Description of the PokéMod</string>
</property>
- <property name="acceptRichText" >
- <bool>false</bool>
- </property>
</widget>
</item>
</layout>
@@ -469,11 +466,6 @@
<container>1</container>
</customwidget>
<customwidget>
- <class>KTextEdit</class>
- <extends>QTextEdit</extends>
- <header>ktextedit.h</header>
- </customwidget>
- <customwidget>
<class>FractionWidget</class>
<extends>QWidget</extends>
<header>../FractionWidget.h</header>
diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui
index 30d25a07..79dac9ba 100644
--- a/pokemodr/gui/species.ui
+++ b/pokemodr/gui/species.ui
@@ -318,13 +318,10 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="KTextEdit" name="varPokedexEntry" >
+ <widget class="KLineEdit" name="varPokedexEntry" >
<property name="toolTip" >
<string>Information provided in the PokéDex about the species</string>
</property>
- <property name="acceptRichText" >
- <bool>false</bool>
- </property>
</widget>
</item>
</layout>
@@ -696,11 +693,6 @@
<container>1</container>
</customwidget>
<customwidget>
- <class>KTextEdit</class>
- <extends>QTextEdit</extends>
- <header>ktextedit.h</header>
- </customwidget>
- <customwidget>
<class>FractionWidget</class>
<extends>QWidget</extends>
<header>../FractionWidget.h</header>