diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 17:57:32 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-27 17:57:32 +0000 |
| commit | 0fa52c1f61c457c9b68bec53bcce3af858e5eb44 (patch) | |
| tree | c5b10b77a01b417775097476029bcf67fac79975 /pokemodr/CoinListObjectUI.cpp | |
| parent | 807071d35159de0660f9df31c48d5bf895ca3622 (diff) | |
[FIX] More header cleanliness
[FIX] UI classes now just use the ObjectUI pointers
[FIX] Some miscellaneous qmake options
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@112 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/CoinListObjectUI.cpp')
| -rw-r--r-- | pokemodr/CoinListObjectUI.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/pokemodr/CoinListObjectUI.cpp b/pokemodr/CoinListObjectUI.cpp index 84fa4a22..18c80886 100644 --- a/pokemodr/CoinListObjectUI.cpp +++ b/pokemodr/CoinListObjectUI.cpp @@ -19,6 +19,7 @@ #include "CoinListObjectUI.h" // Pokemod includes +#include "../pokemod/CoinListObject.h" #include "../pokemod/Item.h" #include "../pokemod/ItemEffect.h" #include "../pokemod/Pokemod.h" @@ -26,24 +27,22 @@ // General includes #include "../general/BugCatcher.h" -#include "../general/Exception.h" -// Qt includes -#include <QVariant> - -CoinListObjectUI::CoinListObjectUI(CoinListObject* coinListObject, QWidget* parent) : +CoinListObjectUI::CoinListObjectUI(CoinListObject* object, QWidget* parent) : ObjectUI(parent), - m_lastType(-1), - m_object(coinListObject), - m_object_mod(new CoinListObject(*coinListObject)) + m_lastType(-1) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(m_object, m_object_mod); + setObjects(object, new CoinListObject(*object)); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } +CoinListObjectUI::~CoinListObjectUI() +{ +} + void CoinListObjectUI::initGui() { varType->addItems(CoinListObject::TypeStr); @@ -51,45 +50,45 @@ void CoinListObjectUI::initGui() void CoinListObjectUI::setGui() { - bool resetObjects = (m_object_mod->type() != m_lastType); - varType->setCurrentIndex(m_object_mod->type()); - m_lastType = m_object_mod->type(); + bool resetObjects = (static_cast<CoinListObject*>(modified())->type() != m_lastType); + varType->setCurrentIndex(static_cast<CoinListObject*>(modified())->type()); + m_lastType = static_cast<CoinListObject*>(modified())->type(); if (resetObjects) { varObject->clear(); - if (m_object_mod->type() == CoinListObject::Item) + if (static_cast<CoinListObject*>(modified())->type() == CoinListObject::Item) { - for (int i = 0; i < static_cast<const Pokemod*>(m_object->pokemod())->itemCount(); ++i) + for (int i = 0; i < static_cast<const Pokemod*>(static_cast<CoinListObject*>(original())->pokemod())->itemCount(); ++i) { - const Item* item = static_cast<const Pokemod*>(m_object->pokemod())->item(i); + const Item* item = static_cast<const Pokemod*>(static_cast<CoinListObject*>(original())->pokemod())->item(i); varObject->addItem(item->name()); varObject->setItemData(i, item->id()); } } else { - for (int i = 0; i < static_cast<const Pokemod*>(m_object->pokemod())->speciesCount(); ++i) + for (int i = 0; i < static_cast<const Pokemod*>(static_cast<CoinListObject*>(original())->pokemod())->speciesCount(); ++i) { - const Species* species = static_cast<const Pokemod*>(m_object->pokemod())->species(i); + const Species* species = static_cast<const Pokemod*>(static_cast<CoinListObject*>(original())->pokemod())->species(i); varObject->addItem(species->name()); varObject->setItemData(i, species->id()); } } } - varObject->setCurrentIndex(varObject->findData(m_object_mod->object())); - varAmount->setValue(m_object_mod->amount()); - varCost->setValue(m_object_mod->cost()); + varObject->setCurrentIndex(varObject->findData(static_cast<CoinListObject*>(modified())->object())); + varAmount->setValue(static_cast<CoinListObject*>(modified())->amount()); + varCost->setValue(static_cast<CoinListObject*>(modified())->cost()); } void CoinListObjectUI::on_buttonApply_clicked() { - *m_object = *m_object_mod; + *static_cast<CoinListObject*>(original()) = *static_cast<CoinListObject*>(modified()); emit(changed(false)); } void CoinListObjectUI::on_buttonDiscard_clicked() { - *m_object_mod = *m_object; + *static_cast<CoinListObject*>(modified()) = *static_cast<CoinListObject*>(original()); setGui(); emit(changed(false)); } @@ -98,7 +97,7 @@ void CoinListObjectUI::on_varType_currentIndexChanged(const int type) { try { - m_object_mod->setType(type); + static_cast<CoinListObject*>(modified())->setType(type); emit(changed(true)); } catch (BoundsException& exception) @@ -112,7 +111,7 @@ void CoinListObjectUI::on_varObject_currentIndexChanged(const int obey) { try { - m_object_mod->setObject(varObject->itemData(obey).toInt()); + static_cast<CoinListObject*>(modified())->setObject(varObject->itemData(obey).toInt()); emit(changed(true)); } catch (BoundsException& exception) @@ -126,7 +125,7 @@ void CoinListObjectUI::on_varAmount_valueChanged(const int amount) { try { - m_object_mod->setAmount(amount); + static_cast<CoinListObject*>(modified())->setAmount(amount); emit(changed(true)); } catch (BoundsException& exception) @@ -140,7 +139,7 @@ void CoinListObjectUI::on_varCost_valueChanged(const int cost) { try { - m_object_mod->setCost(cost); + static_cast<CoinListObject*>(modified())->setCost(cost); emit(changed(true)); } catch (BoundsException& exception) |
