diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-01-25 22:57:54 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-01-25 22:57:54 +0000 |
| commit | 404d1e3419e85ad06cf4d1cdef185877f4a57771 (patch) | |
| tree | 7979c422e3a82285e9ac442b84f50f8d590841ab | |
| parent | 2d8ee00f42b980d8351c810062d17271b3a65cf6 (diff) | |
| download | sigen-404d1e3419e85ad06cf4d1cdef185877f4a57771.tar.gz sigen-404d1e3419e85ad06cf4d1cdef185877f4a57771.tar.xz sigen-404d1e3419e85ad06cf4d1cdef185877f4a57771.zip | |
[ADD] win32 support (KDE) into .pro files
[FIX] Ref.h extern variables
[FIX] Nature include
[FIX[ GUI fixes
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@48 6ecfd1a5-f3ed-3746-8530-beee90d26b22
| -rw-r--r-- | Changelog | 10 | ||||
| -rw-r--r-- | general/Ref.h | 8 | ||||
| -rw-r--r-- | general/general.pro | 43 | ||||
| -rw-r--r-- | pokemod/Nature.cpp | 1 | ||||
| -rw-r--r-- | pokemod/Nature.h | 1 | ||||
| -rw-r--r-- | pokemodr/ItemTypeUI.cpp | 1 | ||||
| -rw-r--r-- | pokemodr/NatureUI.cpp | 141 | ||||
| -rw-r--r-- | pokemodr/NatureUI.h | 61 | ||||
| -rw-r--r-- | pokemodr/PokeModrUI.cpp | 10 | ||||
| -rw-r--r-- | pokemodr/RulesUI.cpp | 10 | ||||
| -rw-r--r-- | pokemodr/TimeUI.cpp | 5 | ||||
| -rw-r--r-- | pokemodr/TimeUI.h | 2 | ||||
| -rw-r--r-- | pokemodr/gui/mapwarp.ui | 8 | ||||
| -rw-r--r-- | pokemodr/pokemodr.pro | 43 |
14 files changed, 321 insertions, 23 deletions
@@ -1,4 +1,14 @@ ----------------- +Rev: 48 +Date: 25 January 2008 +User: MathStuf +----------------- +[ADD] win32 support (KDE) into .pro files +[FIX] Ref.h extern variables +[FIX] Nature include +[FIX[ GUI fixes + +----------------- Rev: 47 Date: 25 January 2008 User: MathStuf diff --git a/general/Ref.h b/general/Ref.h index 7dd32769..6f17a86e 100644 --- a/general/Ref.h +++ b/general/Ref.h @@ -40,6 +40,8 @@ enum EnumStat ST_Evasion = 7, ST_End_Battle = 8, }; +extern const QStringList StatRBYStr; +extern const QStringList StatGSCStr; enum EnumBattleMember { @@ -47,6 +49,7 @@ enum EnumBattleMember BM_Enemy = 1, BM_End = 2 }; +extern const QStringList BattleMemberStr; enum EnumWeather { @@ -58,6 +61,7 @@ enum EnumWeather W_All = 4, W_End_All = 5 }; +extern const QStringList WeatherStr; enum EnumDirection { @@ -69,6 +73,7 @@ enum EnumDirection D_None = 4, D_End_None = 5 }; +extern const QStringList DirectionStr; enum EnumRelative { @@ -80,6 +85,7 @@ enum EnumRelative REL_NotEqual = 5, REL_End = 6 }; +extern const QStringList RelativeStr; enum EnumStatus { @@ -92,6 +98,7 @@ enum EnumStatus STS_Any = 6, STS_End = 7 }; +extern const QStringList StatusStr; enum HMMove { @@ -110,5 +117,6 @@ enum HMMove HM_Flash = 11, HM_End_All = 12 }; +extern const QStringList HMStr; #endif diff --git a/general/general.pro b/general/general.pro index d0754b7e..13a78d0d 100644 --- a/general/general.pro +++ b/general/general.pro @@ -3,9 +3,50 @@ DESTDIR = ../../lib MOC_DIR = .moc LANGUAGE = C++ TEMPLATE = lib -LIBS += -L/usr/lib64/kde4/devel -lphonon +LIBS += -lphonon INCLUDEPATH+=/usr/include/kde4 +# Following is reformatted from the KTIGCC .pro file +win32 { + KDEPREFIX = $$(KDEPREFIX) + isEmpty(KDEPREFIX) { + # Try running kde4-config, however chances are it's not in the path or it was compiled with a bad prefix. + KDEPREFIX = $$system(kde4-config --prefix) + isEmpty(KDEPREFIX):error(KDE 4 kdelibs not found, set KDEPREFIX.) + !exists($$KDEPREFIX):error(KDE 4 kdelibs not found, set KDEPREFIX.) + } + KDEINCDIR = $$KDEPREFIX/include + # $$KDEINCDIR/mingw contains the kdewin32 headers, defining stuff like mkdtemp. + INCLUDEPATH += $$KDEINCDIR/mingw $$KDEINCDIR + LIBS += -lkdewin32 + QMAKE_LIBDIR = $$KDEPREFIX/lib $$QMAKE_LIBDIR +} else { + KDEPREFIX = $$system(kde4-config --prefix) + isEmpty(KDEPREFIX) : error(KDE 4 kdelibs required.) + exists($$KDEPREFIX/include/kde4/KDE) { + KDEINCDIR = $$KDEPREFIX/include/kde4 + } else : exists($$KDEPREFIX/include/kde/KDE) { + KDEINCDIR = $$KDEPREFIX/include/kde + } else { + KDEINCDIR = $$KDEPREFIX/include + } + INCLUDEPATH += $$KDEINCDIR + KDELIBDIR = $$KDEPREFIX/lib$$system(kde4-config --libsuffix) + KDEDEVELLIBDIR = $$KDELIBDIR + exists($$KDEDEVELLIBDIR/kde4/devel) { + KDEDEVELLIBDIR = $$KDEDEVELLIBDIR/kde4/devel + } + !equals(KDEDEVELLIBDIR,/usr/lib) : !equals(KDEDEVELLIBDIR,/usr/lib64) { + QMAKE_LIBDIR = $$KDEDEVELLIBDIR $$QMAKE_LIBDIR + } + !equals(KDELIBDIR,/usr/lib):!equals(KDELIBDIR,/usr/lib64) { + !darwin-* : !macx-* { + LIBS += -Wl,--rpath,"$$KDELIBDIR" + } + } +} + + CONFIG += qt warn_on dll SOURCES += *.cpp diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp index b2e93227..64cf0c03 100644 --- a/pokemod/Nature.cpp +++ b/pokemod/Nature.cpp @@ -20,7 +20,6 @@ // with this program. If not, see <http://www.gnu.org/licenses/>. ///////////////////////////////////////////////////////////////////////////// -#include "../general/Ref.h" #include "Pokemod.h" #include "Nature.h" diff --git a/pokemod/Nature.h b/pokemod/Nature.h index 6ade607f..fa42cb7c 100644 --- a/pokemod/Nature.h +++ b/pokemod/Nature.h @@ -26,6 +26,7 @@ #include <QString> #include "../general/Exception.h" #include "../general/Frac.h" +#include "../general/Ref.h" #include "Object.h" class Pokemod; diff --git a/pokemodr/ItemTypeUI.cpp b/pokemodr/ItemTypeUI.cpp index 03da5f43..768dbcd8 100644 --- a/pokemodr/ItemTypeUI.cpp +++ b/pokemodr/ItemTypeUI.cpp @@ -52,7 +52,6 @@ void ItemTypeUI::on_buttonApply_clicked() { *itemType = *itemType_mod; emit(setChanged(false)); - setGui(); } void ItemTypeUI::on_buttonDiscard_clicked() diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp new file mode 100644 index 00000000..ce975772 --- /dev/null +++ b/pokemodr/NatureUI.cpp @@ -0,0 +1,141 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/NatureUI.cpp +// Purpose: Nature UI form handling +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Fri Jan 25 15:19:04 2008 +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see <http://www.gnu.org/licenses/>. +///////////////////////////////////////////////////////////////////////////// + +#include <QMetaObject> +#include <QStringList> +#include "../general/BugCatcher.h" +#include "../general/Exception.h" +#include "../general/Ref.h" +#include "../pokemod/Pokemod.h" +#include "NatureUI.h" + +NatureUI::NatureUI(Nature* n, QWidget* parent) : + ObjectUI(parent), + curStat(ST_HP), + nature(n), + nature_mod(new Nature(n->getPokemod(), *n, n->getId())) +{ + setupUi(this); + QMetaObject::connectSlotsByName(this); + setObjects(nature, nature_mod); + setGui(); +} + +// KToolbar NatureUI::getToolbar(QWidget* parent) +// { +// } + +void NatureUI::setGui() +{ + const bool isSplit = nature_mod->getPokemod().getRules().getSpecialSplit(); + const QStringList& statList = isSplit ? StatRBYStr : StatGSCStr; + varName->setText(nature_mod->getName()); + varStat->clear(); + varStat->addItems(statList.mid(0, isSplit ? ST_End_RBY : ST_End_GSC)); + varStat->setCurrentItem(statList[curStat]); + varStatMultiplierNum->setValue(nature_mod->getStat(curStat).getNum()); + varStatMultiplierDenom->setValue(nature_mod->getStat(curStat).getDenom()); + varStatMultiplierNum->setMaximum(nature_mod->getStat(curStat).getDenom()); + varStatMultiplier->setText(QString::number(nature_mod->getStat(curStat), 'g', 15)); + varWeight->setValue(nature_mod->getWeight()); +} + +void NatureUI::on_buttonApply_clicked() +{ + *nature = *nature_mod; + emit(setChanged(false)); +} + +void NatureUI::on_buttonDiscard_clicked() +{ + *nature_mod = *nature; + emit(setChanged(false)); + setGui(); +} + +void NatureUI::on_varName_textChanged(const QString& n) +{ + nature_mod->setName(n); +} + +void NatureUI::on_varStat_currentIndexChanged(const QString& s) +{ + try + { + const QStringList& statList = nature_mod->getPokemod().getRules().getSpecialSplit() ? StatRBYStr : StatGSCStr; + if (statList.contains(s)) + curStat = statList.indexOf(s); + else + throw(BoundsException("NatureUI", "stat")); + emit(setChanged(true)); + } + catch (BoundsException& e) + { + BugCatcher::report(e); + setGui(); + } +} + +void NatureUI::on_varStatMultiplierNum_valueChanged(const int s) +{ + try + { + nature_mod->setStatNum(curStat, s); + varStatMultiplier->setText(QString::number(nature_mod->getStat(curStat), 'g', 15)); + emit(setChanged(true)); + } + catch (BoundsException& e) + { + BugCatcher::report(e); + setGui(); + } +} + +void NatureUI::on_varStatMultiplierDenom_valueChanged(const int s) +{ + try + { + nature_mod->setStatDenom(curStat, s); + varStatMultiplierNum->setMaximum(s); + varStatMultiplier->setText(QString::number(nature_mod->getStat(curStat), 'g', 15)); + emit(setChanged(true)); + } + catch (BoundsException& e) + { + BugCatcher::report(e); + setGui(); + } +} + +void NatureUI::on_varWeight_valueChanged(const int w) +{ + try + { + nature_mod->setWeight(w); + emit(setChanged(true)); + } + catch (BoundsException& e) + { + BugCatcher::report(e); + setGui(); + } +} diff --git a/pokemodr/NatureUI.h b/pokemodr/NatureUI.h new file mode 100644 index 00000000..a8dfbe48 --- /dev/null +++ b/pokemodr/NatureUI.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokegen/NatureUI.h +// Purpose: Nature UI form handling +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Fri Jan 25 15:14:07 2008 +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see <http://www.gnu.org/licenses/>. +///////////////////////////////////////////////////////////////////////////// + +#ifndef __POKEMODR_NATUREUI__ +#define __POKEMODR_NATUREUI__ + +#include <ktoolbar.h> +#include <QString> +#include "../pokemod/Nature.h" +#include "ObjectUI.h" +#include "ui_nature.h" + +class NatureUI : public ObjectUI, private Ui::formNature +{ + Q_OBJECT + + public: + NatureUI(Nature* n, QWidget* parent); + ~NatureUI() + { + delete nature_mod; + } + +// KToolbar getToolbar(QWidget* parent); + public slots: + void on_buttonApply_clicked(); + void on_buttonDiscard_clicked(); + void on_varName_textChanged(const QString& n); + void on_varStat_currentIndexChanged(const QString& s); + void on_varStatMultiplierNum_valueChanged(const int s); + void on_varStatMultiplierDenom_valueChanged(const int s); + void on_varWeight_valueChanged(const int w); + private: + void setGui(); + + unsigned curStat; + + Nature* nature; + Nature* nature_mod; +}; + +#endif diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp index 9af87b61..6f539844 100644 --- a/pokemodr/PokeModrUI.cpp +++ b/pokemodr/PokeModrUI.cpp @@ -28,8 +28,8 @@ #include "../general/Exception.h" #include "PokeModrUI.h" -#include <iostream> #include "../pokemod/Pokemod.h" +#include "NatureUI.h" #include "ItemTypeUI.h" #include "RulesUI.h" #include "TimeUI.h" @@ -53,8 +53,12 @@ PokeModrUI::PokeModrUI(KConfigGroup cfg, KConfigGroup history, QWidget* parent) try { Pokemod foo; - foo.newItemType(); - formPanel->setViewport(new ItemTypeUI(&foo.getItemType(0), formPanel)); + foo.newNature(); + NatureUI* n = new NatureUI(&foo.getNature(0), formPanel); + formPanel->setViewport(n); +// foo.newItemType(); +// ItemTypeUI* it = new ItemTypeUI(&foo.getItemType(0), formPanel); +// formPanel->setViewport(it); // foo.newTime(); // formPanel->setViewport(new TimeUI(&foo.getTime(0), formPanel)); // formPanel->setViewport(new RulesUI(&foo.getRules(), formPanel)); diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp index 33168e67..25ffe63c 100644 --- a/pokemodr/RulesUI.cpp +++ b/pokemodr/RulesUI.cpp @@ -33,7 +33,6 @@ RulesUI::RulesUI(Rules* r, QWidget* parent) : setupUi(this); QMetaObject::connectSlotsByName(this); setObjects(rules, rules_mod); - varMaxDV->addItems(Rules::DVStr); setGui(); } @@ -61,6 +60,8 @@ void RulesUI::setGui() boxHardCash->setChecked(rules_mod->getHardCash() ? Qt::Checked : Qt::Unchecked); boxSplitSpecial->setChecked(rules_mod->getSpecialSplit() ? Qt::Checked : Qt::Unchecked); varSplitSpecialDV->setCheckState(rules_mod->getSpecialDVSplit() ? Qt::Checked : Qt::Unchecked); + varMaxDV->clear(); + varMaxDV->addItems(Rules::DVStr); varMaxDV->setCurrentItem(Rules::DVStr[rules_mod->getMaxDVValue()]); boxHappiness->setChecked(rules_mod->getHappiness() ? Qt::Checked : Qt::Unchecked); varFaintLoss->setValue(rules_mod->getHappyFaintLoss()); @@ -79,7 +80,6 @@ void RulesUI::on_buttonApply_clicked() { *rules = *rules_mod; emit(setChanged(false)); - setGui(); } void RulesUI::on_buttonDiscard_clicked() @@ -216,12 +216,10 @@ void RulesUI::on_varMaxDV_currentIndexChanged(const QString& m) try { if (Rules::DVStr.contains(m)) - { rules_mod->setMaxDVValue(Rules::DVStr.indexOf(m)); - emit(setChanged(true)); - } else throw(BoundsException("RulesUI", "maxDVValue")); + emit(setChanged(true)); } catch (BoundsException& e) { @@ -264,8 +262,6 @@ void RulesUI::on_varMaxEV_valueChanged(const int m) { try { - if (unsigned(m) < rules_mod->getMaxEVPerStat()) - varMaxEVPerStat->setValue(m); rules_mod->setMaxTotalEV(m); varMaxEVPerStat->setMaximum(m); emit(setChanged(true)); diff --git a/pokemodr/TimeUI.cpp b/pokemodr/TimeUI.cpp index 5710d16f..7dc411e5 100644 --- a/pokemodr/TimeUI.cpp +++ b/pokemodr/TimeUI.cpp @@ -49,7 +49,6 @@ void TimeUI::on_buttonApply_clicked() { *time = *time_mod; emit(setChanged(false)); - setGui(); } void TimeUI::on_buttonDiscard_clicked() @@ -59,9 +58,9 @@ void TimeUI::on_buttonDiscard_clicked() setGui(); } -void TimeUI::on_varName_textChanged(const QString& t) +void TimeUI::on_varName_textChanged(const QString& n) { - time_mod->setName(t); + time_mod->setName(n); emit(setChanged(true)); } diff --git a/pokemodr/TimeUI.h b/pokemodr/TimeUI.h index 306ea1da..7d04bd0e 100644 --- a/pokemodr/TimeUI.h +++ b/pokemodr/TimeUI.h @@ -45,7 +45,7 @@ class TimeUI : public ObjectUI, private Ui::formTime public slots: void on_buttonApply_clicked(); void on_buttonDiscard_clicked(); - void on_varName_textChanged(const QString& t); + void on_varName_textChanged(const QString& n); void on_varTime_timeChanged(const QTime& t); private: void setGui(); diff --git a/pokemodr/gui/mapwarp.ui b/pokemodr/gui/mapwarp.ui index cd88416e..f2d2ab00 100644 --- a/pokemodr/gui/mapwarp.ui +++ b/pokemodr/gui/mapwarp.ui @@ -1,16 +1,16 @@ <ui version="4.0" > - <class>Form</class> - <widget class="QWidget" name="Form" > + <class>formMapWarp</class> + <widget class="QWidget" name="formMapWarp" > <property name="geometry" > <rect> <x>0</x> <y>0</y> <width>290</width> - <height>1051</height> + <height>1053</height> </rect> </property> <property name="windowTitle" > - <string>Form</string> + <string/> </property> <layout class="QVBoxLayout" > <item> diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index 906ab89b..fdd34bd2 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -4,8 +4,47 @@ UI_DIR = .ui MOC_DIR = .moc LANGUAGE = C++ TEMPLATE = app -LIBS += -L/usr/lib64/kde4/devel -lkdecore -lkdeui -L../../lib -lgeneral -lpokemod -INCLUDEPATH+= /usr/include/kde4 +LIBS += -lkdecore -lkdeui -L../../lib -lgeneral -lpokemod + +# Following is reformatted from the KTIGCC .pro file +win32 { + KDEPREFIX = $$(KDEPREFIX) + isEmpty(KDEPREFIX) { + # Try running kde4-config, however chances are it's not in the path or it was compiled with a bad prefix. + KDEPREFIX = $$system(kde4-config --prefix) + isEmpty(KDEPREFIX):error(KDE 4 kdelibs not found, set KDEPREFIX.) + !exists($$KDEPREFIX):error(KDE 4 kdelibs not found, set KDEPREFIX.) + } + KDEINCDIR = $$KDEPREFIX/include + # $$KDEINCDIR/mingw contains the kdewin32 headers, defining stuff like mkdtemp. + INCLUDEPATH += $$KDEINCDIR/mingw $$KDEINCDIR + LIBS += -lkdewin32 + QMAKE_LIBDIR = $$KDEPREFIX/lib $$QMAKE_LIBDIR +} else { + KDEPREFIX = $$system(kde4-config --prefix) + isEmpty(KDEPREFIX) : error(KDE 4 kdelibs required.) + exists($$KDEPREFIX/include/kde4/KDE) { + KDEINCDIR = $$KDEPREFIX/include/kde4 + } else : exists($$KDEPREFIX/include/kde/KDE) { + KDEINCDIR = $$KDEPREFIX/include/kde + } else { + KDEINCDIR = $$KDEPREFIX/include + } + INCLUDEPATH += $$KDEINCDIR + KDELIBDIR = $$KDEPREFIX/lib$$system(kde4-config --libsuffix) + KDEDEVELLIBDIR = $$KDELIBDIR + exists($$KDEDEVELLIBDIR/kde4/devel) { + KDEDEVELLIBDIR = $$KDEDEVELLIBDIR/kde4/devel + } + !equals(KDEDEVELLIBDIR,/usr/lib) : !equals(KDEDEVELLIBDIR,/usr/lib64) { + QMAKE_LIBDIR = $$KDEDEVELLIBDIR $$QMAKE_LIBDIR + } + !equals(KDELIBDIR,/usr/lib):!equals(KDELIBDIR,/usr/lib64) { + !darwin-* : !macx-* { + LIBS += -Wl,--rpath,"$$KDELIBDIR" + } + } +} CONFIG += qt gui warn_on dll debug |
