summaryrefslogtreecommitdiffstats
path: root/pokemodr/MapWildListUI.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-04-27 17:57:32 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-04-27 17:57:32 +0000
commit0fa52c1f61c457c9b68bec53bcce3af858e5eb44 (patch)
treec5b10b77a01b417775097476029bcf67fac79975 /pokemodr/MapWildListUI.cpp
parent807071d35159de0660f9df31c48d5bf895ca3622 (diff)
downloadsigen-0fa52c1f61c457c9b68bec53bcce3af858e5eb44.tar.gz
sigen-0fa52c1f61c457c9b68bec53bcce3af858e5eb44.tar.xz
sigen-0fa52c1f61c457c9b68bec53bcce3af858e5eb44.zip
[FIX] More header cleanliness
[FIX] UI classes now just use the ObjectUI pointers [FIX] Some miscellaneous qmake options git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@112 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/MapWildListUI.cpp')
-rw-r--r--pokemodr/MapWildListUI.cpp49
1 files changed, 23 insertions, 26 deletions
diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp
index 52b67b78..8b204440 100644
--- a/pokemodr/MapWildListUI.cpp
+++ b/pokemodr/MapWildListUI.cpp
@@ -27,24 +27,21 @@
// General includes
#include "../general/BugCatcher.h"
-#include "../general/Exception.h"
-
-// Qt includes
-#include <QListWidgetItem>
-#include <QVariant>
MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) :
- ObjectUI(parent),
- m_wildList(wildList),
- m_wildList_mod(new MapWildList(*wildList))
+ ObjectUI(parent)
{
setupUi(this);
QMetaObject::connectSlotsByName(this);
- setObjects(m_wildList, m_wildList_mod);
+ setObjects(wildList, new MapWildList(*wildList));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
init();
}
+MapWildListUI::~MapWildListUI()
+{
+}
+
void MapWildListUI::initGui()
{
varControl->addItems(MapWildList::ControlStr);
@@ -54,9 +51,9 @@ void MapWildListUI::refreshGui()
{
varValue->clear();
varScope->clear();
- for (int i = 0; i < static_cast<const Pokemod*>(m_wildList->pokemod())->itemCount(); ++i)
+ for (int i = 0; i < static_cast<const Pokemod*>(static_cast<MapWildList*>(original())->pokemod())->itemCount(); ++i)
{
- const Item* item = static_cast<const Pokemod*>(m_wildList->pokemod())->item(i);
+ const Item* item = static_cast<const Pokemod*>(static_cast<MapWildList*>(original())->pokemod())->item(i);
for (int j = 0; j < item->effectCount(); ++j)
{
const ItemEffect* effect = item->effect(j);
@@ -73,9 +70,9 @@ void MapWildListUI::refreshGui()
}
}
varTimes->clear();
- for (int i = 0; i < static_cast<const Pokemod*>(m_wildList->pokemod())->timeCount(); ++i)
+ for (int i = 0; i < static_cast<const Pokemod*>(static_cast<MapWildList*>(original())->pokemod())->timeCount(); ++i)
{
- const Time* time = static_cast<const Pokemod*>(m_wildList->pokemod())->time(i);
+ const Time* time = static_cast<const Pokemod*>(static_cast<MapWildList*>(original())->pokemod())->time(i);
QListWidgetItem* widgetItem = new QListWidgetItem(time->name(), varTimes);
widgetItem->setData(Qt::UserRole, time->id());
}
@@ -83,27 +80,27 @@ void MapWildListUI::refreshGui()
void MapWildListUI::setGui()
{
- varControl->setCurrentIndex(m_wildList_mod->control());
- varValue->setEnabled(m_wildList_mod->control() == MapWildList::Fishing);
- varValue->setCurrentIndex(varValue->findData(m_wildList_mod->value()));
+ varControl->setCurrentIndex(static_cast<MapWildList*>(modified())->control());
+ varValue->setEnabled(static_cast<MapWildList*>(modified())->control() == MapWildList::Fishing);
+ varValue->setCurrentIndex(varValue->findData(static_cast<MapWildList*>(modified())->value()));
for (int i = 0; i < varTimes->count(); ++i)
{
QListWidgetItem* widgetItem = varTimes->item(i);
- widgetItem->setSelected(m_wildList_mod->time(widgetItem->data(Qt::UserRole).toInt()));
+ widgetItem->setSelected(static_cast<MapWildList*>(modified())->time(widgetItem->data(Qt::UserRole).toInt()));
}
- boxScope->setChecked(m_wildList_mod->scope() == INT_MAX);
- varScope->setCurrentIndex(varScope->findData(m_wildList_mod->scope()));
+ boxScope->setChecked(static_cast<MapWildList*>(modified())->scope() == INT_MAX);
+ varScope->setCurrentIndex(varScope->findData(static_cast<MapWildList*>(modified())->scope()));
}
void MapWildListUI::on_buttonApply_clicked()
{
- *m_wildList = *m_wildList_mod;
+ *static_cast<MapWildList*>(original()) = *static_cast<MapWildList*>(modified());
emit(changed(false));
}
void MapWildListUI::on_buttonDiscard_clicked()
{
- *m_wildList_mod = *m_wildList;
+ *static_cast<MapWildList*>(modified()) = *static_cast<MapWildList*>(original());
setGui();
emit(changed(false));
}
@@ -112,7 +109,7 @@ void MapWildListUI::on_varControl_currentIndexChanged(const int control)
{
try
{
- m_wildList_mod->setControl(control);
+ static_cast<MapWildList*>(modified())->setControl(control);
emit(changed(true));
}
catch (BoundsException& exception)
@@ -126,7 +123,7 @@ void MapWildListUI::on_varValue_currentIndexChanged(const int value)
{
try
{
- m_wildList_mod->setValue(varValue->itemData(value).toInt());
+ static_cast<MapWildList*>(modified())->setValue(varValue->itemData(value).toInt());
emit(changed(true));
}
catch (BoundsException& exception)
@@ -143,7 +140,7 @@ void MapWildListUI::on_varTimes_itemSelectionChanged()
for (int i = 0; i < varTimes->count(); ++i)
{
const QListWidgetItem* widgetItem = varTimes->item(i);
- m_wildList_mod->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
+ static_cast<MapWildList*>(modified())->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected());
}
emit(changed(true));
}
@@ -157,7 +154,7 @@ void MapWildListUI::on_varTimes_itemSelectionChanged()
void MapWildListUI::on_boxScope_toggled(const bool scopeUsed)
{
if (!scopeUsed)
- m_wildList_mod->setScope(INT_MAX);
+ static_cast<MapWildList*>(modified())->setScope(INT_MAX);
emit(changed(true));
setGui();
}
@@ -166,7 +163,7 @@ void MapWildListUI::on_varScope_currentIndexChanged(const int scope)
{
try
{
- m_wildList_mod->setScope(varScope->itemData(scope).toInt());
+ static_cast<MapWildList*>(modified())->setScope(varScope->itemData(scope).toInt());
emit(changed(true));
}
catch (BoundsException& exception)