summaryrefslogtreecommitdiffstats
path: root/pokemodr/StoreUI.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-17 23:34:36 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-17 23:34:36 +0000
commit6679f5cffa9d35a23b76605ddfbf3257f882b6ee (patch)
treec8e41854a60b64e8569939bca6b827807175ef9a /pokemodr/StoreUI.cpp
parent05980e883719b1c8ebde1bd2fcbf4f8c16df7ad6 (diff)
[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/StoreUI.cpp')
-rw-r--r--pokemodr/StoreUI.cpp80
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();
}
}