summaryrefslogtreecommitdiffstats
path: root/sigmodr/tree/SkinGroupModel.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-05-23 01:07:11 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-05-23 01:07:11 -0400
commitb81b2ae4d0c96b37e442b5c8d2a82d518c50cfff (patch)
tree4ead6e424bef729cfc1ec97f7f4d3b0496dc3643 /sigmodr/tree/SkinGroupModel.cpp
parent2cc02d1c40fbc340951aa66a2dd1d53409952db3 (diff)
downloadsigen-b81b2ae4d0c96b37e442b5c8d2a82d518c50cfff.tar.gz
sigen-b81b2ae4d0c96b37e442b5c8d2a82d518c50cfff.tar.xz
sigen-b81b2ae4d0c96b37e442b5c8d2a82d518c50cfff.zip
Delete old tree widget files
Diffstat (limited to 'sigmodr/tree/SkinGroupModel.cpp')
-rw-r--r--sigmodr/tree/SkinGroupModel.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/sigmodr/tree/SkinGroupModel.cpp b/sigmodr/tree/SkinGroupModel.cpp
deleted file mode 100644
index 48330a92..00000000
--- a/sigmodr/tree/SkinGroupModel.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2008-2009 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 "SkinGroupModel.h"
-
-// Sigmodr tree includes
-#include "SkinModel.h"
-
-// Sigmod includes
-#include <sigmod/Game.h>
-#include <sigmod/Skin.h>
-
-// KDE includes
-#include <KMenu>
-
-using namespace Sigmod;
-using namespace Sigmodr::Tree;
-
-SkinGroupModel::SkinGroupModel(BaseModel* parent, Game* game) :
- GroupModel(parent, game, "Skins")
-{
- for (int i = 0; i < game->skinCount(); ++i)
- addObject(game->skin(i));
-}
-
-QVariant SkinGroupModel::data(const int role) const
-{
- if (role == BaseModel::ContextMenuRole)
- {
- KMenu* menu = new KMenu;
- menu->addAction("&Add Skin", this, SLOT(addObject()));
- return QVariant::fromValue(menu);
- }
- return GroupModel::data(role);
-}
-
-bool SkinGroupModel::setData(const QVariant& value, int role)
-{
- if (role == BaseModel::XmlRole)
- {
- QString data = value.toString();
- if (!data.isEmpty())
- {
- QDomDocument xml;
- if (loadFromData(data, &xml) && (xml.doctype().name() == "Skin"))
- {
- addObject(qobject_cast<Game*>(m_object)->newSkin(xml.documentElement()));
- return true;
- }
- }
- }
- return false;
-}
-
-QString SkinGroupModel::types() const
-{
- return "Skin";
-}
-
-void SkinGroupModel::addObject(Object* object)
-{
- if (!object)
- object = qobject_cast<Game*>(m_object)->newSkin();
- if (object->className() == "Skin")
- addChild(new SkinModel(this, qobject_cast<Skin*>(object)));
-}
-
-void SkinGroupModel::deleteObject(BaseModel* model)
-{
- const int index = find(model);
- if (0 <= index)
- {
- qobject_cast<Game*>(m_object)->deleteSkin(index);
- removeChild(index);
- }
-}