diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-23 22:39:56 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-23 22:39:56 +0000 |
| commit | 0fe749eb04515ff7ee28cdc5d14c7be6f6fdeca4 (patch) | |
| tree | 61da8fe050b81a477c24fc481e5d6cb39f928e2f | |
| parent | 793f2e539316e796968103617025320870f8c3ce (diff) | |
| download | sigen-0fe749eb04515ff7ee28cdc5d14c7be6f6fdeca4.tar.gz sigen-0fe749eb04515ff7ee28cdc5d14c7be6f6fdeca4.tar.xz sigen-0fe749eb04515ff7ee28cdc5d14c7be6f6fdeca4.zip | |
[ADD] Added UI classes for GlobalScript
[FIX] Script support is now in pokemodr
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@168 6ecfd1a5-f3ed-3746-8530-beee90d26b22
65 files changed, 815 insertions, 1046 deletions
@@ -1,4 +1,19 @@ ----------------- +Rev: 168 +Date: 23 May 2008 +User: MathStuf +----------------- +[ADD] Added UI classes for GlobalScript +[FIX] Script support is now in pokemodr + +----------------- +Rev: 167 +Date: 23 May 2008 +User: MathStuf +----------------- +[DEL] Cleaned out unneeded files + +----------------- Rev: 166 Date: 23 May 2008 User: MathStuf diff --git a/pokemod/MapWildList.h b/pokemod/MapWildList.h index cfc06fc3..22726f38 100644 --- a/pokemod/MapWildList.h +++ b/pokemod/MapWildList.h @@ -87,7 +87,6 @@ class MapWildList : public Object int m_control; Script m_script; QList<int> m_time; - QList<MapWildListEncounter*> m_encounters; }; diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index 0f52af1f..a0e86ced 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -65,8 +65,6 @@ Pokemod::Pokemod() : m_flySkin(192, 128), m_fishSkin(192, 128), m_surfFishSkin(192, 128), - m_superPCUname(""), - m_superPCPasswd(""), m_typeChart(0, 0), m_rules(new Rules(this)) { @@ -107,10 +105,6 @@ void Pokemod::validate() if (mapById(m_startMap)->warpIndex(m_startWarp) == INT_MAX) emit(error("Invalid starting warp")); } - if (m_superPCUname.isEmpty()) - emit(warning("Super PC username not defined")); - if (m_superPCPasswd.isEmpty()) - emit(warning("Super PC password not defined")); if ((m_typeChart.width() != typeCount()) || (m_typeChart.height() != typeCount())) emit(error("Type chart is invalid")); m_rules->validate(); @@ -395,8 +389,6 @@ void Pokemod::load(const QDomElement& xml, const int) LOAD(QPixmap, flySkin); LOAD(QPixmap, fishSkin); LOAD(QPixmap, surfFishSkin); - LOAD(QString, superPCUname); - LOAD(QString, superPCPasswd); LOAD(Rules, rules); LOAD_SUB(newAbility, Ability); LOAD_SUB(newAuthor, Author); @@ -433,8 +425,6 @@ QDomElement Pokemod::save() const SAVE(QPixmap, flySkin); SAVE(QPixmap, fishSkin); SAVE(QPixmap, surfFishSkin); - SAVE(QString, superPCUname); - SAVE(QString, superPCPasswd); SAVE_Rules(rules); SAVE_MATRIX(Fraction, typeChart); SAVE_SUB(Ability, abilities); @@ -569,16 +559,6 @@ void Pokemod::setSurfFishSkin(const QPixmap& surfFishSkin) emit(changed()); } -void Pokemod::setSuperPCUname(const QString& superPCUname) -{ - CHECK(superPCUname); -} - -void Pokemod::setSuperPCPasswd(const QString& superPCPasswd) -{ - CHECK(superPCPasswd); -} - void Pokemod::setTypeChart(const int attack, const int defense, const Fraction& multiplier) { CHECK_ARRAY(typeChart(attack, defense), multiplier); @@ -649,16 +629,6 @@ QPixmap Pokemod::surfFishSkin() const return m_surfFishSkin; } -QString Pokemod::superPCUname() const -{ - return m_superPCUname; -} - -QString Pokemod::superPCPasswd() const -{ - return m_superPCPasswd; -} - const Matrix<Fraction>* Pokemod::typeChart() const { return &m_typeChart; @@ -2166,8 +2136,6 @@ Pokemod& Pokemod::operator=(const Pokemod& rhs) COPY(description); COPY(startMap); COPY(startWarp); - COPY(superPCUname); - COPY(superPCPasswd); COPY(typeChart); COPY_Rules(rules); COPY_SUB(Ability, abilities); diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index 1509e342..9f4c1d08 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -174,8 +174,6 @@ class Pokemod : public Object void setFlySkin(const QPixmap& slySkin); void setFishSkin(const QPixmap& fishSkin); void setSurfFishSkin(const QPixmap& surfFishSkin); - void setSuperPCUname(const QString& superPCUname); - void setSuperPCPasswd(const QString& superPCPasswd); void setTypeChart(const int attack, const int defense, const Fraction& multiplier); void setRules(const Rules& rules); void setRules(const QDomElement& xml); @@ -191,8 +189,6 @@ class Pokemod : public Object QPixmap flySkin() const; QPixmap fishSkin() const; QPixmap surfFishSkin() const; - QString superPCUname() const; - QString superPCPasswd() const; const Matrix<Fraction>* typeChart() const; Matrix<Fraction>* typeChart(); Fraction typeChart(const int attack, const int defense) const; @@ -475,8 +471,6 @@ class Pokemod : public Object void clear(); - void copyDir(const QString& src, const QString& dest) const; - QString m_title; QString m_version; QString m_description; @@ -488,8 +482,6 @@ class Pokemod : public Object QPixmap m_flySkin; QPixmap m_fishSkin; QPixmap m_surfFishSkin; - QString m_superPCUname; - QString m_superPCPasswd; Matrix<Fraction> m_typeChart; Rules* m_rules; QList<Ability*> m_abilities; diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp deleted file mode 100644 index 4c2c5c8e..00000000 --- a/pokemod/SpeciesEvolution.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com> - * - * 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/>. - */ - -// Header include -#include "SpeciesEvolution.h" - -// Pokemod includes -#include "Item.h" -#include "Pokemod.h" -#include "Rules.h" -#include "Species.h" - -SpeciesEvolution::SpeciesEvolution(const SpeciesEvolution& evolution) : - Object("SpeciesEvolution", evolution.parent(), evolution.id()) -{ - *this = evolution; -} - -SpeciesEvolution::SpeciesEvolution(const Species* parent, const int id) : - Object("SpeciesEvolution", parent, id), - m_species(INT_MAX), - m_script(""), - m_level(0) -{ -} - -SpeciesEvolution::SpeciesEvolution(const SpeciesEvolution& evolution, const Species* parent, const int id) : - Object("SpeciesEvolution", parent, id) -{ - *this = evolution; -} - -SpeciesEvolution::SpeciesEvolution(const QDomElement& xml, const Species* parent, const int id) : - Object("SpeciesEvolution", parent, id) -{ - load(xml, id); -} - -void SpeciesEvolution::validate() -{ - TEST(setSpecies, species); - if (m_script.isEmpty()) - emit(warning("Script is empty")); - TEST(setLevel, level); -} - -void SpeciesEvolution::load(const QDomElement& xml, int id) -{ - LOAD_ID(); - LOAD(int, species); - LOAD(QString, script); - LOAD(int, level); -} - -QDomElement SpeciesEvolution::save() const -{ - SAVE_CREATE(); - SAVE(int, species); - SAVE(QString, script); - SAVE(int, level); - return xml; -} - -void SpeciesEvolution::setSpecies(const int species) -{ - if (static_cast<const Pokemod*>(pokemod())->speciesIndex(species) == INT_MAX) - { - emit(error(bounds("species"))); - return; - } - CHECK(species); -} - -void SpeciesEvolution::setScript(const QString& script) -{ - CHECK(script); -} - -void SpeciesEvolution::setLevel(const int level) -{ - if (static_cast<const Pokemod*>(pokemod())->rules()->maxLevel() < level) - { - emit(error(bounds("level"))); - return; - } - CHECK(level); -} - -int SpeciesEvolution::species() const -{ - return m_species; -} - -QString SpeciesEvolution::script() const -{ - return m_script; -} - -int SpeciesEvolution::level() const -{ - return m_level; -} - -SpeciesEvolution& SpeciesEvolution::operator=(const SpeciesEvolution& rhs) -{ - if (this == &rhs) - return *this; - COPY(species); - COPY(script); - COPY(level); - return *this; -} diff --git a/pokemod/SpeciesEvolution.h b/pokemod/SpeciesEvolution.h deleted file mode 100644 index 126649b8..00000000 --- a/pokemod/SpeciesEvolution.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2007-2008 Ben Boeckel <MathStuf@gmail.com> - * - * 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 __POKEMOD_SPECIESEVOLUTION__ -#define __POKEMOD_SPECIESEVOLUTION__ - -// Pokemod includes -#include "Object.h" - -// Forward declarations -class Species; - -class SpeciesEvolution : public Object -{ - Q_OBJECT - - public: - SpeciesEvolution(const SpeciesEvolution& evolution); - SpeciesEvolution(const Species* parent, const int id); - SpeciesEvolution(const SpeciesEvolution& evolution, const Species* parent, const int id); - SpeciesEvolution(const QDomElement& xml, const Species* parent, const int id = INT_MAX); - - void validate(); - - void load(const QDomElement& xml, int id = INT_MAX); - QDomElement save() const; - - void setSpecies(const int species); - void setScript(const QString& script); - void setLevel(const int level); - - int species() const; - QString script() const; - int level() const; - - SpeciesEvolution& operator=(const SpeciesEvolution& rhs); - private: - int m_species; - QString m_script; - int m_level; -}; - -#endif diff --git a/pokemodr/AbilityUI.cpp b/pokemodr/AbilityUI.cpp index bc1d434f..c3e36e4d 100644 --- a/pokemodr/AbilityUI.cpp +++ b/pokemodr/AbilityUI.cpp @@ -53,5 +53,4 @@ void AbilityUI::discard() void AbilityUI::on_varName_textChanged(const QString& name) { static_cast<Ability*>(modified())->setName(name); - emit(changed(true)); } diff --git a/pokemodr/AuthorUI.cpp b/pokemodr/AuthorUI.cpp index 104d9445..33cdb5f6 100644 --- a/pokemodr/AuthorUI.cpp +++ b/pokemodr/AuthorUI.cpp @@ -55,17 +55,14 @@ void AuthorUI::discard() void AuthorUI::on_varName_textChanged(const QString& name) { static_cast<Author*>(modified())->setName(name); - emit(changed(true)); } void AuthorUI::on_varEmail_textChanged(const QString& email) { static_cast<Author*>(modified())->setEmail(email); - emit(changed(true)); } void AuthorUI::on_varRole_textChanged(const QString& role) { static_cast<Author*>(modified())->setRole(role); - emit(changed(true)); } diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp index 7669f879..b7b4a959 100644 --- a/pokemodr/CoinListUI.cpp +++ b/pokemodr/CoinListUI.cpp @@ -36,7 +36,7 @@ CoinListUI::~CoinListUI() void CoinListUI::setGui() { varName->setText(static_cast<CoinList*>(modified())->name()); - varScript->setPlainText(static_cast<CoinList*>(modified())->script()); + varScript->setValue(static_cast<CoinList*>(modified())->script()); } void CoinListUI::apply() @@ -57,9 +57,7 @@ void CoinListUI::on_varName_textChanged(const QString& name) static_cast<CoinList*>(modified())->setName(name); } -void CoinListUI::on_varScript_textChanged() +void CoinListUI::on_varScript_valueChanged(const Script& script) { - QTextCursor cursor = varScript->textCursor(); - static_cast<CoinList*>(modified())->setScript(varScript->toPlainText()); - varScript->setTextCursor(cursor); + static_cast<CoinList*>(modified())->setScript(script); } diff --git a/pokemodr/CoinListUI.h b/pokemodr/CoinListUI.h index d7f08886..1c82799b 100644 --- a/pokemodr/CoinListUI.h +++ b/pokemodr/CoinListUI.h @@ -39,7 +39,7 @@ class CoinListUI : public ObjectUI, private Ui::formCoinList void discard(); protected slots: void on_varName_textChanged(const QString& name); - void on_varScript_textChanged(); + void on_varScript_valueChanged(const Script& script); private slots: void setGui(); }; diff --git a/pokemodr/FractionWidget.h b/pokemodr/FractionWidget.h index 38990c72..f20e8dc9 100644 --- a/pokemodr/FractionWidget.h +++ b/pokemodr/FractionWidget.h @@ -15,8 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __FRACTIONWIDGET__ -#define __FRACTIONWIDGET__ +#ifndef __POKEMODR_FRACTIONWIDGET__ +#define __POKEMODR_FRACTIONWIDGET__ // Pokemod includes #include "../pokemod/Fraction.h" diff --git a/pokemodr/GlobalScriptUI.cpp b/pokemodr/GlobalScriptUI.cpp new file mode 100644 index 00000000..3aab8f08 --- /dev/null +++ b/pokemodr/GlobalScriptUI.cpp @@ -0,0 +1,62 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * 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/>. + */ + +// Header include +#include "GlobalScriptUI.h" + +// Pokemod includes +#include "../pokemod/GlobalScript.h" + +GlobalScriptUI::GlobalScriptUI(GlobalScript* globalScript, QWidget* parent) : + ObjectUI(parent) +{ + setupUi(this); + setObjects(globalScript, new GlobalScript(*globalScript)); +} + +GlobalScriptUI::~GlobalScriptUI() +{ +} + +void GlobalScriptUI::setGui() +{ + varName->setText(static_cast<GlobalScript*>(modified())->name()); + varScript->setValue(static_cast<GlobalScript*>(modified())->script()); +} + +void GlobalScriptUI::apply() +{ + *static_cast<GlobalScript*>(original()) = *static_cast<GlobalScript*>(modified()); + emit(changed(false)); +} + +void GlobalScriptUI::discard() +{ + *static_cast<GlobalScript*>(modified()) = *static_cast<GlobalScript*>(original()); + setGui(); + emit(changed(false)); +} + +void GlobalScriptUI::on_varName_textChanged(const QString& name) +{ + static_cast<GlobalScript*>(modified())->setName(name); +} + +void GlobalScriptUI::on_varScript_valueChanged(const Script& script) +{ + static_cast<GlobalScript*>(modified())->setScript(script); +} diff --git a/pokemodr/GlobalScriptUI.h b/pokemodr/GlobalScriptUI.h new file mode 100644 index 00000000..3ca6acca --- /dev/null +++ b/pokemodr/GlobalScriptUI.h @@ -0,0 +1,47 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * 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_GLOBALSCRIPTUI__ +#define __POKEMODR_GLOBALSCRIPTUI__ + +// PokeModr includes +#include "ObjectUI.h" + +// Form include +#include "ui_globalscript.h" + +// Forward declarations +class GlobalScript; + +class GlobalScriptUI : public ObjectUI, private Ui::formGlobalScript +{ + Q_OBJECT + + public: + GlobalScriptUI(GlobalScript* globalScript, QWidget* parent); + ~GlobalScriptUI(); + public slots: + void apply(); + void discard(); + protected slots: + void on_varName_textChanged(const QString& name); + void on_varScript_valueChanged(const Script& script); + private slots: + void setGui(); +}; + +#endif diff --git a/pokemodr/MapEffectUI.cpp b/pokemodr/MapEffectUI.cpp index 2008d4b9..9727eb1c 100644 --- a/pokemodr/MapEffectUI.cpp +++ b/pokemodr/MapEffectUI.cpp @@ -48,7 +48,7 @@ void MapEffectUI::setGui() varName->setText(static_cast<MapEffect*>(modified())->name()); varCoordinate->setValue(static_cast<MapEffect*>(modified())->coordinate()); varSkin->setIcon(static_cast<MapEffect*>(modified())->skin()); - varScript->setPlainText(static_cast<MapEffect*>(modified())->script()); + varScript->setValue(static_cast<MapEffect*>(modified())->script()); varIsGhost->setChecked(static_cast<MapEffect*>(modified())->isGhost() ? Qt::Checked : Qt::Unchecked); } @@ -86,11 +86,9 @@ void MapEffectUI::on_varSkin_pressed() delete dialog; } -void MapEffectUI::on_varScript_textChanged() +void MapEffectUI::on_varScript_valueChanged(const Script& script) { - QTextCursor cursor = varScript->textCursor(); - static_cast<MapEffect*>(modified())->setScript(varScript->toPlainText()); - varScript->setTextCursor(cursor); + static_cast<MapEffect*>(modified())->setScript(script); } void MapEffectUI::on_varIsGhost_clicked(const bool isGhost) diff --git a/pokemodr/MapEffectUI.h b/pokemodr/MapEffectUI.h index 927da32b..1e4feb00 100644 --- a/pokemodr/MapEffectUI.h +++ b/pokemodr/MapEffectUI.h @@ -41,7 +41,7 @@ class MapEffectUI : public ObjectUI, private Ui::formMapEffect void on_varName_textChanged(const QString& name); void on_varCoordinate_valueChanged(const Point& coordinate); void on_varSkin_pressed(); - void on_varScript_textChanged(); + void on_varScript_valueChanged(const Script& script); void on_varIsGhost_clicked(const bool isGhost); private slots: void refreshGui(); diff --git a/pokemodr/MapTrainerUI.cpp b/pokemodr/MapTrainerUI.cpp index ad4c02cd..c56c72dc 100644 --- a/pokemodr/MapTrainerUI.cpp +++ b/pokemodr/MapTrainerUI.cpp @@ -38,11 +38,6 @@ MapTrainerUI::~MapTrainerUI() { } -void MapTrainerUI::initGui() -{ - varDirection->addItems(Pokemod::DirectionStr.mid(0, Pokemod::D_End)); -} - void MapTrainerUI::refreshGui() { varTrainerClass->clear(); @@ -70,11 +65,8 @@ void MapTrainerUI::setGui() varName->setText(static_cast<MapTrainer*>(modified())->name()); varTrainerClass->setCurrentIndex(varTrainerClass->findData(static_cast<MapTrainer*>(modified())->trainerClass())); varCoordinate->setValue(static_cast<MapTrainer*>(modified())->coordinate()); - varSight->setValue(static_cast<MapTrainer*>(modified())->sight()); - varDirection->setCurrentIndex(static_cast<MapTrainer*>(modified())->direction()); varNumberFight->setValue(static_cast<MapTrainer*>(modified())->numberFight()); - varAppearFlag->setValue(static_cast<MapTrainer*>(modified())->appearFlag()); - varDialog->setCurrentIndex(varDialog->findData(static_cast<MapTrainer*>(modified())->dialog())); + varScript->setValue(static_cast<MapTrainer*>(modified())->script()); varLeadTeamMember->setCurrentIndex(varLeadTeamMember->findData(static_cast<MapTrainer*>(modified())->leadTeamMember())); } @@ -106,29 +98,14 @@ void MapTrainerUI::on_varCoordinate_valueChanged(const Point& coordinate) static_cast<MapTrainer*>(modified())->setCoordinate(coordinate); } -void MapTrainerUI::on_varSight_valueChanged(const int sight) -{ - static_cast<MapTrainer*>(modified())->setSight(sight); -} - -void MapTrainerUI::on_varDirection_activated(const int direction) -{ - static_cast<MapTrainer*>(modified())->setDirection(direction); -} - void MapTrainerUI::on_varNumberFight_valueChanged(const int numberFight) { static_cast<MapTrainer*>(modified())->setNumberFight(numberFight); } -void MapTrainerUI::on_varAppearFlag_valueChanged(const Flag& appearFlag) -{ - static_cast<MapTrainer*>(modified())->setAppearFlag(appearFlag); -} - -void MapTrainerUI::on_varDialog_activated(const int dialog) +void MapTrainerUI::on_varScript_valueChanged(const Script& script) { - static_cast<MapTrainer*>(modified())->setDialog(varDialog->itemData(dialog).toInt()); + static_cast<MapTrainer*>(modified())->setScript(script); } void MapTrainerUI::on_varLeadTeamMember_activated(const int leadTeamMember) diff --git a/pokemodr/MapTrainerUI.h b/pokemodr/MapTrainerUI.h index 2c0665bd..43f4f92f 100644 --- a/pokemodr/MapTrainerUI.h +++ b/pokemodr/MapTrainerUI.h @@ -41,14 +41,10 @@ class MapTrainerUI : public ObjectUI, private Ui::formMapTrainer void on_varName_textChanged(const QString& name); void on_varTrainerClass_activated(const int trainerClass); void on_varCoordinate_valueChanged(const Point& coordinate); - void on_varSight_valueChanged(const int sight); - void on_varDirection_activated(const int direction); void on_varNumberFight_valueChanged(const int numberFight); - void on_varAppearFlag_valueChanged(const Flag& appearFlag); - void on_varDialog_activated(const int dialog); + void on_varScript_valueChanged(const Script& script); void on_varLeadTeamMember_activated(const int leadTeamMember); private slots: - void initGui(); void refreshGui(); void setGui(); }; diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp index 29774e13..f0f887a6 100644 --- a/pokemodr/MapWarpUI.cpp +++ b/pokemodr/MapWarpUI.cpp @@ -19,7 +19,6 @@ #include "MapWarpUI.h" // Pokemod includes -#include "../pokemod/Dialog.h" #include "../pokemod/Map.h" #include "../pokemod/MapWarp.h" #include "../pokemod/Pokemod.h" @@ -38,7 +37,6 @@ MapWarpUI::~MapWarpUI() void MapWarpUI::initGui() { - varActivation->addItems(Pokemod::DirectionStr.mid(0, Pokemod::D_End)); varType->addItems(MapWarp::TypeStr); } @@ -51,12 +49,6 @@ void MapWarpUI::refreshGui() const Map* map = static_cast<const Pokemod*>(original()->pokemod())->map(i); varToMap->addItem(map->name(), map->id()); } - varDialog->clear(); - for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->dialogCount(); ++i) - { - const Dialog* dialog = static_cast<const Pokemod*>(original()->pokemod())->dialog(i); - varDialog->addItem(dialog->dialog().mid(0, 25), dialog->id()); - } } void MapWarpUI::setGui() @@ -64,13 +56,7 @@ void MapWarpUI::setGui() const bool resetWarps = (static_cast<MapWarp*>(modified())->toMap() != m_lastMap); varName->setText(static_cast<MapWarp*>(modified())->name()); varCoordinate->setValue(static_cast<MapWarp*>(modified())->coordinate()); - for (int i = 0; i < varActivation->count(); ++i) - varActivation->item(i)->setSelected(static_cast<MapWarp*>(modified())->from(i)); - varDirectionOut->setCurrentIndex(static_cast<MapWarp*>(modified())->directionOut()); varType->setCurrentIndex(static_cast<MapWarp*>(modified())->type()); - varBiking->setCheckState((static_cast<MapWarp*>(modified())->isBiking() == Flag::On) ? Qt::Checked : ((static_cast<MapWarp*>(modified())->isBiking() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked)); - varFlash->setCheckState((static_cast<MapWarp*>(modified())->isFlash() == Flag::On) ? Qt::Checked : ((static_cast<MapWarp*>(modified())->isFlash() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked)); - varFog->setCheckState((static_cast<MapWarp*>(modified())->isFoggy() == Flag::On) ? Qt::Checked : ((static_cast<MapWarp*>(modified())->isFoggy() == Flag::Off) ? Qt::Unchecked : Qt::PartiallyChecked)); varToMap->setCurrentIndex(varToMap->findData(static_cast<MapWarp*>(modified())->toMap())); m_lastMap = static_cast<MapWarp*>(modified())->toMap(); if (resetWarps) @@ -87,8 +73,7 @@ void MapWarpUI::setGui() } } varToWarp->setCurrentIndex(varToMap->findData(static_cast<MapWarp*>(modified())->toWarp())); - varWorkingFlag->setValue(static_cast<MapWarp*>(modified())->workingFlag()); - varDialog->setCurrentIndex(varDialog->findData(static_cast<MapWarp*>(modified())->dialog())); + varScript->setValue(static_cast<MapWarp*>(modified())->script()); } void MapWarpUI::apply() @@ -114,37 +99,11 @@ void MapWarpUI::on_varCoordinate_valueChanged(const Point& coordinate) static_cast<MapWarp*>(modified())->setCoordinate(coordinate); } -void MapWarpUI::on_varActivation_itemSelectionChanged() -{ - for (int i = 0; i < varActivation->count(); ++i) - static_cast<MapWarp*>(modified())->setFrom(i, varActivation->item(i)->isSelected()); -} - -void MapWarpUI::on_varDirectionOut_activated(const int directionOut) -{ - static_cast<MapWarp*>(modified())->setDirectionOut(directionOut); -} - void MapWarpUI::on_varType_activated(const int type) { static_cast<MapWarp*>(modified())->setType(type); } -void MapWarpUI::on_varBiking_toggled(const int biking) -{ - static_cast<MapWarp*>(modified())->setIsBiking(biking); -} - -void MapWarpUI::on_varFlash_toggled(const int flash) -{ - static_cast<MapWarp*>(modified())->setIsFlash(flash); -} - -void MapWarpUI::on_varFog_toggled(const int fog) -{ - static_cast<MapWarp*>(modified())->setIsFoggy(fog); -} - void MapWarpUI::on_varToMap_activated(const int toMap) { static_cast<MapWarp*>(modified())->setToMap(toMap); @@ -155,13 +114,7 @@ void MapWarpUI::on_varToWarp_activated(const int toWarp) static_cast<MapWarp*>(modified())->setToWarp(toWarp); } -void MapWarpUI::on_varWorkingFlag_valueChanged(const Flag& workingFlag) -{ - static_cast<MapWarp*>(modified())->setWorkingFlag(workingFlag); -} - - -void MapWarpUI::on_varDialog_activated(const int dialog) +void MapWarpUI::on_varScript_valueChanged(const Script& script) { - static_cast<MapWarp*>(modified())->setDialog(varDialog->itemData(dialog).toInt()); + static_cast<MapWarp*>(modified())->setScript(script); } diff --git a/pokemodr/MapWarpUI.h b/pokemodr/MapWarpUI.h index 8ffb40a3..d5d0846f 100644 --- a/pokemodr/MapWarpUI.h +++ b/pokemodr/MapWarpUI.h @@ -40,16 +40,10 @@ class MapWarpUI : public ObjectUI, private Ui::formMapWarp protected slots: void on_varName_textChanged(const QString& name); void on_varCoordinate_valueChanged(const Point& coordinate); - void on_varActivation_itemSelectionChanged(); - void on_varDirectionOut_activated(const int directionOut); void on_varType_activated(const int type); - void on_varBiking_toggled(const int biking); - void on_varFlash_toggled(const int flash); - void on_varFog_toggled(const int fog); void on_varToMap_activated(const int toMap); void on_varToWarp_activated(const int toWarp); - void on_varWorkingFlag_valueChanged(const Flag& workingFlag); - void on_varDialog_activated(const int dialog); + void on_varScript_valueChanged(const Script& script); private slots: void initGui(); void refreshGui(); diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp index e754abf0..c9e39b69 100644 --- a/pokemodr/MapWildListUI.cpp +++ b/pokemodr/MapWildListUI.cpp @@ -20,7 +20,6 @@ // Pokemod includes #include "../pokemod/Item.h" -#include "../pokemod/ItemEffect.h" #include "../pokemod/Pokemod.h" #include "../pokemod/MapWildList.h" #include "../pokemod/Time.h" @@ -43,20 +42,6 @@ void MapWildListUI::initGui() void MapWildListUI::refreshGui() { - varValue->clear(); - varScope->clear(); - for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->itemCount(); ++i) - { - const Item* item = static_cast<const Pokemod*>(original()->pokemod())->item(i); - for (int j = 0; j < item->effectCount(); ++j) - { - const ItemEffect* effect = item->effect(j); - if (effect->effect() == ItemEffect::E_Fish) - varValue->addItem(item->name(), effect->value2()); - else if (effect->effect() == ItemEffect::E_Scope) - varScope->addItem(item->name(), effect->value2()); - } - } varTimes->clear(); for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->timeCount(); ++i) { @@ -69,15 +54,12 @@ void MapWildListUI::refreshGui() void MapWildListUI::setGui() { varControl->setCurrentIndex(static_cast<MapWildList*>(modified())->control()); - varValue->setEnabled(static_cast<MapWildList*>(modified())->control() == MapWildList::Fishing); - varValue->setCurrentIndex(varValue->findData(static_cast<MapWildList*>(modified())->value())); + varScript->setValue(static_cast<MapWildList*>(modified())->script()); for (int i = 0; i < varTimes->count(); ++i) { QListWidgetItem* widgetItem = varTimes->item(i); widgetItem->setSelected(static_cast<MapWildList*>(modified())->time(widgetItem->data(Qt::UserRole).toInt())); } - boxScope->setChecked(static_cast<MapWildList*>(modified())->scope() == INT_MAX); - varScope->setCurrentIndex(varScope->findData(static_cast<MapWildList*>(modified())->scope())); } void MapWildListUI::apply() @@ -98,9 +80,9 @@ void MapWildListUI::on_varControl_activated(const int control) static_cast<MapWildList*>(modified())->setControl(control); } -void MapWildListUI::on_varValue_activated(const int value) +void MapWildListUI::on_varScript_valueChanged(const Script& script) { - static_cast<MapWildList*>(modified())->setValue(varValue->itemData(value).toInt()); + static_cast<MapWildList*>(modified())->setScript(script); } void MapWildListUI::on_varTimes_itemSelectionChanged() @@ -111,14 +93,3 @@ void MapWildListUI::on_varTimes_itemSelectionChanged() static_cast<MapWildList*>(modified())->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); } } - -void MapWildListUI::on_boxScope_toggled(const bool scopeUsed) -{ - if (!scopeUsed) - static_cast<MapWildList*>(modified())->setScope(INT_MAX); -} - -void MapWildListUI::on_varScope_activated(const int scope) -{ - static_cast<MapWildList*>(modified())->setScope(varScope->itemData(scope).toInt()); -} diff --git a/pokemodr/MapWildListUI.h b/pokemodr/MapWildListUI.h index 3f9b1900..7bc56fbe 100644 --- a/pokemodr/MapWildListUI.h +++ b/pokemodr/MapWildListUI.h @@ -39,10 +39,8 @@ class MapWildListUI : public ObjectUI, private Ui::formMapWildList void discard(); protected slots: void on_varControl_activated(const int control); - void on_varValue_activated(const int value); + void on_varScript_valueChanged(const Script& script); void on_varTimes_itemSelectionChanged(); - void on_boxScope_toggled(const bool scopeUsed); - void on_varScope_activated(const int scope); private slots: void initGui(); void refreshGui(); diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp index ccd68438..f531c46b 100644 --- a/pokemodr/MoveUI.cpp +++ b/pokemodr/MoveUI.cpp @@ -61,11 +61,6 @@ void MoveUI::setGui() varNumTargets->setValue(static_cast<Move*>(modified())->numTargets()); varTargetChoice->setCurrentIndex(static_cast<Move*>(modified())->targetChoice()); varSpecial->setChecked(static_cast<Move*>(modified())->special() ? Qt::Checked : Qt::Unchecked); - varIgnoreAccuracy->setChecked(static_cast<Move*>(modified())->ignoreAccuracy() ? Qt::Checked : Qt::Unchecked); - varCanFlinch->setChecked(static_cast<Move*>(modified())->canFlinch() ? Qt::Checked : Qt::Unchecked); - varCanRandom->setChecked(static_cast<Move*>(modified())->canRandom() ? Qt::Checked : Qt::Unchecked); - varCanSnatch->setChecked(static_cast<Move*>(modified())->canSnatch() ? Qt::Checked : Qt::Unchecked); - varMakesSound->setChecked(static_cast<Move*>(modified())->sound() ? Qt::Checked : Qt::Unchecked); varDescription->setPlainText(static_cast<Move*>(modified())->description()); } @@ -122,34 +117,14 @@ void MoveUI::on_varSpecial_toggled(const bool special) static_cast<Move*>(modified())->setSpecial(special); } -void MoveUI::on_varIgnoreAccuracy_toggled(const bool ignoreAccuracy) -{ - static_cast<Move*>(modified())->setIgnoreAccuracy(ignoreAccuracy); -} - -void MoveUI::on_varCanFlinch_toggled(const bool canFlinch) -{ - static_cast<Move*>(modified())->setCanFlinch(canFlinch); -} - -void MoveUI::on_varCanRandom_toggled(const bool canRandom) -{ - static_cast<Move*>(modified())->setCanRandom(canRandom); -} - -void MoveUI::on_varCanSnatch_toggled(const bool canSnatch) -{ - static_cast<Move*>(modified())->setCanSnatch(canSnatch); -} - -void MoveUI::on_varSound_toggled(const bool sound) -{ - static_cast<Move*>(modified())->setSound(sound); -} - void MoveUI::on_varDescription_textChanged() { QTextCursor cursor = varDescription->textCursor(); static_cast<Move*>(modified())->setDescription(varDescription->toPlainText()); varDescription->setTextCursor(cursor); } + +void MoveUI::on_varScript_valueChanged(const Script& script) +{ + static_cast<Move*>(modified())->setScript(script); +} diff --git a/pokemodr/MoveUI.h b/pokemodr/MoveUI.h index 4ba00e3f..0b1d8719 100644 --- a/pokemodr/MoveUI.h +++ b/pokemodr/MoveUI.h @@ -46,12 +46,8 @@ class MoveUI : public ObjectUI, private Ui::formMove void on_varNumTargets_valueChanged(const int numTargets); void on_varTargetChoice_activated(const int targetChoice); void on_varSpecial_toggled(const bool special); - void on_varIgnoreAccuracy_toggled(const bool ignoreAccuracy); - void on_varCanFlinch_toggled(const bool canFlinch); - void on_varCanRandom_toggled(const bool canRandom); - void on_varCanSnatch_toggled(const bool canSnatch); - void on_varSound_toggled(const bool sound); void on_varDescription_textChanged(); + void on_varScript_valueChanged(const Script& script); private slots: void initGui(); void refreshGui(); diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp index 1475b6d4..a3df0af0 100644 --- a/pokemodr/PokemodUI.cpp +++ b/pokemodr/PokemodUI.cpp @@ -85,8 +85,6 @@ void PokemodUI::setGui() } } varWarp->setCurrentIndex(varWarp->findData(static_cast<Pokemod*>(modified())->startWarp())); - varSuperPCUsername->setText(static_cast<Pokemod*>(modified())->superPCUname()); - varSuperPCPassword->setText(static_cast<Pokemod*>(modified())->superPCPasswd()); varWalkSkin->setIcon(static_cast<Pokemod*>(original())->walkSkin()); varBikeSkin->setIcon(static_cast<Pokemod*>(original())->bikeSkin()); varFlySkin->setIcon(static_cast<Pokemod*>(original())->flySkin()); @@ -135,16 +133,6 @@ void PokemodUI::on_varWarp_activated(const int warp) static_cast<Pokemod*>(modified())->setStartWarp(warp); } -void PokemodUI::on_varSuperPCUsername_textChanged(const QString& username) -{ - static_cast<Pokemod*>(modified())->setSuperPCUname(username); -} - -void PokemodUI::on_varSuperPCPassword_textChanged(const QString& password) -{ - static_cast<Pokemod*>(modified())->setSuperPCPasswd(password); -} - void PokemodUI::on_varWalkSkin_pressed() { FileDialog* dialog = new FileDialog(QSize(192, 168)); diff --git a/pokemodr/PokemodUI.h b/pokemodr/PokemodUI.h index f5064325..63038a0b 100644 --- a/pokemodr/PokemodUI.h +++ b/pokemodr/PokemodUI.h @@ -42,8 +42,6 @@ class PokemodUI : public ObjectUI, private Ui::formPokemod void on_varDescription_textChanged(); void on_varMap_activated(const int map); void on_varWarp_activated(const int warp); - void on_varSuperPCUsername_textChanged(const QString& username); - void on_varSuperPCPassword_textChanged(const QString& password); void on_varWalkSkin_pressed(); void on_varBikeSkin_pressed(); void on_varFlySkin_pressed(); diff --git a/pokemodr/FlagWidget.cpp b/pokemodr/ScriptWidget.cpp index ef983cd7..8001199b 100644 --- a/pokemodr/FlagWidget.cpp +++ b/pokemodr/ScriptWidget.cpp @@ -16,45 +16,43 @@ */ // Header include -#include "FlagWidget.h" +#include "ScriptWidget.h" -FlagWidget::FlagWidget(QWidget* parent, const Flag& value) : - QGroupBox(parent), +ScriptWidget::ScriptWidget(QWidget* parent, const Script& value) : + QWidget(parent), m_value(value) { setupUi(this); - connect(this, SIGNAL(clicked(bool)), SLOT(boxClicked(bool))); + varInterpreter->addItem("python"); + varInterpreter->addItem("ruby"); + varInterpreter->addItem("kjs"); } -Flag FlagWidget::value() const +Script ScriptWidget::value() const { return m_value; } -void FlagWidget::setValue(const Flag& value) +void ScriptWidget::setValue(const Script& value) { if (m_value == value) return; m_value = value; - setChecked(m_value.status() == Flag::Ignore); - varFlag->setValue(m_value.flag()); - varState->setCheckState((m_value.status() == Flag::On) ? Qt::Checked : Qt::Unchecked); + varInterpreter->setEditText(m_value.interpreter()); + varScript->setPlainText(m_value.script()); emit(valueChanged(m_value)); } -void FlagWidget::boxClicked(const bool clicked) +void ScriptWidget::on_varInterpreter_activated(const QString& interpreter) { - if (!clicked) - m_value.setStatus(Flag::Ignore); -} - -void FlagWidget::on_varFlag_valueChanged(const int flag) -{ - m_value.setFlag(flag); + m_value.setInterpreter(interpreter); + emit(valueChanged(m_value)); } -void FlagWidget::on_varState_toggled(const bool state) +void ScriptWidget::on_varScript_textChanged(const QString& script) { - m_value.setStatus(state ? Flag::On : Flag::Off); + QTextCursor cursor = varScript->textCursor(); + m_value.setScript(script); + varScript->setTextCursor(cursor); + emit(valueChanged(m_value)); } - diff --git a/pokemodr/FlagWidget.h b/pokemodr/ScriptWidget.h index 7e749179..1b0d536e 100644 --- a/pokemodr/FlagWidget.h +++ b/pokemodr/ScriptWidget.h @@ -15,36 +15,35 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __FLAGWIDGET__ -#define __FLAGWIDGET__ +#ifndef __POKEMODR_SCRIPTWIDGET__ +#define __POKEMODR_SCRIPTWIDGET__ // Pokemod includes -#include "../pokemod/Flag.h" +#include "../pokemod/Script.h" // Qt includes #include <QWidget> // Form include -#include "ui_flag.h" +#include "ui_script.h" -class FlagWidget : public QGroupBox, private Ui::formFlag +class ScriptWidget : public QWidget, private Ui::formScript { Q_OBJECT public: - FlagWidget(QWidget* parent, const Flag& value = Flag(0, Flag::Off)); + ScriptWidget(QWidget* parent, const Script& value = Script("", "")); - Flag value() const; + Script value() const; signals: - void valueChanged(const Flag&); + void valueChanged(const Script&); public slots: - void setValue(const Flag& value); + void setValue(const Script& value); protected slots: - void boxClicked(const bool clicked); - void on_varFlag_valueChanged(const int flag); - void on_varState_toggled(const bool state); + void on_varInterpreter_activated(const QString& interpreter); + void on_varScript_textChanged(const QString& script); private: - Flag m_value; + Script m_value; }; #endif diff --git a/pokemodr/gui/ability.ui b/pokemodr/gui/ability.ui index cb9636a2..00641dbc 100644 --- a/pokemodr/gui/ability.ui +++ b/pokemodr/gui/ability.ui @@ -21,6 +21,18 @@ </layout> </widget> </item> + <item> + <widget class="QGroupBox" name="boxScript" > + <property name="title" > + <string>Script</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="ScriptWidget" name="varScript" /> + </item> + </layout> + </widget> + </item> </layout> </widget> <customwidgets> @@ -29,6 +41,11 @@ <extends>QLineEdit</extends> <header>klineedit.h</header> </customwidget> + <customwidget> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> + </customwidget> </customwidgets> <resources/> <connections/> diff --git a/pokemodr/gui/badge.ui b/pokemodr/gui/badge.ui index 8727dba4..daa950f8 100644 --- a/pokemodr/gui/badge.ui +++ b/pokemodr/gui/badge.ui @@ -51,7 +51,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -74,7 +74,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -97,7 +97,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -132,7 +132,7 @@ <property name="toolTip" > <string>The multiplier to the stat in-game battles</string> </property> - <property name="behavior" > + <property name="behavior" stdset="0" > <number>1</number> </property> </widget> @@ -183,6 +183,11 @@ <header>klistwidget.h</header> </customwidget> <customwidget> + <class>KPushButton</class> + <extends>QPushButton</extends> + <header>kpushbutton.h</header> + </customwidget> + <customwidget> <class>FractionWidget</class> <extends>QWidget</extends> <header>../FractionWidget.h</header> diff --git a/pokemodr/gui/coinlist.ui b/pokemodr/gui/coinlist.ui index 5a21eb60..ae4aa1ef 100644 --- a/pokemodr/gui/coinlist.ui +++ b/pokemodr/gui/coinlist.ui @@ -28,11 +28,7 @@ </property> <layout class="QHBoxLayout" > <item> - <widget class="KTextEdit" name="varScript" > - <property name="toolTip" > - <string>The script that is used to determine whether the coin list is aple to be used or not</string> - </property> - </widget> + <widget class="ScriptWidget" name="varScript" /> </item> </layout> </widget> @@ -41,19 +37,14 @@ </widget> <customwidgets> <customwidget> - <class>KComboBox</class> - <extends>QComboBox</extends> - <header>kcombobox.h</header> - </customwidget> - <customwidget> <class>KLineEdit</class> <extends>QLineEdit</extends> <header>klineedit.h</header> </customwidget> <customwidget> - <class>KTextEdit</class> - <extends>QTextEdit</extends> - <header>ktextedit.h</header> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> </customwidget> </customwidgets> <resources/> diff --git a/pokemodr/gui/flag.ui b/pokemodr/gui/flag.ui deleted file mode 100644 index 49ae08b8..00000000 --- a/pokemodr/gui/flag.ui +++ /dev/null @@ -1,39 +0,0 @@ -<ui version="4.0" > - <class>formFlag</class> - <widget class="QGroupBox" name="formFlag" > - <property name="checkable" > - <bool>true</bool> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KIntNumInput" name="varFlag" > - <property name="toolTip" > - <string>The number of the flag</string> - </property> - <property name="minimum" > - <number>0</number> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varState" > - <property name="toolTip" > - <string>Whether the flag has to be on or off</string> - </property> - <property name="text" > - <string>State</string> - </property> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>KIntNumInput</class> - <extends>QWidget</extends> - <header>knuminput.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/pokemodr/gui/globalscript.ui b/pokemodr/gui/globalscript.ui new file mode 100644 index 00000000..8d1a8854 --- /dev/null +++ b/pokemodr/gui/globalscript.ui @@ -0,0 +1,49 @@ +<ui version="4.0" > + <class>formGlobalScript</class> + <widget class="QWidget" name="formGlobalScript" > + <layout class="QVBoxLayout" > + <item> + <widget class="QGroupBox" name="boxName" > + <property name="title" > + <string>Name</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="KLineEdit" name="varName" > + <property name="showClearButton" stdset="0" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="boxScipt" > + <property name="title" > + <string>Script</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="ScriptWidget" name="varScript" /> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>KLineEdit</class> + <extends>QLineEdit</extends> + <header>klineedit.h</header> + </customwidget> + <customwidget> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/pokemodr/gui/item.ui b/pokemodr/gui/item.ui index fe1a1418..e3732693 100644 --- a/pokemodr/gui/item.ui +++ b/pokemodr/gui/item.ui @@ -89,11 +89,23 @@ </widget> </item> <item> + <widget class="QGroupBox" name="boxScript" > + <property name="title" > + <string>Script</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="ScriptWidget" name="varScript" /> + </item> + </layout> + </widget> + </item> + <item> <spacer> <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -124,6 +136,11 @@ <extends>QTextEdit</extends> <header>ktextedit.h</header> </customwidget> + <customwidget> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> + </customwidget> </customwidgets> <resources/> <connections/> diff --git a/pokemodr/gui/mapeffect.ui b/pokemodr/gui/mapeffect.ui index cb2cf18b..a4c4375a 100644 --- a/pokemodr/gui/mapeffect.ui +++ b/pokemodr/gui/mapeffect.ui @@ -51,7 +51,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -77,7 +77,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -89,36 +89,27 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxScript" > + <widget class="QGroupBox" name="varIsGhost" > <property name="title" > - <string>Script</string> + <string>Is Transparent</string> </property> - <layout class="QVBoxLayout" > - <item> - <widget class="KTextEdit" name="varScript" > - <property name="toolTip" > - <string>The script that controls the effect</string> - </property> - </widget> - </item> - </layout> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>false</bool> + </property> + <layout class="QVBoxLayout" /> </widget> </item> <item> - <widget class="QGroupBox" name="boxFlags" > + <widget class="QGroupBox" name="boxScript" > <property name="title" > - <string>Flags</string> + <string>Script</string> </property> <layout class="QVBoxLayout" > <item> - <widget class="QCheckBox" name="varIsGhost" > - <property name="toolTip" > - <string>If checked, the effect is able to be walked through</string> - </property> - <property name="text" > - <string>Ghost</string> - </property> - </widget> + <widget class="ScriptWidget" name="varScript" /> </item> </layout> </widget> @@ -127,16 +118,6 @@ </widget> <customwidgets> <customwidget> - <class>KComboBox</class> - <extends>QComboBox</extends> - <header>kcombobox.h</header> - </customwidget> - <customwidget> - <class>KIntNumInput</class> - <extends>QWidget</extends> - <header>knuminput.h</header> - </customwidget> - <customwidget> <class>KLineEdit</class> <extends>QLineEdit</extends> <header>klineedit.h</header> @@ -147,14 +128,14 @@ <header>kpushbutton.h</header> </customwidget> <customwidget> - <class>PointWidget</class> + <class>ScriptWidget</class> <extends>QWidget</extends> - <header>../PointWidget.h</header> + <header>../ScriptWidget.h</header> </customwidget> <customwidget> - <class>KTextEdit</class> - <extends>QTextEdit</extends> - <header>ktextedit.h</header> + <class>PointWidget</class> + <extends>QWidget</extends> + <header>../PointWidget.h</header> </customwidget> </customwidgets> <resources/> diff --git a/pokemodr/gui/maptrainer.ui b/pokemodr/gui/maptrainer.ui index 5a784455..58c5126f 100644 --- a/pokemodr/gui/maptrainer.ui +++ b/pokemodr/gui/maptrainer.ui @@ -50,41 +50,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxSight" > - <property name="title" > - <string>Sight</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KIntNumInput" name="varSight" > - <property name="toolTip" > - <string>How far the trainer can see</string> - </property> - <property name="minimum" > - <number>0</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxDirection" > - <property name="title" > - <string>Direction</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KComboBox" name="varDirection" > - <property name="toolTip" > - <string>Direction the trainer faces</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxNumberFight" > <property name="title" > <string>Number Fight</string> @@ -104,30 +69,13 @@ </widget> </item> <item> - <widget class="FlagWidget" name="varAppearFlag" > - <property name="toolTip" > - <string>The flag that determines whether the trainer is active or not</string> - </property> + <widget class="QGroupBox" name="boxScript" > <property name="title" > - <string>Appear Flag</string> + <string>Script</string> </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxDialogs" > - <property name="title" > - <string>Dialog</string> - </property> - <layout class="QHBoxLayout" > + <layout class="QHBoxLayout" name="horizontalLayout" > <item> - <widget class="KComboBox" name="varDialog" > - <property name="toolTip" > - <string>The dialog used when the trainer is encountered</string> - </property> - </widget> + <widget class="ScriptWidget" name="varScript" /> </item> </layout> </widget> @@ -167,15 +115,14 @@ <header>klineedit.h</header> </customwidget> <customwidget> - <class>PointWidget</class> + <class>ScriptWidget</class> <extends>QWidget</extends> - <header>../PointWidget.h</header> + <header>../ScriptWidget.h</header> </customwidget> <customwidget> - <class>FlagWidget</class> - <extends>QGroupBox</extends> - <header>../FlagWidget.h</header> - <container>1</container> + <class>PointWidget</class> + <extends>QWidget</extends> + <header>../PointWidget.h</header> </customwidget> </customwidgets> <resources/> diff --git a/pokemodr/gui/mapwarp.ui b/pokemodr/gui/mapwarp.ui index f4600225..844cffc2 100644 --- a/pokemodr/gui/mapwarp.ui +++ b/pokemodr/gui/mapwarp.ui @@ -38,38 +38,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxActivation" > - <property name="title" > - <string>Activation</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KListWidget" name="varActivation" > - <property name="toolTip" > - <string>Directions, that when walked into from, the warp is activated</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxDirectionOut" > - <property name="title" > - <string>Direction Out</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KComboBox" name="varDirectionOut" > - <property name="toolTip" > - <string>Direction the warp pushes things when arrived at</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxType" > <property name="title" > <string>Type</string> @@ -86,54 +54,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Flags</string> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="QCheckBox" name="varBiking" > - <property name="toolTip" > - <string>Whether to force, allow, of disable biking when going through</string> - </property> - <property name="text" > - <string>Biking</string> - </property> - <property name="tristate" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varFlash" > - <property name="toolTip" > - <string>Whether to force, allow, of disable darkness when going through</string> - </property> - <property name="text" > - <string>Flash</string> - </property> - <property name="tristate" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varFog" > - <property name="toolTip" > - <string>Whether to force, allow, of disable fog when going through</string> - </property> - <property name="text" > - <string>Fog</string> - </property> - <property name="tristate" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxDestination" > <property name="title" > <string>Destination Map</string> @@ -160,36 +80,21 @@ </widget> </item> </layout> + <zorder>varToWarp</zorder> + <zorder>boxScript</zorder> </widget> </item> </layout> </widget> </item> <item> - <widget class="FlagWidget" name="varWorkingFlag" > - <property name="toolTip" > - <string>The flag that controls whether the warp is active or not</string> - </property> + <widget class="QGroupBox" name="boxScript" > <property name="title" > - <string>Working Flag</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxDialog" > - <property name="title" > - <string>Dialog</string> + <string>Script</string> </property> <layout class="QHBoxLayout" > <item> - <widget class="KComboBox" name="varDialog" > - <property name="toolTip" > - <string>The dialog to parse when the warp is activated</string> - </property> - </widget> + <widget class="ScriptWidget" name="varScript" /> </item> </layout> </widget> @@ -208,21 +113,15 @@ <header>klineedit.h</header> </customwidget> <customwidget> - <class>KListWidget</class> - <extends>QListWidget</extends> - <header>klistwidget.h</header> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> </customwidget> <customwidget> <class>PointWidget</class> <extends>QWidget</extends> <header>../PointWidget.h</header> </customwidget> - <customwidget> - <class>FlagWidget</class> - <extends>QGroupBox</extends> - <header>../FlagWidget.h</header> - <container>1</container> - </customwidget> </customwidgets> <resources/> <connections/> diff --git a/pokemodr/gui/mapwildlist.ui b/pokemodr/gui/mapwildlist.ui index ba0e9aac..00897af7 100644 --- a/pokemodr/gui/mapwildlist.ui +++ b/pokemodr/gui/mapwildlist.ui @@ -15,57 +15,34 @@ </property> </widget> </item> - <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Value</string> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="KComboBox" name="varValue" > - <property name="toolTip" > - <string>Value of the controlling factor</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="boxTimes" > + <widget class="QGroupBox" name="boxScript" > <property name="title" > - <string>Times</string> + <string>Script</string> </property> <layout class="QHBoxLayout" > <item> - <widget class="KListWidget" name="varTimes" > - <property name="toolTip" > - <string>Times when the list is active</string> - </property> - <property name="selectionMode" > - <enum>QAbstractItemView::ExtendedSelection</enum> - </property> - </widget> + <widget class="ScriptWidget" name="varScript" /> </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="boxScope" > + <widget class="QGroupBox" name="boxTimes" > <property name="title" > - <string>Scope</string> - </property> - <property name="checkable" > - <bool>true</bool> + <string>Times</string> </property> <layout class="QHBoxLayout" > <item> - <widget class="KComboBox" name="varScope" > + <widget class="KListWidget" name="varTimes" > <property name="toolTip" > - <string>Scope needed to see encounters (-1 for none)</string> + <string>Times when the list is active</string> + </property> + <property name="selectionMode" > + <enum>QAbstractItemView::ExtendedSelection</enum> </property> </widget> </item> @@ -85,6 +62,11 @@ <extends>QListWidget</extends> <header>klistwidget.h</header> </customwidget> + <customwidget> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> + </customwidget> </customwidgets> <resources/> <connections/> diff --git a/pokemodr/gui/mapwildlistencounter.ui b/pokemodr/gui/mapwildlistencounter.ui index a0b2928d..df8e1fc2 100644 --- a/pokemodr/gui/mapwildlistencounter.ui +++ b/pokemodr/gui/mapwildlistencounter.ui @@ -3,7 +3,7 @@ <widget class="QWidget" name="formMapWildListEncounter" > <layout class="QVBoxLayout" > <item> - <widget class="QGroupBox" name="groupBox" > + <widget class="QGroupBox" name="boxSpecies" > <property name="title" > <string>Species</string> </property> @@ -19,7 +19,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_2" > + <widget class="QGroupBox" name="boxLevel" > <property name="title" > <string>Level</string> </property> @@ -38,7 +38,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_3" > + <widget class="QGroupBox" name="boxWeight" > <property name="title" > <string>Weight</string> </property> diff --git a/pokemodr/gui/move.ui b/pokemodr/gui/move.ui index bf10657a..a236cb09 100644 --- a/pokemodr/gui/move.ui +++ b/pokemodr/gui/move.ui @@ -143,72 +143,11 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxFlags" > + <widget class="QGroupBox" name="varSpecial" > <property name="title" > - <string>Flags</string> + <string>Special</string> </property> - <layout class="QVBoxLayout" > - <item> - <widget class="QCheckBox" name="varSpecial" > - <property name="toolTip" > - <string>If checked, the move uses the Special stat(s) rather than the physical</string> - </property> - <property name="text" > - <string>Special</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varIgnoreAccuracy" > - <property name="toolTip" > - <string>If checked, the move ignores any accuracy-affecting items the enemy may be holding</string> - </property> - <property name="text" > - <string>Ignore Accuracy</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varCanFlinch" > - <property name="toolTip" > - <string>If checked, the move can make the target flinch with items</string> - </property> - <property name="text" > - <string>Can Flinch</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varCanRandom" > - <property name="toolTip" > - <string>If checked, Metronome-like moves can use this move</string> - </property> - <property name="text" > - <string>Randomizable</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varCanSnatch" > - <property name="toolTip" > - <string>If checked, the effects can be stolen</string> - </property> - <property name="text" > - <string>Can Snatch</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="varMakesSound" > - <property name="toolTip" > - <string>If checked, the move makes sound</string> - </property> - <property name="text" > - <string>Makes Sound</string> - </property> - </widget> - </item> - </layout> + <layout class="QVBoxLayout" /> </widget> </item> <item> @@ -235,7 +174,7 @@ <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -243,6 +182,18 @@ </property> </spacer> </item> + <item> + <widget class="QGroupBox" name="boxScript" > + <property name="title" > + <string>Script</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="ScriptWidget" name="varScript" /> + </item> + </layout> + </widget> + </item> </layout> </widget> <customwidgets> @@ -271,6 +222,11 @@ <extends>QWidget</extends> <header>../FractionWidget.h</header> </customwidget> + <customwidget> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> + </customwidget> </customwidgets> <resources/> <connections/> diff --git a/pokemodr/gui/nature.ui b/pokemodr/gui/nature.ui index 98aeb4f2..13271169 100644 --- a/pokemodr/gui/nature.ui +++ b/pokemodr/gui/nature.ui @@ -42,7 +42,7 @@ <property name="toolTip" > <string>The multiplier of the stat</string> </property> - <property name="behavior" > + <property name="behavior" stdset="0" > <number>1</number> </property> </widget> diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui index 618375e4..1660f9e8 100644 --- a/pokemodr/gui/pokemod.ui +++ b/pokemodr/gui/pokemod.ui @@ -4,6 +4,9 @@ <layout class="QVBoxLayout" > <item> <widget class="KTabWidget" name="notebookPokemod" > + <property name="currentIndex" > + <number>0</number> + </property> <widget class="QWidget" name="tabGeneral" > <attribute name="title" > <string>General</string> @@ -99,58 +102,11 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxSuperPC" > - <property name="title" > - <string>Super PC</string> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="QGroupBox" name="boxUsername" > - <property name="title" > - <string>Username</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KLineEdit" name="varSuperPCUsername" > - <property name="toolTip" > - <string>Username to access the Super PC</string> - </property> - <property name="showClearButton" stdset="0" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxPassword" > - <property name="title" > - <string>Password</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KLineEdit" name="varSuperPCPassword" > - <property name="toolTip" > - <string>Password to access the Super PC</string> - </property> - <property name="showClearButton" stdset="0" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </item> - <item> <spacer> <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -176,6 +132,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> @@ -193,6 +155,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -209,6 +177,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> @@ -226,6 +200,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -242,6 +222,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> @@ -259,6 +245,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -275,6 +267,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> @@ -292,6 +290,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -308,6 +312,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> @@ -325,6 +335,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -341,6 +357,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> @@ -358,6 +380,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -368,7 +396,7 @@ <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -404,7 +432,7 @@ <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -425,11 +453,6 @@ <header>kcombobox.h</header> </customwidget> <customwidget> - <class>KIntNumInput</class> - <extends>QWidget</extends> - <header>knuminput.h</header> - </customwidget> - <customwidget> <class>KLineEdit</class> <extends>QLineEdit</extends> <header>klineedit.h</header> @@ -440,14 +463,15 @@ <header>kpushbutton.h</header> </customwidget> <customwidget> - <class>KTextEdit</class> - <extends>QTextEdit</extends> - <header>ktextedit.h</header> - </customwidget> - <customwidget> <class>KTabWidget</class> <extends>QTabWidget</extends> <header>ktabwidget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>KTextEdit</class> + <extends>QTextEdit</extends> + <header>ktextedit.h</header> </customwidget> <customwidget> <class>FractionWidget</class> diff --git a/pokemodr/gui/script.ui b/pokemodr/gui/script.ui new file mode 100644 index 00000000..62d6a2ce --- /dev/null +++ b/pokemodr/gui/script.ui @@ -0,0 +1,52 @@ +<ui version="4.0" > + <class>formScript</class> + <widget class="QWidget" name="formScript" > + <layout class="QVBoxLayout" > + <item> + <widget class="QGroupBox" name="boxInterpreter" > + <property name="title" > + <string>Interpreter</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="KComboBox" name="varInterpreter" > + <property name="editable" > + <bool>true</bool> + </property> + <property name="autoCompletion" > + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="boxScript" > + <property name="title" > + <string>Code</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="KTextEdit" name="varScript" /> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> + </customwidget> + <customwidget> + <class>KTextEdit</class> + <extends>QTextEdit</extends> + <header>ktextedit.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui index cd87a91d..30d25a07 100644 --- a/pokemodr/gui/species.ui +++ b/pokemodr/gui/species.ui @@ -4,6 +4,9 @@ <layout class="QVBoxLayout" > <item> <widget class="KTabWidget" name="notebookSpecies" > + <property name="currentIndex" > + <number>3</number> + </property> <widget class="QWidget" name="tabGeneral" > <attribute name="title" > <string>General</string> @@ -96,11 +99,11 @@ </widget> </item> <item> - <spacer> + <spacer name="verticalSpacer" > <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -229,7 +232,7 @@ <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -241,7 +244,7 @@ </widget> <widget class="QWidget" name="tabPokedex" > <attribute name="title" > - <string>PokéDex</string> + <string>Pokédex</string> </attribute> <layout class="QVBoxLayout" > <item> @@ -332,7 +335,7 @@ <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -428,11 +431,23 @@ </widget> </item> <item> + <widget class="QGroupBox" name="boxEvolution" > + <property name="title" > + <string>Evolution Script</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="ScriptWidget" name="varEvolution" /> + </item> + </layout> + </widget> + </item> + <item> <spacer> <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -458,14 +473,20 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> <widget class="KPushButton" name="varMaleFront" > <property name="minimumSize" > <size> - <width>64</width> - <height>64</height> + <width>128</width> + <height>128</height> </size> </property> </widget> @@ -475,14 +496,20 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> <widget class="KPushButton" name="varMaleBack" > <property name="minimumSize" > <size> - <width>64</width> - <height>64</height> + <width>128</width> + <height>128</height> </size> </property> </widget> @@ -492,6 +519,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -508,14 +541,20 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> <widget class="KPushButton" name="varFemaleFront" > <property name="minimumSize" > <size> - <width>64</width> - <height>64</height> + <width>128</width> + <height>128</height> </size> </property> </widget> @@ -525,14 +564,20 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> <widget class="KPushButton" name="varFemaleBack" > <property name="minimumSize" > <size> - <width>64</width> - <height>64</height> + <width>128</width> + <height>128</height> </size> </property> </widget> @@ -542,6 +587,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -558,6 +609,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> <item> @@ -575,6 +632,12 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> </spacer> </item> </layout> @@ -585,7 +648,7 @@ <property name="orientation" > <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -627,20 +690,26 @@ <header>kpushbutton.h</header> </customwidget> <customwidget> - <class>KTextEdit</class> - <extends>QTextEdit</extends> - <header>ktextedit.h</header> - </customwidget> - <customwidget> <class>KTabWidget</class> <extends>QTabWidget</extends> <header>ktabwidget.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>KTextEdit</class> + <extends>QTextEdit</extends> + <header>ktextedit.h</header> </customwidget> <customwidget> <class>FractionWidget</class> <extends>QWidget</extends> <header>../FractionWidget.h</header> </customwidget> + <customwidget> + <class>ScriptWidget</class> + <extends>QWidget</extends> + <header>../ScriptWidget.h</header> + </customwidget> </customwidgets> <resources/> <connections/> diff --git a/pokemodr/gui/tile.ui b/pokemodr/gui/tile.ui index 0382f871..808a839a 100644 --- a/pokemodr/gui/tile.ui +++ b/pokemodr/gui/tile.ui @@ -32,7 +32,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -58,7 +58,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> diff --git a/pokemodr/gui/trainer.ui b/pokemodr/gui/trainer.ui index d95a72d5..7a6ef271 100644 --- a/pokemodr/gui/trainer.ui +++ b/pokemodr/gui/trainer.ui @@ -45,7 +45,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> @@ -71,7 +71,7 @@ <property name="orientation" > <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" > + <property name="sizeHint" stdset="0" > <size> <width>20</width> <height>40</height> diff --git a/pokemodr/gui/type.ui b/pokemodr/gui/type.ui index 8615bbd2..71dc8903 100644 --- a/pokemodr/gui/type.ui +++ b/pokemodr/gui/type.ui @@ -32,7 +32,7 @@ <property name="toolTip" > <string>Multiplier for species with this type for using a move of this type</string> </property> - <property name="behavior" > + <property name="behavior" stdset="0" > <number>1</number> </property> </widget> diff --git a/pokemodr/models/AbilityModel.cpp b/pokemodr/models/AbilityModel.cpp index 9a3f6b76..a76a6c87 100644 --- a/pokemodr/models/AbilityModel.cpp +++ b/pokemodr/models/AbilityModel.cpp @@ -18,28 +18,22 @@ // Header include #include "AbilityModel.h" -// Model includes -#include "AbilityEffectModel.h" - // PokeModr includes #include "../AbilityUI.h" // Pokemod includes #include "../../pokemod/Ability.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> AbilityModel::AbilityModel(BaseModel* parent, Ability* ability) : - GroupObjectModel(parent, ability) + ObjectModel(parent, ability) { - setupData(); } AbilityModel::~AbilityModel() { - clearData(); } QVariant AbilityModel::data(int role) const @@ -57,7 +51,7 @@ QVariant AbilityModel::data(int role) const QWidget* widget = new AbilityUI(static_cast<Ability*>(m_object), NULL); return QVariant::fromValue(widget); } - return GroupObjectModel::data(role); + return ObjectModel::data(role); } bool AbilityModel::setData(const QVariant& value, int role) @@ -72,9 +66,7 @@ bool AbilityModel::setData(const QVariant& value, int role) { if (xml.doctype().name() == m_object->className()) { - clearData(); m_object->load(xml.documentElement()); - setupData(); return true; } file.close(); @@ -83,28 +75,3 @@ bool AbilityModel::setData(const QVariant& value, int role) } return false; } - -bool AbilityModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new AbilityEffectModel(this, static_cast<Ability*>(m_object)->newEffect())); - return true; -} - -bool AbilityModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Ability*>(m_object)->deleteEffect(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - -void AbilityModel::setupData() -{ - Ability* ability = static_cast<Ability*>(m_object); - for (int i = 0; i < ability->effectCount(); ++i) - m_objects.append(new AbilityEffectModel(this, ability->effect(i))); -} diff --git a/pokemodr/models/AbilityModel.h b/pokemodr/models/AbilityModel.h index 23a87699..005b1066 100644 --- a/pokemodr/models/AbilityModel.h +++ b/pokemodr/models/AbilityModel.h @@ -19,13 +19,12 @@ #define __POKEMODR_ABILITYMODEL__ // Model includes -#include "GroupObjectModel.h" +#include "ObjectModel.h" // Forward declarations class Ability; -class AbilityEffectModel; -class AbilityModel : public GroupObjectModel +class AbilityModel : public ObjectModel { public: AbilityModel(BaseModel* parent, Ability* ability); @@ -34,12 +33,6 @@ class AbilityModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); - protected: - void setupData(); }; #endif diff --git a/pokemodr/models/AuthorModel.cpp b/pokemodr/models/AuthorModel.cpp index 2daa76ab..c2597098 100644 --- a/pokemodr/models/AuthorModel.cpp +++ b/pokemodr/models/AuthorModel.cpp @@ -23,7 +23,6 @@ // Pokemod includes #include "../../pokemod/Author.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> diff --git a/pokemodr/models/BadgeModel.cpp b/pokemodr/models/BadgeModel.cpp index 275016eb..f750255e 100644 --- a/pokemodr/models/BadgeModel.cpp +++ b/pokemodr/models/BadgeModel.cpp @@ -23,7 +23,6 @@ // Pokemod includes #include "../../pokemod/Badge.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> diff --git a/pokemodr/models/CoinListModel.cpp b/pokemodr/models/CoinListModel.cpp index 167d9070..fa5f8a0d 100644 --- a/pokemodr/models/CoinListModel.cpp +++ b/pokemodr/models/CoinListModel.cpp @@ -26,7 +26,6 @@ // Pokemod includes #include "../../pokemod/CoinList.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> diff --git a/pokemodr/models/EggGroupModel.cpp b/pokemodr/models/EggGroupModel.cpp index 1e25b26d..78adf60b 100644 --- a/pokemodr/models/EggGroupModel.cpp +++ b/pokemodr/models/EggGroupModel.cpp @@ -23,7 +23,6 @@ // Pokemod includes #include "../../pokemod/EggGroup.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> diff --git a/pokemodr/models/GlobalScriptGroupModel.cpp b/pokemodr/models/GlobalScriptGroupModel.cpp new file mode 100644 index 00000000..ad2ee2b6 --- /dev/null +++ b/pokemodr/models/GlobalScriptGroupModel.cpp @@ -0,0 +1,60 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * 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/>. + */ + +// Header include +#include "GlobalScriptGroupModel.h" + +// Model includes +#include "GlobalScriptModel.h" + +// Pokemod includes +#include "../../pokemod/Pokemod.h" + +GlobalScriptGroupModel::GlobalScriptGroupModel(BaseModel* parent, Pokemod* pokemod) : + GroupModel(parent, pokemod, "Global Scripts") +{ + setupData(); +} + +GlobalScriptGroupModel::~GlobalScriptGroupModel() +{ +} + +bool GlobalScriptGroupModel::insertRows(const int rows) +{ + for (int i = 0; i < rows; ++i) + m_objects.append(new GlobalScriptModel(this, static_cast<Pokemod*>(m_object)->newGlobalScript())); + return true; +} + +bool GlobalScriptGroupModel::removeRows(const int position, const int rows) +{ + for (int i = 0; i < rows; ++i) + { + static_cast<Pokemod*>(m_object)->deleteGlobalScript(position); + delete m_objects[position]; + m_objects.removeAt(position); + } + return true; +} + +void GlobalScriptGroupModel::setupData() +{ + Pokemod* pokemod = static_cast<Pokemod*>(m_object); + for (int i = 0; i < pokemod->globalScriptCount(); ++i) + m_objects.append(new GlobalScriptModel(this, pokemod->globalScript(i))); +} diff --git a/pokemodr/models/GlobalScriptGroupModel.h b/pokemodr/models/GlobalScriptGroupModel.h new file mode 100644 index 00000000..40796e41 --- /dev/null +++ b/pokemodr/models/GlobalScriptGroupModel.h @@ -0,0 +1,40 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * 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_GLOBALSCRIPTGROUPMODEL__ +#define __POKEMODR_GLOBALSCRIPTGROUPMODEL__ + +// Model includes +#include "GroupModel.h" + +// Forward declarations +class Pokemod; + +class GlobalScriptGroupModel : public GroupModel +{ + public: + GlobalScriptGroupModel(BaseModel* parent, Pokemod* pokemod); + ~GlobalScriptGroupModel(); + + bool insertRows(const int rows); + + bool removeRows(const int position, const int rows); + protected: + void setupData(); +}; + +#endif diff --git a/pokemodr/models/GlobalScriptModel.cpp b/pokemodr/models/GlobalScriptModel.cpp new file mode 100644 index 00000000..25db22b6 --- /dev/null +++ b/pokemodr/models/GlobalScriptModel.cpp @@ -0,0 +1,77 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * 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/>. + */ + +// Header include +#include "GlobalScriptModel.h" + +// PokeModr includes +#include "../GlobalScriptUI.h" + +// Pokemod includes +#include "../../pokemod/GlobalScript.h" + +// Qt includes +#include <QFile> + +GlobalScriptModel::GlobalScriptModel(BaseModel* parent, GlobalScript* globalScript) : + ObjectModel(parent, globalScript) +{ +} + +GlobalScriptModel::~GlobalScriptModel() +{ +} + +QVariant GlobalScriptModel::data(int role) const +{ + if (role == Qt::DisplayRole) + return static_cast<GlobalScript*>(m_object)->name(); + else if (role == BaseModel::XmlRole) + { + QDomDocument xml(m_object->className()); + xml.appendChild(m_object->save()); + return xml.toString(); + } + else if (role == BaseModel::WidgetRole) + { + QWidget* widget = new GlobalScriptUI(static_cast<GlobalScript*>(m_object), NULL); + return QVariant::fromValue(widget); + } + return ObjectModel::data(role); +} + +bool GlobalScriptModel::setData(const QVariant& value, int role) +{ + if (role == BaseModel::XmlRole) + { + if (value.canConvert<QString>()) + { + QFile file(value.toString()); + QDomDocument xml; + if ((file.open(QIODevice::ReadOnly) && xml.setContent(&file)) || xml.setContent(value.toString())) + { + if (xml.doctype().name() == m_object->className()) + { + m_object->load(xml.documentElement()); + return true; + } + file.close(); + } + } + } + return false; +} diff --git a/pokemodr/models/GlobalScriptModel.h b/pokemodr/models/GlobalScriptModel.h new file mode 100644 index 00000000..29a0028d --- /dev/null +++ b/pokemodr/models/GlobalScriptModel.h @@ -0,0 +1,38 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * 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_GLOBALSCRIPTMODEL__ +#define __POKEMODR_GLOBALSCRIPTMODEL__ + +// Model includes +#include "ObjectModel.h" + +// Forward declarations +class GlobalScript; + +class GlobalScriptModel : public ObjectModel +{ + public: + GlobalScriptModel(BaseModel* parent, GlobalScript* globalScript); + ~GlobalScriptModel(); + + QVariant data(int role = Qt::DisplayRole) const; + + bool setData(const QVariant& value, int role = Qt::EditRole); +}; + +#endif diff --git a/pokemodr/models/ItemModel.cpp b/pokemodr/models/ItemModel.cpp index daa5f903..66968cf7 100644 --- a/pokemodr/models/ItemModel.cpp +++ b/pokemodr/models/ItemModel.cpp @@ -18,28 +18,22 @@ // Header include #include "ItemModel.h" -// Model includes -#include "ItemEffectModel.h" - // PokeModr includes #include "../ItemUI.h" // Pokemod includes #include "../../pokemod/Item.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> ItemModel::ItemModel(BaseModel* parent, Item* item) : - GroupObjectModel(parent, item) + ObjectModel(parent, item) { - setupData(); } ItemModel::~ItemModel() { - clearData(); } QVariant ItemModel::data(int role) const @@ -57,7 +51,7 @@ QVariant ItemModel::data(int role) const QWidget* widget = new ItemUI(static_cast<Item*>(m_object), NULL); return QVariant::fromValue(widget); } - return GroupObjectModel::data(role); + return ObjectModel::data(role); } bool ItemModel::setData(const QVariant& value, int role) @@ -72,9 +66,7 @@ bool ItemModel::setData(const QVariant& value, int role) { if (xml.doctype().name() == m_object->className()) { - clearData(); m_object->load(xml.documentElement()); - setupData(); return true; } file.close(); @@ -83,28 +75,3 @@ bool ItemModel::setData(const QVariant& value, int role) } return false; } - -bool ItemModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new ItemEffectModel(this, static_cast<Item*>(m_object)->newEffect())); - return true; -} - -bool ItemModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Item*>(m_object)->deleteEffect(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - -void ItemModel::setupData() -{ - Item* item = static_cast<Item*>(m_object); - for (int i = 0; i < item->effectCount(); ++i) - m_objects.append(new ItemEffectModel(this, item->effect(i))); -} diff --git a/pokemodr/models/ItemModel.h b/pokemodr/models/ItemModel.h index bc0419d6..ad126f20 100644 --- a/pokemodr/models/ItemModel.h +++ b/pokemodr/models/ItemModel.h @@ -19,13 +19,12 @@ #define __POKEMODR_ITEMMODEL__ // Model includes -#include "GroupObjectModel.h" +#include "ObjectModel.h" // Forward declarations class Item; -class ItemEffectModel; -class ItemModel : public GroupObjectModel +class ItemModel : public ObjectModel { public: ItemModel(BaseModel* parent, Item* item); @@ -34,12 +33,6 @@ class ItemModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); - protected: - void setupData(); }; #endif diff --git a/pokemodr/models/ItemTypeModel.cpp b/pokemodr/models/ItemTypeModel.cpp index ffe92bc3..5ed25951 100644 --- a/pokemodr/models/ItemTypeModel.cpp +++ b/pokemodr/models/ItemTypeModel.cpp @@ -23,7 +23,6 @@ // Pokemod includes #include "../../pokemod/ItemType.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> diff --git a/pokemodr/models/MapModel.cpp b/pokemodr/models/MapModel.cpp index 4fc65ae1..57d5e5ee 100644 --- a/pokemodr/models/MapModel.cpp +++ b/pokemodr/models/MapModel.cpp @@ -29,7 +29,6 @@ // Map includes #include "../../pokemod/Map.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> diff --git a/pokemodr/models/MoveModel.cpp b/pokemodr/models/MoveModel.cpp index f0db1dfd..5799e374 100644 --- a/pokemodr/models/MoveModel.cpp +++ b/pokemodr/models/MoveModel.cpp @@ -18,28 +18,22 @@ // Header include #include "MoveModel.h" -// Model includes -#include "MoveEffectModel.h" - // PokeModr includes #include "../MoveUI.h" // Pokemod includes #include "../../pokemod/Move.h" -#include "../../pokemod/Pokemod.h" // Qt includes #include <QFile> MoveModel::MoveModel(BaseModel* parent, Move* move) : - GroupObjectModel(parent, move) + ObjectModel(parent, move) { - setupData(); } MoveModel::~MoveModel() { - clearData(); } QVariant MoveModel::data(int role) const @@ -57,7 +51,7 @@ QVariant MoveModel::data(int role) const QWidget* widget = new MoveUI(static_cast<Move*>(m_object), NULL); return QVariant::fromValue(widget); } - return GroupObjectModel::data(role); + return ObjectModel::data(role); } bool MoveModel::setData(const QVariant& value, int role) @@ -72,9 +66,7 @@ bool MoveModel::setData(const QVariant& value, int role) { if (xml.doctype().name() == m_object->className()) { - clearData(); m_object->load(xml.documentElement()); - setupData(); return true; } file.close(); @@ -83,28 +75,3 @@ bool MoveModel::setData(const QVariant& value, int role) } return false; } - -bool MoveModel::insertRows(const int rows) -{ - for (int i = 0; i < rows; ++i) - m_objects.append(new MoveEffectModel(this, static_cast<Move*>(m_object)->newEffect())); - return true; -} - -bool MoveModel::removeRows(const int position, const int rows) -{ - for (int i = 0; i < rows; ++i) - { - static_cast<Move*>(m_object)->deleteEffect(position); - delete m_objects[position]; - m_objects.removeAt(position); - } - return true; -} - -void MoveModel::setupData() -{ - Move* move = static_cast<Move*>(m_object); - for (int i = 0; i < move->effectCount(); ++i) - m_objects.append(new MoveEffectModel(this, move->effect(i))); -} diff --git a/pokemodr/models/MoveModel.h b/pokemodr/models/MoveModel.h index f6b89de5..cc8df8ac 100644 --- a/pokemodr/models/MoveModel.h +++ b/pokemodr/models/MoveModel.h @@ -19,13 +19,12 @@ #define __POKEMODR_MOVEMODEL__ // Model includes -#include "GroupObjectModel.h" +#include "ObjectModel.h" // Forward declarations class Move; -class MoveEffectModel; -class MoveModel : public GroupObjectModel +class MoveModel : public ObjectModel { public: MoveModel(BaseModel* parent, Move* move); @@ -34,12 +33,6 @@ class MoveModel : public GroupObjectModel QVariant data(int role = Qt::DisplayRole) const; bool setData(const QVariant& value, int role = Qt::EditRole); - - bool insertRows(const int rows); - - bool removeRows(const int position, const int rows); - protected: - void setupData(); }; #endif diff --git a/pokemodr/models/PokemodModel.cpp b/pokemodr/models/PokemodModel.cpp index 3309107a..01c9cf5a 100644 --- a/pokemodr/models/PokemodModel.cpp +++ b/pokemodr/models/PokemodModel.cpp @@ -23,8 +23,8 @@ #include "AuthorGroupModel.h" #include "BadgeGroupModel.h" #include "CoinListGroupModel.h" -#include "DialogGroupModel.h" #include "EggGroupGroupModel.h" +#include "GlobalScriptGroupModel.h" #include "ItemGroupModel.h" #include "ItemTypeGroupModel.h" #include "MapGroupModel.h" @@ -118,8 +118,8 @@ void PokemodModel::setupData() m_objects.append(new AuthorGroupModel(this, static_cast<Pokemod*>(m_object))); m_objects.append(new BadgeGroupModel(this, static_cast<Pokemod*>(m_object))); m_objects.append(new CoinListGroupModel(this, static_cast<Pokemod*>(m_object))); - m_objects.append(new DialogGroupModel(this, static_cast<Pokemod*>(m_object))); m_objects.append(new EggGroupGroupModel(this, static_cast<Pokemod*>(m_object))); + m_objects.append(new GlobalScriptGroupModel(this, static_cast<Pokemod*>(m_object))); m_objects.append(new ItemGroupModel(this, static_cast<Pokemod*>(m_object))); m_objects.append(new ItemTypeGroupModel(this, static_cast<Pokemod*>(m_object))); m_objects.append(new MapGroupModel(this, static_cast<Pokemod*>(m_object))); diff --git a/pokemodr/models/SpeciesModel.cpp b/pokemodr/models/SpeciesModel.cpp index 60463cbf..4bacbeff 100644 --- a/pokemodr/models/SpeciesModel.cpp +++ b/pokemodr/models/SpeciesModel.cpp @@ -20,7 +20,6 @@ // Model includes #include "SpeciesAbilityGroupModel.h" -#include "SpeciesEvolutionGroupModel.h" #include "SpeciesItemGroupModel.h" #include "SpeciesMoveGroupModel.h" @@ -100,7 +99,6 @@ bool SpeciesModel::removeRows(const int /*position*/, const int /*rows*/) void SpeciesModel::setupData() { m_objects.append(new SpeciesAbilityGroupModel(this, static_cast<Species*>(m_object))); - m_objects.append(new SpeciesEvolutionGroupModel(this, static_cast<Species*>(m_object))); m_objects.append(new SpeciesItemGroupModel(this, static_cast<Species*>(m_object))); m_objects.append(new SpeciesMoveGroupModel(this, static_cast<Species*>(m_object))); } diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index d7366f94..62f0cee6 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -38,7 +38,6 @@ SOURCES += AbilityUI.cpp \ CoinListObjectUI.cpp \ EggGroupUI.cpp \ FileDialog.cpp \ - FlagWidget.cpp \ FractionWidget.cpp \ GlobalScriptUI.cpp \ ItemUI.cpp \ @@ -142,7 +141,6 @@ HEADERS += AbilityUI.h \ CoinListObjectUI.h \ EggGroupUI.h \ FileDialog.h \ - FlagWidget.h \ FractionWidget.h \ GlobalScriptUI.h \ ItemUI.h \ @@ -246,10 +244,9 @@ FORMS += gui/ability.ui \ gui/badge.ui \ gui/coinlist.ui \ gui/coinlistobject.ui \ - gui/dialog.ui \ gui/egggroup.ui \ - gui/flag.ui \ gui/fraction.ui \ + gui/globalscript.ui \ gui/item.ui \ gui/itemtype.ui \ gui/map.ui \ |
