diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-02-23 00:30:00 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-02-23 00:30:00 +0000 |
| commit | 9cd7f4656b01cfb243433e1063c0339b2b96bbd4 (patch) | |
| tree | b3faeacc636f956013e2972b950a2c1b9cd85f59 | |
| parent | 0ee1ea1cef9eec7e0187aa9f8f2dc291775e8864 (diff) | |
| download | sigen-9cd7f4656b01cfb243433e1063c0339b2b96bbd4.tar.gz sigen-9cd7f4656b01cfb243433e1063c0339b2b96bbd4.tar.xz sigen-9cd7f4656b01cfb243433e1063c0339b2b96bbd4.zip | |
[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
| -rw-r--r-- | Changelog | 22 | ||||
| -rw-r--r-- | general/ImageCache.cpp | 2 | ||||
| -rw-r--r-- | general/ImageCache.h | 2 | ||||
| -rw-r--r-- | pokemod/Ability.cpp | 2 | ||||
| -rw-r--r-- | pokemod/CoinList.cpp | 2 | ||||
| -rw-r--r-- | pokemod/CoinList.h | 2 | ||||
| -rw-r--r-- | pokemod/Item.cpp | 2 | ||||
| -rw-r--r-- | pokemod/Map.cpp | 8 | ||||
| -rw-r--r-- | pokemod/MapTrainer.cpp | 2 | ||||
| -rw-r--r-- | pokemod/Pokemod.cpp | 139 | ||||
| -rw-r--r-- | pokemod/Pokemod.h | 9 | ||||
| -rw-r--r-- | pokemod/Species.cpp | 12 | ||||
| -rw-r--r-- | pokemodr/PokemodUI.cpp | 153 | ||||
| -rw-r--r-- | pokemodr/PokemodUI.h | 67 | ||||
| -rw-r--r-- | pokemodr/SkinsUI.cpp | 195 | ||||
| -rw-r--r-- | pokemodr/SkinsUI.h | 55 | ||||
| -rw-r--r-- | pokemodr/TODO | 2 | ||||
| -rw-r--r-- | pokemodr/gui/skins.ui | 273 | ||||
| -rw-r--r-- | pokemodr/pokemodr.pro | 7 |
19 files changed, 826 insertions, 130 deletions
@@ -3,10 +3,24 @@ Rev: 70 Date: 22 February 2008 User: MathStuf ----------------- -[FIX] SpeciesUI now compiles without vtable errors +[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} ----------------- Rev: 69 +Date: 22 February 2008 +User: MathStuf +----------------- +[FIX] SpeciesUI now compiles without vtable errors + +----------------- +Rev: 68 Date: 21 February 2008 User: MathStuf ----------------- @@ -16,12 +30,6 @@ User: MathStuf [FIX] Precision of Frac decimal equivalents now use a define [FIX] Species UI form is now more compact and complete [ADD] SpeciesUI.{h, cpp} (again; wasn't actually included last time and got lost) - ------------------ -Rev: 68 -Date: 21 February 2008 -User: MathStuf ------------------ [FIX] Species form now uses tabs so its not as gigantically tall [FIX] SpeciesUI files disappeared, so remade [FIX] Include cleanup in pokemodr diff --git a/general/ImageCache.cpp b/general/ImageCache.cpp index b7e5bf71..a5ce28f3 100644 --- a/general/ImageCache.cpp +++ b/general/ImageCache.cpp @@ -27,7 +27,7 @@ KPixmapCache ImageCache::cache("pokegen"); -QPixmap ImageCache::open(const QString& fname, const bool force) throw(OpenException) +QPixmap ImageCache::open(const QString& fname) throw(OpenException) { if (!QFile::exists(fname)) throw(OpenException("ImageCache", fname)); diff --git a/general/ImageCache.h b/general/ImageCache.h index 450126cf..e693dc1d 100644 --- a/general/ImageCache.h +++ b/general/ImageCache.h @@ -32,7 +32,7 @@ class ImageCache { public: - static QPixmap open(const QString& fname, const bool force = false) throw(OpenException); + static QPixmap open(const QString& fname) throw(OpenException); static void clear() { cache.discard(); diff --git a/pokemod/Ability.cpp b/pokemod/Ability.cpp index dbcd657d..234d2dae 100644 --- a/pokemod/Ability.cpp +++ b/pokemod/Ability.cpp @@ -202,6 +202,6 @@ Ability& Ability::operator=(const Ability& rhs) name = rhs.name; effects.clear(); for (int i = 0; i < rhs.getEffectCount(); ++i) - newEffect(*rhs.getEffect(i)); + effects.append(AbilityEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId())); return *this; } diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp index 9ecddc2f..60abab92 100644 --- a/pokemod/CoinList.cpp +++ b/pokemod/CoinList.cpp @@ -267,6 +267,6 @@ CoinList& CoinList::operator=(const CoinList& rhs) name = rhs.name; items.clear(); for (int i = 0; i < rhs.getItemCount(); ++i) - newItem(*rhs.getItem(i)); + items.append(CoinListObject(pokemod, *rhs.getItem(i), rhs.getItem(i)->getId())); return *this; } diff --git a/pokemod/CoinList.h b/pokemod/CoinList.h index 17a5a18c..041177be 100644 --- a/pokemod/CoinList.h +++ b/pokemod/CoinList.h @@ -58,7 +58,7 @@ class CoinList : public Object int getItemCount() const; CoinListObject* newItem(); CoinListObject* newItem(const QString& fname); - CoinListObject* newItem(const CoinListObject& c); + CoinListObject* newItem(const CoinListObject& o); void deleteItem(const int i) throw(IndexException); CoinList& operator=(const CoinList& rhs); diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index b857e20e..f6293cf7 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -271,6 +271,6 @@ Item& Item::operator=(const Item& rhs) description = rhs.description; effects.clear(); for (int i = 0; i < rhs.getEffectCount(); ++i) - newEffect(*rhs.getEffect(i)); + effects.append(ItemEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId())); return *this; } diff --git a/pokemod/Map.cpp b/pokemod/Map.cpp index e3401e98..7a575271 100644 --- a/pokemod/Map.cpp +++ b/pokemod/Map.cpp @@ -699,15 +699,15 @@ Map& Map::operator=(const Map& rhs) tiles = rhs.tiles; effects.clear(); for (int i = 0; i < rhs.getEffectCount(); ++i) - newEffect(*rhs.getEffect(i)); + effects.append(MapEffect(pokemod, *rhs.getEffect(i), rhs.getEffect(i)->getId())); trainers.clear(); for (int i = 0; i < rhs.getTrainerCount(); ++i) - newTrainer(*rhs.getTrainer(i)); + trainers.append(MapTrainer(pokemod, *rhs.getTrainer(i), rhs.getTrainer(i)->getId())); warps.clear(); for (int i = 0; i < rhs.getWarpCount(); ++i) - newWarp(*rhs.getWarp(i)); + warps.append(MapWarp(pokemod, *rhs.getWarp(i), rhs.getWarp(i)->getId())); wildLists.clear(); for (int i = 0; i < rhs.getWildListCount(); ++i) - newWildList(*rhs.getWildList(i)); + wildLists.append(MapWildList(pokemod, *rhs.getWildList(i), rhs.getWildList(i)->getId())); return *this; } diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp index 810692f5..306b50ec 100644 --- a/pokemod/MapTrainer.cpp +++ b/pokemod/MapTrainer.cpp @@ -444,6 +444,6 @@ MapTrainer& MapTrainer::operator=(const MapTrainer& rhs) leadTeamMember = rhs.leadTeamMember; teamMembers.clear(); for (int i = 0; i < rhs.getTeamMemberCount(); ++i) - newTeamMember(*rhs.getTeamMember(i)); + teamMembers.append(MapTrainerTeamMember(pokemod, *rhs.getTeamMember(i), rhs.getTeamMember(i)->getId())); return *this; } diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index 5e433cd0..9272cb5a 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -50,6 +50,13 @@ Pokemod::Pokemod() : { } +Pokemod::Pokemod(const Pokemod& p) : + Object("Pokemod", this, 0), + rules(this) +{ + *this = p; +} + Pokemod::Pokemod(const QString& fname) : Object("Pokemod", this, 0), valOutput(NULL), @@ -95,32 +102,32 @@ bool Pokemod::validate() const validationMsg("Invalid starting map"); valid = false; } - if (!QFile::exists(QString("%1/image/skin/walk.png").arg(getPath()))) + if (!QFile::exists(getWalkSkin())) { validationMsg("Cannot find walking skin"); valid = false; } - if (!QFile::exists(QString("%1/image/skin/bike.png").arg(getPath()))) + if (!QFile::exists(getBikeSkin())) { validationMsg("Cannot find biking skin"); valid = false; } - if (!QFile::exists(QString("%1/image/skin/surf.png").arg(getPath()))) + if (!QFile::exists(getSurfSkin())) { validationMsg("Cannot find surfing skin"); valid = false; } - if (!QFile::exists(QString("%1/image/skin/fly.png").arg(getPath()))) + if (!QFile::exists(getFlySkin())) { validationMsg("Cannot find flying skin"); valid = false; } - if (!QFile::exists(QString("%1/image/skin/fish.png").arg(getPath()))) + if (!QFile::exists(getFishSkin())) { validationMsg("Cannot find fishing skin"); valid = false; } - if (!QFile::exists(QString("%1/image/skin/surfFish.png").arg(getPath()))) + if (!QFile::exists(getSurfFishSkin())) { validationMsg("Cannot find surf fishing skin"); valid = false; @@ -383,7 +390,7 @@ bool Pokemod::validate() const { if (1 < i.value()) { - validationMsg(QString("There are %1 Mmps with id %2").arg(i.value()).arg(i.key())); + validationMsg(QString("There are %1 maps with id %2").arg(i.value()).arg(i.key())); valid = false; } } @@ -1000,55 +1007,55 @@ void Pokemod::setStartWarp(const int s) throw(BoundsException) void Pokemod::setWalkSkin(const QString& fname) throw(Exception) { - QFile file(QString("%1/image/skin/walk.png").arg(getPath())); + QFile file(getWalkSkin()); if (file.exists() && !file.remove()) throw(RemoveException(className, file.fileName())); - if (!QFile::copy(fname, QString("%1/image/skin/walk.png").arg(getPath()))) + if (!QFile::copy(fname, getWalkSkin())) throw(SaveException(className, file.fileName())); } void Pokemod::setBikeSkin(const QString& fname) throw(Exception) { - QFile file(QString("%1/image/skin/bike.png").arg(getPath())); + QFile file(getBikeSkin()); if (file.exists() && !file.remove()) throw(RemoveException(className, file.fileName())); - if (!QFile::copy(fname, QString("%1/image/skin/bike.png").arg(getPath()))) + if (!QFile::copy(fname, getBikeSkin())) throw(SaveException(className, file.fileName())); } void Pokemod::setSurfSkin(const QString& fname) throw(Exception) { - QFile file(QString("%1/image/skin/surf.png").arg(getPath())); + QFile file(getSurfSkin()); if (file.exists() && !file.remove()) throw(RemoveException(className, file.fileName())); - if (!QFile::copy(fname, QString("%1/image/skin/surf.png").arg(getPath()))) + if (!QFile::copy(fname, getSurfSkin())) throw(SaveException(className, file.fileName())); } void Pokemod::setFlySkin(const QString& fname) throw(Exception) { - QFile file(QString("%1/image/skin/fly.png").arg(getPath())); + QFile file(getFlySkin()); if (file.exists() && !file.remove()) throw(RemoveException(className, file.fileName())); - if (!QFile::copy(fname, QString("%1/image/skin/fly.png").arg(getPath()))) + if (!QFile::copy(fname, getFlySkin())) throw(SaveException(className, file.fileName())); } void Pokemod::setFishSkin(const QString& fname) throw(Exception) { - QFile file(QString("%1/image/skin/fish.png").arg(getPath())); + QFile file(getFishSkin()); if (file.exists() && !file.remove()) throw(RemoveException(className, file.fileName())); - if (!QFile::copy(fname, QString("%1/image/skin/fish.png").arg(getPath()))) + if (!QFile::copy(fname, getFishSkin())) throw(SaveException(className, file.fileName())); } void Pokemod::setSurfFishSkin(const QString& fname) throw(Exception) { - QFile file(QString("%1/image/skin/surfFish.png").arg(getPath())); + QFile file(getSurfFishSkin()); if (file.exists() && !file.remove()) throw(RemoveException(className, file.fileName())); - if (!QFile::copy(fname, QString("%1/image/skin/surfFish.png").arg(getPath()))) + if (!QFile::copy(fname, getSurfFishSkin())) throw(SaveException(className, file.fileName())); } @@ -1112,6 +1119,36 @@ int Pokemod::getStartWarp() const return startWarp; } +QString Pokemod::getWalkSkin() const +{ + return QString("%1/image/skin/walk.png").arg(getPath()); +} + +QString Pokemod::getBikeSkin() const +{ + return QString("%1/image/skin/bike.png").arg(getPath()); +} + +QString Pokemod::getSurfSkin() const +{ + return QString("%1/image/skin/surf.png").arg(getPath()); +} + +QString Pokemod::getFlySkin() const +{ + return QString("%1/image/skin/fly.png").arg(getPath()); +} + +QString Pokemod::getFishSkin() const +{ + return QString("%1/image/skin/fish.png").arg(getPath()); +} + +QString Pokemod::getSurfFishSkin() const +{ + return QString("%1/image/skin/surfFish.png").arg(getPath()); +} + QString Pokemod::getSuperPCUname() const { return superPCUname; @@ -2180,3 +2217,67 @@ void Pokemod::deleteType(const int i) throw(IndexException) typeChart.deleteCol(i); typeChart.deleteRow(i); } + +Pokemod& Pokemod::operator=(const Pokemod& rhs) +{ + if (this == &rhs) + return *this; + title = rhs.title; + version = rhs.version; + description = rhs.description; + startMap = rhs.startMap; + startWarp = rhs.startWarp; + superPCUname = rhs.superPCUname; + superPCPasswd = rhs.superPCPasswd; + typeChart = rhs.typeChart; + rules = rhs.rules; + abilities.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + abilities.append(Ability(this, *rhs.getAbility(i), rhs.getAbility(i)->getId())); + authors.clear(); + for (int i = 0; i < rhs.getAuthorCount(); ++i) + authors.append(Author(this, *rhs.getAuthor(i), rhs.getAuthor(i)->getId())); + badges.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + badges.append(Badge(this, *rhs.getBadge(i), rhs.getBadge(i)->getId())); + coinLists.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + coinLists.append(CoinList(this, *rhs.getCoinList(i), rhs.getCoinList(i)->getId())); + dialogs.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + dialogs.append(Dialog(this, *rhs.getDialog(i), rhs.getDialog(i)->getId())); + eggGroups.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + eggGroups.append(EggGroup(this, *rhs.getEggGroup(i), rhs.getEggGroup(i)->getId())); + items.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + items.append(Item(this, *rhs.getItem(i), rhs.getItem(i)->getId())); + itemTypes.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + itemTypes.append(ItemType(this, *rhs.getItemType(i), rhs.getItemType(i)->getId())); + maps.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + maps.append(Map(this, *rhs.getMap(i), rhs.getMap(i)->getId())); + moves.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + moves.append(Move(this, *rhs.getMove(i), rhs.getMove(i)->getId())); + natures.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + natures.append(Nature(this, *rhs.getNature(i), rhs.getNature(i)->getId())); + species.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + species.append(Species(this, *rhs.getSpecies(i), rhs.getSpecies(i)->getId())); + stores.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + stores.append(Store(this, *rhs.getStore(i), rhs.getStore(i)->getId())); + tiles.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + tiles.append(Tile(this, *rhs.getTile(i), rhs.getTile(i)->getId())); + times.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + times.append(Time(this, *rhs.getTime(i), rhs.getTime(i)->getId())); + types.clear(); + for (int i = 0; i < rhs.getAbilityCount(); ++i) + types.append(Type(this, *rhs.getType(i), rhs.getType(i)->getId())); + return *this; +} diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index eefd6533..7bd2a97f 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -64,6 +64,7 @@ class Pokemod : public Object static const QStringList ValidationStr; Pokemod(); + Pokemod(const Pokemod& p); Pokemod(const QString& fpath); void load(const QString& fpath, const int = 0) throw(Exception); @@ -101,6 +102,12 @@ class Pokemod : public Object QString getDescription() const; int getStartMap() const; int getStartWarp() const; + QString getWalkSkin() const; + QString getBikeSkin() const; + QString getSurfSkin() const; + QString getFlySkin() const; + QString getFishSkin() const; + QString getSurfFishSkin() const; QString getSuperPCUname() const; QString getSuperPCPasswd() const; const Matrix<Frac>* getTypeChart() const; @@ -284,6 +291,8 @@ class Pokemod : public Object Type* newType(const QString& fname); Type* newType(const Type& t); void deleteType(const int i) throw(IndexException); + + Pokemod& operator=(const Pokemod& rhs); private: QStringList* valOutput; diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp index 14433c5f..50a33679 100644 --- a/pokemod/Species.cpp +++ b/pokemod/Species.cpp @@ -1086,13 +1086,17 @@ Species& Species::operator=(const Species& rhs) nidoranGroup = rhs.nidoranGroup; types = rhs.types; eggGroups = rhs.eggGroups; + abilities.clear(); for (int i = 0; i < rhs.getAbilityCount(); ++i) - newAbility(*rhs.getAbility(i)); + abilities.append(SpeciesAbility(pokemod, *rhs.getAbility(i), rhs.getAbility(i)->getId())); + evolutions.clear(); for (int i = 0; i < rhs.getEvolutionCount(); ++i) - newEvolution(*rhs.getEvolution(i)); + evolutions.append(SpeciesEvolution(pokemod, *rhs.getEvolution(i), rhs.getEvolution(i)->getId())); + items.clear(); for (int i = 0; i < rhs.getItemCount(); ++i) - newItem(*rhs.getItem(i)); + items.append(SpeciesItem(pokemod, *rhs.getItem(i), rhs.getItem(i)->getId())); + moves.clear(); for (int i = 0; i < rhs.getMoveCount(); ++i) - newMove(*rhs.getMove(i)); + moves.append(SpeciesMove(pokemod, *rhs.getMove(i), rhs.getMove(i)->getId())); return *this; } 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 <http://www.gnu.org/licenses/>. +///////////////////////////////////////////////////////////////////////////// + +#include <QMetaObject> + +#include <BugCatcher.h> +#include <Exception.h> + +#include <Pokemod.h> + +#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)); +} diff --git a/pokemodr/PokemodUI.h b/pokemodr/PokemodUI.h new file mode 100644 index 00000000..64f2275d --- /dev/null +++ b/pokemodr/PokemodUI.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/PokemodUI.h +// Purpose: Pokemod UI form handling +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Fri Feb 22 16:27:02 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_POKEMODUI__ +#define __POKEMODR_POKEMODUI__ + +#include <ktoolbar.h> + +#include <QString> + +#include <Pokemod.h> + +#include "ObjectUI.h" + +#include "ui_pokemod.h" + +class PokemodUI : public ObjectUI, private Ui::formPokemod +{ + Q_OBJECT + + public: + PokemodUI(Pokemod* p, QWidget* parent); + ~PokemodUI() + { + delete pokemod_mod; + } + +// KToolbar getToolbar(QWidget* parent); + public slots: + void on_buttonApply_clicked(); + void on_buttonDiscard_clicked(); + void on_varTitle_textChanged(const QString& t); + void on_varVersion_textChanged(const QString& v); + void on_varDescription_textChanged(); + void on_varMap_currentIndexChanged(const int s); + void on_varWarp_currentIndexChanged(const int s); + void on_varSuperPCUsername_textChanged(const QString& u); + void on_varSuperPCPassword_textChanged(const QString& p); + private: + void setGui(); + + int lastMap; + + Pokemod* pokemod; + Pokemod* pokemod_mod; +}; + +#endif diff --git a/pokemodr/SkinsUI.cpp b/pokemodr/SkinsUI.cpp new file mode 100644 index 00000000..9e9dd267 --- /dev/null +++ b/pokemodr/SkinsUI.cpp @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/SkinsUI.cpp +// Purpose: Skins UI form handling +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Fri Feb 22 19:16:28 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 <QMetaObject> + +#include <BugCatcher.h> +#include <Exception.h> +#include <ImageCache.h> + +#include <Pokemod.h> + +#include "ImageDialog.h" +#include "SkinsUI.h" + +SkinsUI::SkinsUI(Pokemod* p, QWidget* parent) : + ObjectUI(parent), + pokemod(p) +{ + setupUi(this); + QMetaObject::connectSlotsByName(this); + setObjects(pokemod, NULL); + setGui(); +} + +// KToolbar getToolbar(QWidget* parent) +// { +// +// } + +void SkinsUI::setGui() +{ + try + { + varWalkSkin->setIcon(ImageCache::open(pokemod->getWalkSkin())); + } + catch (OpenException& e) + { + BugCatcher::report(e); + } + try + { + varBikeSkin->setIcon(ImageCache::open(pokemod->getBikeSkin())); + } + catch (OpenException& e) + { + BugCatcher::report(e); + } + try + { + varFlySkin->setIcon(ImageCache::open(pokemod->getFlySkin())); + } + catch (OpenException& e) + { + BugCatcher::report(e); + } + try + { + varSurfSkin->setIcon(ImageCache::open(pokemod->getSurfSkin())); + } + catch (OpenException& e) + { + BugCatcher::report(e); + } + try + { + varFishSkin->setIcon(ImageCache::open(pokemod->getFishSkin())); + } + catch (OpenException& e) + { + BugCatcher::report(e); + } + try + { + varSurfFishSkin->setIcon(ImageCache::open(pokemod->getSurfFishSkin())); + } + catch (OpenException& e) + { + BugCatcher::report(e); + } +} + +void SkinsUI::on_varWalkSkin_pressed() +{ + if (ImageDialog::exec()) + { + try + { + pokemod->setWalkSkin(ImageDialog::selectedUrl()); + } + catch (SaveException& e) + { + BugCatcher::report(e); + } + setGui(); + } +} + +void SkinsUI::on_varBikeSkin_pressed() +{ + if (ImageDialog::exec()) + { + try + { + pokemod->setBikeSkin(ImageDialog::selectedUrl()); + } + catch (SaveException& e) + { + BugCatcher::report(e); + } + setGui(); + } +} + +void SkinsUI::on_varFlySkin_pressed() +{ + if (ImageDialog::exec()) + { + try + { + pokemod->setFlySkin(ImageDialog::selectedUrl()); + } + catch (SaveException& e) + { + BugCatcher::report(e); + } + setGui(); + } +} + +void SkinsUI::on_varSurfSkin_pressed() +{ + if (ImageDialog::exec()) + { + try + { + pokemod->setSurfSkin(ImageDialog::selectedUrl()); + } + catch (SaveException& e) + { + BugCatcher::report(e); + } + setGui(); + } +} + +void SkinsUI::on_varFishSkin_pressed() +{ + if (ImageDialog::exec()) + { + try + { + pokemod->setFishSkin(ImageDialog::selectedUrl()); + } + catch (SaveException& e) + { + BugCatcher::report(e); + } + setGui(); + } +} + +void SkinsUI::on_varSurfFishSkin_pressed() +{ + if (ImageDialog::exec()) + { + try + { + pokemod->setSurfFishSkin(ImageDialog::selectedUrl()); + } + catch (SaveException& e) + { + BugCatcher::report(e); + } + setGui(); + } +} diff --git a/pokemodr/SkinsUI.h b/pokemodr/SkinsUI.h new file mode 100644 index 00000000..e76d9990 --- /dev/null +++ b/pokemodr/SkinsUI.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/SkinsUI.h +// Purpose: Skins UI form handling +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Fri Feb 22 19:14:21 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_SKINSUI__ +#define __POKEMODR_SKINSUI__ + +#include <ktoolbar.h> + +#include <Pokemod.h> + +#include "ObjectUI.h" + +#include "ui_skins.h" + +class SkinsUI : public ObjectUI, private Ui::formSkins +{ + Q_OBJECT + + public: + SkinsUI(Pokemod* p, QWidget* parent); + +// KToolbar getToolbar(QWidget* parent); + public slots: + void on_varWalkSkin_pressed(); + void on_varBikeSkin_pressed(); + void on_varFlySkin_pressed(); + void on_varSurfSkin_pressed(); + void on_varFishSkin_pressed(); + void on_varSurfFishSkin_pressed(); + private: + void setGui(); + + Pokemod* pokemod; +}; + +#endif diff --git a/pokemodr/TODO b/pokemodr/TODO index c331f1bd..2cfecd33 100644 --- a/pokemodr/TODO +++ b/pokemodr/TODO @@ -9,9 +9,7 @@ MapWarp MapWildList MapWildListEncounter MoveEffect -Pokemod -Skins TypeChart Tree Handling diff --git a/pokemodr/gui/skins.ui b/pokemodr/gui/skins.ui index e8928cc3..5d17cddf 100644 --- a/pokemodr/gui/skins.ui +++ b/pokemodr/gui/skins.ui @@ -5,61 +5,64 @@ <rect> <x>0</x> <y>0</y> - <width>432</width> - <height>608</height> + <width>458</width> + <height>563</height> </rect> </property> <layout class="QGridLayout" > - <item row="0" column="0" colspan="2" > - <widget class="QGroupBox" name="boxButtons" > + <item row="1" column="0" > + <widget class="QGroupBox" name="boxWalkingSkin" > <property name="title" > - <string/> + <string>Walking</string> </property> <layout class="QHBoxLayout" > + <property name="leftMargin" > + <number>4</number> + </property> + <property name="topMargin" > + <number>4</number> + </property> + <property name="rightMargin" > + <number>4</number> + </property> + <property name="bottomMargin" > + <number>4</number> + </property> <item> - <widget class="KPushButton" name="buttonApply_2" > - <property name="text" > - <string>&Apply</string> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> </property> - <property name="shortcut" > - <string>Ctrl+Return</string> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> </property> - </widget> + </spacer> </item> <item> - <widget class="KPushButton" name="buttonDiscard_2" > - <property name="text" > - <string>&Discard</string> - </property> - <property name="shortcut" > - <string>Esc</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="0" > - <widget class="QGroupBox" name="boxWalkingSkin" > - <property name="title" > - <string>Walking</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGraphicsView" name="varWalkingSkin" > + <widget class="KIconButton" name="varWalkSkin" > <property name="minimumSize" > <size> <width>192</width> <height>128</height> </size> </property> - <property name="maximumSize" > + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > <size> - <width>192</width> - <height>128</height> + <width>40</width> + <height>20</height> </size> </property> - </widget> + </spacer> </item> </layout> </widget> @@ -69,16 +72,23 @@ <property name="title" > <string>Biking</string> </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGraphicsView" name="varBikingSkin" > - <property name="minimumSize" > + <layout class="QHBoxLayout" > + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > <size> - <width>192</width> - <height>128</height> + <width>40</width> + <height>20</height> </size> </property> - <property name="maximumSize" > + </spacer> + </item> + <item> + <widget class="KIconButton" name="varBikeSkin" > + <property name="minimumSize" > <size> <width>192</width> <height>128</height> @@ -86,6 +96,19 @@ </property> </widget> </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> @@ -94,16 +117,23 @@ <property name="title" > <string>Flying</string> </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGraphicsView" name="varFlyingSkin" > - <property name="minimumSize" > + <layout class="QHBoxLayout" > + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > <size> - <width>192</width> - <height>128</height> + <width>40</width> + <height>20</height> </size> </property> - <property name="maximumSize" > + </spacer> + </item> + <item> + <widget class="KIconButton" name="varFlySkin" > + <property name="minimumSize" > <size> <width>192</width> <height>128</height> @@ -111,6 +141,19 @@ </property> </widget> </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> @@ -119,16 +162,23 @@ <property name="title" > <string>Surfing</string> </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGraphicsView" name="varSurfingSkin" > - <property name="minimumSize" > + <layout class="QHBoxLayout" > + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > <size> - <width>192</width> - <height>128</height> + <width>40</width> + <height>20</height> </size> </property> - <property name="maximumSize" > + </spacer> + </item> + <item> + <widget class="KIconButton" name="varSurfSkin" > + <property name="minimumSize" > <size> <width>192</width> <height>128</height> @@ -136,6 +186,19 @@ </property> </widget> </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> @@ -144,47 +207,42 @@ <property name="title" > <string>Fishing</string> </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGraphicsView" name="varFishingSkin" > - <property name="minimumSize" > - <size> - <width>192</width> - <height>128</height> - </size> + <layout class="QHBoxLayout" > + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> </property> - <property name="maximumSize" > + <property name="sizeHint" > <size> - <width>192</width> - <height>128</height> + <width>40</width> + <height>20</height> </size> </property> - </widget> + </spacer> </item> - </layout> - </widget> - </item> - <item row="3" column="1" > - <widget class="QGroupBox" name="boxSurfFishingSkin" > - <property name="title" > - <string>Surf Fishing</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGraphicsView" name="varSurfFishingSkin" > + <item> + <widget class="KIconButton" name="varFishSkin" > <property name="minimumSize" > <size> <width>192</width> <height>128</height> </size> </property> - <property name="maximumSize" > + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > <size> - <width>192</width> - <height>128</height> + <width>40</width> + <height>20</height> </size> </property> - </widget> + </spacer> </item> </layout> </widget> @@ -202,13 +260,58 @@ </property> </spacer> </item> + <item row="3" column="1" > + <widget class="QGroupBox" name="boxSurfFishingSkin" > + <property name="title" > + <string>Surf Fishing</string> + </property> + <layout class="QHBoxLayout" > + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="KIconButton" name="varSurfFishSkin" > + <property name="minimumSize" > + <size> + <width>192</width> + <height>128</height> + </size> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> </layout> </widget> <customwidgets> <customwidget> - <class>KPushButton</class> + <class>KIconButton</class> <extends>QPushButton</extends> - <header>kpushbutton.h</header> + <header>kicondialog.h</header> </customwidget> </customwidgets> <resources/> diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index 651df95a..3b41589c 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -80,7 +80,9 @@ TileDelegate.cpp \ TilemapModel.cpp \ TileUI.cpp \ TimeUI.cpp \ -TypeUI.cpp +TypeUI.cpp \ + PokemodUI.cpp \ + SkinsUI.cpp HEADERS += AbilityUI.h \ AuthorUI.h \ BadgeUI.h \ @@ -108,7 +110,8 @@ TileDelegate.h \ TilemapModel.h \ TileUI.h \ TimeUI.h \ -TypeUI.h +TypeUI.h \ + SkinsUI.h FORMS += gui/abilityeffect.ui \ gui/ability.ui \ gui/author.ui \ |
