summaryrefslogtreecommitdiffstats
path: root/pokemodr/MapWildListUI.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/MapWildListUI.cpp
parent05980e883719b1c8ebde1bd2fcbf4f8c16df7ad6 (diff)
downloadsigen-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/MapWildListUI.cpp')
-rw-r--r--pokemodr/MapWildListUI.cpp134
1 files changed, 66 insertions, 68 deletions
diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp
index df0d2ee6..87033b29 100644
--- a/pokemodr/MapWildListUI.cpp
+++ b/pokemodr/MapWildListUI.cpp
@@ -1,48 +1,46 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: pokegen/MapWildListUI.cpp
-// Purpose: MapWildList UI form handling
-// Author: Ben Boeckel
-// Modified by: Ben Boeckel
-// Created: Sat Feb 23 15:12:59 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 <ItemEffect.h>
#include <Pokemod.h>
#include <MapWildList.h>
#include <Time.h>
+// Header include
#include "MapWildListUI.h"
-MapWildListUI::MapWildListUI(MapWildList* w, QWidget* parent) :
+MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) :
ObjectUI(parent),
- mapWildList(w),
- mapWildList_mod(new MapWildList(w->getPokemod(), *w, w->getId()))
+ m_wildList(wildList),
+ m_wildList_mod(new MapWildList(*wildList))
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(mapWildList, mapWildList_mod);
+ setObjects(m_wildList, m_wildList_mod);
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
@@ -56,84 +54,84 @@ void MapWildListUI::refreshGui()
{
varValue->clear();
varScope->clear();
- for (int i = 0; i < mapWildList->getPokemod()->getItemCount(); ++i)
+ for (int i = 0; i < m_wildList->pokemod()->itemCount(); ++i)
{
- const Item* it = mapWildList->getPokemod()->getItem(i);
- for (int j = 0; j < it->getEffectCount(); ++j)
+ const Item* item = m_wildList->pokemod()->item(i);
+ for (int j = 0; j < item->effectCount(); ++j)
{
- const ItemEffect* e = it->getEffect(j);
- if (e->getEffect() == ItemEffect::E_Fish)
+ const ItemEffect* effect = item->effect(j);
+ if (effect->effect() == ItemEffect::E_Fish)
{
- varValue->addItem(it->getName());
- varValue->setItemData(varValue->count() - 1, e->getVal2());
+ varValue->addItem(item->name());
+ varValue->setItemData(varValue->count() - 1, effect->value2());
}
- if (e->getEffect() == ItemEffect::E_Scope)
+ else if (effect->effect() == ItemEffect::E_Scope)
{
- varScope->addItem(it->getName());
- varScope->setItemData(varScope->count() - 1, e->getVal2());
+ varScope->addItem(item->name());
+ varScope->setItemData(varScope->count() - 1, effect->value2());
}
}
}
varTimes->clear();
- for (int i = 0; i < mapWildList->getPokemod()->getTimeCount(); ++i)
+ for (int i = 0; i < m_wildList->pokemod()->timeCount(); ++i)
{
- const Time* t = mapWildList->getPokemod()->getTime(i);
- QListWidgetItem* lwi = new QListWidgetItem(t->getName(), varTimes);
- lwi->setData(Qt::UserRole, t->getId());
+ const Time* time = m_wildList->pokemod()->time(i);
+ QListWidgetItem* widgetItem = new QListWidgetItem(time->name(), varTimes);
+ widgetItem->setData(Qt::UserRole, time->id());
}
}
void MapWildListUI::setGui()
{
- varControl->setCurrentIndex(mapWildList_mod->getControl());
- varValue->setEnabled(mapWildList_mod->getControl() == MapWildList::Fishing);
- varValue->setCurrentIndex(varValue->findData(mapWildList_mod->getValue()));
+ varControl->setCurrentIndex(m_wildList_mod->control());
+ varValue->setEnabled(m_wildList_mod->control() == MapWildList::Fishing);
+ varValue->setCurrentIndex(varValue->findData(m_wildList_mod->value()));
for (int i = 0; i < varTimes->count(); ++i)
{
- QListWidgetItem* lwi = varTimes->item(i);
- lwi->setSelected(mapWildList_mod->getTime(lwi->data(Qt::UserRole).toInt()));
+ QListWidgetItem* widgetItem = varTimes->item(i);
+ widgetItem->setSelected(m_wildList_mod->time(widgetItem->data(Qt::UserRole).toInt()));
}
- boxScope->setChecked(mapWildList_mod->getScope() == INT_MAX);
- varScope->setCurrentIndex(varScope->findData(mapWildList_mod->getScope()));
+ boxScope->setChecked(m_wildList_mod->scope() == INT_MAX);
+ varScope->setCurrentIndex(varScope->findData(m_wildList_mod->scope()));
}
void MapWildListUI::on_buttonApply_clicked()
{
- *mapWildList = *mapWildList_mod;
+ *m_wildList = *m_wildList_mod;
emit(changed(false));
}
void MapWildListUI::on_buttonDiscard_clicked()
{
- *mapWildList_mod = *mapWildList;
+ *m_wildList_mod = *m_wildList;
setGui();
emit(changed(false));
}
-void MapWildListUI::on_varControl_currentIndexChanged(const int c)
+void MapWildListUI::on_varControl_currentIndexChanged(const int control)
{
try
{
- mapWildList_mod->setControl(c);
+ m_wildList_mod->setControl(control);
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
-void MapWildListUI::on_varValue_currentIndexChanged(const int v)
+void MapWildListUI::on_varValue_currentIndexChanged(const int value)
{
try
{
- mapWildList_mod->setValue(varValue->itemData(v).toInt());
+ m_wildList_mod->setValue(varValue->itemData(value).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
}
setGui();
}
@@ -144,36 +142,36 @@ void MapWildListUI::on_varTimes_itemSelectionChanged()
{
for (int i = 0; i < varTimes->count(); ++i)
{
- const QListWidgetItem* lwi = varTimes->item(i);
- mapWildList_mod->setTime(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ const QListWidgetItem* widgetItem = varTimes->item(i);
+ m_wildList_mod->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}
-void MapWildListUI::on_boxScope_toggled(const bool s)
+void MapWildListUI::on_boxScope_toggled(const bool scopeUsed)
{
- if (!s)
- mapWildList_mod->setScope(INT_MAX);
+ if (!scopeUsed)
+ m_wildList_mod->setScope(INT_MAX);
emit(changed(true));
setGui();
}
-void MapWildListUI::on_varScope_currentIndexChanged(const int s)
+void MapWildListUI::on_varScope_currentIndexChanged(const int scope)
{
try
{
- mapWildList_mod->setScope(varScope->itemData(s).toInt());
+ m_wildList_mod->setScope(varScope->itemData(scope).toInt());
emit(changed(true));
}
- catch (BoundsException& e)
+ catch (BoundsException& exception)
{
- BugCatcher::report(e);
+ BugCatcher::report(exception);
setGui();
}
}