summaryrefslogtreecommitdiffstats
path: root/pokemodr/CoinListUI.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-02-01 15:19:37 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-02-01 15:19:37 +0000
commit9cf41b6e6faf6a325baebf65c037a9ac5e12890e (patch)
treebe795760434f7f574135483a4f62ceb33b073c5d /pokemodr/CoinListUI.cpp
parent29d664520f09818f4762169c4a13f4cacb4e55aa (diff)
downloadsigen-9cf41b6e6faf6a325baebf65c037a9ac5e12890e.tar.gz
sigen-9cf41b6e6faf6a325baebf65c037a9ac5e12890e.tar.xz
sigen-9cf41b6e6faf6a325baebf65c037a9ac5e12890e.zip
[FIX] CoinList UI now uses a KComboBox instead of a KIntNumInput for value
[FIX] Badge UI now uses KPushButtons instead of a QGraphicsView [FIX] BadgeUI now works [FIX] PokeModr now sends a new error when an Exception got all the way through [DEL] GenericListItem replaced as QListWidgetItem works on its own [ADD] pokemodr now needs to like to kio [ADD] getFace/getBadge methods to Badge [ADD] 2 HMs (Heal and Escape) git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@53 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/CoinListUI.cpp')
-rw-r--r--pokemodr/CoinListUI.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp
index 6fc14aa0..994ff8ad 100644
--- a/pokemodr/CoinListUI.cpp
+++ b/pokemodr/CoinListUI.cpp
@@ -21,8 +21,12 @@
/////////////////////////////////////////////////////////////////////////////
#include <QMetaObject>
+#include <QVariant>
#include "../general/BugCatcher.h"
#include "../general/Exception.h"
+#include "../pokemod/Item.h"
+#include "../pokemod/ItemEffect.h"
+#include "../pokemod/Pokemod.h"
#include "CoinListUI.h"
CoinListUI::CoinListUI(CoinList* c, QWidget* parent) :
@@ -33,6 +37,16 @@ CoinListUI::CoinListUI(CoinList* c, QWidget* parent) :
setupUi(this);
QMetaObject::connectSlotsByName(this);
setObjects(coinList, coinList_mod);
+ for (unsigned i = 0; i < coinList->getPokemod().getItemCount(); ++i)
+ {
+ const Item& item = coinList->getPokemod().getItem(i);
+ for (unsigned j = 0; j < item.getEffectCount(); ++j)
+ {
+ const ItemEffect& effect = item.getEffect(j);
+ if (effect.getEffect() == ItemEffect::E_CoinCase)
+ varValue->addItem(item.getName(), QVariant(effect.getVal1()));
+ }
+ }
setGui();
}
@@ -44,7 +58,7 @@ CoinListUI::CoinListUI(CoinList* c, QWidget* parent) :
void CoinListUI::setGui()
{
varName->setText(coinList_mod->getName());
- varValue->setValue(coinList_mod->getValue());
+ varValue->setCurrentIndex(varValue->findData(QVariant(coinList_mod->getValue())));
}
void CoinListUI::on_buttonApply_clicked()
@@ -66,17 +80,16 @@ void CoinListUI::on_varName_textChanged(const QString& n)
emit(setChanged(true));
}
-void CoinListUI::on_varValue_valueChanged(const int v)
+void CoinListUI::on_varValue_currentIndexChanged(const int v)
{
- // TODO: Make a KComboBox with all available coin types instead
try
{
- coinList_mod->setValue(v);
+ coinList_mod->setValue(varValue->itemData(v, Qt::UserRole).toInt());
emit(setChanged(true));
}
catch (Exception& e)
{
-// BugCatcher::report(e);
+ BugCatcher::report(e);
setGui();
}
}