diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-23 19:17:53 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-23 19:17:53 +0000 |
| commit | 793f2e539316e796968103617025320870f8c3ce (patch) | |
| tree | f702d6498d3c0841b05a07bc129d34a12b09625e /pokemodr/models/DialogModel.cpp | |
| parent | c07a81f2656d1168e7124f0b7281a4e38128926b (diff) | |
| download | sigen-793f2e539316e796968103617025320870f8c3ce.tar.gz sigen-793f2e539316e796968103617025320870f8c3ce.tar.xz sigen-793f2e539316e796968103617025320870f8c3ce.zip | |
[DEL] Cleaned out unneeded files
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@167 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/models/DialogModel.cpp')
| -rw-r--r-- | pokemodr/models/DialogModel.cpp | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/pokemodr/models/DialogModel.cpp b/pokemodr/models/DialogModel.cpp deleted file mode 100644 index c5b3370e..00000000 --- a/pokemodr/models/DialogModel.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 "DialogModel.h" - -// PokeModr includes -#include "../DialogUI.h" - -// Pokemod includes -#include "../../pokemod/Dialog.h" -#include "../../pokemod/Pokemod.h" - -// Qt includes -#include <QFile> - -DialogModel::DialogModel(BaseModel* parent, Dialog* dialog) : - ObjectModel(parent, dialog) -{ -} - -DialogModel::~DialogModel() -{ -} - -QVariant DialogModel::data(int role) const -{ - if (role == Qt::DisplayRole) - return static_cast<Dialog*>(m_object)->dialog(); - else if (role == BaseModel::XmlRole) - { - QDomDocument xml(m_object->className()); - xml.appendChild(m_object->save()); - return xml.toString(); - } - else if (role == BaseModel::WidgetRole) - { - QWidget* widget = new DialogUI(static_cast<Dialog*>(m_object), NULL); - return QVariant::fromValue(widget); - } - return ObjectModel::data(role); -} - -bool DialogModel::setData(const QVariant& value, int role) -{ - if (role == BaseModel::XmlRole) - { - if (value.canConvert<QString>()) - { - QFile file(value.toString()); - QDomDocument xml; - if ((file.open(QIODevice::ReadOnly) && xml.setContent(&file)) || xml.setContent(value.toString())) - { - if (xml.doctype().name() == m_object->className()) - { - m_object->load(xml.documentElement()); - return true; - } - file.close(); - } - } - } - return false; -} |
