From 9cd7f4656b01cfb243433e1063c0339b2b96bbd4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 23 Feb 2008 00:30:00 +0000 Subject: [FIX] Changelog/SVN desynchronization fixed [FIX] skins UI file cleaned up [FIX] ImageCache no longer uses force argument [FIX] operator= now correctly copies subdata from rhs (instead of reassigning ID numbers) [FIX] Pokemod can now be copied [FIX] Pokemod skin calls cleaned up [ADD] PokemodUI.{h, cpp} [ADD] SkinsUI.{h, cpp} git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@70 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- pokemodr/PokemodUI.cpp | 153 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 pokemodr/PokemodUI.cpp (limited to 'pokemodr/PokemodUI.cpp') diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp new file mode 100644 index 00000000..d3be9621 --- /dev/null +++ b/pokemodr/PokemodUI.cpp @@ -0,0 +1,153 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/PokemodUI.cpp +// Purpose: Pokemod UI form handling +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Fri Feb 22 16:30:10 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 . +///////////////////////////////////////////////////////////////////////////// + +#include + +#include +#include + +#include + +#include "PokemodUI.h" + +PokemodUI::PokemodUI(Pokemod* p, QWidget* parent) : + ObjectUI(parent), + lastMap(-1), + pokemod(p), + pokemod_mod(new Pokemod(*p)) +{ + setupUi(this); + QMetaObject::connectSlotsByName(this); + setObjects(pokemod, pokemod_mod); + for (int i = 0; i < pokemod->getPokemod()->getMapCount(); ++i) + { + const Map* m = pokemod->getPokemod()->getMap(i); + varMap->addItem(m->getName()); + varMap->setItemData(i, m->getId()); + } + setGui(); +} + +// KToolbar PokemodUI::getToolbar(QWidget* parent) +// { +// +// } + +void PokemodUI::setGui() +{ + const bool resetWarps = (pokemod_mod->getStartMap() == lastMap); + varTitle->setText(pokemod_mod->getTitle()); + varVersion->setText(pokemod_mod->getVersion()); + varDescription->setText(pokemod_mod->getDescription()); + varMap->setCurrentIndex(varMap->findData(pokemod_mod->getStartMap())); + if (resetWarps) + { + try + { + const Map* m = pokemod->getMapByID(pokemod_mod->getStartMap()); + for (int i = 0; i < m->getWarpCount(); ++i) + { + const MapWarp* w = m->getWarp(i); + varWarp->addItem(w->getName()); + varWarp->setItemData(i, w->getId()); + } + } + catch (BoundsException& e) + { + BugCatcher::report(e); + } + } + varWarp->setCurrentIndex(varWarp->findData(pokemod_mod->getStartWarp())); + varSuperPCUsername->setText(pokemod_mod->getSuperPCUname()); + varSuperPCPassword->setText(pokemod_mod->getSuperPCPasswd()); +} + +void PokemodUI::on_buttonApply_clicked() +{ + *pokemod = *pokemod_mod; + emit(setChanged(false)); +} + +void PokemodUI::on_buttonDiscard_clicked() +{ + *pokemod_mod = *pokemod; + emit(setChanged(false)); + setGui(); +} + +void PokemodUI::on_varTitle_textChanged(const QString & t) +{ + pokemod_mod->setTitle(t); + emit(setChanged(true)); +} + +void PokemodUI::on_varVersion_textChanged(const QString & v) +{ + pokemod_mod->setVersion(v); + emit(setChanged(true)); +} + +void PokemodUI::on_varDescription_textChanged() +{ + pokemod_mod->setDescription(varDescription->toPlainText()); + emit(setChanged(true)); +} + +void PokemodUI::on_varMap_currentIndexChanged(const int s) +{ + try + { + pokemod_mod->setStartMap(s); + emit(setChanged(true)); + } + catch (BoundsException& e) + { + BugCatcher::report(e); + setGui(); + } +} + +void PokemodUI::on_varWarp_currentIndexChanged(const int s) +{ + try + { + pokemod_mod->setStartWarp(s); + emit(setChanged(true)); + } + catch (BoundsException& e) + { + BugCatcher::report(e); + setGui(); + } +} + +void PokemodUI::on_varSuperPCUsername_textChanged(const QString & u) +{ + pokemod_mod->setSuperPCUname(u); + emit(setChanged(true)); +} + +void PokemodUI::on_varSuperPCPassword_textChanged(const QString & p) +{ + pokemod_mod->setSuperPCPasswd(p); + emit(setChanged(true)); +} -- cgit