diff options
Diffstat (limited to 'pokemodr/TileDelegate.cpp')
| -rw-r--r-- | pokemodr/TileDelegate.cpp | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/pokemodr/TileDelegate.cpp b/pokemodr/TileDelegate.cpp index d86bcfb4..756edc66 100644 --- a/pokemodr/TileDelegate.cpp +++ b/pokemodr/TileDelegate.cpp @@ -1,37 +1,35 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pokegen/TileDelegate.cpp -// Purpose: Provides an editor for tiles in the tilemap editor -// Author: Ben Boeckel -// Modified by: Ben Boeckel -// Created: Sat Feb 2 01:31:30 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/>. -///////////////////////////////////////////////////////////////////////////// - +/* + * 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/>. + */ + +// KDE includes #include <kcombobox.h> -#include "../general/ImageCache.h" - +// Pokemod includes #include <Pokemod.h> #include <Tile.h> +// PokeModr includes #include "ObjectUI.h" #include "MapUI.h" -#include "TileDelegate.h" #include "TilemapModel.h" +// Header include +#include "TileDelegate.h" + QWidget* TileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem&, const QModelIndex&) const { KComboBox* editor = new KComboBox(parent); @@ -40,11 +38,11 @@ QWidget* TileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& void TileDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const { - for (int i = 0; i < static_cast<ObjectUI*>(editor->parent())->getOriginal()->getPokemod()->getTileCount(); ++i) + for (int i = 0; i < static_cast<ObjectUI*>(editor->parent())->original()->pokemod()->tileCount(); ++i) { - const Tile* t = static_cast<ObjectUI*>(editor->parent())->getOriginal()->getPokemod()->getTile(i); - static_cast<KComboBox*>(editor)->addItem(ImageCache::open(t->getPic()), t->getName()); - static_cast<KComboBox*>(editor)->setItemData(i, t->getId()); + const Tile* tile = static_cast<ObjectUI*>(editor->parent())->original()->pokemod()->tile(i); + static_cast<KComboBox*>(editor)->addItem(tile->sprite(), tile->name()); + static_cast<KComboBox*>(editor)->setItemData(i, tile->id()); } static_cast<KComboBox*>(editor)->setCurrentIndex(index.data(Qt::EditRole).toInt()); } |
