summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-02-23 19:54:49 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-02-23 19:54:49 +0000
commite4f17883b6c71645933f1930d2dabf338d65a5ba (patch)
tree5c3ff474012f0fc0432f220888259e2b879e16aa
parent327cb610e065d9e02f176078b064c2780bb1ec03 (diff)
[FIX] Errors with MapWarpUI and MapWildListEncounterUI
[ADD] MapTrainerTeamMemberUI.{h, cpp} git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@77 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog10
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.cpp164
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.h60
-rw-r--r--pokemodr/MapWarpUI.cpp4
-rw-r--r--pokemodr/MapWarpUI.h2
-rw-r--r--pokemodr/MapWildListEncounterUI.cpp3
-rw-r--r--pokemodr/MapWildListEncounterUI.h2
-rw-r--r--pokemodr/TODO2
-rw-r--r--pokemodr/gui/maptrainerteammember.ui8
-rw-r--r--pokemodr/pokemodr.pro6
10 files changed, 246 insertions, 15 deletions
diff --git a/Changelog b/Changelog
index 5b5d1141..66f02634 100644
--- a/Changelog
+++ b/Changelog
@@ -1,10 +1,18 @@
-----------------
+Rev: 77
+Date: 23 February 2008
+User: MathStuf
+-----------------
+[FIX] Errors with MapWarpUI and MapWildListEncounterUI
+[ADD] MapTrainerTeamMemberUI.{h, cpp}
+
+-----------------
Rev: 76
Date: 23 February 2008
User: MathStuf
-----------------
[ADD] MapWarpUI.{h, cpp} added to repo
-[ADD] MapWildListEncounter.{h, cpp}
+[ADD] MapWildListEncounterUI.{h, cpp}
[ADD] Flag setting in UI forms a less work
[FIX] Scope setting in MapWildList better
[FIX] SpeciesUI form elements now disabled if not available
diff --git a/pokemodr/MapTrainerTeamMemberUI.cpp b/pokemodr/MapTrainerTeamMemberUI.cpp
new file mode 100644
index 00000000..3b3ec52e
--- /dev/null
+++ b/pokemodr/MapTrainerTeamMemberUI.cpp
@@ -0,0 +1,164 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokegen/MapTrainerTeamMemberUI.cpp
+// Purpose: MapTrainerTeamMember UI form handling
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Sun Jan 27 13:39:26 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/>.
+/////////////////////////////////////////////////////////////////////////////
+
+#include <QListWidgetItem>
+#include <QMetaObject>
+
+#include <BugCatcher.h>
+#include <Exception.h>
+
+#include <Nature.h>
+#include <Pokemod.h>
+#include <Species.h>
+
+#include "MapTrainerTeamMemberUI.h"
+
+MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* t, QWidget* parent) :
+ ObjectUI(parent),
+ mapTrainerTeamMember(t),
+ mapTrainerTeamMember_mod(new MapTrainerTeamMember(t->getPokemod(), *t, t->getId()))
+{
+ setupUi(this);
+ QMetaObject::connectSlotsByName(this);
+ setObjects(mapTrainerTeamMember, mapTrainerTeamMember_mod);
+ connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setDisabled(bool)));
+ for (int i = 0; i < mapTrainerTeamMember->getPokemod()->getSpeciesCount(); ++i)
+ {
+ const Species* s = mapTrainerTeamMember->getPokemod()->getSpecies(i);
+ varSpecies->addItem(s->getName());
+ varSpecies->setItemData(i, s->getId());
+ }
+ varLevel->setMaximum(mapTrainerTeamMember->getPokemod()->getRules()->getMaxLevel());
+ if (mapTrainerTeamMember->getPokemod()->getRules()->getNatureAllowed())
+ {
+ for (int i = 0; i < mapTrainerTeamMember->getPokemod()->getNatureCount(); ++i)
+ {
+ const Nature* n = mapTrainerTeamMember->getPokemod()->getNature(i);
+ varNature->addItem(n->getName());
+ varNature->setItemData(i, n->getId());
+ }
+ }
+ else
+ boxNature->setEnabled(false);
+ if (mapTrainerTeamMember->getPokemod()->getRules()->getHoldItems())
+ {
+ for (int i = 0; i < mapTrainerTeamMember->getPokemod()->getItemCount(); ++i)
+ {
+ const Item* it = mapTrainerTeamMember->getPokemod()->getItem(i);
+ QListWidgetItem* lwi = new QListWidgetItem(it->getName(), varItems);
+ lwi->setData(Qt::UserRole, it->getId());
+ }
+ }
+ else
+ boxItems->setEnabled(false);
+ setGui();
+}
+
+// KToolbar getToolbar(QWidget* parent)
+// {
+//
+// }
+
+void MapTrainerTeamMemberUI::setGui()
+{
+ varSpecies->setCurrentIndex(varSpecies->findData(mapTrainerTeamMember_mod->getSpecies()));
+ varLevel->setValue(mapTrainerTeamMember_mod->getLevel());
+ varNature->setCurrentIndex(varNature->findData(mapTrainerTeamMember_mod->getNature()));
+ for (int i = 0; i < varItems->count(); ++i)
+ {
+ QListWidgetItem* lwi = varItems->item(i);
+ lwi->setSelected(mapTrainerTeamMember_mod->getItem(lwi->data(Qt::UserRole).toInt()));
+ }
+}
+
+void MapTrainerTeamMemberUI::on_buttonApply_clicked()
+{
+ *mapTrainerTeamMember = *mapTrainerTeamMember_mod;
+ emit(changed(false));
+}
+
+void MapTrainerTeamMemberUI::on_buttonDiscard_clicked()
+{
+ *mapTrainerTeamMember_mod = *mapTrainerTeamMember;
+ emit(changed(false));
+ setGui();
+}
+
+void MapTrainerTeamMemberUI::on_varSpecies_currentIndexChanged(const int s)
+{
+ try
+ {
+ mapTrainerTeamMember_mod->setSpecies(varSpecies->itemData(s).toInt());
+ emit(changed(true));
+ }
+ catch (BoundsException& e)
+ {
+ BugCatcher::report(e);
+ setGui();
+ }
+}
+
+void MapTrainerTeamMemberUI::on_varLevel_valueChanged(const int l)
+{
+ try
+ {
+ mapTrainerTeamMember_mod->setLevel(l);
+ emit(changed(true));
+ }
+ catch (Exception& e)
+ {
+ BugCatcher::report(e);
+ }
+ setGui();
+}
+
+void MapTrainerTeamMemberUI::on_varNature_currentIndexChanged(const int n)
+{
+ try
+ {
+ mapTrainerTeamMember_mod->setNature(varNature->itemData(n).toInt());
+ emit(changed(true));
+ }
+ catch (BoundsException& e)
+ {
+ BugCatcher::report(e);
+ setGui();
+ }
+}
+
+void MapTrainerTeamMemberUI::on_varItems_itemSelectionChanged()
+{
+ try
+ {
+ for (int i = 0; i < varItems->count(); ++i)
+ {
+ const QListWidgetItem* lwi = varItems->item(i);
+ mapTrainerTeamMember_mod->setItem(lwi->data(Qt::UserRole).toInt(), lwi->isSelected());
+ }
+ emit(changed(true));
+ }
+ catch (BoundsException& e)
+ {
+ BugCatcher::report(e);
+ setGui();
+ }
+}
diff --git a/pokemodr/MapTrainerTeamMemberUI.h b/pokemodr/MapTrainerTeamMemberUI.h
new file mode 100644
index 00000000..c7082a19
--- /dev/null
+++ b/pokemodr/MapTrainerTeamMemberUI.h
@@ -0,0 +1,60 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokegen/MapTrainerTeamMemberUI.h
+// Purpose: MapTrainerTeamMember UI form handling
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Sat Feb 23 14:39:14 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/>.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __POKEMODR_MAPTRAINERTEAMMEMBERUI__
+#define __POKEMODR_MAPTRAINERTEAMMEMBERUI__
+
+#include <ktoolbar.h>
+
+#include <MapTrainerTeamMember.h>
+
+#include "ObjectUI.h"
+
+#include "ui_maptrainerteammember.h"
+
+class MapTrainerTeamMemberUI : public ObjectUI, private Ui::formMapTrainerTeamMember
+{
+ Q_OBJECT
+
+ public:
+ MapTrainerTeamMemberUI(MapTrainerTeamMember* t, QWidget* parent);
+ ~MapTrainerTeamMemberUI()
+ {
+ delete mapTrainerTeamMember_mod;
+ }
+
+// KToolbar getToolbar(QWidget* parent);
+ public slots:
+ void on_buttonApply_clicked();
+ void on_buttonDiscard_clicked();
+ void on_varSpecies_currentIndexChanged(const int s);
+ void on_varLevel_valueChanged(const int l);
+ void on_varNature_currentIndexChanged(const int n);
+ void on_varItems_itemSelectionChanged();
+ private:
+ void setGui();
+
+ MapTrainerTeamMember* mapTrainerTeamMember;
+ MapTrainerTeamMember* mapTrainerTeamMember_mod;
+};
+
+#endif
diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp
index eb4fc0f6..237472d7 100644
--- a/pokemodr/MapWarpUI.cpp
+++ b/pokemodr/MapWarpUI.cpp
@@ -98,7 +98,7 @@ void MapWarpUI::setGui()
}
}
varToWarp->setCurrentIndex(varToMap->findData(mapWarp_mod->getToWarp()));
- boxFlag->setCheckState((mapWarp_mod->getWorkingFlag().getStatus() == Flag::Ignore) ? Qt::Unchecked : Qt::Checked);
+ boxFlag->setChecked((mapWarp_mod->getWorkingFlag().getStatus() == Flag::Ignore) ? Qt::Unchecked : Qt::Checked);
if (boxFlag->isChecked())
{
varFlag->setValue(mapWarp_mod->getWorkingFlag().getFlag());
@@ -251,7 +251,7 @@ void MapWarpUI::on_varToWarp_currentIndexChanged(const int w)
}
}
-void on_boxFlag_toggled(const bool f)
+void MapWarpUI::on_boxFlag_toggled(const bool f)
{
if (f)
mapWarp_mod->setWorkingFlagStatus(Flag::Ignore);
diff --git a/pokemodr/MapWarpUI.h b/pokemodr/MapWarpUI.h
index 65f524b7..3d73ca5e 100644
--- a/pokemodr/MapWarpUI.h
+++ b/pokemodr/MapWarpUI.h
@@ -61,7 +61,7 @@ class MapWarpUI : public ObjectUI, private Ui::formMapWarp
void on_varToWarp_currentIndexChanged(const int w);
void on_boxFlag_toggled(const bool f);
void on_varFlag_valueChanged(const int f);
- void on_varState_stateChanged(const int s);
+ void on_varState_toggled(const bool s);
void on_varDialog_currentIndexChanged(const int d);
private:
void setGui();
diff --git a/pokemodr/MapWildListEncounterUI.cpp b/pokemodr/MapWildListEncounterUI.cpp
index fbac4e95..e4fde4a0 100644
--- a/pokemodr/MapWildListEncounterUI.cpp
+++ b/pokemodr/MapWildListEncounterUI.cpp
@@ -20,7 +20,6 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////
-#include <QListWidgetItem>
#include <QMetaObject>
#include <BugCatcher.h>
@@ -57,7 +56,7 @@ MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* w, QWidget*
void MapWildListEncounterUI::setGui()
{
- varSpecies->setCurrentItem(carSpecies->findData(mapWildListEncounter_mod->getSpecies()));
+ varSpecies->setCurrentIndex(varSpecies->findData(mapWildListEncounter_mod->getSpecies()));
varLevel->setValue(mapWildListEncounter_mod->getLevel());
varWeight->setValue(mapWildListEncounter_mod->getWeight());
}
diff --git a/pokemodr/MapWildListEncounterUI.h b/pokemodr/MapWildListEncounterUI.h
index c5921e6e..e65e927b 100644
--- a/pokemodr/MapWildListEncounterUI.h
+++ b/pokemodr/MapWildListEncounterUI.h
@@ -29,7 +29,7 @@
#include "ObjectUI.h"
-#include "ui_mapwildlist.h"
+#include "ui_mapwildlistencounter.h"
class MapWildListEncounterUI : public ObjectUI, private Ui::formMapWildListEncounter
{
diff --git a/pokemodr/TODO b/pokemodr/TODO
index 491442dc..95d10738 100644
--- a/pokemodr/TODO
+++ b/pokemodr/TODO
@@ -3,9 +3,7 @@ Dialog
ItemEffect
MapEffect
MapTrainer
-MapTrainerTeamMember
MapWildList
-MapWildListEncounter
MoveEffect
TypeChart
diff --git a/pokemodr/gui/maptrainerteammember.ui b/pokemodr/gui/maptrainerteammember.ui
index 7e0079b5..cb0ce6cb 100644
--- a/pokemodr/gui/maptrainerteammember.ui
+++ b/pokemodr/gui/maptrainerteammember.ui
@@ -1,12 +1,12 @@
<ui version="4.0" >
- <class>forMapTrainerTeamMember</class>
- <widget class="QWidget" name="forMapTrainerTeamMember" >
+ <class>formMapTrainerTeamMember</class>
+ <widget class="QWidget" name="formMapTrainerTeamMember" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
- <width>226</width>
- <height>421</height>
+ <width>236</width>
+ <height>441</height>
</rect>
</property>
<property name="windowTitle" >
diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro
index 50df5370..cc7b3440 100644
--- a/pokemodr/pokemodr.pro
+++ b/pokemodr/pokemodr.pro
@@ -81,7 +81,8 @@ SOURCES += AbilityUI.cpp \
TimeUI.cpp \
TypeUI.cpp \
MapWarpUI.cpp \
- MapWildListEncounterUI.cpp
+ MapWildListEncounterUI.cpp \
+ MapTrainerTeamMemberUI.cpp
HEADERS += AbilityUI.h \
AuthorUI.h \
@@ -115,7 +116,8 @@ HEADERS += AbilityUI.h \
TypeUI.h \
MapWarpUI.h \
MapWildListUI.h \
- MapWildListEncounterUI.h
+ MapWildListEncounterUI.h \
+ MapTrainerTeamMemberUI.h
FORMS += gui/ability.ui \
gui/abilityeffect.ui \