summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-11 22:35:28 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-11 22:35:28 +0000
commite11ae3d4907f0ce39b96ba6b29442be05f99b59c (patch)
tree4e042bc22c1808e39c08e49bc548d15f8e6bdab8
parent3d877ca28bcb7c70945ff408bd0273e176472969 (diff)
[FIX] UI widgets now load upon click
[FIX] Connections fixed now [ADD] Slots for errors and warnings made [ADD] Subclassed QTreeView for PokemodTree class [FIX] No more crashes on exit git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@124 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog11
-rw-r--r--general/Audio.h12
-rw-r--r--pokemod/Object.h4
-rw-r--r--pokemod/TODO8
-rw-r--r--pokemodr/AbilityUI.cpp4
-rw-r--r--pokemodr/AuthorUI.cpp4
-rw-r--r--pokemodr/BadgeUI.cpp4
-rw-r--r--pokemodr/CoinListObjectUI.cpp4
-rw-r--r--pokemodr/CoinListUI.cpp4
-rw-r--r--pokemodr/EggGroupUI.cpp4
-rw-r--r--pokemodr/ItemTypeUI.cpp4
-rw-r--r--pokemodr/ItemUI.cpp4
-rw-r--r--pokemodr/MapTrainerTeamMemberUI.cpp4
-rw-r--r--pokemodr/MapUI.cpp4
-rw-r--r--pokemodr/MapWarpUI.cpp4
-rw-r--r--pokemodr/MapWildListEncounterUI.cpp4
-rw-r--r--pokemodr/MapWildListUI.cpp4
-rw-r--r--pokemodr/MoveUI.cpp4
-rw-r--r--pokemodr/NatureUI.cpp4
-rw-r--r--pokemodr/ObjectUI.h10
-rw-r--r--pokemodr/PokeModr.cpp8
-rw-r--r--pokemodr/PokeModrUI.cpp31
-rw-r--r--pokemodr/PokeModrUI.h1
-rw-r--r--pokemodr/PokemodTree.cpp36
-rw-r--r--pokemodr/PokemodTree.h34
-rw-r--r--pokemodr/PokemodTreeModel.cpp7
-rw-r--r--pokemodr/PokemodUI.cpp4
-rw-r--r--pokemodr/RulesUI.cpp4
-rw-r--r--pokemodr/SpeciesAbilityUI.cpp4
-rw-r--r--pokemodr/SpeciesEvolutionUI.cpp4
-rw-r--r--pokemodr/SpeciesItemUI.cpp4
-rw-r--r--pokemodr/SpeciesMoveUI.cpp4
-rw-r--r--pokemodr/SpeciesUI.cpp4
-rw-r--r--pokemodr/StoreUI.cpp4
-rw-r--r--pokemodr/TileUI.cpp4
-rw-r--r--pokemodr/TimeUI.cpp4
-rw-r--r--pokemodr/TrainerUI.cpp4
-rw-r--r--pokemodr/TypeUI.cpp4
-rw-r--r--pokemodr/gui/pokemodr.ui7
-rw-r--r--pokemodr/pokemodr.pro8
40 files changed, 184 insertions, 101 deletions
diff --git a/Changelog b/Changelog
index f3b160a6..522918ec 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,15 @@
-----------------
+Rev: 124
+Date: 11 May 2008
+User: MathStuf
+-----------------
+[FIX] UI widgets now load upon click
+[FIX] Connections fixed now
+[ADD] Slots for errors and warnings made
+[ADD] Subclassed QTreeView for PokemodTree class
+[FIX] No more crashes on exit
+
+-----------------
Rev: 123
Date: 9 May 2008
User: MathStuf
diff --git a/general/Audio.h b/general/Audio.h
index 5f6b2fe7..4d4d78cc 100644
--- a/general/Audio.h
+++ b/general/Audio.h
@@ -57,18 +57,18 @@ class Audio : public QObject
{
m_output.setVolume(volume);
}
- private:
- inline void start()
- {
- if (!m_started)
- connect(&m_music, SIGNAL(aboutToFinish()), this, SLOT(loopMusic()));
- }
private slots:
inline void loopMusic()
{
m_music.enqueue(m_musicUrl);
}
private:
+ inline void start()
+ {
+ if (!m_started)
+ connect(&m_music, SIGNAL(aboutToFinish()), this, SLOT(loopMusic()));
+ }
+
QList<Phonon::MediaObject*> m_curPlay;
Phonon::MediaObject m_music;
QString m_musicUrl;
diff --git a/pokemod/Object.h b/pokemod/Object.h
index 333851e5..472bdd0b 100644
--- a/pokemod/Object.h
+++ b/pokemod/Object.h
@@ -44,9 +44,9 @@ class Object : public QObject
QString className() const;
signals:
void warning(const QString& message) const;
- void error(const QString& message);
+ void error(const QString& message) const;
- void changed();
+ void changed() const;
public slots:
virtual void validate() = 0;
diff --git a/pokemod/TODO b/pokemod/TODO
index 256c2693..16a54917 100644
--- a/pokemod/TODO
+++ b/pokemod/TODO
@@ -2,17 +2,11 @@ MoveEffects (GSC+)
Figure out what makes 2 PokéMods incompatable
-Validation crap
-
-General cleanup
-
Trainer AI stuff
-Emit changed signals
-
Test library
* Rules
- - Disallow switch style
+ - (Dis)allow switch style option
* Type
- Immune to weather
diff --git a/pokemodr/AbilityUI.cpp b/pokemodr/AbilityUI.cpp
index bb1f21c4..79a88362 100644
--- a/pokemodr/AbilityUI.cpp
+++ b/pokemodr/AbilityUI.cpp
@@ -28,10 +28,10 @@ AbilityUI::AbilityUI(Ability* ability, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(ability, new Ability(*ability));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(const QString&)), this, SLOT(errorMessage(const QString&)));
connect(modified(), SIGNAL(warning(const QString&)), this, SLOT(warningMessage(const QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/AuthorUI.cpp b/pokemodr/AuthorUI.cpp
index 2f2caf09..d61a57b4 100644
--- a/pokemodr/AuthorUI.cpp
+++ b/pokemodr/AuthorUI.cpp
@@ -28,10 +28,10 @@ AuthorUI::AuthorUI(Author* author, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(author, new Author(*author));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(const QString&)), this, SLOT(errorMessage(const QString&)));
connect(modified(), SIGNAL(warning(const QString&)), this, SLOT(warningMessage(const QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/BadgeUI.cpp b/pokemodr/BadgeUI.cpp
index 1643680e..60b47654 100644
--- a/pokemodr/BadgeUI.cpp
+++ b/pokemodr/BadgeUI.cpp
@@ -32,10 +32,10 @@ BadgeUI::BadgeUI(Badge* badge, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(badge, new Badge(*badge));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/CoinListObjectUI.cpp b/pokemodr/CoinListObjectUI.cpp
index af166d9d..283a55c9 100644
--- a/pokemodr/CoinListObjectUI.cpp
+++ b/pokemodr/CoinListObjectUI.cpp
@@ -33,10 +33,10 @@ CoinListObjectUI::CoinListObjectUI(CoinListObject* object, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(object, new CoinListObject(*object));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/CoinListUI.cpp b/pokemodr/CoinListUI.cpp
index b46bf4a0..17e49b89 100644
--- a/pokemodr/CoinListUI.cpp
+++ b/pokemodr/CoinListUI.cpp
@@ -31,10 +31,10 @@ CoinListUI::CoinListUI(CoinList* coinList, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(coinList, new CoinList(*coinList));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/EggGroupUI.cpp b/pokemodr/EggGroupUI.cpp
index f13807b0..2a948935 100644
--- a/pokemodr/EggGroupUI.cpp
+++ b/pokemodr/EggGroupUI.cpp
@@ -28,10 +28,10 @@ EggGroupUI::EggGroupUI(EggGroup* eggGroup, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(eggGroup, new EggGroup(*eggGroup));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/ItemTypeUI.cpp b/pokemodr/ItemTypeUI.cpp
index dbad0441..a49c8835 100644
--- a/pokemodr/ItemTypeUI.cpp
+++ b/pokemodr/ItemTypeUI.cpp
@@ -28,10 +28,10 @@ ItemTypeUI::ItemTypeUI(ItemType* itemType, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(itemType, new ItemType(*itemType));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/ItemUI.cpp b/pokemodr/ItemUI.cpp
index 5dbeb8ff..9a8d2fdd 100644
--- a/pokemodr/ItemUI.cpp
+++ b/pokemodr/ItemUI.cpp
@@ -30,10 +30,10 @@ ItemUI::ItemUI(Item* item, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(item, new Item(*item));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapTrainerTeamMemberUI.cpp b/pokemodr/MapTrainerTeamMemberUI.cpp
index e239cd0c..c3cef705 100644
--- a/pokemodr/MapTrainerTeamMemberUI.cpp
+++ b/pokemodr/MapTrainerTeamMemberUI.cpp
@@ -32,10 +32,10 @@ MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember,
QMetaObject::connectSlotsByName(this);
setObjects(teamMember, new MapTrainerTeamMember(*teamMember));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapUI.cpp b/pokemodr/MapUI.cpp
index 9364edfc..77ab875e 100644
--- a/pokemodr/MapUI.cpp
+++ b/pokemodr/MapUI.cpp
@@ -42,10 +42,10 @@ MapUI::MapUI(Map* map, QWidget* parent) :
setObjects(map, new Map(*map));
m_model = new TilemapModel(this, static_cast<Map*>(modified())->map(), static_cast<const Pokemod*>(static_cast<Map*>(original())->pokemod()));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp
index cafdcfba..c56393bb 100644
--- a/pokemodr/MapWarpUI.cpp
+++ b/pokemodr/MapWarpUI.cpp
@@ -32,10 +32,10 @@ MapWarpUI::MapWarpUI(MapWarp* warp, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(warp, new MapWarp(*warp));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapWildListEncounterUI.cpp b/pokemodr/MapWildListEncounterUI.cpp
index 5fd582ed..70d74b7a 100644
--- a/pokemodr/MapWildListEncounterUI.cpp
+++ b/pokemodr/MapWildListEncounterUI.cpp
@@ -30,10 +30,10 @@ MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* encounter,
QMetaObject::connectSlotsByName(this);
setObjects(encounter, new MapWildListEncounter(*encounter));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp
index 3530495e..fd9e2453 100644
--- a/pokemodr/MapWildListUI.cpp
+++ b/pokemodr/MapWildListUI.cpp
@@ -32,10 +32,10 @@ MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(wildList, new MapWildList(*wildList));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp
index 33454ebd..78182684 100644
--- a/pokemodr/MoveUI.cpp
+++ b/pokemodr/MoveUI.cpp
@@ -30,10 +30,10 @@ MoveUI::MoveUI(Move* move, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(move, new Move(*move));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp
index 7a2a43e4..4915dc79 100644
--- a/pokemodr/NatureUI.cpp
+++ b/pokemodr/NatureUI.cpp
@@ -29,10 +29,10 @@ NatureUI::NatureUI(Nature* nature, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(nature, new Nature(*nature));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/ObjectUI.h b/pokemodr/ObjectUI.h
index 82c715fc..a85a5448 100644
--- a/pokemodr/ObjectUI.h
+++ b/pokemodr/ObjectUI.h
@@ -99,10 +99,18 @@ class ObjectUI : public QWidget
signals:
void changed(bool);
public slots:
- void setChanged(const bool changed)
+ void setChanged(const bool changed = true)
{
m_changed = changed;
}
+ void errorMessage(const QString& message)
+ {
+ KMessageBox::error(this, message, "Error");
+ }
+ void warningMessage(const QString& message)
+ {
+ KMessageBox::warningContinueCancel(this, message, "Warning");
+ }
virtual void on_buttonApply_clicked() = 0;
virtual void on_buttonDiscard_clicked() = 0;
protected slots:
diff --git a/pokemodr/PokeModr.cpp b/pokemodr/PokeModr.cpp
index 220f717c..35df3157 100644
--- a/pokemodr/PokeModr.cpp
+++ b/pokemodr/PokeModr.cpp
@@ -43,12 +43,12 @@ int main(int argc, char* argv[])
about.addCredit(ki18n("Kevin Kofler"), ki18n("Qt, KDE, debugging help"), "kevin.kofler@chello.at", "http://www.tigen.org/kevin.kofler");
KCmdLineArgs::init(argc, argv, &about);
- KApplication app;
+ KApplication* app = new KApplication();
KConfig cfg("~/.kde/share/config/pokegenrc");
- PokeModrUI mainWindow(cfg.group("pokemodr"), cfg.group("pokemodr-recent"));
- mainWindow.show();
- app.exec();
+ PokeModrUI* mainWindow = new PokeModrUI(cfg.group("pokemodr"), cfg.group("pokemodr-recent"));
+ mainWindow->show();
+ app->exec();
return 0;
}
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index e09b4de6..72d145b9 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -19,6 +19,7 @@
#include "PokeModrUI.h"
// PokeModr includes
+#include "ObjectUI.h"
#include "PokemodTreeModel.h"
// Pokemod includes
@@ -26,7 +27,6 @@
// Qt includes
#include <QCloseEvent>
-#include <QMutableListIterator>
#include <QString>
// KDE includes
@@ -45,7 +45,7 @@
PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* parent) :
KMainWindow(parent),
m_config(config),
- m_recent(new KRecentFilesAction("&Recent Files...", NULL)),
+ m_recent(new KRecentFilesAction("&Recent Files...", this)),
m_clipboard(NULL)
{
setupUi(this);
@@ -122,7 +122,7 @@ PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* paren
PokeModrUI::~PokeModrUI()
{
- delete m_recent;
+// delete m_recent;
// on_actionQuit_triggered();
}
@@ -274,20 +274,17 @@ void PokeModrUI::on_splitter_splitterMoved()
void PokeModrUI::on_treePokemod_clicked(const QModelIndex& index)
{
// TODO: update the panel with the new widget needed
-// if (!static_cast<PokeModTreeItem*>(current)->getUi())
-// {
-// if (previous)
-// treePokemod->setCurrentItem(previous);
-// current->setSelected(false);
-// return;
-// }
-// if (formPanel->widget())
-// {
-// if (!static_cast<ObjectUI*>(formPanel->widget())->close())
-// return;
-// }
-// formPanel->setWidget(static_cast<PokeModTreeItem*>(current)->getUi());
-// formPanel->show();
+ QWidget* widget = treePokemod->editorWidget(index);
+ if (widget)
+ {
+ if (formPanel->widget())
+ {
+ if (!static_cast<ObjectUI*>(formPanel->widget())->close())
+ return;
+ }
+ formPanel->setWidget(widget);
+ formPanel->show();
+ }
}
void PokeModrUI::on_treePokemod_customContextMenuRequested(const QPoint& position)
diff --git a/pokemodr/PokeModrUI.h b/pokemodr/PokeModrUI.h
index 9b38a259..1b61cf9f 100644
--- a/pokemodr/PokeModrUI.h
+++ b/pokemodr/PokeModrUI.h
@@ -38,7 +38,6 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr
public:
PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* parent = 0);
~PokeModrUI();
-
public slots:
void openPokeMod(const KUrl& path);
void savePokeMod();
diff --git a/pokemodr/PokemodTree.cpp b/pokemodr/PokemodTree.cpp
new file mode 100644
index 00000000..e075af83
--- /dev/null
+++ b/pokemodr/PokemodTree.cpp
@@ -0,0 +1,36 @@
+/*
+ * 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 "PokemodTree.h"
+
+// Model includes
+#include "models/BaseModel.h"
+
+// Qt includes
+#include <QHeaderView>
+
+PokemodTree::PokemodTree(QWidget* parent) :
+ QTreeView(parent)
+{
+ header()->hide();
+}
+
+QWidget* PokemodTree::editorWidget(const QModelIndex& index)
+{
+ return model()->data(index, BaseModel::WidgetRole).value<QWidget*>();
+}
diff --git a/pokemodr/PokemodTree.h b/pokemodr/PokemodTree.h
new file mode 100644
index 00000000..45d37f11
--- /dev/null
+++ b/pokemodr/PokemodTree.h
@@ -0,0 +1,34 @@
+/*
+ * 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_POKEMODTREE__
+#define __POKEMODR_POKEMODTREE__
+
+// Qt includes
+#include <QTreeView>
+
+class PokemodTree : public QTreeView
+{
+ Q_OBJECT
+
+ public:
+ PokemodTree(QWidget* parent = 0);
+
+ QWidget* editorWidget(const QModelIndex& index);
+};
+
+#endif
diff --git a/pokemodr/PokemodTreeModel.cpp b/pokemodr/PokemodTreeModel.cpp
index 03532c40..e41ec0d8 100644
--- a/pokemodr/PokemodTreeModel.cpp
+++ b/pokemodr/PokemodTreeModel.cpp
@@ -53,12 +53,9 @@ QVariant PokemodTreeModel::headerData(int /*section*/, Qt::Orientation /*orienta
QModelIndex PokemodTreeModel::index(int row, int /*column*/, const QModelIndex& parent) const
{
if (row < 0)
- return createIndex(-1, 0, m_root);
+ return createIndex(row, 0, m_root);
BaseModel* object = getItem(parent)->childItem(row);
- if (object)
- return createIndex(row, 0, object);
- else
- return QModelIndex();
+ return createIndex(row, 0, object);
}
QModelIndex PokemodTreeModel::parent(const QModelIndex& index) const
diff --git a/pokemodr/PokemodUI.cpp b/pokemodr/PokemodUI.cpp
index 788df1b4..76059e5b 100644
--- a/pokemodr/PokemodUI.cpp
+++ b/pokemodr/PokemodUI.cpp
@@ -36,10 +36,10 @@ PokemodUI::PokemodUI(Pokemod* pokemod, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(pokemod, new Pokemod(*pokemod));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/RulesUI.cpp b/pokemodr/RulesUI.cpp
index bb366b59..7c3a0080 100644
--- a/pokemodr/RulesUI.cpp
+++ b/pokemodr/RulesUI.cpp
@@ -28,10 +28,10 @@ RulesUI::RulesUI(Rules* rules, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(rules, new Rules(*rules));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesAbilityUI.cpp b/pokemodr/SpeciesAbilityUI.cpp
index c55c6587..3fc43533 100644
--- a/pokemodr/SpeciesAbilityUI.cpp
+++ b/pokemodr/SpeciesAbilityUI.cpp
@@ -30,10 +30,10 @@ SpeciesAbilityUI::SpeciesAbilityUI(SpeciesAbility* ability, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(ability, new SpeciesAbility(*ability));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp
index 85873df2..26a32d03 100644
--- a/pokemodr/SpeciesEvolutionUI.cpp
+++ b/pokemodr/SpeciesEvolutionUI.cpp
@@ -33,10 +33,10 @@ SpeciesEvolutionUI::SpeciesEvolutionUI(SpeciesEvolution* evolution, QWidget* par
QMetaObject::connectSlotsByName(this);
setObjects(evolution, new SpeciesEvolution(*evolution));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesItemUI.cpp b/pokemodr/SpeciesItemUI.cpp
index 29d10057..b4b0407d 100644
--- a/pokemodr/SpeciesItemUI.cpp
+++ b/pokemodr/SpeciesItemUI.cpp
@@ -30,10 +30,10 @@ SpeciesItemUI::SpeciesItemUI(SpeciesItem* item, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(item, new SpeciesItem(*item));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesMoveUI.cpp b/pokemodr/SpeciesMoveUI.cpp
index 228b4f91..d9fa8a29 100644
--- a/pokemodr/SpeciesMoveUI.cpp
+++ b/pokemodr/SpeciesMoveUI.cpp
@@ -30,10 +30,10 @@ SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* move, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(move, new SpeciesMove(*move));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp
index ea5d4b08..5b233573 100644
--- a/pokemodr/SpeciesUI.cpp
+++ b/pokemodr/SpeciesUI.cpp
@@ -34,10 +34,10 @@ SpeciesUI::SpeciesUI(Species* species, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(species, new Species(*species));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/StoreUI.cpp b/pokemodr/StoreUI.cpp
index 72128247..7c1ff177 100644
--- a/pokemodr/StoreUI.cpp
+++ b/pokemodr/StoreUI.cpp
@@ -30,10 +30,10 @@ StoreUI::StoreUI(Store* store, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(store, new Store(*store));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TileUI.cpp b/pokemodr/TileUI.cpp
index b0ac2a1a..d391193e 100644
--- a/pokemodr/TileUI.cpp
+++ b/pokemodr/TileUI.cpp
@@ -32,10 +32,10 @@ TileUI::TileUI(Tile* tile, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(tile, new Tile(*tile));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TimeUI.cpp b/pokemodr/TimeUI.cpp
index 7b7874e8..b4ae1fdd 100644
--- a/pokemodr/TimeUI.cpp
+++ b/pokemodr/TimeUI.cpp
@@ -28,10 +28,10 @@ TimeUI::TimeUI(Time* time, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(time, new Time(*time));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TrainerUI.cpp b/pokemodr/TrainerUI.cpp
index d105369f..fdd86a48 100644
--- a/pokemodr/TrainerUI.cpp
+++ b/pokemodr/TrainerUI.cpp
@@ -31,10 +31,10 @@ TrainerUI::TrainerUI(Trainer * trainer, QWidget * parent) :
QMetaObject::connectSlotsByName(this);
setObjects(trainer, new Trainer(*trainer));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/TypeUI.cpp b/pokemodr/TypeUI.cpp
index e638bfcc..d10a3af8 100644
--- a/pokemodr/TypeUI.cpp
+++ b/pokemodr/TypeUI.cpp
@@ -28,10 +28,10 @@ TypeUI::TypeUI(Type* type, QWidget* parent) :
QMetaObject::connectSlotsByName(this);
setObjects(type, new Type(*type));
connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
- connect(modified(), SIGNAL(error()), this, SLOT(setGui()));
+ connect(modified(), SIGNAL(error(const QString&)), this, SLOT(setGui()));
connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&)));
connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&)));
- connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true)));
+ connect(modified(), SIGNAL(changed()), this, SLOT(setChanged()));
init();
}
diff --git a/pokemodr/gui/pokemodr.ui b/pokemodr/gui/pokemodr.ui
index 5e9a8373..e48d4637 100644
--- a/pokemodr/gui/pokemodr.ui
+++ b/pokemodr/gui/pokemodr.ui
@@ -22,7 +22,7 @@
<property name="childrenCollapsible" >
<bool>false</bool>
</property>
- <widget class="QTreeView" name="treePokemod" >
+ <widget class="PokemodTree" name="treePokemod" >
<property name="acceptDrops" >
<bool>true</bool>
</property>
@@ -160,6 +160,11 @@
<header>kmainwindow.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>PokemodTree</class>
+ <extends>QTreeView</extends>
+ <header>../PokemodTree.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro
index fb388fc8..4baadeeb 100644
--- a/pokemodr/pokemodr.pro
+++ b/pokemodr/pokemodr.pro
@@ -16,7 +16,7 @@ CONFIG += qt \
!win32 : CONFIG += debug
QT += xml
-; RESOURCES += images/overlays.qrc
+RESOURCES += images/overlays.qrc
win32 {
TARGETDEPS += $${DESTDIR}/pokemod.dll $${DESTDIR}/general.dll
@@ -82,6 +82,7 @@ SOURCES += AbilityUI.cpp \
MoveUI.cpp \
NatureUI.cpp \
PointWidget.cpp \
+ PokemodTree.cpp \
PokemodTreeModel.cpp \
PokemodUI.cpp \
PokeModr.cpp \
@@ -154,6 +155,7 @@ HEADERS += AbilityUI.h \
NatureUI.h \
ObjectUI.h \
PointWidget.h \
+ PokemodTree.h \
PokemodTreeModel.h \
PokemodUI.h \
PokeModr.h \
@@ -254,10 +256,10 @@ FORMS += gui/ability.ui \
; images/overlays/wilds.png
INSTALLS += target
-isEmpty(PREFIX) {
+isEmpty(PREFIX){
PREFIX = $$(PREFIX)
}
-isEmpty(PREFIX) {
+isEmpty(PREFIX){
PREFIX = /usr
}
target.path = $$PREFIX/bin