summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-15 03:12:36 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-15 03:12:36 +0000
commit3e72425d8566687631cb7b7fc1b299efd8a4877e (patch)
tree6bbd08723dd89d021ccebd07f4e96fbde1f44646
parente445583ac47ef5416565c91142eec38a09f731cc (diff)
downloadsigen-3e72425d8566687631cb7b7fc1b299efd8a4877e.tar.gz
sigen-3e72425d8566687631cb7b7fc1b299efd8a4877e.tar.xz
sigen-3e72425d8566687631cb7b7fc1b299efd8a4877e.zip
[FIX] Added the MapTrainer code (forgot to commit)
[FIX] Signal and slots in the main window class git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@131 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r--Changelog15
-rw-r--r--pokemodr/MapTrainerUI.cpp169
-rw-r--r--pokemodr/MapTrainerUI.h57
-rw-r--r--pokemodr/MapWarpUI.cpp2
-rw-r--r--pokemodr/PokeModr.cpp2
-rw-r--r--pokemodr/PokeModrUI.cpp158
-rw-r--r--pokemodr/PokeModrUI.h24
-rw-r--r--pokemodr/gui/pokemodr.ui102
8 files changed, 331 insertions, 198 deletions
diff --git a/Changelog b/Changelog
index d44ec563..23ae8400 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,19 @@
-----------------
+Rev: 131
+Date: 14 May 2008
+User: MathStuf
+-----------------
+[FIX] Added the MapTrainer code (forgot to commit)
+[FIX] Signal and slots in the main window class
+
+-----------------
+Rev: 130
+Date: 14 May 2008
+User: MathStuf
+-----------------
+[FIX] Fixed up some of the spec file stuff
+
+-----------------
Rev: 129
Date: 14 May 2008
User: MathStuf
diff --git a/pokemodr/MapTrainerUI.cpp b/pokemodr/MapTrainerUI.cpp
new file mode 100644
index 00000000..8ad8a32c
--- /dev/null
+++ b/pokemodr/MapTrainerUI.cpp
@@ -0,0 +1,169 @@
+/*
+ * 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 "MapTrainerUI.h"
+
+// Pokemod includes
+#include "../pokemod/Dialog.h"
+#include "../pokemod/Map.h"
+#include "../pokemod/MapTrainer.h"
+#include "../pokemod/MapTrainerTeamMember.h"
+#include "../pokemod/Pokemod.h"
+#include "../pokemod/Species.h"
+#include "../pokemod/Trainer.h"
+
+MapTrainerUI::MapTrainerUI(MapTrainer* trainer, QWidget* parent) :
+ ObjectUI(parent)
+{
+ setupUi(this);
+ QMetaObject::connectSlotsByName(this);
+ setObjects(trainer, new MapTrainer(*trainer));
+ connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool)));
+ 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, SLOT(setChanged()));
+ init();
+}
+
+MapTrainerUI::~MapTrainerUI()
+{
+}
+
+void MapTrainerUI::initGui()
+{
+ varDirection->addItems(Pokemod::DirectionStr.mid(0, Pokemod::D_End));
+}
+
+void MapTrainerUI::refreshGui()
+{
+ varTrainerClass->clear();
+ for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->trainerCount(); ++i)
+ {
+ const Trainer* trainer = static_cast<const Pokemod*>(original()->pokemod())->trainer(i);
+ varTrainerClass->addItem(trainer->name());
+ varTrainerClass->setItemData(i, trainer->id());
+ }
+ varCoordinate->setMaximum(static_cast<const Map*>(original()->parent())->size());
+ varNumberFight->setMaximum(static_cast<const Pokemod*>(original()->pokemod())->rules()->maxFight());
+ 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));
+ varDialog->setItemData(i, dialog->id());
+ }
+ varLeadTeamMember->clear();
+ for (int i = 0; i < static_cast<MapTrainer*>(original())->teamMemberCount(); ++i)
+ {
+ const MapTrainerTeamMember* teamMember = static_cast<MapTrainer*>(original())->teamMember(i);
+ const Species* species = static_cast<const Pokemod*>(original()->pokemod())->species(teamMember->species());
+ if (species)
+ varLeadTeamMember->addItem(species->name());
+ else
+ varLeadTeamMember->addItem("Invalid Species");
+ varLeadTeamMember->setItemData(i, teamMember->id());
+ }
+}
+
+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());
+ boxFlag->setChecked((static_cast<MapTrainer*>(modified())->flag().status() == Flag::Ignore) ? Qt::Unchecked : Qt::Checked);
+ if (boxFlag->isChecked())
+ {
+ varFlag->setValue(static_cast<MapTrainer*>(modified())->flag().flag());
+ varState->setCheckState((static_cast<MapTrainer*>(modified())->flag().status() == Flag::On) ? Qt::Checked : Qt::Unchecked);
+ }
+ varDialog->setCurrentIndex(varDialog->findData(static_cast<MapTrainer*>(modified())->dialog()));
+ varLeadTeamMember->setCurrentIndex(varLeadTeamMember->findData(static_cast<MapTrainer*>(modified())->leadTeamMember()));
+}
+
+void MapTrainerUI::on_buttonApply_clicked()
+{
+ *static_cast<MapTrainer*>(original()) = *static_cast<MapTrainer*>(modified());
+ emit(changed(false));
+}
+
+void MapTrainerUI::on_buttonDiscard_clicked()
+{
+ *static_cast<MapTrainer*>(modified()) = *static_cast<MapTrainer*>(original());
+ setGui();
+ emit(changed(false));
+}
+
+void MapTrainerUI::on_varName_textChanged(const QString& name)
+{
+ static_cast<MapTrainer*>(modified())->setName(name);
+}
+
+void MapTrainerUI::on_varTrainerClass_currentIndexChanged(const int trainerClass)
+{
+ static_cast<MapTrainer*>(modified())->setTrainerClass(varTrainerClass->itemData(trainerClass).toInt());
+}
+
+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_currentIndexChanged(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_boxFlag_toggled(const bool flagUsed)
+{
+ if (!flagUsed)
+ static_cast<MapTrainer*>(modified())->setFlag(Flag(varFlag->value(), Flag::Ignore));
+}
+
+void MapTrainerUI::on_varFlag_valueChanged(const int flag)
+{
+ static_cast<MapTrainer*>(modified())->setFlag(Flag(flag, boxFlag->isChecked() ? Flag::Ignore : (varState->isChecked() ? Flag::On : Flag::Off)));
+}
+
+void MapTrainerUI::on_varState_toggled(const bool status)
+{
+ static_cast<MapTrainer*>(modified())->setFlag(Flag(varFlag->value(), status ? Flag::On : Flag::Off));
+}
+
+void MapTrainerUI::on_varDialog_currentIndexChanged(const int dialog)
+{
+ static_cast<MapTrainer*>(modified())->setDialog(varDialog->itemData(dialog).toInt());
+}
+
+void MapTrainerUI::on_varLeadTeamMember_currentIndexChanged(const int leadTeamMember)
+{
+ static_cast<MapTrainer*>(modified())->setLeadTeamMember(leadTeamMember);
+}
diff --git a/pokemodr/MapTrainerUI.h b/pokemodr/MapTrainerUI.h
new file mode 100644
index 00000000..89df3e5d
--- /dev/null
+++ b/pokemodr/MapTrainerUI.h
@@ -0,0 +1,57 @@
+/*
+ * 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_MAPTRAINERUI__
+#define __POKEMODR_MAPTRAINERUI__
+
+// PokeModr includes
+#include "ObjectUI.h"
+
+// Form include
+#include "ui_maptrainer.h"
+
+// Forward declarations
+class MapTrainer;
+
+class MapTrainerUI : public ObjectUI, private Ui::formMapTrainer
+{
+ Q_OBJECT
+
+ public:
+ MapTrainerUI(MapTrainer* trainer, QWidget* parent);
+ ~MapTrainerUI();
+ public slots:
+ void on_buttonApply_clicked();
+ void on_buttonDiscard_clicked();
+ void on_varName_textChanged(const QString& name);
+ void on_varTrainerClass_currentIndexChanged(const int trainerClass);
+ void on_varCoordinate_valueChanged(const Point& coordinate);
+ void on_varSight_valueChanged(const int sight);
+ void on_varDirection_currentIndexChanged(const int direction);
+ void on_varNumberFight_valueChanged(const int numberFight);
+ void on_boxFlag_toggled(const bool flagUsed);
+ void on_varFlag_valueChanged(const int flag);
+ void on_varState_toggled(const bool state);
+ void on_varDialog_currentIndexChanged(const int dialog);
+ void on_varLeadTeamMember_currentIndexChanged(const int leadTeamMember);
+ private slots:
+ void initGui();
+ void refreshGui();
+ void setGui();
+};
+
+#endif
diff --git a/pokemodr/MapWarpUI.cpp b/pokemodr/MapWarpUI.cpp
index b95f1a4f..a0f498c7 100644
--- a/pokemodr/MapWarpUI.cpp
+++ b/pokemodr/MapWarpUI.cpp
@@ -192,5 +192,5 @@ void MapWarpUI::on_varState_toggled(const bool status)
void MapWarpUI::on_varDialog_currentIndexChanged(const int dialog)
{
- static_cast<MapWarp*>(modified())->setDialog(dialog);
+ static_cast<MapWarp*>(modified())->setDialog(varDialog->itemData(dialog).toInt());
}
diff --git a/pokemodr/PokeModr.cpp b/pokemodr/PokeModr.cpp
index 5d17be27..678c8293 100644
--- a/pokemodr/PokeModr.cpp
+++ b/pokemodr/PokeModr.cpp
@@ -49,6 +49,6 @@ int main(int argc, char* argv[])
PokeModrUI* mainWindow = new PokeModrUI(cfg.group("pokemodr"), cfg.group("pokemodr-recent"));
mainWindow->show();
- app->exec() == QDialog::Accepted;
+ app->exec();
return 0;
}
diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp
index ad9dd884..6a9ea1b1 100644
--- a/pokemodr/PokeModrUI.cpp
+++ b/pokemodr/PokeModrUI.cpp
@@ -54,14 +54,14 @@ PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* paren
m_recent->loadEntries(history);
KMenuBar* menubar = new KMenuBar(this);
KMenu* menuFile = new KMenu("&File", menubar);
- menuFile->addAction(KStandardAction::openNew(this, SLOT(on_actionNew_triggered()), menuFile));
- menuFile->addAction(KStandardAction::open(this, SLOT(on_actionOpen_triggered()), menuFile));
- menuFile->addAction(KStandardAction::openRecent(this, SLOT(openPokeMod(const KUrl&)), menuFile));
+ menuFile->addAction(KStandardAction::openNew(this, SLOT(newPokemod()), menuFile));
+ menuFile->addAction(KStandardAction::open(this, SLOT(openPokemod()), menuFile));
+ menuFile->addAction(KStandardAction::openRecent(this, SLOT(openPokemod(const KUrl&)), menuFile));
menuFile->addSeparator();
- menuFile->addAction(KStandardAction::save(this, SLOT(on_actionSave_triggered()), menuFile));
- menuFile->addAction(KStandardAction::saveAs(this, SLOT(on_actionSaveAs_triggered()), menuFile));
+ menuFile->addAction(KStandardAction::save(this, SLOT(savePokemod()), menuFile));
+ menuFile->addAction(KStandardAction::saveAs(this, SLOT(saveAsPokemod()), menuFile));
menuFile->addSeparator();
- menuFile->addAction(KStandardAction::quit(this, SLOT(on_actionQuit_triggered()), menuFile));
+ menuFile->addAction(KStandardAction::quit(this, SLOT(quit()), menuFile));
menubar->addMenu(menuFile);
KMenu* menuEdit = new KMenu("&Edit", menubar);
menuEdit->addAction(KStandardAction::cut(menuEdit));
@@ -71,27 +71,27 @@ PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* paren
KAction* menuCut = new KAction(KIcon("edit-cut"), "Cu&t Object", menuEdit);
menuCut->setShortcut(KShortcut("Alt+X"));
menuEdit->addAction(menuCut);
- connect(menuCut, SIGNAL(triggered()), this, SLOT(on_actionCut_triggered()));
+ connect(menuCut, SIGNAL(triggered()), this, SLOT(cutObject()));
KAction* menuCopy = new KAction(KIcon("edit-copy"), "Cop&y Object", menuEdit);
menuCopy->setShortcut(KShortcut("Alt+C"));
menuEdit->addAction(menuCopy);
- connect(menuCopy, SIGNAL(triggered()), this, SLOT(on_actionCopy_triggered()));
+ connect(menuCopy, SIGNAL(triggered()), this, SLOT(copyObject()));
KAction* menuPaste = new KAction(KIcon("edit-paste"), "Past&e Object", menuEdit);
menuPaste->setShortcut(KShortcut("Alt+V"));
menuEdit->addAction(menuPaste);
- connect(menuPaste, SIGNAL(triggered()), this, SLOT(on_actionPaste_triggered()));
+ connect(menuPaste, SIGNAL(triggered()), this, SLOT(pasteObject()));
menuEdit->addSeparator();
- menuEdit->addAction(KStandardAction::preferences(this, SLOT(on_actionPreferences_triggered()), menuEdit));
+ menuEdit->addAction(KStandardAction::preferences(this, SLOT(preferences()), menuEdit));
menubar->addMenu(menuEdit);
menubar->addMenu(customHelpMenu(false));
setMenuBar(menubar);
KToolBar* toolbar = new KToolBar("toolbar", this, Qt::TopToolBarArea, false, true, true);
- toolbar->addAction(KStandardAction::openNew(this, SLOT(on_actionNew_triggered()), toolbar));
- toolbar->addAction(KStandardAction::open(this, SLOT(on_actionOpen_triggered()), toolbar));
- toolbar->addAction(KStandardAction::openRecent(this, SLOT(openPokeMod(const KUrl&)), toolbar));
+ toolbar->addAction(KStandardAction::openNew(this, SLOT(newPokemod()), toolbar));
+ toolbar->addAction(KStandardAction::open(this, SLOT(openPokemod()), toolbar));
+ toolbar->addAction(KStandardAction::openRecent(this, SLOT(openPokemod(const KUrl&)), toolbar));
toolbar->addSeparator();
- toolbar->addAction(KStandardAction::save(this, SLOT(on_actionSave_triggered()), toolbar));
- toolbar->addAction(KStandardAction::saveAs(this, SLOT(on_actionSaveAs_triggered()), toolbar));
+ toolbar->addAction(KStandardAction::save(this, SLOT(savePokemod()), toolbar));
+ toolbar->addAction(KStandardAction::saveAs(this, SLOT(saveAsPokemod()), toolbar));
toolbar->addSeparator();
toolbar->addAction(KStandardAction::cut(toolbar));
toolbar->addAction(KStandardAction::copy(toolbar));
@@ -99,17 +99,17 @@ PokeModrUI::PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* paren
toolbar->addSeparator();
KAction* toolbarCut = new KAction(KIcon("edit-cut"), "Cu&t Object", toolbar);
toolbar->addAction(toolbarCut);
- connect(toolbarCut, SIGNAL(triggered()), this, SLOT(on_actionCut_triggered()));
+ connect(toolbarCut, SIGNAL(triggered()), this, SLOT(cutObject()));
KAction* toolbarCopy = new KAction(KIcon("edit-copy"), "Cop&y Object", toolbar);
toolbar->addAction(toolbarCopy);
- connect(toolbarCopy, SIGNAL(triggered()), this, SLOT(on_actionCopy_triggered()));
+ connect(toolbarCopy, SIGNAL(triggered()), this, SLOT(copyObject()));
KAction* toolbarPaste = new KAction(KIcon("edit-paste"), "Past&e Object", toolbar);
toolbar->addAction(toolbarPaste);
- connect(toolbarPaste, SIGNAL(triggered()), this, SLOT(on_actionPaste_triggered()));
+ connect(toolbarPaste, SIGNAL(triggered()), this, SLOT(pasteObject()));
toolbar->addSeparator();
- toolbar->addAction(KStandardAction::preferences(this, SLOT(on_actionPreferences_triggered()), toolbar));
+ toolbar->addAction(KStandardAction::preferences(this, SLOT(preferences()), toolbar));
toolbar->addSeparator();
- toolbar->addAction(KStandardAction::quit(this, SLOT(on_actionQuit_triggered()), toolbar));
+ toolbar->addAction(KStandardAction::quit(this, SLOT(quit()), toolbar));
addToolBar(toolbar);
splitter->setSizes(QList<int>() << config.readEntry("treeWidth", 100) << config.readEntry("panelWidth", 100));
// if (config.readEntry("reloadOnStart", false))
@@ -127,7 +127,37 @@ PokeModrUI::~PokeModrUI()
// on_actionQuit_triggered();
}
-void PokeModrUI::openPokeMod(const KUrl& path)
+void PokeModrUI::closeEvent(QCloseEvent* event)
+{
+ quit();
+ event->accept();
+}
+
+void PokeModrUI::setChangedTitle(const bool changed)
+{
+ // TODO: set the title
+// if (formPanel->widget())
+// setWindowTitle(QString::fromUtf8("%1%2 - PokéModr").arg(static_cast<ObjectUI*>(formPanel->widget())->original()->pokemod()->title()).arg(c ? "*" : ""));
+// else
+// setWindowTitle(QString::fromUtf8("PokéModr"));
+}
+
+void PokeModrUI::newPokemod()
+{
+ // TODO: add a blank pokemod to the tree
+}
+
+void PokeModrUI::openPokemod()
+{
+ QFile file(KFileDialog::getOpenFileName(KUrl("kfiledialog:///pokemod"), QString::fromUtf8("*.pmod|PokéMods"), this));
+ if (file.open(QIODevice::ReadOnly))
+ {
+ // TODO: open the file into the tree
+ file.close();
+ }
+}
+
+void PokeModrUI::openPokemod(const KUrl& path)
{
if (path.isLocalFile())
{
@@ -137,11 +167,26 @@ void PokeModrUI::openPokeMod(const KUrl& path)
}
}
-void PokeModrUI::savePokeMod()
+void PokeModrUI::savePokemod()
{
- // TODO: save pokemod
-// if (formPanel->widget())
-// static_cast<ObjectUI*>(formPanel->widget())->original()->pokemod()->save();
+ // TODO: Save the current pokemod with the object open
+// if (!treePokemod->currentItem())
+// return;
+// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save();
+// static_cast<Pokemod*>(static_cast<PokeModTreeItem*>(treePokemod->currentItem())->object())->pokemod()->save();
+}
+
+void PokeModrUI::saveAsPokemod()
+{
+ // TODO: Save the current pokemod to a new file
+// if (!treePokemod->currentItem())
+// return;
+// QString dir = KFileDialog::existingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod"));
+// if (dir != "")
+// {
+// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save();
+// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->pokemod()->setPath(dir);
+// }
}
void PokeModrUI::closePokeMod()
@@ -174,59 +219,9 @@ void PokeModrUI::closePokeMod()
// }
}
-void PokeModrUI::closeEvent(QCloseEvent* event)
-{
- on_actionQuit_triggered();
- event->accept();
-}
-
-void PokeModrUI::setChangedTitle(const bool c)
-{
- // TODO: set the title
-// if (formPanel->widget())
-// setWindowTitle(QString::fromUtf8("%1%2 - PokéModr").arg(static_cast<ObjectUI*>(formPanel->widget())->original()->pokemod()->title()).arg(c ? "*" : ""));
-// else
-// setWindowTitle(QString::fromUtf8("PokéModr"));
-}
-
-void PokeModrUI::on_actionNew_triggered()
-{
-// QString dir = KFileDialog::existingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("New PokéMod"));
-// if (dir != "")
-// openPokeMod(KUrl(dir));
-}
-
-void PokeModrUI::on_actionOpen_triggered()
-{
-// QString dir = KFileDialog::existingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod"));
-// if (dir != "")
-// openPokeMod(KUrl(dir));
-}
-
-void PokeModrUI::on_actionSave_triggered()
-{
- // TODO: Save the current pokemod with the object open
-// if (!treePokemod->currentItem())
-// return;
-// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save();
-// static_cast<Pokemod*>(static_cast<PokeModTreeItem*>(treePokemod->currentItem())->object())->pokemod()->save();
-}
-
-void PokeModrUI::on_actionSaveAs_triggered()
-{
- // TODO: Save the current pokemod to a new file
-// if (!treePokemod->currentItem())
-// return;
-// QString dir = KFileDialog::existingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod"));
-// if (dir != "")
-// {
-// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save();
-// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->pokemod()->setPath(dir);
-// }
-}
-
-void PokeModrUI::on_actionQuit_triggered()
+void PokeModrUI::quit()
{
+ // TODO: clean up the tree
// while (m_pokemods.size())
// closePokeMod();
// if (m_clipboard)
@@ -234,7 +229,7 @@ void PokeModrUI::on_actionQuit_triggered()
close();
}
-void PokeModrUI::on_actionCut_triggered()
+void PokeModrUI::cutObject()
{
// TODO: cut the item
// if (!treePokemod->currentItem())
@@ -244,7 +239,7 @@ void PokeModrUI::on_actionCut_triggered()
// m_clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->cut();
}
-void PokeModrUI::on_actionCopy_triggered()
+void PokeModrUI::copyObject()
{
// TODO: copy the item
// if (!treePokemod->currentItem())
@@ -254,7 +249,7 @@ void PokeModrUI::on_actionCopy_triggered()
// m_clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->copy();
}
-void PokeModrUI::on_actionPaste_triggered()
+void PokeModrUI::pasteObject()
{
// TODO: paste the item
// if (!m_clipboard || !treePokemod->currentItem())
@@ -262,8 +257,9 @@ void PokeModrUI::on_actionPaste_triggered()
// static_cast<PokeModTreeItem*>(treePokemod->currentItem())->paste(m_clipboard);
}
-void PokeModrUI::on_actionPreferences_triggered()
+void PokeModrUI::preferences()
{
+ // TODO: preferences
}
void PokeModrUI::on_splitter_splitterMoved()
diff --git a/pokemodr/PokeModrUI.h b/pokemodr/PokeModrUI.h
index fb559a3f..b35562e6 100644
--- a/pokemodr/PokeModrUI.h
+++ b/pokemodr/PokeModrUI.h
@@ -39,23 +39,21 @@ class PokeModrUI : public KMainWindow, private Ui::formPokeModr
PokeModrUI(KConfigGroup config, KConfigGroup history, QWidget* parent = 0);
~PokeModrUI();
public slots:
- void openPokeMod(const KUrl& path);
- void savePokeMod();
- void closePokeMod();
-
void closeEvent(QCloseEvent* event);
void setChangedTitle(const bool changed);
- void on_actionNew_triggered();
- void on_actionOpen_triggered();
- void on_actionSave_triggered();
- void on_actionSaveAs_triggered();
- void on_actionQuit_triggered();
- void on_actionCut_triggered();
- void on_actionCopy_triggered();
- void on_actionPaste_triggered();
- void on_actionPreferences_triggered();
+ void newPokemod();
+ void openPokemod();
+ void openPokemod(const KUrl& path);
+ void savePokemod();
+ void saveAsPokemod();
+ void closePokeMod();
+ void quit();
+ void cutObject();
+ void copyObject();
+ void pasteObject();
+ void preferences();
void on_splitter_splitterMoved();
void on_treePokemod_clicked(const QModelIndex& index);
void on_treePokemod_customContextMenuRequested(const QPoint& position);
diff --git a/pokemodr/gui/pokemodr.ui b/pokemodr/gui/pokemodr.ui
index e48d4637..c1d20a51 100644
--- a/pokemodr/gui/pokemodr.ui
+++ b/pokemodr/gui/pokemodr.ui
@@ -44,108 +44,6 @@
</item>
</layout>
</widget>
- <action name="actionNew" >
- <property name="text" >
- <string>&amp;New</string>
- </property>
- <property name="toolTip" >
- <string>Create a new Pokémod</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+N</string>
- </property>
- </action>
- <action name="actionOpen" >
- <property name="text" >
- <string>&amp;Open</string>
- </property>
- <property name="toolTip" >
- <string>Open an existing PokéMod</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+O</string>
- </property>
- </action>
- <action name="actionSave" >
- <property name="text" >
- <string>&amp;Save</string>
- </property>
- <property name="toolTip" >
- <string>Save current PokéMod</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+S</string>
- </property>
- </action>
- <action name="actionSaveAs" >
- <property name="text" >
- <string>Save &amp;As...</string>
- </property>
- <property name="toolTip" >
- <string>Save the current PokéMod into a new file</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+Shift+S</string>
- </property>
- </action>
- <action name="actionSaveAll" >
- <property name="text" >
- <string>Save A&amp;ll</string>
- </property>
- <property name="toolTip" >
- <string>Save all opened PokéMods</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+Alt+S</string>
- </property>
- </action>
- <action name="actionQuit" >
- <property name="text" >
- <string>&amp;Quit</string>
- </property>
- <property name="toolTip" >
- <string>Quit PokéModr</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+Q</string>
- </property>
- </action>
- <action name="actionCopy" >
- <property name="text" >
- <string>&amp;Copy</string>
- </property>
- <property name="toolTip" >
- <string>Copy the current object</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+Shift+C</string>
- </property>
- </action>
- <action name="actionPaste" >
- <property name="text" >
- <string>&amp;Paste</string>
- </property>
- <property name="toolTip" >
- <string>Paste an object</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+Shift+V</string>
- </property>
- </action>
- <action name="actionPreferences" >
- <property name="text" >
- <string>P&amp;references...</string>
- </property>
- <property name="iconText" >
- <string>Preferences</string>
- </property>
- <property name="toolTip" >
- <string>Open the preferences</string>
- </property>
- <property name="shortcut" >
- <string>Ctrl+P</string>
- </property>
- </action>
</widget>
<customwidgets>
<customwidget>