diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-17 23:34:36 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-17 23:34:36 +0000 |
| commit | 6679f5cffa9d35a23b76605ddfbf3257f882b6ee (patch) | |
| tree | c8e41854a60b64e8569939bca6b827807175ef9a /pokemodr/CoinListUI.cpp | |
| parent | 05980e883719b1c8ebde1bd2fcbf4f8c16df7ad6 (diff) | |
| download | sigen-6679f5cffa9d35a23b76605ddfbf3257f882b6ee.tar.gz sigen-6679f5cffa9d35a23b76605ddfbf3257f882b6ee.tar.xz sigen-6679f5cffa9d35a23b76605ddfbf3257f882b6ee.zip | |
[FIX] Frac -> Fraction
[FIX] ImageCache and Ini removed
[FIX] Fraction/Point widgets moved to pokemodr
[FIX] Copy ctors made for pokemod classes
[FIX] Ctors in pokemod fixed
[FIX] Copyright headers fixed in pokemodr
[FIX] PokeModr updated to new API and fixed in some places
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@99 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/CoinListUI.cpp')
| -rw-r--r-- | pokemodr/CoinListUI.cpp | 84 |
1 files changed, 41 insertions, 43 deletions
diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp index 6c65f7a0..bf854781 100644 --- a/pokemodr/CoinListUI.cpp +++ b/pokemodr/CoinListUI.cpp @@ -1,45 +1,43 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokegen/CoinListUI.cpp -// Purpose: CoinList UI form handling -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Sun Jan 27 12:31:08 2008 -// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions -// Licence: -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program. If not, see <http://www.gnu.org/licenses/>. -///////////////////////////////////////////////////////////////////////////// +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ -#include <QMetaObject> +// Qt includes #include <QVariant> +// General includes #include <BugCatcher.h> #include <Exception.h> +// Pokemod includes #include <Item.h> #include <ItemEffect.h> #include <Pokemod.h> +// Header include #include "CoinListUI.h" -CoinListUI::CoinListUI(CoinList* c, QWidget* parent) : +CoinListUI::CoinListUI(CoinList* coinList, QWidget* parent) : ObjectUI(parent), - coinList(c), - coinList_mod(new CoinList(c->getPokemod(), *c, c->getId())) + m_coinList(coinList), + m_coinList_mod(new CoinList(*coinList)) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(coinList, coinList_mod); + setObjects(m_coinList, m_coinList_mod); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } @@ -47,16 +45,16 @@ CoinListUI::CoinListUI(CoinList* c, QWidget* parent) : void CoinListUI::refreshGui() { varValue->clear(); - for (int i = 0; i < coinList->getPokemod()->getItemCount(); ++i) + for (int i = 0; i < m_coinList->pokemod()->itemCount(); ++i) { - const Item* it = coinList->getPokemod()->getItem(i); - for (int j = 0; j < it->getEffectCount(); ++j) + const Item* item = m_coinList->pokemod()->item(i); + for (int j = 0; j < item->effectCount(); ++j) { - const ItemEffect* e = it->getEffect(j); - if (e->getEffect() == ItemEffect::E_CoinCase) + const ItemEffect* effect = item->effect(j); + if (effect->effect() == ItemEffect::E_CoinCase) { - varValue->addItem(it->getName()); - varValue->setItemData(varValue->count() - 1, e->getVal1()); + varValue->addItem(item->name()); + varValue->setItemData(varValue->count() - 1, effect->value1()); } } } @@ -64,39 +62,39 @@ void CoinListUI::refreshGui() void CoinListUI::setGui() { - varName->setText(coinList_mod->getName()); - varValue->setCurrentIndex(varValue->findData(coinList_mod->getValue())); + varName->setText(m_coinList_mod->name()); + varValue->setCurrentIndex(varValue->findData(m_coinList_mod->value())); } void CoinListUI::on_buttonApply_clicked() { - *coinList = *coinList_mod; + *m_coinList = *m_coinList_mod; emit(changed(false)); } void CoinListUI::on_buttonDiscard_clicked() { - *coinList_mod = *coinList; + *m_coinList_mod = *m_coinList; setGui(); emit(changed(false)); } -void CoinListUI::on_varName_textChanged(const QString& n) +void CoinListUI::on_varName_textChanged(const QString& name) { - coinList_mod->setName(n); + m_coinList_mod->setName(name); emit(changed(true)); } -void CoinListUI::on_varValue_currentIndexChanged(const int v) +void CoinListUI::on_varValue_currentIndexChanged(const int value) { try { - coinList_mod->setValue(varValue->itemData(v).toInt()); + m_coinList_mod->setValue(varValue->itemData(value).toInt()); emit(changed(true)); } - catch (Exception& e) + catch (Exception& exception) { - BugCatcher::report(e); + BugCatcher::report(exception); setGui(); } } |
