diff options
Diffstat (limited to 'pokemodr/CoinListUI.cpp')
| -rw-r--r-- | pokemodr/CoinListUI.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp index d8eadc3d..54355187 100644 --- a/pokemodr/CoinListUI.cpp +++ b/pokemodr/CoinListUI.cpp @@ -19,35 +19,34 @@ #include "CoinListUI.h" // Pokemod includes +#include "../pokemod/CoinList.h" #include "../pokemod/Item.h" #include "../pokemod/ItemEffect.h" #include "../pokemod/Pokemod.h" // General includes #include "../general/BugCatcher.h" -#include "../general/Exception.h" - -// Qt includes -#include <QVariant> CoinListUI::CoinListUI(CoinList* coinList, QWidget* parent) : - ObjectUI(parent), - m_coinList(coinList), - m_coinList_mod(new CoinList(*coinList)) + ObjectUI(parent) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(m_coinList, m_coinList_mod); + setObjects(coinList, new CoinList(*coinList)); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } +CoinListUI::~CoinListUI() +{ +} + void CoinListUI::refreshGui() { varValue->clear(); - for (int i = 0; i < static_cast<const Pokemod*>(m_coinList->pokemod())->itemCount(); ++i) + for (int i = 0; i < static_cast<const Pokemod*>(static_cast<CoinList*>(original())->pokemod())->itemCount(); ++i) { - const Item* item = static_cast<const Pokemod*>(m_coinList->pokemod())->item(i); + const Item* item = static_cast<const Pokemod*>(static_cast<CoinList*>(original())->pokemod())->item(i); for (int j = 0; j < item->effectCount(); ++j) { const ItemEffect* effect = item->effect(j); @@ -62,26 +61,26 @@ void CoinListUI::refreshGui() void CoinListUI::setGui() { - varName->setText(m_coinList_mod->name()); - varValue->setCurrentIndex(varValue->findData(m_coinList_mod->value())); + varName->setText(static_cast<CoinList*>(modified())->name()); + varValue->setCurrentIndex(varValue->findData(static_cast<CoinList*>(modified())->value())); } void CoinListUI::on_buttonApply_clicked() { - *m_coinList = *m_coinList_mod; + *static_cast<CoinList*>(original()) = *static_cast<CoinList*>(modified()); emit(changed(false)); } void CoinListUI::on_buttonDiscard_clicked() { - *m_coinList_mod = *m_coinList; + *static_cast<CoinList*>(modified()) = *static_cast<CoinList*>(original()); setGui(); emit(changed(false)); } void CoinListUI::on_varName_textChanged(const QString& name) { - m_coinList_mod->setName(name); + static_cast<CoinList*>(modified())->setName(name); emit(changed(true)); } @@ -89,7 +88,7 @@ void CoinListUI::on_varValue_currentIndexChanged(const int value) { try { - m_coinList_mod->setValue(varValue->itemData(value).toInt()); + static_cast<CoinList*>(modified())->setValue(varValue->itemData(value).toInt()); emit(changed(true)); } catch (Exception& exception) |
