diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-12-07 01:03:48 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-12-07 01:03:48 -0500 |
| commit | 7459a5a34a5bcf7011c4164e3c92c7770da09514 (patch) | |
| tree | 57c53a9fad0dbff587bc8249ec2e0d09308f5f7a /sigmodr/CoinListObjectUI.cpp | |
| parent | 67aefdbacc16395bda2a8bfb14004190ced25e00 (diff) | |
| download | sigen-7459a5a34a5bcf7011c4164e3c92c7770da09514.tar.gz sigen-7459a5a34a5bcf7011c4164e3c92c7770da09514.tar.xz sigen-7459a5a34a5bcf7011c4164e3c92c7770da09514.zip | |
Renamed CoinListObject to CoinListItem and added documentation for it
Diffstat (limited to 'sigmodr/CoinListObjectUI.cpp')
| -rw-r--r-- | sigmodr/CoinListObjectUI.cpp | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/sigmodr/CoinListObjectUI.cpp b/sigmodr/CoinListObjectUI.cpp deleted file mode 100644 index 2979ba11..00000000 --- a/sigmodr/CoinListObjectUI.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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/>. - */ - -// Header include -#include "CoinListObjectUI.h" - -// Sigmod includes -#include "../sigmod/CoinListObject.h" -#include "../sigmod/Item.h" -#include "../sigmod/Sigmod.h" -#include "../sigmod/Species.h" - -Sigmodr::CoinListObjectUI::CoinListObjectUI(Sigmod::CoinListObject* object, QWidget* parent) : - ObjectUI(parent), - m_lastType(-1) -{ - setupUi(this); - setObjects(object, new Sigmod::CoinListObject(*object)); -} - -Sigmodr::CoinListObjectUI::~CoinListObjectUI() -{ -} - -void Sigmodr::CoinListObjectUI::initGui() -{ - connect(varType, SIGNAL(activated(const int)), this, SLOT(setGui())); - varType->addItem(Sigmod::CoinListObject::TypeStr[Sigmod::CoinListObject::Item], QVariant::fromValue(Sigmod::CoinListObject::Item)); - varType->addItem(Sigmod::CoinListObject::TypeStr[Sigmod::CoinListObject::Species], QVariant::fromValue(Sigmod::CoinListObject::Species)); -} - -void Sigmodr::CoinListObjectUI::setGui() -{ - bool resetObjects = (qobject_cast<Sigmod::CoinListObject*>(modified())->type() != m_lastType); - varType->setCurrentIndex(qobject_cast<Sigmod::CoinListObject*>(modified())->type()); - m_lastType = qobject_cast<Sigmod::CoinListObject*>(modified())->type(); - if (resetObjects) - { - const bool blocked = varObject->blockSignals(true); - varObject->clear(); - if (qobject_cast<Sigmod::CoinListObject*>(modified())->type() == Sigmod::CoinListObject::Item) - { - for (int i = 0; i < sigmod()->itemCount(); ++i) - { - const Sigmod::Item* item = sigmod()->item(i); - varObject->addItem(item->name(), item->id()); - } - } - else - { - for (int i = 0; i < sigmod()->speciesCount(); ++i) - { - const Sigmod::Species* species = sigmod()->species(i); - varObject->addItem(species->name(), species->id()); - } - } - varObject->blockSignals(blocked); - } - varObject->setCurrentIndex(varObject->findData(qobject_cast<Sigmod::CoinListObject*>(modified())->object())); - varCost->setValue(qobject_cast<Sigmod::CoinListObject*>(modified())->cost()); -} - -void Sigmodr::CoinListObjectUI::apply() -{ - *qobject_cast<Sigmod::CoinListObject*>(original()) = *qobject_cast<Sigmod::CoinListObject*>(modified()); - emit(changed(false)); -} - -void Sigmodr::CoinListObjectUI::discard() -{ - *qobject_cast<Sigmod::CoinListObject*>(modified()) = *qobject_cast<Sigmod::CoinListObject*>(original()); - setGui(); - emit(changed(false)); -} - -void Sigmodr::CoinListObjectUI::on_varType_activated(const int type) -{ - qobject_cast<Sigmod::CoinListObject*>(modified())->setType(varType->itemData(type).value<Sigmod::CoinListObject::Type>()); -} - -void Sigmodr::CoinListObjectUI::on_varObject_activated(const int obey) -{ - qobject_cast<Sigmod::CoinListObject*>(modified())->setObject(varObject->itemData(obey).toInt()); -} - -void Sigmodr::CoinListObjectUI::on_varCost_valueChanged(const int cost) -{ - qobject_cast<Sigmod::CoinListObject*>(modified())->setCost(cost); -} |
