summaryrefslogtreecommitdiffstats
path: root/pokemodr/PokeModTreeItem.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-02-24 09:10:35 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-02-24 09:10:35 +0000
commit09ffeef4fd962c5635cafc89df88296e9c6bfd5f (patch)
tree52598cf3ce5abebd98dff82acc2b288ec9071911 /pokemodr/PokeModTreeItem.cpp
parentfc3046a7e917458e024d76fd37ec531ce7efe217 (diff)
downloadsigen-09ffeef4fd962c5635cafc89df88296e9c6bfd5f.tar.gz
sigen-09ffeef4fd962c5635cafc89df88296e9c6bfd5f.tar.xz
sigen-09ffeef4fd962c5635cafc89df88296e9c6bfd5f.zip
[FIX] Macro fun with the repetitive class checking for determining class types with the tree
[FIX] KDE classes used in PokeModr UI form now [FIX] Includes in the file, only commented for ease of adding [FIX] Simpler KMessageBox used in ObjectUI [ADD] PokemodTreeItem.cpp git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@80 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/PokeModTreeItem.cpp')
-rw-r--r--pokemodr/PokeModTreeItem.cpp142
1 files changed, 142 insertions, 0 deletions
diff --git a/pokemodr/PokeModTreeItem.cpp b/pokemodr/PokeModTreeItem.cpp
new file mode 100644
index 00000000..a3788cea
--- /dev/null
+++ b/pokemodr/PokeModTreeItem.cpp
@@ -0,0 +1,142 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: pokegen/PokeModTreeItem.cpp
+// Purpose: Subclass of QTreeWidgetItem that allows information to be
+// tacked on as well
+// Author: Ben Boeckel
+// Modified by: Ben Boeckel
+// Created: Sat Feb 23 18:44:25 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 <QString>
+
+#include <Ability.h>
+#include <AbilityEffect.h>
+#include <Author.h>
+#include <Badge.h>
+#include <CoinList.h>
+#include <CoinListObject.h>
+#include <Dialog.h>
+#include <EggGroup.h>
+#include <Item.h>
+#include <ItemEffect.h>
+#include <ItemType.h>
+#include <Map.h>
+#include <MapEffect.h>
+#include <MapTrainer.h>
+#include <MapTrainerTeamMember.h>
+#include <MapWarp.h>
+#include <MapWildList.h>
+#include <MapWildListEncounter.h>
+#include <Move.h>
+#include <MoveEffect.h>
+#include <Nature.h>
+#include <Pokemod.h>
+#include <Rules.h>
+#include <Species.h>
+#include <SpeciesAbility.h>
+#include <SpeciesEvolution.h>
+#include <SpeciesItem.h>
+#include <SpeciesMove.h>
+#include <Store.h>
+#include <Tile.h>
+#include <Time.h>
+#include <Type.h>
+
+#include "PokeModTreeItem.h"
+
+void PokeModTreeItem::updateName()
+{
+ QString name(obj->getClassName());
+ QString text;
+ if (name == "Ability")
+ text = static_cast<Ability*>(obj)->getName();
+ else if (name == "AbilityEffect")
+ text = static_cast<AbilityEffect*>(obj)->getEffect();
+ else if (name == "Author")
+ text = static_cast<Author*>(obj)->getName();
+ else if (name == "Badge")
+ text = static_cast<Badge*>(obj)->getName();
+ else if (name == "CoinList")
+ text = static_cast<CoinList*>(obj)->getName();
+ else if (name == "CoinListObject")
+ {
+ const CoinListObject* o = static_cast<CoinListObject*>(obj);
+ if (o->getType() == CoinListObject::Item)
+ text = obj->getPokemod()->getItem(o->getObject())->getName();
+ else
+ text = obj->getPokemod()->getSpecies(o->getObject())->getName();
+ }
+ else if (name == "Dialog")
+ text = static_cast<Dialog*>(obj)->getDialog().mid(0, 25);
+ else if (name == "EggGroup")
+ text = static_cast<EggGroup*>(obj)->getName();
+ else if (name == "Item")
+ text = static_cast<Item*>(obj)->getName();
+ else if (name == "ItemEffect")
+ text = ItemEffect::EffectStr.at(static_cast<ItemEffect*>(obj)->getEffect());
+ else if (name == "ItemType")
+ text = static_cast< ::ItemType* >(obj)->getName();
+ else if (name == "Map")
+ text = static_cast<Map*>(obj)->getName();
+ else if (name == "MapEffect")
+ text = static_cast<MapEffect*>(obj)->getName();
+ else if (name == "MapTrainer")
+ text = static_cast<MapTrainer*>(obj)->getName();
+ else if (name == "MapTrainerTeamMember")
+ {
+ const MapTrainerTeamMember* t = static_cast<MapTrainerTeamMember*>(obj);
+ text = QString("Lv. %1 %2").arg(t->getLevel()).arg(obj->getPokemod()->getSpecies(t->getSpecies())->getName());
+ }
+ else if (name == "MapWarp")
+ text = static_cast<MapWarp*>(obj)->getName();
+ else if (name == "MapWildList")
+ text = MapWildList::ControlStr.at(static_cast<MapWildList*>(obj)->getControl());
+ else if (name == "MapWildListEncounter")
+ {
+ const MapWildListEncounter* e = static_cast<MapWildListEncounter*>(obj);
+ text = QString("Lv. %1 %2").arg(e->getLevel()).arg(obj->getPokemod()->getSpecies(e->getSpecies())->getName());
+ }
+ else if (name == "Move")
+ text = static_cast<Move*>(obj)->getName();
+ else if (name == "MoveEffect")
+ text = MoveEffect::EffectStr.at(static_cast<MoveEffect*>(obj)->getEffect());
+ else if (name == "Nature")
+ text = static_cast<Nature*>(obj)->getName();
+ else if (name == "Pokemod")
+ text = static_cast<Pokemod*>(obj)->getTitle();
+ else if (name == "Rules")
+ text = "Rules";
+ else if (name == "Species")
+ text = static_cast<Species*>(obj)->getName();
+ else if (name == "SpeciesAbility")
+ text = obj->getPokemod()->getAbility(static_cast<SpeciesAbility*>(obj)->getAbility())->getName();
+ else if (name == "SpeciesEvolution")
+ text = obj->getPokemod()->getSpecies(static_cast<SpeciesEvolution*>(obj)->getSpecies())->getName();
+ else if (name == "SpeciesItem")
+ text = obj->getPokemod()->getItem(static_cast<SpeciesItem*>(obj)->getItem())->getName();
+ else if (name == "SpeciesMove")
+ text = obj->getPokemod()->getMove(static_cast<SpeciesMove*>(obj)->getMove())->getName();
+ else if (name == "Store")
+ text = static_cast<Store*>(obj)->getName();
+ else if (name == "Tile")
+ text = static_cast<Tile*>(obj)->getName();
+ else if (name == "Time")
+ text = static_cast<Time*>(obj)->getName();
+ else if (name == "Type")
+ text = static_cast< ::Type* >(obj)->getName();
+ setText(0, text);
+}