diff options
Diffstat (limited to 'pokemodr/StoreUI.cpp')
| -rw-r--r-- | pokemodr/StoreUI.cpp | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/pokemodr/StoreUI.cpp b/pokemodr/StoreUI.cpp index 61957593..713563e4 100644 --- a/pokemodr/StoreUI.cpp +++ b/pokemodr/StoreUI.cpp @@ -1,46 +1,44 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokegen/StoreUI.cpp -// Purpose: Store UI form handling -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Mon Feb 11 22:59:48 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/>. + */ +// Qt includes #include <QListWidgetItem> -#include <QMetaObject> #include <QVariant> +// General includes #include <BugCatcher.h> #include <Exception.h> +// Pokemod includes #include <Item.h> #include <Pokemod.h> #include <Store.h> +// Header include #include "StoreUI.h" -StoreUI::StoreUI(Store* s, QWidget* parent) : +StoreUI::StoreUI(Store* store, QWidget* parent) : ObjectUI(parent), - store(s), - store_mod(new Store(s->getPokemod(), *s, s->getId())) + m_store(store), + m_store_mod(new Store(*store)) { setupUi(this); QMetaObject::connectSlotsByName(this); - setObjects(store, store_mod); + setObjects(m_store, m_store_mod); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); init(); } @@ -48,40 +46,40 @@ StoreUI::StoreUI(Store* s, QWidget* parent) : void StoreUI::refreshGui() { varItems->clear(); - for (int i = 0; i < store->getPokemod()->getItemCount(); ++i) + for (int i = 0; i < m_store->pokemod()->itemCount(); ++i) { - const Item* it = store->getPokemod()->getItem(i); - QListWidgetItem* lwi = new QListWidgetItem(it->getName(), varItems); - lwi->setData(Qt::UserRole, it->getId()); + const Item* item = m_store->pokemod()->item(i); + QListWidgetItem* widgetItem = new QListWidgetItem(item->name(), varItems); + widgetItem->setData(Qt::UserRole, item->id()); } } void StoreUI::setGui() { - varName->setText(store_mod->getName()); + varName->setText(m_store_mod->name()); for (int i = 0; i < varItems->count(); ++i) { - QListWidgetItem* lwi = varItems->item(i); - lwi->setSelected(store_mod->getItem(lwi->data(Qt::UserRole).toInt())); + QListWidgetItem* widgetItem = varItems->item(i); + widgetItem->setSelected(m_store_mod->item(widgetItem->data(Qt::UserRole).toInt())); } } void StoreUI::on_buttonApply_clicked() { - *store = *store_mod; + *m_store = *m_store_mod; emit(changed(false)); } void StoreUI::on_buttonDiscard_clicked() { - *store_mod = *store; + *m_store_mod = *m_store; setGui(); emit(changed(false)); } -void StoreUI::on_varName_textChanged(const QString& n) +void StoreUI::on_varName_textChanged(const QString& name) { - store_mod->setName(n); + m_store_mod->setName(name); emit(changed(true)); } @@ -91,14 +89,14 @@ void StoreUI::on_varItems_itemSelectionChanged() { for (int i = 0; i < varItems->count(); ++i) { - const QListWidgetItem* lwi = varItems->item(i); - store_mod->setItem(lwi->data(Qt::UserRole).toInt(), lwi->isSelected()); + const QListWidgetItem* widgetItem = varItems->item(i); + m_store_mod->setItem(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); } emit(changed(true)); } - catch (BoundsException& e) + catch (BoundsException& exception) { - BugCatcher::report(e); + BugCatcher::report(exception); setGui(); } } |
