From 6679f5cffa9d35a23b76605ddfbf3257f882b6ee Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 17 Apr 2008 23:34:36 +0000 Subject: [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 --- pokemodr/CoinListObjectUI.cpp | 118 +++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 60 deletions(-) (limited to 'pokemodr/CoinListObjectUI.cpp') diff --git a/pokemodr/CoinListObjectUI.cpp b/pokemodr/CoinListObjectUI.cpp index 85953908..61fb5908 100644 --- a/pokemodr/CoinListObjectUI.cpp +++ b/pokemodr/CoinListObjectUI.cpp @@ -1,47 +1,45 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokegen/CoinListObjectUI.cpp -// Purpose: CoinListObject UI form handling -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Fri Feb 1 13:35:58 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 . -///////////////////////////////////////////////////////////////////////////// +/* + * Copyright 2008 Ben Boeckel + * + * 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 . + */ -#include +// Qt includes #include +// General includes #include #include +// Pokemod includes #include #include #include #include +// Header include #include "CoinListObjectUI.h" -CoinListObjectUI::CoinListObjectUI(CoinListObject* c, QWidget* parent) : +CoinListObjectUI::CoinListObjectUI(CoinListObject* coinListObject, QWidget* parent) : ObjectUI(parent), - lastType(-1), - coinListObject(c), - coinListObject_mod(new CoinListObject(c->getPokemod(), *c, c->getId())) + m_lastType(-1), + m_object(coinListObject), + m_object_mod(new CoinListObject(*coinListObject)) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(coinListObject, coinListObject_mod); + setObjects(m_object, m_object_mod); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } @@ -53,101 +51,101 @@ void CoinListObjectUI::initGui() void CoinListObjectUI::setGui() { - bool resetObjects = (coinListObject_mod->getType() != lastType); - varType->setCurrentIndex(coinListObject_mod->getType()); - lastType = coinListObject_mod->getType(); + bool resetObjects = (m_object_mod->type() != m_lastType); + varType->setCurrentIndex(m_object_mod->type()); + m_lastType = m_object_mod->type(); if (resetObjects) { varObject->clear(); - if (coinListObject_mod->getType() == CoinListObject::Item) + if (m_object_mod->type() == CoinListObject::Item) { - for (int i = 0; i < coinListObject->getPokemod()->getItemCount(); ++i) + for (int i = 0; i < m_object->pokemod()->itemCount(); ++i) { - const Item* it = coinListObject->getPokemod()->getItem(i); - varObject->addItem(it->getName()); - varObject->setItemData(i, it->getId()); + const Item* item = m_object->pokemod()->item(i); + varObject->addItem(item->name()); + varObject->setItemData(i, item->id()); } } else { - for (int i = 0; i < coinListObject->getPokemod()->getSpeciesCount(); ++i) + for (int i = 0; i < m_object->pokemod()->speciesCount(); ++i) { - const Species* s = coinListObject->getPokemod()->getSpecies(i); - varObject->addItem(s->getName()); - varObject->setItemData(i, s->getId()); + const Species* species = m_object->pokemod()->species(i); + varObject->addItem(species->name()); + varObject->setItemData(i, species->id()); } } } - varObject->setCurrentIndex(varObject->findData(coinListObject_mod->getObject())); - varAmount->setValue(coinListObject_mod->getAmount()); - varCost->setValue(coinListObject_mod->getCost()); + varObject->setCurrentIndex(varObject->findData(m_object_mod->object())); + varAmount->setValue(m_object_mod->amount()); + varCost->setValue(m_object_mod->cost()); } void CoinListObjectUI::on_buttonApply_clicked() { - *coinListObject = *coinListObject_mod; + *m_object = *m_object_mod; emit(changed(false)); } void CoinListObjectUI::on_buttonDiscard_clicked() { - *coinListObject_mod = *coinListObject; + *m_object_mod = *m_object; setGui(); emit(changed(false)); } -void CoinListObjectUI::on_varType_currentIndexChanged(const int t) +void CoinListObjectUI::on_varType_currentIndexChanged(const int type) { try { - coinListObject_mod->setType(t); + m_object_mod->setType(type); emit(changed(true)); } - catch (BoundsException& e) + catch (BoundsException& exception) { - BugCatcher::report(e); + BugCatcher::report(exception); } setGui(); } -void CoinListObjectUI::on_varObject_currentIndexChanged(const int o) +void CoinListObjectUI::on_varObject_currentIndexChanged(const int obey) { try { - coinListObject_mod->setObject(varObject->itemData(o).toInt()); + m_object_mod->setObject(varObject->itemData(obey).toInt()); emit(changed(true)); } - catch (BoundsException& e) + catch (BoundsException& exception) { - BugCatcher::report(e); + BugCatcher::report(exception); setGui(); } } -void CoinListObjectUI::on_varAmount_valueChanged(const int a) +void CoinListObjectUI::on_varAmount_valueChanged(const int amount) { try { - coinListObject_mod->setAmount(a); + m_object_mod->setAmount(amount); emit(changed(true)); } - catch (BoundsException& e) + catch (BoundsException& exception) { - BugCatcher::report(e); + BugCatcher::report(exception); setGui(); } } -void CoinListObjectUI::on_varCost_valueChanged(const int c) +void CoinListObjectUI::on_varCost_valueChanged(const int cost) { try { - coinListObject_mod->setCost(c); + m_object_mod->setCost(cost); emit(changed(true)); } - catch (BoundsException& e) + catch (BoundsException& exception) { - BugCatcher::report(e); + BugCatcher::report(exception); setGui(); } } -- cgit