diff options
Diffstat (limited to 'pokemodr/PokeModrUI.cpp')
| -rw-r--r-- | pokemodr/PokeModrUI.cpp | 99 |
1 files changed, 90 insertions, 9 deletions
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp index 19e86090..a8490551 100644 --- a/pokemodr/PokeModrUI.cpp +++ b/pokemodr/PokeModrUI.cpp @@ -30,8 +30,8 @@ #include <Exception.h> #include "PokeModrUI.h" +#include "PokeModTreeItem.h" -// Debugging includes #include "AbilityUI.h" #include "AuthorUI.h" #include "BadgeUI.h" @@ -41,7 +41,10 @@ #include "ItemUI.h" #include "ItemTypeUI.h" #include "MapUI.h" +#include "MapTrainerTeamMemberUI.h" #include "MapWarpUI.h" +#include "MapWildListUI.h" +#include "MapWildListEncounterUI.h" #include "MoveUI.h" #include "NatureUI.h" #include "PokemodUI.h" @@ -57,16 +60,16 @@ #include "TypeUI.h" PokeModrUI::PokeModrUI(KConfigGroup cfg, KConfigGroup history, QWidget* parent) : - QMainWindow(parent), + KMainWindow(parent), config(cfg), recent("&Recent Files...", NULL) { setupUi(this); QMetaObject::connectSlotsByName(this); -// recent.loadEntries(history); -// menuBar()->addMenu(helpMenu("", false)); -// restoreWindowSize(cfg); -// cfg.readEntry("splitterPos", 100); + recent.loadEntries(history); + menuBar()->addMenu(customHelpMenu(false)); + restoreWindowSize(cfg); + cfg.readEntry("splitterPos", 100); // if (cfg.readEntry("reloadOnStart", false).toBool()) // open(recent.urls().at(0)); @@ -115,6 +118,7 @@ void PokeModrUI::PokeModrUI::on_actionNew_triggered() void PokeModrUI::on_actionOpen_triggered() { + } void PokeModrUI::on_actionSave_triggered() @@ -149,6 +153,83 @@ void PokeModrUI::on_splitter_splitterMoved(const int pos) { } -// void PokeModrUI::on_treePokemod_itemChanged(QTreeWidgetItem* item) -// { -// } +void PokeModrUI::on_treePokemod_itemSelectionChanged() +{ + QTreeWidgetItem* cur = treePokemod->currentItem(); + PokeModTreeItem* selected = static_cast<PokeModTreeItem*>(treePokemod->selectedItems()[0]); + if (selected->getObject() || static_cast<ObjectUI*>(formPanel->widget())->close()) + { + Object* o = selected->getObject(); + QString name(o->getClassName()); + ObjectUI* widget = NULL; + if (name == "Ability") + widget = new AbilityUI(static_cast<Ability*>(o), formPanel); +// else if (name == "AbilityEffect") +// widget = new AbilityEffectUI(static_cast<AbilityEffect*>(o), formPanel); + else if (name == "Author") + widget = new AuthorUI(static_cast<Author*>(o), formPanel); + else if (name == "Badge") + widget = new BadgeUI(static_cast<Badge*>(o), formPanel); + else if (name == "CoinList") + widget = new CoinListUI(static_cast<CoinList*>(o), formPanel); + else if (name == "CoinListObject") + widget = new CoinListObjectUI(static_cast<CoinListObject*>(o), formPanel); +// else if (name == "Dialog") +// widget = new DialogUI(static_cast<Dialog*>(o), formPanel); + else if (name == "EggGroup") + widget = new EggGroupUI(static_cast<EggGroup*>(o), formPanel); + else if (name == "Item") + widget = new ItemUI(static_cast<Item*>(o), formPanel); +// else if (name == "ItemEffect") +// widget = new ItemEffectUI(static_cast<ItemEffect*>(o), formPanel); + else if (name == "ItemType") + widget = new ItemTypeUI(static_cast<ItemType*>(o), formPanel); + else if (name == "Map") + widget = new MapUI(static_cast<Map*>(o), formPanel); +// else if (name == "MapEffect") +// widget = new MapEffectUI(static_cast<MapEffect*>(o), formPanel); +// else if (name == "MapTrainer") +// widget = new MapTrainerUI(static_cast<MapTrainer*>(o), formPanel); + else if (name == "MapTrainerTeamMember") + widget = new MapTrainerTeamMemberUI(static_cast<MapTrainerTeamMember*>(o), formPanel); + else if (name == "MapWarp") + widget = new MapWarpUI(static_cast<MapWarp*>(o), formPanel); + else if (name == "MapWildList") + widget = new MapWildListUI(static_cast<MapWildList*>(o), formPanel); + else if (name == "MapWildListEncounter") + widget = new MapWildListEncounterUI(static_cast<MapWildListEncounter*>(o), formPanel); + else if (name == "Move") + widget = new MoveUI(static_cast<Move*>(o), formPanel); +// else if (name == "MoveEffect") +// widget = new MoveEffectUI(static_cast<MoveEffect*>(o), formPanel); + else if (name == "Nature") + widget = new NatureUI(static_cast<Nature*>(o), formPanel); + else if (name == "Pokemod") + widget = new PokemodUI(static_cast<Pokemod*>(o), formPanel); + else if (name == "Rules") + widget = new RulesUI(static_cast<Rules*>(o), formPanel); + else if (name == "Species") + widget = new SpeciesUI(static_cast<Species*>(o), formPanel); + else if (name == "SpeciesAbility") + widget = new SpeciesAbilityUI(static_cast<SpeciesAbility*>(o), formPanel); + else if (name == "SpeciesEvolution") + widget = new SpeciesEvolutionUI(static_cast<SpeciesEvolution*>(o), formPanel); + else if (name == "SpeciesItem") + widget = new SpeciesItemUI(static_cast<SpeciesItem*>(o), formPanel); + else if (name == "SpeciesMove") + widget = new SpeciesMoveUI(static_cast<SpeciesMove*>(o), formPanel); + else if (name == "Store") + widget = new StoreUI(static_cast<Store*>(o), formPanel); + else if (name == "Tile") + widget = new TileUI(static_cast<Tile*>(o), formPanel); + else if (name == "Time") + widget = new TimeUI(static_cast<Time*>(o), formPanel); + else if (name == "Type") + widget = new TypeUI(static_cast<Type*>(o), formPanel); + formPanel->setWidget(widget); + connect(widget, SIGNAL(changed(bool)), selected, SLOT(updateName())); + formPanel->show(); + } + else + treePokemod->setCurrentItem(cur); +} |
